File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed
Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 66import wx
77import wx .aui
88
9- from .generate_interactive_bom import GenerateInteractiveBomPlugin
10-
119
1210def check_for_bom_button ():
1311 # From Miles McCoo's blog
@@ -42,12 +40,15 @@ def callback(_):
4240 top_tb .Realize ()
4341
4442
45- plugin = GenerateInteractiveBomPlugin ()
46- plugin .register ()
43+ if wx .GetApp ():
44+ from .generate_interactive_bom import GenerateInteractiveBomPlugin
45+
46+ plugin = GenerateInteractiveBomPlugin ()
47+ plugin .register ()
4748
48- # Add a button the hacky way if plugin button is not supported
49- # in pcbnew, unless this is linux.
50- if not plugin .pcbnew_icon_support and not sys .platform .startswith ('linux' ):
51- t = threading .Thread (target = check_for_bom_button )
52- t .daemon = True
53- t .start ()
49+ # Add a button the hacky way if plugin button is not supported
50+ # in pcbnew, unless this is linux.
51+ if not plugin .pcbnew_icon_support and not sys .platform .startswith ('linux' ):
52+ t = threading .Thread (target = check_for_bom_button )
53+ t .daemon = True
54+ t .start ()
Original file line number Diff line number Diff line change 55
66from wx import FileConfig
77
8- from .dialog import settings_dialog
9-
108
119class Config :
1210 # Helper constants
Original file line number Diff line number Diff line change 99import pcbnew
1010import wx
1111
12+ if __name__ == "__main__" :
13+ # Circumvent the "scripts can't do relative imports because they are not
14+ # packages" restriction by exerting dominance and making it a package!
15+ __package__ = os .path .basename (os .path .dirname (__file__ ))
16+ sys .path .insert (0 , os .path .dirname (os .path .dirname (__file__ )))
17+ __import__ (__package__ )
18+
1219from . import dialog
1320from . import units
1421from .config import Config
You can’t perform that action at this time.
0 commit comments