summaryrefslogtreecommitdiff
path: root/kimesh/mesh_plugin.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2020-12-29 19:50:28 +0100
committerjaseg <git@jaseg.net>2020-12-29 19:51:29 +0100
commit093b2c2df43c5242fb43b2e9bde565fac01f5a5c (patch)
treef52f27403f347db69b0e276137fd7f28e60b9169 /kimesh/mesh_plugin.py
parent61c0ecea7d1e1ca739b8016844f0db53ec2e125f (diff)
downloadkimesh-093b2c2df43c5242fb43b2e9bde565fac01f5a5c.tar.gz
kimesh-093b2c2df43c5242fb43b2e9bde565fac01f5a5c.tar.bz2
kimesh-093b2c2df43c5242fb43b2e9bde565fac01f5a5c.zip
Update README
Diffstat (limited to 'kimesh/mesh_plugin.py')
-rw-r--r--kimesh/mesh_plugin.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/kimesh/mesh_plugin.py b/kimesh/mesh_plugin.py
new file mode 100644
index 0000000..1951875
--- /dev/null
+++ b/kimesh/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())