beremiz

fix problem running PLCOpenEditor

2017-08-25, Andrey Skvortsov
3216ed1ba1f7
Parents 47fc06c13b37
Children 4d1de8b0183f
fix problem running PLCOpenEditor

$ ./PLCOpenEditor.py
../src/common/stdpbase.cpp(62): assert "traits" failed in Get(): create wxApp before calling this

Regression was introduced by '3311eea' (clean-up: fix PEP8 E402 module level import not at top of file)
--- a/PLCOpenEditor.py Fri Aug 25 12:01:23 2017 +0300
+++ b/PLCOpenEditor.py Fri Aug 25 12:23:45 2017 +0300
@@ -33,25 +33,6 @@
import version
import util.paths as paths
-from docutil import *
-from IDEFrame import IDEFrame, AppendMenu
-from IDEFrame import \
- TITLE, \
- EDITORTOOLBAR, \
- FILEMENU, \
- EDITMENU, \
- DISPLAYMENU, \
- PROJECTTREE, \
- POUINSTANCEVARIABLESPANEL, \
- LIBRARYTREE, \
- PAGETITLES
-
-from IDEFrame import EncodeFileSystemPath, DecodeFileSystemPath
-from editors.Viewer import Viewer
-from PLCControler import PLCControler
-from dialogs import ProjectDialog
-from dialogs.AboutDialog import ShowAboutDialog
-
beremiz_dir = paths.AbsDir(__file__)
@@ -96,6 +77,27 @@
from util.misc import InstallLocalRessources
InstallLocalRessources(beremiz_dir)
+ # these imports require wx.GetApp to return
+ # a valid application instance
+ from docutil import *
+ from IDEFrame import IDEFrame, AppendMenu
+ from IDEFrame import \
+ TITLE, \
+ EDITORTOOLBAR, \
+ FILEMENU, \
+ EDITMENU, \
+ DISPLAYMENU, \
+ PROJECTTREE, \
+ POUINSTANCEVARIABLESPANEL, \
+ LIBRARYTREE, \
+ PAGETITLES
+
+ from IDEFrame import EncodeFileSystemPath, DecodeFileSystemPath
+ from editors.Viewer import Viewer
+ from PLCControler import PLCControler
+ from dialogs import ProjectDialog
+ from dialogs.AboutDialog import ShowAboutDialog
+
# -------------------------------------------------------------------------------
# PLCOpenEditor Main Class