summaryrefslogtreecommitdiff
path: root/de.jaseg.kimesh.plugin/plugins/mesh_plugin.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-10-23 16:13:48 +0200
committerjaseg <git@jaseg.de>2023-10-23 17:12:17 +0200
commitc91ed4f594451ced01be60e305ebc9cd85efba72 (patch)
treec33b7722a8345439beb3b84b9724ba23ad9bd99d /de.jaseg.kimesh.plugin/plugins/mesh_plugin.py
parentc4f176d3f43a020abeaa9d2500237d8ff77e5e3f (diff)
downloadkimesh-c91ed4f594451ced01be60e305ebc9cd85efba72.tar.gz
kimesh-c91ed4f594451ced01be60e305ebc9cd85efba72.tar.bz2
kimesh-c91ed4f594451ced01be60e305ebc9cd85efba72.zip
Repo re-org, now we are KiCad add-ons.
Diffstat (limited to 'de.jaseg.kimesh.plugin/plugins/mesh_plugin.py')
-rw-r--r--de.jaseg.kimesh.plugin/plugins/mesh_plugin.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/de.jaseg.kimesh.plugin/plugins/mesh_plugin.py b/de.jaseg.kimesh.plugin/plugins/mesh_plugin.py
new file mode 100644
index 0000000..1951875
--- /dev/null
+++ b/de.jaseg.kimesh.plugin/plugins/mesh_plugin.py
@@ -0,0 +1,38 @@
+from os import path
+import subprocess
+import sys
+
+import wx
+
+import pcbnew
+
+def check_requirements(*packages):
+ missing = []
+ for pkg in packages:
+ try:
+ __import__(pkg)
+ except ImportError:
+ missing.append(pkg)
+
+ if missing:
+ wx.MessageDialog(None, "Error: Missing python dependencies:\n\n{}".format('\n'.join(missing)),
+ "Missing Dependencies").ShowModal()
+ return False
+
+ else:
+ return True
+
+class MeshPlugin(pcbnew.ActionPlugin):
+ def defaults(self):
+ self.name = 'Mesh generator'
+ self.category = 'Modify PCB'
+ self.description = 'Creates security mesh traces on a PCB'
+ self.icon_file_name = path.join(path.dirname(__file__), 'mesh_plugin_icon.png')
+ self.show_toolbar_button = True
+
+ def Run(self):
+ if not check_requirements('shapely'):
+ return
+
+ from .mesh_dialog import show_dialog
+ show_dialog(pcbnew.GetBoard())