Skip to content

Commit e594337

Browse files
committed
Move some code to .core
Fix python3/wxphoenix compatibility
1 parent 9edb1af commit e594337

File tree

8 files changed

+703
-676
lines changed

8 files changed

+703
-676
lines changed

InteractiveHtmlBom/__init__.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import wx
77
import wx.aui
88

9+
from .generate_interactive_bom import InteractiveHtmlBomPlugin
10+
911

1012
def check_for_bom_button():
1113
# From Miles McCoo's blog
@@ -22,6 +24,8 @@ def callback(_):
2224

2325
import os
2426
path = os.path.dirname(__file__)
27+
while not wx.GetApp():
28+
time.sleep(1)
2529
bm = wx.Bitmap(path + '/icon.png', wx.BITMAP_TYPE_PNG)
2630
button_wx_item_id = 0
2731
while True:
@@ -40,15 +44,12 @@ def callback(_):
4044
top_tb.Realize()
4145

4246

43-
if wx.GetApp():
44-
from .generate_interactive_bom import GenerateInteractiveBomPlugin
45-
46-
plugin = GenerateInteractiveBomPlugin()
47-
plugin.register()
47+
plugin = InteractiveHtmlBomPlugin()
48+
plugin.register()
4849

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()
50+
# Add a button the hacky way if plugin button is not supported
51+
# in pcbnew, unless this is linux.
52+
if not plugin.pcbnew_icon_support and not sys.platform.startswith('linux'):
53+
t = threading.Thread(target=check_for_bom_button)
54+
t.daemon = True
55+
t.start()

InteractiveHtmlBom/core/__init__.py

Whitespace-only changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class Config:
1010
# Helper constants
11-
config_file = os.path.join(os.path.dirname(__file__), 'config.ini')
11+
config_file = os.path.join(os.path.dirname(__file__), '..', 'config.ini')
1212
bom_view_choices = ['bom-only', 'left-right', 'top-bottom']
1313
layer_view_choices = ['F', 'FB', 'B']
1414
default_sort_order = [

0 commit comments

Comments
 (0)