-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathjlcpcba_action.py
38 lines (26 loc) · 1007 Bytes
/
jlcpcba_action.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import re
import sys
import pcbnew
import wx
from .jlcpcba_main import *
class JlcpcbaPluginAction(pcbnew.ActionPlugin):
def defaults(self):
self.name = "Export JLCPCB PCBA Files"
self.category = "PCBA"
self.description = "Create BOM and CPL files for JLCPCBs PCBA Service"
self.show_toolbar_button = True
self.icon_file_name = os.path.join(os.path.dirname(__file__), 'jlcpcba.png')
def Run(self):
print("Testing")
try:
create_pcba()
wx.MessageDialog(None, "All Done").ShowModal()
except Exception as e:
import traceback
plugin_dir = os.path.dirname(os.path.realpath(__file__))
log_file = os.path.join(plugin_dir, 'jlcpcba_run.log')
tb = ''.join(traceback.format_exception(None, e, e.__traceback__))
with open(log_file, 'w') as f:
f.write(tb)
wx.MessageDialog(None, "Failed, check logs").ShowModal()