From 0e2fe700e3f093687551ee56e829fe5ec0f204a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Inostroza?= Date: Tue, 18 Dec 2018 15:41:44 -0300 Subject: [PATCH] Changes to make it work on Python 3 with wxPython 4. --- InteractiveHtmlBom/__init__.py | 2 +- InteractiveHtmlBom/config.py | 2 +- InteractiveHtmlBom/dialog/__init__.py | 2 +- InteractiveHtmlBom/dialog/settings_dialog.py | 9 +++++++-- InteractiveHtmlBom/fontparser.py | 2 +- InteractiveHtmlBom/generate_interactive_bom.py | 10 +++++----- InteractiveHtmlBom/schematic_data/__init__.py | 4 ++-- InteractiveHtmlBom/schematic_data/netlistparser.py | 4 ++-- InteractiveHtmlBom/schematic_data/xmlparser.py | 2 +- __init__.py | 2 +- 10 files changed, 22 insertions(+), 17 deletions(-) diff --git a/InteractiveHtmlBom/__init__.py b/InteractiveHtmlBom/__init__.py index 02c46430..adac58e3 100644 --- a/InteractiveHtmlBom/__init__.py +++ b/InteractiveHtmlBom/__init__.py @@ -6,7 +6,7 @@ import wx import wx.aui -from generate_interactive_bom import GenerateInteractiveBomPlugin +from .generate_interactive_bom import GenerateInteractiveBomPlugin def check_for_bom_button(): diff --git a/InteractiveHtmlBom/config.py b/InteractiveHtmlBom/config.py index 695f5add..bb6347ae 100644 --- a/InteractiveHtmlBom/config.py +++ b/InteractiveHtmlBom/config.py @@ -5,7 +5,7 @@ from wx import FileConfig -import dialog.settings_dialog +from .dialog import settings_dialog class Config: diff --git a/InteractiveHtmlBom/dialog/__init__.py b/InteractiveHtmlBom/dialog/__init__.py index 3b86c22e..d91b58d4 100644 --- a/InteractiveHtmlBom/dialog/__init__.py +++ b/InteractiveHtmlBom/dialog/__init__.py @@ -1 +1 @@ -from settings_dialog import SettingsDialog +from .settings_dialog import SettingsDialog diff --git a/InteractiveHtmlBom/dialog/settings_dialog.py b/InteractiveHtmlBom/dialog/settings_dialog.py index be062795..21824988 100644 --- a/InteractiveHtmlBom/dialog/settings_dialog.py +++ b/InteractiveHtmlBom/dialog/settings_dialog.py @@ -4,7 +4,7 @@ import wx -import dialog_base +from . import dialog_base def pop_error(msg): @@ -24,7 +24,12 @@ def __init__(self, extra_data_func, config_save_func): # hack for new wxFormBuilder generating code incompatible with old wxPython # noinspection PyMethodOverriding def SetSizeHints(self, sz1, sz2): - self.SetSizeHintsSz(sz1, sz2) + try: + # wxPython 3 + self.SetSizeHintsSz(sz1, sz2) + except TypeError: + # wxPython 4 + super(SettingsDialog, self).SetSizeHints(sz1, sz2) def set_extra_data_path(self, extra_data_file): self.panel.extra.netlistFilePicker.Path = extra_data_file diff --git a/InteractiveHtmlBom/fontparser.py b/InteractiveHtmlBom/fontparser.py index ce408e8b..9be158f0 100644 --- a/InteractiveHtmlBom/fontparser.py +++ b/InteractiveHtmlBom/fontparser.py @@ -1,4 +1,4 @@ -from newstroke_font import NEWSTROKE_FONT +from .newstroke_font import NEWSTROKE_FONT class FontParser: diff --git a/InteractiveHtmlBom/generate_interactive_bom.py b/InteractiveHtmlBom/generate_interactive_bom.py index 5dae77bc..d10cad6d 100644 --- a/InteractiveHtmlBom/generate_interactive_bom.py +++ b/InteractiveHtmlBom/generate_interactive_bom.py @@ -9,11 +9,11 @@ import pcbnew import wx -import dialog -import units -from config import Config -from fontparser import FontParser -from schematic_data import parse_schematic_data, find_latest_schematic_data +from . import dialog +from . import units +from .config import Config +from .fontparser import FontParser +from .schematic_data import parse_schematic_data, find_latest_schematic_data def setup_logger(): diff --git a/InteractiveHtmlBom/schematic_data/__init__.py b/InteractiveHtmlBom/schematic_data/__init__.py index 8a1cbd85..896b9b0b 100644 --- a/InteractiveHtmlBom/schematic_data/__init__.py +++ b/InteractiveHtmlBom/schematic_data/__init__.py @@ -1,7 +1,7 @@ import os -from xmlparser import XmlParser -from netlistparser import NetlistParser +from .xmlparser import XmlParser +from .netlistparser import NetlistParser PARSERS = { '.xml': XmlParser, diff --git a/InteractiveHtmlBom/schematic_data/netlistparser.py b/InteractiveHtmlBom/schematic_data/netlistparser.py index 0c658b2d..96afd4d1 100644 --- a/InteractiveHtmlBom/schematic_data/netlistparser.py +++ b/InteractiveHtmlBom/schematic_data/netlistparser.py @@ -1,5 +1,5 @@ -from parser_base import ParserBase -from sexpressions import parse_sexpression +from .parser_base import ParserBase +from .sexpressions import parse_sexpression class NetlistParser(ParserBase): diff --git a/InteractiveHtmlBom/schematic_data/xmlparser.py b/InteractiveHtmlBom/schematic_data/xmlparser.py index 229466e6..36c813f9 100644 --- a/InteractiveHtmlBom/schematic_data/xmlparser.py +++ b/InteractiveHtmlBom/schematic_data/xmlparser.py @@ -1,6 +1,6 @@ from xml.dom import minidom -from parser_base import ParserBase +from .parser_base import ParserBase class XmlParser(ParserBase): diff --git a/__init__.py b/__init__.py index a80a3b5b..82747fbb 100644 --- a/__init__.py +++ b/__init__.py @@ -1 +1 @@ -import InteractiveHtmlBom +from . import InteractiveHtmlBom