--- a/BeremizIDE.py Fri Aug 18 12:36:31 2017 +0300
+++ b/BeremizIDE.py Fri Aug 18 20:14:38 2017 +0300
@@ -228,29 +228,29 @@
def _init_coll_FileMenu_Items(self, parent):
AppendMenu(parent, help='', id=wx.ID_NEW,
- kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N')
+ kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N')
AppendMenu(parent, help='', id=wx.ID_OPEN,
- kind=wx.ITEM_NORMAL, text=_(u'Open') + '\tCTRL+O')
+ kind=wx.ITEM_NORMAL, text=_(u'Open') + '\tCTRL+O')
parent.AppendMenu(ID_FILEMENURECENTPROJECTS, _("&Recent Projects"), self.RecentProjectsMenu)
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_SAVE,
- kind=wx.ITEM_NORMAL, text=_(u'Save') + '\tCTRL+S')
+ kind=wx.ITEM_NORMAL, text=_(u'Save') + '\tCTRL+S')
AppendMenu(parent, help='', id=wx.ID_SAVEAS,
- kind=wx.ITEM_NORMAL, text=_(u'Save as') + '\tCTRL+SHIFT+S')
+ kind=wx.ITEM_NORMAL, text=_(u'Save as') + '\tCTRL+SHIFT+S')
AppendMenu(parent, help='', id=wx.ID_CLOSE,
- kind=wx.ITEM_NORMAL, text=_(u'Close Tab') + '\tCTRL+W')
+ kind=wx.ITEM_NORMAL, text=_(u'Close Tab') + '\tCTRL+W')
AppendMenu(parent, help='', id=wx.ID_CLOSE_ALL,
- kind=wx.ITEM_NORMAL, text=_(u'Close Project') + '\tCTRL+SHIFT+W')
+ kind=wx.ITEM_NORMAL, text=_(u'Close Project') + '\tCTRL+SHIFT+W')
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_PAGE_SETUP,
- kind=wx.ITEM_NORMAL, text=_(u'Page Setup') + '\tCTRL+ALT+P')
+ kind=wx.ITEM_NORMAL, text=_(u'Page Setup') + '\tCTRL+ALT+P')
AppendMenu(parent, help='', id=wx.ID_PREVIEW,
- kind=wx.ITEM_NORMAL, text=_(u'Preview') + '\tCTRL+SHIFT+P')
+ kind=wx.ITEM_NORMAL, text=_(u'Preview') + '\tCTRL+SHIFT+P')
AppendMenu(parent, help='', id=wx.ID_PRINT,
- kind=wx.ITEM_NORMAL, text=_(u'Print') + '\tCTRL+P')
+ kind=wx.ITEM_NORMAL, text=_(u'Print') + '\tCTRL+P')
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_EXIT,
- kind=wx.ITEM_NORMAL, text=_(u'Quit') + '\tCTRL+Q')
+ kind=wx.ITEM_NORMAL, text=_(u'Quit') + '\tCTRL+Q')
self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW)
self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN)
@@ -278,7 +278,7 @@
self._RecursiveAddMenuItems(new_menu, children)
else:
AppendMenu(menu, help=help, id=new_id,
- kind=wx.ITEM_NORMAL, text=text)
+ kind=wx.ITEM_NORMAL, text=text)
self.Bind(wx.EVT_MENU, self.GetAddConfNodeFunction(name),
id=new_id)
@@ -298,7 +298,7 @@
self.Bind(wx.EVT_MENU, handler, id=id)
parent.Append(help='', id=wx.ID_ABOUT,
- kind=wx.ITEM_NORMAL, text=_(u'About'))
+ kind=wx.ITEM_NORMAL, text=_(u'About'))
self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
def _init_coll_ConnectionStatusBar_Fields(self, parent):
@@ -375,14 +375,14 @@
#self.BottomNoteBook.Split(self.BottomNoteBook.GetPageIndex(self.LogViewer), wx.RIGHT)
StatusToolBar = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
- wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER)
+ wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER)
StatusToolBar.SetToolBitmapSize(wx.Size(25, 25))
StatusToolBar.Realize()
self.Panes["StatusToolBar"] = StatusToolBar
self.AUIManager.AddPane(StatusToolBar, wx.aui.AuiPaneInfo().
- Name("StatusToolBar").Caption(_("Status ToolBar")).
- ToolbarPane().Top().Position(1).
- LeftDockable(False).RightDockable(False))
+ Name("StatusToolBar").Caption(_("Status ToolBar")).
+ ToolbarPane().Top().Position(1).
+ LeftDockable(False).RightDockable(False))
self.AUIManager.Update()
@@ -485,7 +485,8 @@
# choose an arbitrary random port for runtime
self.runtime_port = int(random.random() * 1000) + 61131
# launch local runtime
- self.local_runtime = ProcessLogger(self.Log,
+ self.local_runtime = ProcessLogger(
+ self.Log,
"\"%s\" \"%s\" -p %s -i localhost %s %s" % (
sys.executable,
Bpath("Beremiz_service.py"),
@@ -735,8 +736,8 @@
for confnode_method in self.CTR.StatusMethods:
if "method" in confnode_method and confnode_method.get("shown", True):
id = wx.NewId()
- StatusToolBar.AddSimpleTool(id,
- GetBitmap(confnode_method.get("bitmap", "Unknown")),
+ StatusToolBar.AddSimpleTool(
+ id, GetBitmap(confnode_method.get("bitmap", "Unknown")),
confnode_method["tooltip"])
self.Bind(wx.EVT_MENU, self.GetMenuCallBackFunction(confnode_method["method"]), id=id)
@@ -1033,8 +1034,9 @@
self.ProjectTree.SelectItem(root)
self.ResetSelectedItem()
else:
- return self.RecursiveProjectTreeItemSelection(root,
- [(word, ITEM_CONFNODE) for word in tagname.split(".")])
+ return self.RecursiveProjectTreeItemSelection(
+ root,
+ [(word, ITEM_CONFNODE) for word in tagname.split(".")])
elif words[0] == "R":
return self.RecursiveProjectTreeItemSelection(root, [(words[2], ITEM_RESOURCE)])
elif not os.path.exists(words[0]):
@@ -1061,7 +1063,8 @@
def DeleteConfNode(self, confnode):
if self.CTR.CheckProjectPathPerm():
- dialog = wx.MessageDialog(self,
+ dialog = wx.MessageDialog(
+ self,
_("Really delete node '%s'?") % confnode.CTNName(),
_("Remove %s node") % confnode.CTNType,
wx.YES_NO | wx.NO_DEFAULT)
@@ -1112,7 +1115,8 @@
if cap:
cap.ReleaseMouse()
- dlg = wx.SingleChoiceDialog(None,
+ dlg = wx.SingleChoiceDialog(
+ None,
_("""
An unhandled exception (bug) occured. Bug report saved at :
(%s)
--- a/CodeFileTreeNode.py Fri Aug 18 12:36:31 2017 +0300
+++ b/CodeFileTreeNode.py Fri Aug 18 20:14:38 2017 +0300
@@ -202,8 +202,8 @@
variable.getinitial())
for variable in variables]
ret.extend([("On"+variable.getname()+"Change", "python_poll", "")
- for variable in variables
- if variable.getonchange()])
+ for variable in variables
+ if variable.getonchange()])
return ret
#-------------------------------------------------------------------------------
--- a/IDEFrame.py Fri Aug 18 12:36:31 2017 +0300
+++ b/IDEFrame.py Fri Aug 18 20:14:38 2017 +0300
@@ -356,52 +356,52 @@
def _init_coll_AddMenu_Items(self, parent, add_config=True):
AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUADDDATATYPE,
- kind=wx.ITEM_NORMAL, text=_(u'&Data Type'))
+ kind=wx.ITEM_NORMAL, text=_(u'&Data Type'))
AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUADDFUNCTION,
- kind=wx.ITEM_NORMAL, text=_(u'&Function'))
+ kind=wx.ITEM_NORMAL, text=_(u'&Function'))
AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUADDFUNCTIONBLOCK,
- kind=wx.ITEM_NORMAL, text=_(u'Function &Block'))
+ kind=wx.ITEM_NORMAL, text=_(u'Function &Block'))
AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUADDPROGRAM,
- kind=wx.ITEM_NORMAL, text=_(u'&Program'))
+ kind=wx.ITEM_NORMAL, text=_(u'&Program'))
AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUADDRESOURCE,
- kind=wx.ITEM_NORMAL, text=_(u'&Resource'))
+ kind=wx.ITEM_NORMAL, text=_(u'&Resource'))
if add_config:
AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUADDCONFIGURATION,
- kind=wx.ITEM_NORMAL, text=_(u'&Configuration'))
+ kind=wx.ITEM_NORMAL, text=_(u'&Configuration'))
def _init_coll_EditMenu_Items(self, parent):
AppendMenu(parent, help='', id=wx.ID_UNDO,
- kind=wx.ITEM_NORMAL, text=_(u'Undo') + '\tCTRL+Z')
+ kind=wx.ITEM_NORMAL, text=_(u'Undo') + '\tCTRL+Z')
AppendMenu(parent, help='', id=wx.ID_REDO,
- kind=wx.ITEM_NORMAL, text=_(u'Redo') + '\tCTRL+Y')
+ kind=wx.ITEM_NORMAL, text=_(u'Redo') + '\tCTRL+Y')
#AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO,
# kind=wx.ITEM_CHECK, text=_(u'Enable Undo/Redo'))
enable_undo_redo = _(u'Enable Undo/Redo') # Keeping text in translations for possible menu reactivation
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_CUT,
- kind=wx.ITEM_NORMAL, text=_(u'Cut') + '\tCTRL+X')
+ kind=wx.ITEM_NORMAL, text=_(u'Cut') + '\tCTRL+X')
AppendMenu(parent, help='', id=wx.ID_COPY,
- kind=wx.ITEM_NORMAL, text=_(u'Copy') + '\tCTRL+C')
+ kind=wx.ITEM_NORMAL, text=_(u'Copy') + '\tCTRL+C')
AppendMenu(parent, help='', id=wx.ID_PASTE,
- kind=wx.ITEM_NORMAL, text=_(u'Paste') + '\tCTRL+V')
+ kind=wx.ITEM_NORMAL, text=_(u'Paste') + '\tCTRL+V')
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_FIND,
- kind=wx.ITEM_NORMAL, text=_(u'Find') + '\tCTRL+F')
+ kind=wx.ITEM_NORMAL, text=_(u'Find') + '\tCTRL+F')
AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUFINDNEXT,
- kind=wx.ITEM_NORMAL, text=_(u'Find Next') + '\tCTRL+K')
+ kind=wx.ITEM_NORMAL, text=_(u'Find Next') + '\tCTRL+K')
AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUFINDPREVIOUS,
- kind=wx.ITEM_NORMAL, text=_(u'Find Previous') + '\tCTRL+SHIFT+K')
+ kind=wx.ITEM_NORMAL, text=_(u'Find Previous') + '\tCTRL+SHIFT+K')
parent.AppendSeparator()
AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUSEARCHINPROJECT,
- kind=wx.ITEM_NORMAL, text=_(u'Search in Project') + '\tCTRL+SHIFT+F')
+ kind=wx.ITEM_NORMAL, text=_(u'Search in Project') + '\tCTRL+SHIFT+F')
parent.AppendSeparator()
add_menu = wx.Menu(title='')
self._init_coll_AddMenu_Items(add_menu)
parent.AppendMenu(wx.ID_ADD, _(u"&Add Element"), add_menu)
AppendMenu(parent, help='', id=wx.ID_SELECTALL,
- kind=wx.ITEM_NORMAL, text=_(u'Select All') + '\tCTRL+A')
+ kind=wx.ITEM_NORMAL, text=_(u'Select All') + '\tCTRL+A')
AppendMenu(parent, help='', id=wx.ID_DELETE,
- kind=wx.ITEM_NORMAL, text=_(u'&Delete'))
+ kind=wx.ITEM_NORMAL, text=_(u'&Delete'))
self.Bind(wx.EVT_MENU, self.OnUndoMenu, id=wx.ID_UNDO)
self.Bind(wx.EVT_MENU, self.OnRedoMenu, id=wx.ID_REDO)
#self.Bind(wx.EVT_MENU, self.OnEnableUndoRedoMenu, id=ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO)
@@ -410,25 +410,25 @@
self.Bind(wx.EVT_MENU, self.OnPasteMenu, id=wx.ID_PASTE)
self.Bind(wx.EVT_MENU, self.OnFindMenu, id=wx.ID_FIND)
self.Bind(wx.EVT_MENU, self.OnFindNextMenu,
- id=ID_PLCOPENEDITOREDITMENUFINDNEXT)
+ id=ID_PLCOPENEDITOREDITMENUFINDNEXT)
self.Bind(wx.EVT_MENU, self.OnFindPreviousMenu,
- id=ID_PLCOPENEDITOREDITMENUFINDPREVIOUS)
+ id=ID_PLCOPENEDITOREDITMENUFINDPREVIOUS)
self.Bind(wx.EVT_MENU, self.OnSearchInProjectMenu,
- id=ID_PLCOPENEDITOREDITMENUSEARCHINPROJECT)
+ id=ID_PLCOPENEDITOREDITMENUSEARCHINPROJECT)
self.Bind(wx.EVT_MENU, self.OnSearchInProjectMenu,
- id=ID_PLCOPENEDITOREDITMENUSEARCHINPROJECT)
+ id=ID_PLCOPENEDITOREDITMENUSEARCHINPROJECT)
self.Bind(wx.EVT_MENU, self.OnAddDataTypeMenu,
- id=ID_PLCOPENEDITOREDITMENUADDDATATYPE)
+ id=ID_PLCOPENEDITOREDITMENUADDDATATYPE)
self.Bind(wx.EVT_MENU, self.GenerateAddPouFunction("function"),
- id=ID_PLCOPENEDITOREDITMENUADDFUNCTION)
+ id=ID_PLCOPENEDITOREDITMENUADDFUNCTION)
self.Bind(wx.EVT_MENU, self.GenerateAddPouFunction("functionBlock"),
- id=ID_PLCOPENEDITOREDITMENUADDFUNCTIONBLOCK)
+ id=ID_PLCOPENEDITOREDITMENUADDFUNCTIONBLOCK)
self.Bind(wx.EVT_MENU, self.GenerateAddPouFunction("program"),
- id=ID_PLCOPENEDITOREDITMENUADDPROGRAM)
+ id=ID_PLCOPENEDITOREDITMENUADDPROGRAM)
self.Bind(wx.EVT_MENU, self.AddResourceMenu,
- id=ID_PLCOPENEDITOREDITMENUADDRESOURCE)
+ id=ID_PLCOPENEDITOREDITMENUADDRESOURCE)
self.Bind(wx.EVT_MENU, self.OnAddConfigurationMenu,
- id=ID_PLCOPENEDITOREDITMENUADDCONFIGURATION)
+ id=ID_PLCOPENEDITOREDITMENUADDCONFIGURATION)
self.Bind(wx.EVT_MENU, self.OnSelectAllMenu, id=wx.ID_SELECTALL)
self.Bind(wx.EVT_MENU, self.OnDeleteMenu, id=wx.ID_DELETE)
@@ -443,17 +443,17 @@
def _init_coll_DisplayMenu_Items(self, parent):
AppendMenu(parent, help='', id=wx.ID_REFRESH,
- kind=wx.ITEM_NORMAL, text=_(u'Refresh') + '\tCTRL+R')
+ kind=wx.ITEM_NORMAL, text=_(u'Refresh') + '\tCTRL+R')
if self.EnableDebug:
AppendMenu(parent, help='', id=wx.ID_CLEAR,
- kind=wx.ITEM_NORMAL, text=_(u'Clear Errors') + '\tCTRL+K')
+ kind=wx.ITEM_NORMAL, text=_(u'Clear Errors') + '\tCTRL+K')
parent.AppendSeparator()
zoommenu = wx.Menu(title='')
parent.AppendMenu(wx.ID_ZOOM_FIT, _("Zoom"), zoommenu)
for idx, value in enumerate(ZOOM_FACTORS):
new_id = wx.NewId()
AppendMenu(zoommenu, help='', id=new_id,
- kind=wx.ITEM_RADIO, text=str(int(round(value * 100))) + "%")
+ kind=wx.ITEM_RADIO, text=str(int(round(value * 100))) + "%")
self.Bind(wx.EVT_MENU, self.GenerateZoomFunction(idx), id=new_id)
parent.AppendSeparator()
@@ -462,7 +462,7 @@
self.Bind(wx.EVT_MENU, self.SwitchFullScrMode, id=ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE)
AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENURESETPERSPECTIVE,
- kind=wx.ITEM_NORMAL, text=_(u'Reset Perspective'))
+ kind=wx.ITEM_NORMAL, text=_(u'Reset Perspective'))
self.Bind(wx.EVT_MENU, self.OnResetPerspective, id=ID_PLCOPENEDITORDISPLAYMENURESETPERSPECTIVE)
self.Bind(wx.EVT_MENU, self.OnRefreshMenu, id=wx.ID_REFRESH)
@@ -494,8 +494,8 @@
def _init_ctrls(self, prnt):
wx.Frame.__init__(self, id=ID_PLCOPENEDITOR, name='IDEFrame',
- parent=prnt, pos=wx.DefaultPosition, size=wx.Size(1000, 600),
- style=wx.DEFAULT_FRAME_STYLE)
+ parent=prnt, pos=wx.DefaultPosition, size=wx.Size(1000, 600),
+ style=wx.DEFAULT_FRAME_STYLE)
self._init_icon(prnt)
self.SetClientSize(wx.Size(1000, 600))
self.Bind(wx.EVT_ACTIVATE, self.OnActivated)
@@ -511,48 +511,62 @@
self.AUIManager.SetDockSizeConstraint(0.5, 0.5)
self.Panes = {}
- self.LeftNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORLEFTNOTEBOOK,
- style=wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_TAB_MOVE |
- wx.aui.AUI_NB_SCROLL_BUTTONS | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+ self.LeftNoteBook = wx.aui.AuiNotebook(
+ self, ID_PLCOPENEDITORLEFTNOTEBOOK,
+ style=(wx.aui.AUI_NB_TOP |
+ wx.aui.AUI_NB_TAB_SPLIT |
+ wx.aui.AUI_NB_TAB_MOVE |
+ wx.aui.AUI_NB_SCROLL_BUTTONS |
+ wx.aui.AUI_NB_TAB_EXTERNAL_MOVE))
self.LeftNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND,
- self.OnAllowNotebookDnD)
- self.AUIManager.AddPane(self.LeftNoteBook,
- wx.aui.AuiPaneInfo().Name("ProjectPane").
- Left().Layer(1).
- BestSize(wx.Size(300, 500)).CloseButton(False))
-
- self.BottomNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORBOTTOMNOTEBOOK,
- style=wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_TAB_MOVE |
- wx.aui.AUI_NB_SCROLL_BUTTONS | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+ self.OnAllowNotebookDnD)
+ self.AUIManager.AddPane(
+ self.LeftNoteBook,
+ wx.aui.AuiPaneInfo().Name("ProjectPane").Left().Layer(1).
+ BestSize(wx.Size(300, 500)).CloseButton(False))
+
+ self.BottomNoteBook = wx.aui.AuiNotebook(
+ self, ID_PLCOPENEDITORBOTTOMNOTEBOOK,
+ style=(wx.aui.AUI_NB_TOP |
+ wx.aui.AUI_NB_TAB_SPLIT |
+ wx.aui.AUI_NB_TAB_MOVE |
+ wx.aui.AUI_NB_SCROLL_BUTTONS |
+ wx.aui.AUI_NB_TAB_EXTERNAL_MOVE))
self.BottomNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND,
- self.OnAllowNotebookDnD)
- self.AUIManager.AddPane(self.BottomNoteBook,
- wx.aui.AuiPaneInfo().Name("ResultPane").
- Bottom().Layer(0).
- BestSize(wx.Size(800, 300)).CloseButton(False))
-
- self.RightNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORRIGHTNOTEBOOK,
- style=wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_TAB_MOVE |
- wx.aui.AUI_NB_SCROLL_BUTTONS | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+ self.OnAllowNotebookDnD)
+ self.AUIManager.AddPane(
+ self.BottomNoteBook,
+ wx.aui.AuiPaneInfo().Name("ResultPane").Bottom().Layer(0).
+ BestSize(wx.Size(800, 300)).CloseButton(False))
+
+ self.RightNoteBook = wx.aui.AuiNotebook(
+ self, ID_PLCOPENEDITORRIGHTNOTEBOOK,
+ style=(wx.aui.AUI_NB_TOP |
+ wx.aui.AUI_NB_TAB_SPLIT |
+ wx.aui.AUI_NB_TAB_MOVE |
+ wx.aui.AUI_NB_SCROLL_BUTTONS |
+ wx.aui.AUI_NB_TAB_EXTERNAL_MOVE))
self.RightNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND,
- self.OnAllowNotebookDnD)
- self.AUIManager.AddPane(self.RightNoteBook,
- wx.aui.AuiPaneInfo().Name("LibraryPane").
- Right().Layer(0).
- BestSize(wx.Size(250, 400)).CloseButton(False))
-
- self.TabsOpened = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORTABSOPENED,
- style=wx.aui.AUI_NB_DEFAULT_STYLE | wx.aui.AUI_NB_WINDOWLIST_BUTTON)
+ self.OnAllowNotebookDnD)
+ self.AUIManager.AddPane(
+ self.RightNoteBook,
+ wx.aui.AuiPaneInfo().Name("LibraryPane").Right().Layer(0).
+ BestSize(wx.Size(250, 400)).CloseButton(False))
+
+ self.TabsOpened = wx.aui.AuiNotebook(
+ self, ID_PLCOPENEDITORTABSOPENED,
+ style=(wx.aui.AUI_NB_DEFAULT_STYLE |
+ wx.aui.AUI_NB_WINDOWLIST_BUTTON))
self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING,
- self.OnPouSelectedChanging)
+ self.OnPouSelectedChanging)
self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED,
- self.OnPouSelectedChanged)
+ self.OnPouSelectedChanged)
self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE,
- self.OnPageClose)
+ self.OnPageClose)
self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_END_DRAG,
- self.OnPageDragged)
+ self.OnPageDragged)
self.AUIManager.AddPane(self.TabsOpened,
- wx.aui.AuiPaneInfo().CentrePane().Name("TabsPane"))
+ wx.aui.AuiPaneInfo().CentrePane().Name("TabsPane"))
#-----------------------------------------------------------------------
# Creating PLCopen Project Types Tree
@@ -560,33 +574,37 @@
self.MainTabs = {}
- self.ProjectPanel = wx.SplitterWindow(id=ID_PLCOPENEDITORPROJECTPANEL,
- name='ProjectPanel', parent=self.LeftNoteBook, point=wx.Point(0, 0),
- size=wx.Size(0, 0), style=wx.SP_3D)
+ self.ProjectPanel = wx.SplitterWindow(
+ id=ID_PLCOPENEDITORPROJECTPANEL,
+ name='ProjectPanel', parent=self.LeftNoteBook, point=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.SP_3D)
self.ProjectTree = CustomTree(id=ID_PLCOPENEDITORPROJECTTREE,
- name='ProjectTree', parent=self.ProjectPanel,
- pos=wx.Point(0, 0), size=wx.Size(0, 0),
- style=wx.SUNKEN_BORDER,
- agwStyle=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.TR_EDIT_LABELS)
+ name='ProjectTree',
+ parent=self.ProjectPanel,
+ pos=wx.Point(0, 0), size=wx.Size(0, 0),
+ style=wx.SUNKEN_BORDER,
+ agwStyle=(wx.TR_HAS_BUTTONS |
+ wx.TR_SINGLE |
+ wx.TR_EDIT_LABELS))
self.ProjectTree.SetBackgroundBitmap(GetBitmap("custom_tree_background"),
wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM)
add_menu = wx.Menu()
self._init_coll_AddMenu_Items(add_menu)
self.ProjectTree.SetAddMenu(add_menu)
self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnProjectTreeRightUp,
- id=ID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.ProjectTree.Bind(wx.EVT_LEFT_UP, self.OnProjectTreeLeftUp)
self.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnProjectTreeItemChanging,
- id=ID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnProjectTreeBeginDrag,
- id=ID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnProjectTreeItemBeginEdit,
- id=ID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnProjectTreeItemEndEdit,
- id=ID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnProjectTreeItemActivated,
- id=ID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.ProjectTree.Bind(wx.EVT_MOTION, self.OnProjectTreeMotion)
#-----------------------------------------------------------------------
@@ -604,30 +622,34 @@
# Creating Tool Bar
#-----------------------------------------------------------------------
- MenuToolBar = wx.ToolBar(self, ID_PLCOPENEDITOREDITORMENUTOOLBAR, wx.DefaultPosition, wx.DefaultSize,
- wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER)
+ MenuToolBar = wx.ToolBar(self, ID_PLCOPENEDITOREDITORMENUTOOLBAR,
+ wx.DefaultPosition, wx.DefaultSize,
+ wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER)
MenuToolBar.SetToolBitmapSize(wx.Size(25, 25))
MenuToolBar.Realize()
self.Panes["MenuToolBar"] = MenuToolBar
self.AUIManager.AddPane(MenuToolBar, wx.aui.AuiPaneInfo().
- Name("MenuToolBar").Caption(_("Menu ToolBar")).
- ToolbarPane().Top().
- LeftDockable(False).RightDockable(False))
-
- EditorToolBar = wx.ToolBar(self, ID_PLCOPENEDITOREDITORTOOLBAR, wx.DefaultPosition, wx.DefaultSize,
- wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER)
+ Name("MenuToolBar").Caption(_("Menu ToolBar")).
+ ToolbarPane().Top().
+ LeftDockable(False).RightDockable(False))
+
+ EditorToolBar = wx.ToolBar(self, ID_PLCOPENEDITOREDITORTOOLBAR,
+ wx.DefaultPosition, wx.DefaultSize,
+ wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER)
EditorToolBar.SetToolBitmapSize(wx.Size(25, 25))
EditorToolBar.AddRadioTool(ID_PLCOPENEDITOREDITORTOOLBARSELECTION,
- GetBitmap("select"), wx.NullBitmap, _("Select an object"))
+ GetBitmap("select"),
+ wx.NullBitmap,
+ _("Select an object"))
EditorToolBar.Realize()
self.Panes["EditorToolBar"] = EditorToolBar
self.AUIManager.AddPane(EditorToolBar, wx.aui.AuiPaneInfo().
- Name("EditorToolBar").Caption(_("Editor ToolBar")).
- ToolbarPane().Top().Position(1).
- LeftDockable(False).RightDockable(False))
+ Name("EditorToolBar").Caption(_("Editor ToolBar")).
+ ToolbarPane().Top().Position(1).
+ LeftDockable(False).RightDockable(False))
self.Bind(wx.EVT_MENU, self.OnSelectionTool,
- id=ID_PLCOPENEDITOREDITORTOOLBARSELECTION)
+ id=ID_PLCOPENEDITOREDITORTOOLBARSELECTION)
#-----------------------------------------------------------------------
# Creating Search Panel
@@ -1141,9 +1163,9 @@
# self.Controler.IsProjectBufferEnabled())
self.EditMenu.Enable(wx.ID_FIND, selected > -1)
self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUFINDNEXT,
- selected > -1 and self.SearchParams is not None)
+ selected > -1 and self.SearchParams is not None)
self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUFINDPREVIOUS,
- selected > -1 and self.SearchParams is not None)
+ selected > -1 and self.SearchParams is not None)
self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUSEARCHINPROJECT, True)
MenuToolBar.EnableTool(ID_PLCOPENEDITOREDITMENUSEARCHINPROJECT, True)
self.EditMenu.Enable(wx.ID_ADD, True)
@@ -1510,8 +1532,8 @@
self.ProjectTree.SetItemTextColour(root, highlight_colours[1])
self.ProjectTree.SetItemExtraImage(root, None)
if infos["type"] == ITEM_POU:
- self.ProjectTree.SetItemImage(root,
- self.TreeImageDict[self.Controler.GetPouBodyType(infos["name"])])
+ self.ProjectTree.SetItemImage(
+ root, self.TreeImageDict[self.Controler.GetPouBodyType(infos["name"])])
if item_alone:
self.ProjectTree.SetItemExtraImage(root, self.Controler.GetPouType(infos["name"]))
elif "icon" in infos and infos["icon"] is not None:
@@ -1550,8 +1572,8 @@
root = self.ProjectTree.GetRootItem()
if root is not None and root.IsOk():
words = tagname.split("::")
- result = self.RecursiveProjectTreeItemSelection(root,
- zip(words[1:], self.TagNamePartsItemTypes.get(words[0], [])))
+ result = self.RecursiveProjectTreeItemSelection(
+ root, zip(words[1:], self.TagNamePartsItemTypes.get(words[0], [])))
return result
def RecursiveProjectTreeItemSelection(self, root, items):
@@ -1718,8 +1740,8 @@
self.EditProjectSettings()
else:
if item_infos["type"] in [ITEM_DATATYPE, ITEM_POU,
- ITEM_CONFIGURATION, ITEM_RESOURCE,
- ITEM_TRANSITION, ITEM_ACTION]:
+ ITEM_CONFIGURATION, ITEM_RESOURCE,
+ ITEM_TRANSITION, ITEM_ACTION]:
self.EditProjectElement(item_infos["type"], item_infos["tagname"])
event.Skip()
@@ -1765,8 +1787,8 @@
block_type = "Action"
self.LastToolTipItem = item
wx.CallAfter(self.ProjectTree.SetToolTipString,
- "%s : %s : %s" % (
- block_type, bodytype, item_infos["name"]))
+ "%s : %s : %s" % (
+ block_type, bodytype, item_infos["name"]))
elif self.LastToolTipItem is not None:
self.ProjectTree.SetToolTip(None)
self.LastToolTipItem = None
@@ -2417,7 +2439,8 @@
if not check_function(name):
return True
- dialog = wx.MessageDialog(self,
+ dialog = wx.MessageDialog(
+ self,
_("\"%s\" is used by one or more POUs. Do you wish to continue?") % name,
title, wx.YES_NO | wx.ICON_QUESTION)
answer = dialog.ShowModal()
--- a/PLCControler.py Fri Aug 18 12:36:31 2017 +0300
+++ b/PLCControler.py Fri Aug 18 20:14:38 2017 +0300
@@ -311,7 +311,8 @@
_Point = namedtuple("Point", ["x", "y"])
-_BlockInstanceInfos = namedtuple("BlockInstanceInfos",
+_BlockInstanceInfos = namedtuple(
+ "BlockInstanceInfos",
["type", "id", "x", "y", "width", "height", "specific_values", "inputs", "outputs"])
_BlockSpecificValues = (
@@ -371,10 +372,12 @@
[lambda x: x]),
}
-_InstanceConnectionInfos = namedtuple("InstanceConnectionInfos",
+_InstanceConnectionInfos = namedtuple(
+ "InstanceConnectionInfos",
["name", "negated", "edge", "position", "links"])
-_ConnectionLinkInfos = namedtuple("ConnectionLinkInfos",
+_ConnectionLinkInfos = namedtuple(
+ "ConnectionLinkInfos",
["refLocalId", "formalParameter", "points"])
@@ -710,8 +713,11 @@
infos = {"name": project.getname(), "type": ITEM_PROJECT}
datatypes = {"name": DATA_TYPES, "type": ITEM_DATATYPES, "values": []}
for datatype in project.getdataTypes():
- datatypes["values"].append({"name": datatype.getname(), "type": ITEM_DATATYPE,
- "tagname": self.ComputeDataTypeName(datatype.getname()), "values": []})
+ datatypes["values"].append({
+ "name": datatype.getname(),
+ "type": ITEM_DATATYPE,
+ "tagname": self.ComputeDataTypeName(datatype.getname()),
+ "values": []})
pou_types = {
"function": {
"name": FUNCTIONS,
@@ -737,13 +743,17 @@
if pou.getbodyType() == "SFC":
transitions = []
for transition in pou.gettransitionList():
- transitions.append({"name": transition.getname(), "type": ITEM_TRANSITION,
+ transitions.append({
+ "name": transition.getname(),
+ "type": ITEM_TRANSITION,
"tagname": self.ComputePouTransitionName(pou.getname(), transition.getname()),
"values": []})
pou_values.append({"name": TRANSITIONS, "type": ITEM_TRANSITIONS, "values": transitions})
actions = []
for action in pou.getactionList():
- actions.append({"name": action.getname(), "type": ITEM_ACTION,
+ actions.append({
+ "name": action.getname(),
+ "type": ITEM_ACTION,
"tagname": self.ComputePouActionName(pou.getname(), action.getname()),
"values": []})
pou_values.append({"name": ACTIONS, "type": ITEM_ACTIONS, "values": actions})
@@ -753,13 +763,17 @@
configurations = {"name": CONFIGURATIONS, "type": ITEM_CONFIGURATIONS, "values": []}
for config in project.getconfigurations():
config_name = config.getname()
- config_infos = {"name": config_name, "type": ITEM_CONFIGURATION,
+ config_infos = {
+ "name": config_name,
+ "type": ITEM_CONFIGURATION,
"tagname": self.ComputeConfigurationName(config.getname()),
"values": []}
resources = {"name": RESOURCES, "type": ITEM_RESOURCES, "values": []}
for resource in config.getresource():
resource_name = resource.getname()
- resource_infos = {"name": resource_name, "type": ITEM_RESOURCE,
+ resource_infos = {
+ "name": resource_name,
+ "type": ITEM_RESOURCE,
"tagname": self.ComputeConfigurationResourceName(config.getname(), resource.getname()),
"values": []}
resources["values"].append(resource_infos)
@@ -814,8 +828,8 @@
extensions={
("instances_ns", "AddInstance"): factory.AddInstance})
- instances_path_xslt_tree(root,
- instance_type=etree.XSLT.strparam(name))
+ instances_path_xslt_tree(
+ root, instance_type=etree.XSLT.strparam(name))
return instances
@@ -853,8 +867,8 @@
"ActionTagName",
"TransitionTagName"]})
- instance_tagname_xslt_tree(project,
- instance_path=etree.XSLT.strparam(instance_path))
+ instance_tagname_xslt_tree(
+ project, instance_path=etree.XSLT.strparam(instance_path))
return factory.GetTagName()
@@ -1386,10 +1400,10 @@
os.path.join(ScriptDirectory, "plcopen", "variables_infos.xslt"),
parser),
extensions={("var_infos_ns", name): getattr(factory, name)
- for name in ["SetType", "AddDimension", "AddTree",
- "AddVarToTree", "AddVariable"]})
- variables_infos_xslt_tree(object_with_vars,
- tree=etree.XSLT.strparam(str(tree)))
+ for name in ["SetType", "AddDimension", "AddTree",
+ "AddVarToTree", "AddVariable"]})
+ variables_infos_xslt_tree(
+ object_with_vars, tree=etree.XSLT.strparam(str(tree)))
return variables
@@ -1437,7 +1451,8 @@
if config_name is None or config_name == configuration.getname():
variables.extend(
[var.getname() for var in reduce(
- lambda x, y: x + y, [varlist.getvariable()
+ lambda x, y: x + y, [
+ varlist.getvariable()
for varlist in configuration.globalVars],
[])])
return variables
@@ -1466,8 +1481,8 @@
return []
# Return resource variable names
- def GetConfigurationResourceVariableNames(self,
- config_name=None, resource_name=None, debug=False):
+ def GetConfigurationResourceVariableNames(
+ self, config_name=None, resource_name=None, debug=False):
variables = []
project = self.GetProject(debug)
if project is not None:
@@ -1477,7 +1492,8 @@
if resource_name is None or resource.getname() == resource_name:
variables.extend(
[var.getname() for var in reduce(
- lambda x, y: x + y, [varlist.getvariable()
+ lambda x, y: x + y, [
+ varlist.getvariable()
for varlist in resource.globalVars],
[])])
return variables
@@ -1553,8 +1569,8 @@
extensions={("var_infos_ns", name): getattr(factory, name)
for name in ["SetType", "AddDimension",
"AddTree", "AddVarToTree"]})
- return_type_infos_xslt_tree(return_type,
- tree=etree.XSLT.strparam(str(tree)))
+ return_type_infos_xslt_tree(
+ return_type, tree=etree.XSLT.strparam(str(tree)))
if tree:
return [factory.GetType(), factory.GetTree()]
return factory.GetType()
@@ -1650,7 +1666,7 @@
return blocktype_infos
if inputs == tuple([var_type
- for name, var_type, modifier in blocktype_infos["inputs"]]):
+ for name, var_type, modifier in blocktype_infos["inputs"]]):
return blocktype_infos
return None
@@ -1674,11 +1690,13 @@
"list": [block for block in category["list"]
if block["type"] in filter]}
for category in self.TotalTypes]
- blocktypes.append({"name": USER_DEFINED_POUS,
+ blocktypes.append({
+ "name": USER_DEFINED_POUS,
"list": [pou.getblockInfos()
for pou in project.getpous(name, filter)
if (name is None or
- len(self.GetInstanceList(pou, name, debug)) == 0)]})
+ len(self.GetInstanceList(pou, name, debug)) == 0)]
+ })
return blocktypes
return self.TotalTypes
@@ -1695,7 +1713,8 @@
if block["type"] == "functionBlock":
blocktypes.append(block["name"])
if project is not None:
- blocktypes.extend([pou.getname()
+ blocktypes.extend([
+ pou.getname()
for pou in project.getpous(name, ["functionBlock"])
if (name is None or
len(self.GetInstanceList(pou, name, debug)) == 0)])
@@ -1996,8 +2015,8 @@
base_type = basetype_content.baseType.getcontent()
base_type_type = base_type.getLocalTag()
infos["base_type"] = (base_type.getname()
- if base_type_type == "derived"
- else base_type_type)
+ if base_type_type == "derived"
+ else base_type_type)
elif basetype_content_type == "enum":
infos["type"] = "Enumerated"
infos["values"] = []
@@ -2011,8 +2030,8 @@
base_type = basetype_content.baseType.getcontent()
base_type_type = base_type.getLocalTag()
infos["base_type"] = (base_type.getname()
- if base_type_type == "derived"
- else base_type_type.upper())
+ if base_type_type == "derived"
+ else base_type_type.upper())
elif basetype_content_type == "struct":
infos["type"] = "Structure"
infos["elements"] = []
@@ -2028,9 +2047,10 @@
base_type = element_type.baseType.getcontent()
base_type_type = base_type.getLocalTag()
element_infos["Type"] = ("array",
- base_type.getname()
- if base_type_type == "derived"
- else base_type_type.upper(), dimensions)
+ base_type.getname()
+ if base_type_type == "derived"
+ else base_type_type.upper(),
+ dimensions)
elif element_type_type == "derived":
element_infos["Type"] = element_type.getname()
else:
@@ -2043,8 +2063,8 @@
else:
infos["type"] = "Directly"
infos["base_type"] = (basetype_content.getname()
- if basetype_content_type == "derived"
- else basetype_content_type.upper())
+ if basetype_content_type == "derived"
+ else basetype_content_type.upper())
if datatype.initialValue is not None:
infos["initial"] = datatype.initialValue.getvalue()
@@ -2334,10 +2354,11 @@
element = self.GetEditedElement(tagname, debug)
if element is not None and element.getbodyType() not in ["ST", "IL"]:
for instance in element.getinstances():
- if isinstance(instance,
- (PLCOpenParser.GetElementClass("step", "sfcObjects"),
- PLCOpenParser.GetElementClass("connector", "commonObjects"),
- PLCOpenParser.GetElementClass("continuation", "commonObjects"))):
+ if isinstance(
+ instance,
+ (PLCOpenParser.GetElementClass("step", "sfcObjects"),
+ PLCOpenParser.GetElementClass("connector", "commonObjects"),
+ PLCOpenParser.GetElementClass("continuation", "commonObjects"))):
names[instance.getname().upper()] = True
else:
project = self.GetProject(debug)
--- a/PLCGenerator.py Fri Aug 18 12:36:31 2017 +0300
+++ b/PLCGenerator.py Fri Aug 18 20:14:38 2017 +0300
@@ -166,7 +166,7 @@
values = [[(value.getname(), (tagname, "value", i))]
for i, value in enumerate(
basetype_content.xpath("ppx:values/ppx:value",
- namespaces=PLCOpenParser.NSMAP))]
+ namespaces=PLCOpenParser.NSMAP))]
datatype_def += [("(", ())]
datatype_def += JoinList([(", ", ())], values)
datatype_def += [(")", ())]
@@ -497,9 +497,10 @@
SelectionConvergenceClass, SelectionDivergenceClass,
SimultaneousConvergenceClass, SimultaneousDivergenceClass] = [
PLCOpenParser.GetElementClass(instance_name, "sfcObjects")
- for instance_name in ["step", "transition", "jumpStep",
- "selectionConvergence", "selectionDivergence",
- "simultaneousConvergence", "simultaneousDivergence"]]
+ for instance_name in [
+ "step", "transition", "jumpStep",
+ "selectionConvergence", "selectionDivergence",
+ "simultaneousConvergence", "simultaneousDivergence"]]
TransitionObjClass = PLCOpenParser.GetElementClass("transition", "transitions")
ActionObjClass = PLCOpenParser.GetElementClass("action", "actions")
@@ -594,7 +595,7 @@
parameter = link.getformalParameter()
instance = body.getcontentInstance(link.getrefLocalId())
if isinstance(instance, (InVariableClass, InOutVariableClass,
- ContinuationClass, ContactClass, CoilClass)):
+ ContinuationClass, ContactClass, CoilClass)):
return instance.connectionPointOut
elif isinstance(instance, BlockClass):
outputvariables = instance.outputVariables.getvariable()
@@ -1459,8 +1460,11 @@
self.GenerateSFCAction(action["value"], pou)
else:
action_name = "%s_INLINE%d" % (step_name.upper(), self.GetActionNumber())
- self.SFCNetworks["Actions"][action_name] = ([(self.CurrentIndent, ()),
- (action["value"], (self.TagName, "action_block", action_infos["id"], "action", i, "inline")),
+ self.SFCNetworks["Actions"][action_name] = ([
+ (self.CurrentIndent, ()),
+ (action["value"], (
+ self.TagName, "action_block", action_infos["id"],
+ "action", i, "inline")),
("\n", ())], ())
action_infos["content"] = action_name
self.SFCNetworks["Steps"][step_name]["actions"].append(action_infos)
--- a/PLCOpenEditor.py Fri Aug 18 12:36:31 2017 +0300
+++ b/PLCOpenEditor.py Fri Aug 18 20:14:38 2017 +0300
@@ -106,33 +106,33 @@
def _init_coll_FileMenu_Items(self, parent):
AppendMenu(parent, help='', id=wx.ID_NEW,
- kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N')
+ kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N')
AppendMenu(parent, help='', id=wx.ID_OPEN,
- kind=wx.ITEM_NORMAL, text=_(u'Open') + '\tCTRL+O')
+ kind=wx.ITEM_NORMAL, text=_(u'Open') + '\tCTRL+O')
AppendMenu(parent, help='', id=wx.ID_CLOSE,
- kind=wx.ITEM_NORMAL, text=_(u'Close Tab') + '\tCTRL+W')
+ kind=wx.ITEM_NORMAL, text=_(u'Close Tab') + '\tCTRL+W')
AppendMenu(parent, help='', id=wx.ID_CLOSE_ALL,
- kind=wx.ITEM_NORMAL, text=_(u'Close Project') + '\tCTRL+SHIFT+W')
+ kind=wx.ITEM_NORMAL, text=_(u'Close Project') + '\tCTRL+SHIFT+W')
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_SAVE,
- kind=wx.ITEM_NORMAL, text=_(u'Save') + '\tCTRL+S')
+ kind=wx.ITEM_NORMAL, text=_(u'Save') + '\tCTRL+S')
AppendMenu(parent, help='', id=wx.ID_SAVEAS,
- kind=wx.ITEM_NORMAL, text=_(u'Save As...') + '\tCTRL+SHIFT+S')
+ kind=wx.ITEM_NORMAL, text=_(u'Save As...') + '\tCTRL+SHIFT+S')
AppendMenu(parent, help='', id=ID_PLCOPENEDITORFILEMENUGENERATE,
- kind=wx.ITEM_NORMAL, text=_(u'Generate Program') + '\tCTRL+G')
+ kind=wx.ITEM_NORMAL, text=_(u'Generate Program') + '\tCTRL+G')
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_PAGE_SETUP,
- kind=wx.ITEM_NORMAL, text=_(u'Page Setup') + '\tCTRL+ALT+P')
+ kind=wx.ITEM_NORMAL, text=_(u'Page Setup') + '\tCTRL+ALT+P')
AppendMenu(parent, help='', id=wx.ID_PREVIEW,
- kind=wx.ITEM_NORMAL, text=_(u'Preview') + '\tCTRL+SHIFT+P')
+ kind=wx.ITEM_NORMAL, text=_(u'Preview') + '\tCTRL+SHIFT+P')
AppendMenu(parent, help='', id=wx.ID_PRINT,
- kind=wx.ITEM_NORMAL, text=_(u'Print') + '\tCTRL+P')
+ kind=wx.ITEM_NORMAL, text=_(u'Print') + '\tCTRL+P')
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_PROPERTIES,
- kind=wx.ITEM_NORMAL, text=_(u'&Properties'))
+ kind=wx.ITEM_NORMAL, text=_(u'&Properties'))
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_EXIT,
- kind=wx.ITEM_NORMAL, text=_(u'Quit') + '\tCTRL+Q')
+ kind=wx.ITEM_NORMAL, text=_(u'Quit') + '\tCTRL+Q')
self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW)
self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN)
@@ -141,7 +141,7 @@
self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE)
self.Bind(wx.EVT_MENU, self.OnSaveProjectAsMenu, id=wx.ID_SAVEAS)
self.Bind(wx.EVT_MENU, self.OnGenerateProgramMenu,
- id=ID_PLCOPENEDITORFILEMENUGENERATE)
+ id=ID_PLCOPENEDITORFILEMENUGENERATE)
self.Bind(wx.EVT_MENU, self.OnPageSetupMenu, id=wx.ID_PAGE_SETUP)
self.Bind(wx.EVT_MENU, self.OnPreviewMenu, id=wx.ID_PREVIEW)
self.Bind(wx.EVT_MENU, self.OnPrintMenu, id=wx.ID_PRINT)
@@ -156,7 +156,7 @@
def _init_coll_HelpMenu_Items(self, parent):
AppendMenu(parent, help='', id=wx.ID_HELP,
- kind=wx.ITEM_NORMAL, text=_(u'PLCOpenEditor') + '\tF1')
+ kind=wx.ITEM_NORMAL, text=_(u'PLCOpenEditor') + '\tF1')
#AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS,
# kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2')
#AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT,
@@ -173,7 +173,7 @@
self.Bind(wx.EVT_MENU, handler, id=id)
AppendMenu(parent, help='', id=wx.ID_ABOUT,
- kind=wx.ITEM_NORMAL, text=_(u'About'))
+ kind=wx.ITEM_NORMAL, text=_(u'About'))
self.Bind(wx.EVT_MENU, self.OnPLCOpenEditorMenu, id=wx.ID_HELP)
#self.Bind(wx.EVT_MENU, self.OnPLCOpenMenu, id=wx.ID_HELP_CONTENTS)
self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
@@ -424,7 +424,8 @@
if cap:
cap.ReleaseMouse()
- dlg = wx.SingleChoiceDialog(None,
+ dlg = wx.SingleChoiceDialog(
+ None,
_("""
An unhandled exception (bug) occured. Bug report saved at :
(%s)
--- a/ProjectController.py Fri Aug 18 12:36:31 2017 +0300
+++ b/ProjectController.py Fri Aug 18 20:14:38 2017 +0300
@@ -145,7 +145,8 @@
try:
# Invoke compiler. Output files are listed to stdout, errors to stderr
status, result, err_result = ProcessLogger(None, buildcmd,
- no_stdout=True, no_stderr=True).spin()
+ no_stdout=True,
+ no_stderr=True).spin()
except Exception, e:
return buildopt
@@ -282,7 +283,8 @@
# Timer to pull PLC status
self.StatusTimer = wx.Timer(self.AppFrame, -1)
self.AppFrame.Bind(wx.EVT_TIMER,
- self.PullPLCStatusProc, self.StatusTimer)
+ self.PullPLCStatusProc,
+ self.StatusTimer)
if self._connector is not None:
frame.LogViewer.SetLogSource(self._connector)
@@ -291,7 +293,8 @@
# Timer to dispatch debug values to consumers
self.DispatchDebugValuesTimer = wx.Timer(self.AppFrame, -1)
self.AppFrame.Bind(wx.EVT_TIMER,
- self.DispatchDebugValuesProc, self.DispatchDebugValuesTimer)
+ self.DispatchDebugValuesProc,
+ self.DispatchDebugValuesTimer)
self.RefreshConfNodesBlockLists()
@@ -376,10 +379,11 @@
if CheckPathPerm(self.ProjectPath):
return True
if self.AppFrame is not None:
- dialog = wx.MessageDialog(self.AppFrame,
- _('You must have permission to work on the project\nWork on a project copy ?'),
- _('Error'),
- wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
+ dialog = wx.MessageDialog(
+ self.AppFrame,
+ _('You must have permission to work on the project\nWork on a project copy ?'),
+ _('Error'),
+ wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
answer = dialog.ShowModal()
dialog.Destroy()
if answer == wx.ID_YES:
@@ -750,7 +754,7 @@
try:
# Invoke compiler. Output files are listed to stdout, errors to stderr
status, result, err_result = ProcessLogger(self.logger, buildcmd,
- no_stdout=True, no_stderr=True).spin()
+ no_stdout=True, no_stderr=True).spin()
except Exception, e:
self.logger.write_error(buildcmd + "\n")
self.logger.write_error(repr(e) + "\n")
@@ -860,8 +864,8 @@
return ([(C_file_name, self.plcCFLAGS)
for C_file_name in self.PLCGeneratedCFiles],
- "", # no ldflags
- False) # do not expose retreive/publish calls
+ "", # no ldflags
+ False) # do not expose retreive/publish calls
def ResetIECProgramsAndVariables(self):
"""
@@ -1005,7 +1009,8 @@
# filter location that are related to code that will be called
# in retreive, publish, init, cleanup
locstrs = map(lambda x: "_".join(map(str, x)),
- [loc for loc, Cfiles, DoCalls in self.LocationCFilesAndCFLAGS if loc and DoCalls])
+ [loc for loc, Cfiles, DoCalls in
+ self.LocationCFilesAndCFLAGS if loc and DoCalls])
# Generate main, based on template
if not self.BeremizRoot.getDisable_Extensions():
@@ -1269,9 +1274,12 @@
editor_name = editors.keys()[0]
elif len(editors) > 0:
names = editors.keys()
- dialog = wx.SingleChoiceDialog(self.AppFrame,
- _("Select an editor:"), _("Editor selection"),
- names, wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
+ dialog = wx.SingleChoiceDialog(
+ self.AppFrame,
+ _("Select an editor:"),
+ _("Editor selection"),
+ names,
+ wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
editor_name = names[dialog.GetSelection()]
dialog.Destroy()
@@ -1397,7 +1405,7 @@
def SnapshotAndResetDebugValuesBuffers(self):
buffers, self.DebugValuesBuffers = (self.DebugValuesBuffers,
- [list() for n in xrange(len(self.TracedIECPath))])
+ [list() for n in xrange(len(self.TracedIECPath))])
ticks, self.DebugTicks = self.DebugTicks, []
return ticks, buffers
--- a/c_ext/CFileEditor.py Fri Aug 18 12:36:31 2017 +0300
+++ b/c_ext/CFileEditor.py Fri Aug 18 20:14:38 2017 +0300
@@ -31,14 +31,14 @@
class CppEditor(CodeEditor):
KEYWORDS = ["asm", "auto", "bool", "break", "case", "catch", "char", "class",
- "const", "const_cast", "continue", "default", "delete", "do", "double",
- "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false",
- "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable",
- "namespace", "new", "operator", "private", "protected", "public", "register",
- "reinterpret_cast", "return", "short", "signed", "sizeof", "static",
- "static_cast", "struct", "switch", "template", "this", "throw", "true", "try",
- "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual",
- "void", "volatile", "wchar_t", "while"]
+ "const", "const_cast", "continue", "default", "delete", "do", "double",
+ "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false",
+ "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable",
+ "namespace", "new", "operator", "private", "protected", "public", "register",
+ "reinterpret_cast", "return", "short", "signed", "sizeof", "static",
+ "static_cast", "struct", "switch", "template", "this", "throw", "true", "try",
+ "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual",
+ "void", "volatile", "wchar_t", "while"]
COMMENT_HEADER = "/"
def SetCodeLexer(self):
--- a/canfestival/NetworkEditor.py Fri Aug 18 12:36:31 2017 +0300
+++ b/canfestival/NetworkEditor.py Fri Aug 18 20:14:38 2017 +0300
@@ -53,8 +53,9 @@
(_("CANOpen network"), "_create_NetworkEditor")]
def _create_NetworkEditor(self, prnt):
- self.NetworkEditor = wx.Panel(id=-1, parent=prnt, pos=wx.Point(0, 0),
- size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+ self.NetworkEditor = wx.Panel(
+ id=-1, parent=prnt, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
NetworkEditorTemplate._init_ctrls(self, self.NetworkEditor)
--- a/canfestival/config_utils.py Fri Aug 18 12:36:31 2017 +0300
+++ b/canfestival/config_utils.py Fri Aug 18 20:14:38 2017 +0300
@@ -320,8 +320,10 @@
@param pdomapping: list od variables to map with PDO
"""
# Add an entry to MasterMapping
- self.MasterMapping[pdocobid] = {"type": InvertPDOType[pdotype],
- "mapping": [None] + [(loc_infos["type"], name) for name, loc_infos in pdomapping]}
+ self.MasterMapping[pdocobid] = {
+ "type": InvertPDOType[pdotype],
+ "mapping": [None] + [(loc_infos["type"], name) for name, loc_infos in pdomapping]
+ }
# Return the data to add to DCF
if sync_TPDOs:
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Fri Aug 18 20:14:38 2017 +0300
@@ -447,8 +447,8 @@
w, h = button.GetSize()
if direction in [wx.LEFT, wx.RIGHT]:
x = rect.x + (- w - offset
- if direction == wx.LEFT
- else rect.width + offset)
+ if direction == wx.LEFT
+ else rect.width + offset)
y = rect.y + (rect.height - h) / 2
offset += w
else:
@@ -644,8 +644,8 @@
# Start a drag'n drop from mouse position in wx coordinate of
# parent
xw, yw = self.GetPosition()
- self.ParentWindow.StartDragNDrop(self,
- self.ItemsDict.values()[item_idx],
+ self.ParentWindow.StartDragNDrop(
+ self, self.ItemsDict.values()[item_idx],
x + xw, y + yw, # Current mouse position
x + xw, y + yw) # Mouse position when button was clicked
@@ -686,7 +686,7 @@
item = self.ParentWindow.DraggingAxesPanel.ItemsDict.values()[0]
# Give mouse position in wx coordinate of parent
self.ParentWindow.StopDragNDrop(item.GetVariable(),
- xw + event.x, yw + height - event.y)
+ xw + event.x, yw + height - event.y)
else:
# Reset any move in progress
@@ -725,9 +725,9 @@
if self.GraphType == GRAPH_PARALLEL: # Graph is parallel
directions = [wx.RIGHT] * len(self.AxesLabels) + \
[wx.LEFT] * len(self.Labels)
- elif len(self.AxesLabels) > 0: # Graph is orthogonal in 2D
- directions = [wx.RIGHT, wx.TOP, # Directions for AxesLabels
- wx.LEFT, wx.BOTTOM] # Directions for Labels
+ elif len(self.AxesLabels) > 0: # Graph is orthogonal in 2D
+ directions = [wx.RIGHT, wx.TOP, # Directions for AxesLabels
+ wx.LEFT, wx.BOTTOM] # Directions for Labels
else: # Graph is orthogonal in 3D
directions = [wx.LEFT] * len(self.Labels)
@@ -787,8 +787,8 @@
elif self.MouseStartPos is not None and len(self.Items) == 1:
xw, yw = self.GetPosition()
self.ParentWindow.SetCursorTick(self.StartCursorTick)
- self.ParentWindow.StartDragNDrop(self,
- self.ItemsDict.values()[0],
+ self.ParentWindow.StartDragNDrop(
+ self, self.ItemsDict.values()[0],
# Current mouse position
event.x + xw, height - event.y + yw,
# Mouse position when button was clicked
@@ -888,8 +888,8 @@
# The minimum height take in account the height of all items, padding
# inside figure and border around figure
return wx.Size(200,
- CANVAS_BORDER[0] + CANVAS_BORDER[1] +
- 2 * CANVAS_PADDING + VALUE_LABEL_HEIGHT * len(self.Items))
+ CANVAS_BORDER[0] + CANVAS_BORDER[1] +
+ 2 * CANVAS_PADDING + VALUE_LABEL_HEIGHT * len(self.Items))
def SetCanvasHeight(self, height):
"""
--- a/controls/DebugVariablePanel/DebugVariablePanel.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py Fri Aug 18 20:14:38 2017 +0300
@@ -230,7 +230,8 @@
self.CanvasRange = wx.ComboBox(self, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnRangeChanged, self.CanvasRange)
graphics_button_sizer.AddWindow(self.CanvasRange, 1,
- border=5, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
+ border=5,
+ flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
self.CanvasRange.Clear()
default_range_idx = 0
@@ -243,26 +244,26 @@
for name, bitmap, help in [
("CurrentButton", "current", _("Go to current value")),
("ExportGraphButton", "export_graph", _("Export graph values to clipboard"))]:
- button = wx.lib.buttons.GenBitmapButton(self,
- bitmap=GetBitmap(bitmap),
- size=wx.Size(28, 28), style=wx.NO_BORDER)
+ button = wx.lib.buttons.GenBitmapButton(
+ self, bitmap=GetBitmap(bitmap),
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
button.SetToolTipString(help)
setattr(self, name, button)
self.Bind(wx.EVT_BUTTON, getattr(self, "On" + name), button)
graphics_button_sizer.AddWindow(button, border=5, flag=wx.LEFT)
- self.CanvasPosition = wx.ScrollBar(self,
- size=wx.Size(0, 16), style=wx.SB_HORIZONTAL)
+ self.CanvasPosition = wx.ScrollBar(
+ self, size=wx.Size(0, 16), style=wx.SB_HORIZONTAL)
self.CanvasPosition.Bind(wx.EVT_SCROLL_THUMBTRACK,
- self.OnPositionChanging, self.CanvasPosition)
+ self.OnPositionChanging, self.CanvasPosition)
self.CanvasPosition.Bind(wx.EVT_SCROLL_LINEUP,
- self.OnPositionChanging, self.CanvasPosition)
+ self.OnPositionChanging, self.CanvasPosition)
self.CanvasPosition.Bind(wx.EVT_SCROLL_LINEDOWN,
- self.OnPositionChanging, self.CanvasPosition)
+ self.OnPositionChanging, self.CanvasPosition)
self.CanvasPosition.Bind(wx.EVT_SCROLL_PAGEUP,
- self.OnPositionChanging, self.CanvasPosition)
+ self.OnPositionChanging, self.CanvasPosition)
self.CanvasPosition.Bind(wx.EVT_SCROLL_PAGEDOWN,
- self.OnPositionChanging, self.CanvasPosition)
+ self.OnPositionChanging, self.CanvasPosition)
main_sizer.AddWindow(self.CanvasPosition, border=5, flag=wx.GROW | wx.LEFT | wx.RIGHT | wx.BOTTOM)
self.TickSizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -388,18 +389,17 @@
def MoveCursorTick(self, move):
if self.CursorTick is not None:
cursor_tick = max(self.Ticks[0],
- min(self.CursorTick + move,
- self.Ticks[-1]))
+ min(self.CursorTick + move, self.Ticks[-1]))
cursor_tick_idx = numpy.argmin(numpy.abs(self.Ticks - cursor_tick))
if self.Ticks[cursor_tick_idx] == self.CursorTick:
cursor_tick_idx = max(0,
- min(cursor_tick_idx + abs(move) / move,
- len(self.Ticks) - 1))
+ min(cursor_tick_idx + abs(move) / move,
+ len(self.Ticks) - 1))
self.CursorTick = self.Ticks[cursor_tick_idx]
- self.StartTick = max(self.Ticks[
- numpy.argmin(numpy.abs(self.Ticks -
- self.CursorTick + self.CurrentRange))],
- min(self.StartTick, self.CursorTick))
+ self.StartTick = max(
+ self.Ticks[numpy.argmin(
+ numpy.abs(self.Ticks - self.CursorTick + self.CurrentRange))],
+ min(self.StartTick, self.CursorTick))
self.RefreshCanvasPosition()
self.UpdateCursorTick()
@@ -737,8 +737,8 @@
for panel in self.GraphicPanels:
items.extend(panel.GetItems())
if len(items) > 1:
- self.VariableNameMask = reduce(compute_mask,
- [item.GetVariable().split('.') for item in items])
+ self.VariableNameMask = reduce(
+ compute_mask, [item.GetVariable().split('.') for item in items])
elif len(items) > 0:
self.VariableNameMask = items[0].GetVariable().split('.')[:-1] + ['*']
else:
@@ -934,7 +934,8 @@
posy = max(0, min(ystart, (vheight - window_size[1]) / SCROLLBAR_UNIT))
self.GraphicsWindow.Scroll(posx, posy)
self.GraphicsWindow.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
- vwidth / SCROLLBAR_UNIT, vheight / SCROLLBAR_UNIT, posx, posy)
+ vwidth / SCROLLBAR_UNIT, vheight / SCROLLBAR_UNIT,
+ posx, posy)
def OnGraphicsWindowEraseBackground(self, event):
pass
--- a/controls/DurationCellEditor.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/DurationCellEditor.py Fri Aug 18 20:14:38 2017 +0300
@@ -42,7 +42,7 @@
# create location text control
self.Duration = wx.TextCtrl(self, size=wx.Size(0, -1),
- style=wx.TE_PROCESS_ENTER)
+ style=wx.TE_PROCESS_ENTER)
self.Duration.Bind(wx.EVT_KEY_DOWN, self.OnDurationChar)
main_sizer.AddWindow(self.Duration, flag=wx.GROW)
--- a/controls/FolderTree.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/FolderTree.py Fri Aug 18 20:14:38 2017 +0300
@@ -57,12 +57,12 @@
main_sizer = wx.BoxSizer(wx.VERTICAL)
self.Tree = wx.TreeCtrl(self,
- style=wx.TR_HAS_BUTTONS |
- wx.TR_SINGLE |
- wx.SUNKEN_BORDER |
- wx.TR_HIDE_ROOT |
- wx.TR_LINES_AT_ROOT |
- wx.TR_EDIT_LABELS)
+ style=(wx.TR_HAS_BUTTONS |
+ wx.TR_SINGLE |
+ wx.SUNKEN_BORDER |
+ wx.TR_HIDE_ROOT |
+ wx.TR_LINES_AT_ROOT |
+ wx.TR_EDIT_LABELS))
if wx.Platform == '__WXMSW__':
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeItemExpanded, self.Tree)
self.Tree.Bind(wx.EVT_LEFT_DOWN, self.OnTreeLeftDown)
@@ -216,8 +216,8 @@
event.Skip()
else:
message = wx.MessageDialog(self,
- _("File '%s' already exists!") % new_name,
- _("Error"), wx.OK | wx.ICON_ERROR)
+ _("File '%s' already exists!") % new_name,
+ _("Error"), wx.OK | wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Veto()
--- a/controls/LibraryPanel.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/LibraryPanel.py Fri Aug 18 20:14:38 2017 +0300
@@ -83,12 +83,12 @@
# Add TreeCtrl for functions and function blocks library in splitter
# window
self.Tree = wx.TreeCtrl(splitter_window,
- size=wx.Size(0, 0),
- style=wx.TR_HAS_BUTTONS |
- wx.TR_SINGLE |
- wx.SUNKEN_BORDER |
- wx.TR_HIDE_ROOT |
- wx.TR_LINES_AT_ROOT)
+ size=wx.Size(0, 0),
+ style=(wx.TR_HAS_BUTTONS |
+ wx.TR_SINGLE |
+ wx.SUNKEN_BORDER |
+ wx.TR_HIDE_ROOT |
+ wx.TR_LINES_AT_ROOT))
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeItemSelected, self.Tree)
self.Tree.Bind(wx.EVT_CHAR, self.OnKeyDown)
# If drag'n drop is enabled, bind event generated when a drag begins on
@@ -98,7 +98,7 @@
# Add TextCtrl for function and function block informations
self.Comment = wx.TextCtrl(splitter_window, size=wx.Size(0, 80),
- style=wx.TE_READONLY | wx.TE_MULTILINE)
+ style=wx.TE_READONLY | wx.TE_MULTILINE)
splitter_window.SplitHorizontally(self.Tree, self.Comment, -80)
@@ -176,9 +176,9 @@
# Don't save selected item if it is a category
selected_infos = ((self.Tree.GetItemText(selected_item),
selected_pydata["inputs"])
- if (selected_pydata is not None and
- selected_pydata["type"] == BLOCK)
- else (None, None))
+ if (selected_pydata is not None and
+ selected_pydata["type"] == BLOCK)
+ else (None, None))
# Get TreeCtrl root item (hidden)
root = self.Tree.GetRootItem()
@@ -246,7 +246,7 @@
for name, type, modifier
in blocktype["inputs"]]),
"extension": (len(blocktype["inputs"])
- if blocktype["extensible"] else None),
+ if blocktype["extensible"] else None),
"comment": _(comment) + blocktype.get("usage", "")
}
self.Tree.SetPyData(blocktype_item, block_data)
--- a/controls/LocationCellEditor.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/LocationCellEditor.py Fri Aug 18 20:14:38 2017 +0300
@@ -42,7 +42,7 @@
# create location text control
self.Location = wx.TextCtrl(self, size=wx.Size(0, -1),
- style=wx.TE_PROCESS_ENTER)
+ style=wx.TE_PROCESS_ENTER)
self.Location.Bind(wx.EVT_KEY_DOWN, self.OnLocationChar)
main_sizer.AddWindow(self.Location, flag=wx.GROW)
@@ -94,10 +94,12 @@
location = infos["location"]
# set the location
if not infos["location"].startswith("%"):
- dialog = wx.SingleChoiceDialog(self,
- _("Select a variable class:"), _("Variable class"),
- [_("Input"), _("Output"), _("Memory")],
- wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
+ dialog = wx.SingleChoiceDialog(
+ self,
+ _("Select a variable class:"),
+ _("Variable class"),
+ [_("Input"), _("Output"), _("Memory")],
+ wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetSelection()
else:
--- a/controls/LogViewer.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/LogViewer.py Fri Aug 18 20:14:38 2017 +0300
@@ -221,8 +221,8 @@
w, h = dc.GetTextExtent(self.Label)
dc.DrawText(self.Label,
- self.Position.x + (self.Size.width - w) / 2,
- self.Position.y + (self.Size.height - h) / 2)
+ self.Position.x + (self.Size.width - w) / 2,
+ self.Position.y + (self.Size.height - h) / 2)
DATE_INFO_SIZE = 10
@@ -316,13 +316,13 @@
self.SearchMessage.ShowCancelButton(True)
self.Bind(wx.EVT_TEXT_ENTER, self.OnSearchMessageChanged, self.SearchMessage)
self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN,
- self.OnSearchMessageSearchButtonClick, self.SearchMessage)
+ self.OnSearchMessageSearchButtonClick, self.SearchMessage)
self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN,
- self.OnSearchMessageCancelButtonClick, self.SearchMessage)
+ self.OnSearchMessageCancelButtonClick, self.SearchMessage)
filter_sizer.AddWindow(self.SearchMessage, 3, border=5, flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL)
self.CleanButton = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap("Clean"),
- size=wx.Size(28, 28), style=wx.NO_BORDER)
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
self.CleanButton.SetToolTipString(_("Clean log messages"))
self.Bind(wx.EVT_BUTTON, self.OnCleanButton, self.CleanButton)
filter_sizer.AddWindow(self.CleanButton)
--- a/controls/PouInstanceVariablesPanel.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/PouInstanceVariablesPanel.py Fri Aug 18 20:14:38 2017 +0300
@@ -124,38 +124,39 @@
def __init__(self, parent, window, controller, debug):
wx.Panel.__init__(self, name='PouInstanceTreePanel',
- parent=parent, pos=wx.Point(0, 0),
- size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
-
- self.ParentButton = wx.lib.buttons.GenBitmapButton(self,
- bitmap=GetBitmap("top"), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ parent=parent, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
+ self.ParentButton = wx.lib.buttons.GenBitmapButton(
+ self, bitmap=GetBitmap("top"), size=wx.Size(28, 28), style=wx.NO_BORDER)
self.ParentButton.SetToolTipString(_("Parent instance"))
self.Bind(wx.EVT_BUTTON, self.OnParentButtonClick,
- self.ParentButton)
+ self.ParentButton)
self.InstanceChoice = wx.ComboBox(self, size=wx.Size(0, 0), style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnInstanceChoiceChanged,
- self.InstanceChoice)
-
- self.DebugButton = wx.lib.buttons.GenBitmapButton(self,
- bitmap=GetBitmap("debug_instance"), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ self.InstanceChoice)
+
+ self.DebugButton = wx.lib.buttons.GenBitmapButton(
+ self, bitmap=GetBitmap("debug_instance"), size=wx.Size(28, 28), style=wx.NO_BORDER)
self.DebugButton.SetToolTipString(_("Debug instance"))
self.Bind(wx.EVT_BUTTON, self.OnDebugButtonClick,
- self.DebugButton)
-
- self.VariablesList = CustomTreeCtrlWithRightImage(self,
- style=wx.SUNKEN_BORDER,
- agwStyle=CT.TR_NO_BUTTONS |
- CT.TR_SINGLE |
- CT.TR_HAS_VARIABLE_ROW_HEIGHT |
- CT.TR_HIDE_ROOT |
- CT.TR_NO_LINES |
- getattr(CT, "TR_ALIGN_WINDOWS_RIGHT", CT.TR_ALIGN_WINDOWS))
+ self.DebugButton)
+
+ self.VariablesList = CustomTreeCtrlWithRightImage(
+ self,
+ style=wx.SUNKEN_BORDER,
+ agwStyle=(CT.TR_NO_BUTTONS |
+ CT.TR_SINGLE |
+ CT.TR_HAS_VARIABLE_ROW_HEIGHT |
+ CT.TR_HIDE_ROOT |
+ CT.TR_NO_LINES |
+ getattr(CT, "TR_ALIGN_WINDOWS_RIGHT", CT.TR_ALIGN_WINDOWS)))
self.VariablesList.SetIndent(0)
self.VariablesList.SetSpacing(5)
self.VariablesList.DoSelectItem = lambda *x, **y: True
self.VariablesList.Bind(CT.EVT_TREE_ITEM_ACTIVATED,
- self.OnVariablesListItemActivated)
+ self.OnVariablesListItemActivated)
self.VariablesList.Bind(wx.EVT_LEFT_DOWN, self.OnVariablesListLeftDown)
self.VariablesList.Bind(wx.EVT_KEY_DOWN, self.OnVariablesListKeyDown)
--- a/controls/ProjectPropertiesPanel.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/ProjectPropertiesPanel.py Fri Aug 18 20:14:38 2017 +0300
@@ -52,7 +52,7 @@
st = wx.StaticText(parent, label=label)
sizer.AddWindow(st, border=10,
- flag=wx.ALIGN_CENTER_VERTICAL | border | wx.LEFT)
+ flag=wx.ALIGN_CENTER_VERTICAL | border | wx.LEFT)
tc = wx.TextCtrl(parent, style=wx.TE_PROCESS_ENTER)
setattr(self, name, tc)
@@ -60,7 +60,7 @@
self.Bind(wx.EVT_TEXT_ENTER, callback, tc)
tc.Bind(wx.EVT_KILL_FOCUS, callback)
sizer.AddWindow(tc, border=10,
- flag=wx.GROW | border | wx.RIGHT)
+ flag=wx.GROW | border | wx.RIGHT)
def __init__(self, parent, controller=None, window=None, enable_required=True):
wx.Notebook.__init__(self, parent)
@@ -77,11 +77,11 @@
self.ProjectPanel.SetSizer(projectpanel_sizer)
self.AddSizerParams(self.ProjectPanel, projectpanel_sizer,
- [("projectName", _('Project Name (required):')),
- ("projectVersion", _('Project Version (optional):')),
- ("productName", _('Product Name (required):')),
- ("productVersion", _('Product Version (required):')),
- ("productRelease", _('Product Release (optional):'))])
+ [("projectName", _('Project Name (required):')),
+ ("projectVersion", _('Project Version (optional):')),
+ ("productName", _('Product Name (required):')),
+ ("productVersion", _('Product Version (required):')),
+ ("productRelease", _('Product Release (optional):'))])
self.AddPage(self.ProjectPanel, _("Project"))
@@ -93,10 +93,10 @@
self.AuthorPanel.SetSizer(authorpanel_sizer)
self.AddSizerParams(self.AuthorPanel, authorpanel_sizer,
- [("companyName", _('Company Name (required):')),
- ("companyURL", _('Company URL (optional):')),
- ("authorName", _('Author Name (optional):')),
- ("organization", _('Organization (optional):'))])
+ [("companyName", _('Company Name (required):')),
+ ("companyURL", _('Company URL (optional):')),
+ ("authorName", _('Author Name (optional):')),
+ ("organization", _('Organization (optional):'))])
self.AddPage(self.AuthorPanel, _("Author"))
@@ -109,23 +109,24 @@
self.GraphicsPanel.SetSizer(graphicpanel_sizer)
pageSize_st = wx.StaticText(self.GraphicsPanel,
- label=_('Page Size (optional):'))
- graphicpanel_sizer.AddWindow(pageSize_st, border=10,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.LEFT | wx.RIGHT)
+ label=_('Page Size (optional):'))
+ graphicpanel_sizer.AddWindow(
+ pageSize_st, border=10,
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.LEFT | wx.RIGHT)
pageSize_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5)
pageSize_sizer.AddGrowableCol(1)
graphicpanel_sizer.AddSizer(pageSize_sizer, border=10,
- flag=wx.GROW | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.LEFT | wx.RIGHT)
for name, label in [('PageWidth', _('Width:')),
('PageHeight', _('Height:'))]:
st = wx.StaticText(self.GraphicsPanel, label=label)
pageSize_sizer.AddWindow(st, border=12,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT)
sp = wx.SpinCtrl(self.GraphicsPanel,
- min=0, max=2**16, style=wx.TE_PROCESS_ENTER)
+ min=0, max=2**16, style=wx.TE_PROCESS_ENTER)
setattr(self, name, sp)
callback = self.GetPageSizeChangedFunction(sp, name)
self.Bind(wx.EVT_TEXT_ENTER, callback, sp)
@@ -133,13 +134,13 @@
pageSize_sizer.AddWindow(sp, flag=wx.GROW)
scaling_st = wx.StaticText(self.GraphicsPanel,
- label=_('Grid Resolution:'))
+ label=_('Grid Resolution:'))
graphicpanel_sizer.AddWindow(scaling_st, border=10,
- flag=wx.GROW | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.LEFT | wx.RIGHT)
scaling_nb = wx.Notebook(self.GraphicsPanel)
graphicpanel_sizer.AddWindow(scaling_nb, border=10,
- flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.Scalings = {}
for language, translation in [("FBD", _("FBD")), ("LD", _("LD")), ("SFC", _("SFC"))]:
@@ -157,17 +158,18 @@
border = wx.BOTTOM
st = wx.StaticText(scaling_panel, label=label)
- scalingpanel_sizer.AddWindow(st, border=10,
- flag=wx.ALIGN_CENTER_VERTICAL | border | wx.LEFT)
+ scalingpanel_sizer.AddWindow(
+ st, border=10,
+ flag=wx.ALIGN_CENTER_VERTICAL | border | wx.LEFT)
sp = wx.SpinCtrl(scaling_panel,
- min=0, max=2**16, style=wx.TE_PROCESS_ENTER)
+ min=0, max=2**16, style=wx.TE_PROCESS_ENTER)
scaling_controls.append(sp)
callback = self.GetScalingChangedFunction(sp, language, name)
self.Bind(wx.EVT_TEXT_ENTER, callback, sp)
sp.Bind(wx.EVT_KILL_FOCUS, callback)
scalingpanel_sizer.AddWindow(sp, border=10,
- flag=wx.GROW | border | wx.RIGHT)
+ flag=wx.GROW | border | wx.RIGHT)
self.Scalings[language] = scaling_controls
scaling_nb.AddPage(scaling_panel, translation)
@@ -176,38 +178,39 @@
# Miscellaneous Panel elements
- self.MiscellaneousPanel = wx.Panel(id=-1, parent=self,
- name='MiscellaneousPanel', pos=wx.Point(0, 0),
- size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+ self.MiscellaneousPanel = wx.Panel(
+ id=-1, parent=self, name='MiscellaneousPanel', pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
miscellaneouspanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=15)
miscellaneouspanel_sizer.AddGrowableCol(1)
miscellaneouspanel_sizer.AddGrowableRow(1)
self.MiscellaneousPanel.SetSizer(miscellaneouspanel_sizer)
language_label = wx.StaticText(self.MiscellaneousPanel,
- label=_('Language (optional):'))
+ label=_('Language (optional):'))
miscellaneouspanel_sizer.AddWindow(language_label, border=10,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.LEFT)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.LEFT)
self.Language = wx.ComboBox(self.MiscellaneousPanel,
- style=wx.CB_READONLY)
+ style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnLanguageChanged, self.Language)
miscellaneouspanel_sizer.AddWindow(self.Language, border=10,
- flag=wx.GROW | wx.TOP | wx.RIGHT)
-
- description_label = wx.StaticText(self.MiscellaneousPanel,
- label=_('Content Description (optional):'))
+ flag=wx.GROW | wx.TOP | wx.RIGHT)
+
+ description_label = wx.StaticText(
+ self.MiscellaneousPanel, label=_('Content Description (optional):'))
miscellaneouspanel_sizer.AddWindow(description_label, border=10,
- flag=wx.BOTTOM | wx.LEFT)
-
- self.ContentDescription = wx.TextCtrl(self.MiscellaneousPanel,
- size=wx.Size(240, 150), style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER)
+ flag=wx.BOTTOM | wx.LEFT)
+
+ self.ContentDescription = wx.TextCtrl(
+ self.MiscellaneousPanel, size=wx.Size(240, 150),
+ style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER)
self.Bind(wx.EVT_TEXT_ENTER, self.OnContentDescriptionChanged,
- self.ContentDescription)
+ self.ContentDescription)
self.ContentDescription.Bind(wx.EVT_KILL_FOCUS,
- self.OnContentDescriptionChanged)
+ self.OnContentDescriptionChanged)
miscellaneouspanel_sizer.AddWindow(self.ContentDescription, border=10,
- flag=wx.GROW | wx.BOTTOM | wx.RIGHT)
+ flag=wx.GROW | wx.BOTTOM | wx.RIGHT)
self.AddPage(self.MiscellaneousPanel, _("Miscellaneous"))
@@ -282,7 +285,7 @@
if old_value != new_value:
self.Controller.SetProjectProperties(properties={name: new_value})
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU,
- PROJECTTREE, PAGETITLES)
+ PROJECTTREE, PAGETITLES)
wx.CallAfter(self.RefreshView)
event.Skip()
return TextCtrlChangedFunction
@@ -301,7 +304,7 @@
if old_value != new_value:
self.Controller.SetProjectProperties(properties={"pageSize": new_value})
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU,
- PAGETITLES, SCALING)
+ PAGETITLES, SCALING)
wx.CallAfter(self.RefreshView)
event.Skip()
return PageSizeChangedFunction
@@ -321,7 +324,7 @@
if old_value != new_value:
self.Controller.SetProjectProperties(properties={"scaling": {language: new_value}})
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU,
- PAGETITLES, SCALING)
+ PAGETITLES, SCALING)
wx.CallAfter(self.RefreshView)
event.Skip()
return ScalingChangedFunction
--- a/controls/SearchResultPanel.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/SearchResultPanel.py Fri Aug 18 20:14:38 2017 +0300
@@ -87,24 +87,25 @@
def _init_ctrls(self, prnt):
wx.Panel.__init__(self, id=ID_SEARCHRESULTPANEL,
- name='SearchResultPanel', parent=prnt, pos=wx.Point(0, 0),
- size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+ name='SearchResultPanel', parent=prnt, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
self.HeaderLabel = wx.StaticText(id=ID_SEARCHRESULTPANELHEADERLABEL,
- name='HeaderLabel', parent=self,
- pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
+ name='HeaderLabel', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
search_results_tree_style = CT.TR_HAS_BUTTONS | CT.TR_NO_LINES | CT.TR_HAS_VARIABLE_ROW_HEIGHT
self.SearchResultsTree = CT.CustomTreeCtrl(id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE,
- name="SearchResultsTree", parent=self,
- pos=wx.Point(0, 0), style=search_results_tree_style)
+ name="SearchResultsTree", parent=self,
+ pos=wx.Point(0, 0), style=search_results_tree_style)
if wx.VERSION >= (2, 8, 11):
self.SearchResultsTree.SetAGWWindowStyleFlag(search_results_tree_style)
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnSearchResultsTreeItemActivated,
- id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE)
-
- self.ResetButton = wx.lib.buttons.GenBitmapButton(self,
- bitmap=GetBitmap("reset"), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE)
+
+ self.ResetButton = wx.lib.buttons.GenBitmapButton(
+ self, bitmap=GetBitmap("reset"),
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
self.ResetButton.SetToolTipString(_("Reset search result"))
self.Bind(wx.EVT_BUTTON, self.OnResetButton, self.ResetButton)
@@ -300,7 +301,7 @@
if wx.Platform != '__WXMSW__' or len(text.splitlines()) > 1:
text_ctrl_style |= wx.TE_MULTILINE
text_ctrl = wx.TextCtrl(id=-1, parent=self.SearchResultsTree, pos=wx.Point(0, 0),
- value=text, style=text_ctrl_style)
+ value=text, style=text_ctrl_style)
width, height = text_ctrl.GetTextExtent(text)
text_ctrl.SetClientSize(wx.Size(width + 1, height))
text_ctrl.SetBackgroundColour(self.SearchResultsTree.GetBackgroundColour())
--- a/controls/VariablePanel.py Fri Aug 18 12:36:31 2017 +0300
+++ b/controls/VariablePanel.py Fri Aug 18 20:14:38 2017 +0300
@@ -295,10 +295,12 @@
message = _("Incompatible size of data between \"{a1}\" and \"{a2}\"").\
format(a1=location, a2=variable_type)
else:
- dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
- _("Select a variable class:"), _("Variable class"),
- [_("Input"), _("Output"), _("Memory")],
- wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
+ dialog = wx.SingleChoiceDialog(
+ self.ParentWindow.ParentWindow.ParentWindow,
+ _("Select a variable class:"),
+ _("Variable class"),
+ [_("Input"), _("Output"), _("Memory")],
+ wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetSelection()
else:
@@ -341,12 +343,14 @@
dlg.Destroy()
if var_name is None:
return
- elif var_name.upper() in [name.upper()
- for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
+ elif var_name.upper() in [
+ name.upper() for name in
+ self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
message = _("\"%s\" pou already exists!") % var_name
- elif not var_name.upper() in [name.upper()
+ elif not var_name.upper() in [
+ name.upper()
for name in self.ParentWindow.Controler.
- GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
+ GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
var_infos = self.ParentWindow.DefaultValue.copy()
var_infos.Name = var_name
var_infos.Type = values[2]
@@ -354,10 +358,12 @@
if values[1] == "location":
location = values[0]
if not location.startswith("%"):
- dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
- _("Select a variable class:"), _("Variable class"),
- [_("Input"), _("Output"), _("Memory")],
- wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
+ dialog = wx.SingleChoiceDialog(
+ self.ParentWindow.ParentWindow.ParentWindow,
+ _("Select a variable class:"),
+ _("Variable class"),
+ [_("Input"), _("Output"), _("Memory")],
+ wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetSelection()
else:
@@ -376,8 +382,9 @@
self.ParentWindow.Debug)
if len(configs) == 0:
return
- if not var_name.upper() in [name.upper()
- for name in self.ParentWindow.Controler.GetConfigurationVariableNames(configs[0])]:
+ if not var_name.upper() in [
+ name.upper() for name in
+ self.ParentWindow.Controler.GetConfigurationVariableNames(configs[0])]:
self.ParentWindow.Controler.AddConfigurationGlobalVar(
configs[0], values[2], var_name, location, "")
var_infos.Class = "External"
@@ -433,7 +440,7 @@
controls_sizer.AddWindow(self.ReturnTypeLabel, flag=wx.ALIGN_CENTER_VERTICAL)
self.ReturnType = wx.ComboBox(self,
- size=wx.Size(145, -1), style=wx.CB_READONLY)
+ size=wx.Size(145, -1), style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnReturnTypeChanged, self.ReturnType)
controls_sizer.AddWindow(self.ReturnType)
@@ -441,7 +448,7 @@
controls_sizer.AddWindow(self.DescriptionLabel, flag=wx.ALIGN_CENTER_VERTICAL)
self.Description = wx.TextCtrl(self,
- size=wx.Size(250, -1), style=wx.TE_PROCESS_ENTER)
+ size=wx.Size(250, -1), style=wx.TE_PROCESS_ENTER)
self.Bind(wx.EVT_TEXT_ENTER, self.OnDescriptionChanged, self.Description)
self.Description.Bind(wx.EVT_KILL_FOCUS, self.OnDescriptionChanged)
controls_sizer.AddWindow(self.Description)
@@ -450,7 +457,7 @@
controls_sizer.AddWindow(class_filter_label, flag=wx.ALIGN_CENTER_VERTICAL)
self.ClassFilter = wx.ComboBox(self,
- size=wx.Size(145, -1), style=wx.CB_READONLY)
+ size=wx.Size(145, -1), style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnClassFilter, self.ClassFilter)
controls_sizer.AddWindow(self.ClassFilter)
@@ -460,7 +467,7 @@
("UpButton", "up", _("Move variable up")),
("DownButton", "down", _("Move variable down"))]:
button = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap(bitmap),
- size=wx.Size(28, 28), style=wx.NO_BORDER)
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
button.SetToolTipString(help)
setattr(self, name, button)
controls_sizer.AddWindow(button)
@@ -468,11 +475,11 @@
self.VariablesGrid = CustomGrid(self, style=wx.VSCROLL | wx.HSCROLL)
self.VariablesGrid.SetDropTarget(VariableDropTarget(self))
self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
- self.OnVariablesGridCellChange)
+ self.OnVariablesGridCellChange)
self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK,
- self.OnVariablesGridCellLeftClick)
+ self.OnVariablesGridCellLeftClick)
self.VariablesGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN,
- self.OnVariablesGridEditorShown)
+ self.OnVariablesGridEditorShown)
self.MainSizer.AddWindow(self.VariablesGrid, flag=wx.GROW)
self.SetSizer(self.MainSizer)
@@ -484,7 +491,7 @@
self.RefreshHighlightsTimer = wx.Timer(self, -1)
self.Bind(wx.EVT_TIMER, self.OnRefreshHighlightsTimer,
- self.RefreshHighlightsTimer)
+ self.RefreshHighlightsTimer)
self.Filter = "All"
self.FilterChoices = []
--- a/dialogs/ActionBlockDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/ActionBlockDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -132,7 +132,7 @@
top_sizer.AddGrowableCol(0)
top_sizer.AddGrowableRow(0)
main_sizer.AddSizer(top_sizer, border=20,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
actions_label = wx.StaticText(self, label=_('Actions:'))
top_sizer.AddWindow(actions_label, flag=wx.ALIGN_BOTTOM)
@@ -142,8 +142,9 @@
("DeleteButton", "remove_element", _("Remove action")),
("UpButton", "up", _("Move action up")),
("DownButton", "down", _("Move action down"))]:
- button = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap(bitmap),
- size=wx.Size(28, 28), style=wx.NO_BORDER)
+ button = wx.lib.buttons.GenBitmapButton(
+ self, bitmap=GetBitmap(bitmap),
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
button.SetToolTipString(help)
setattr(self, name, button)
top_sizer.AddWindow(button)
@@ -154,12 +155,12 @@
self.ActionsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
self.OnActionsGridCellChange)
main_sizer.AddSizer(self.ActionsGrid, border=20,
- flag=wx.GROW | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.LEFT | wx.RIGHT)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
main_sizer.AddSizer(button_sizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.SetSizer(main_sizer)
--- a/dialogs/ArrayTypeDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/ArrayTypeDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -50,7 +50,7 @@
top_sizer = wx.BoxSizer(wx.HORIZONTAL)
main_sizer.AddSizer(top_sizer, border=20,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
basetype_label = wx.StaticText(self, label=_('Base Type:'))
top_sizer.AddWindow(basetype_label, 1, flag=wx.ALIGN_BOTTOM)
@@ -59,9 +59,9 @@
top_sizer.AddWindow(self.BaseType, 1, flag=wx.GROW)
self.Dimensions = CustomEditableListBox(self, label=_("Dimensions:"),
- style=wx.gizmos.EL_ALLOW_NEW |
- wx.gizmos.EL_ALLOW_EDIT |
- wx.gizmos.EL_ALLOW_DELETE)
+ style=(wx.gizmos.EL_ALLOW_NEW |
+ wx.gizmos.EL_ALLOW_EDIT |
+ wx.gizmos.EL_ALLOW_DELETE))
for func in ["_OnLabelEndEdit",
"_OnAddButton",
"_OnDelButton",
@@ -69,12 +69,12 @@
"_OnDownButton"]:
setattr(self.Dimensions, func, self.OnDimensionsChanged)
main_sizer.AddSizer(self.Dimensions, border=20,
- flag=wx.GROW | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.LEFT | wx.RIGHT)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
main_sizer.AddSizer(button_sizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.SetSizer(main_sizer)
--- a/dialogs/BlockPreviewDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/BlockPreviewDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -118,7 +118,7 @@
# Create a sizer for dividing parameters in two columns
self.ColumnSizer = wx.BoxSizer(wx.HORIZONTAL)
self.MainSizer.AddSizer(self.ColumnSizer, border=20,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
# Create a sizer for left column
self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0,
@@ -127,7 +127,7 @@
if left_growable_row is not None:
self.LeftGridSizer.AddGrowableRow(left_growable_row)
self.ColumnSizer.AddSizer(self.LeftGridSizer, 1, border=5,
- flag=wx.GROW | wx.RIGHT | wx.EXPAND)
+ flag=wx.GROW | wx.RIGHT | wx.EXPAND)
# Create a sizer for right column
self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0,
@@ -136,7 +136,7 @@
if right_growable_row is not None:
self.RightGridSizer.AddGrowableRow(right_growable_row)
self.ColumnSizer.AddSizer(self.RightGridSizer, 1, border=5,
- flag=wx.GROW | wx.LEFT)
+ flag=wx.GROW | wx.LEFT)
self.SetSizer(self.MainSizer)
@@ -281,7 +281,7 @@
# calculate preview panel scale so that graphic element fit inside
k = 1.1 if (bbox.width * 1.1 > client_size.width or
bbox.height * 1.1 > client_size.height) \
- else 1.0
+ else 1.0
scale = (max(float(bbox.width) / client_size.width,
float(bbox.height) / client_size.height) * k)
dc.SetUserScale(1.0 / scale, 1.0 / scale)
--- a/dialogs/BrowseLocationsDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/BrowseLocationsDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -70,7 +70,7 @@
def __init__(self, parent, var_type, controller):
wx.Dialog.__init__(self, parent, title=_('Browse Locations'),
- style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
+ style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
main_sizer.AddGrowableCol(0)
@@ -78,40 +78,44 @@
locations_label = wx.StaticText(self, label=_('Locations available:'))
main_sizer.AddWindow(locations_label, border=20,
- flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)
+ flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)
self.LocationsTree = wx.TreeCtrl(self,
- style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)
+ style=(wx.TR_HAS_BUTTONS |
+ wx.TR_SINGLE |
+ wx.SUNKEN_BORDER |
+ wx.TR_HIDE_ROOT |
+ wx.TR_LINES_AT_ROOT))
self.LocationsTree.SetInitialSize(wx.Size(-1, 300))
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnLocationsTreeItemActivated,
self.LocationsTree)
main_sizer.AddWindow(self.LocationsTree, border=20,
- flag=wx.LEFT | wx.RIGHT | wx.GROW)
+ flag=wx.LEFT | wx.RIGHT | wx.GROW)
button_gridsizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
button_gridsizer.AddGrowableCol(1)
button_gridsizer.AddGrowableCol(3)
button_gridsizer.AddGrowableRow(0)
main_sizer.AddSizer(button_gridsizer, border=20,
- flag=wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.GROW)
+ flag=wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.GROW)
direction_label = wx.StaticText(self, label=_('Direction:'))
button_gridsizer.AddWindow(direction_label,
- flag=wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.ALIGN_CENTER_VERTICAL)
self.DirFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.DirFilterChoice)
button_gridsizer.AddWindow(self.DirFilterChoice,
- flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
filter_label = wx.StaticText(self, label=_('Type:'))
button_gridsizer.AddWindow(filter_label,
- flag=wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.ALIGN_CENTER_VERTICAL)
self.TypeFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.TypeFilterChoice)
button_gridsizer.AddWindow(self.TypeFilterChoice,
- flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
--- a/dialogs/BrowseValuesLibraryDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/BrowseValuesLibraryDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -33,9 +33,9 @@
def __init__(self, parent, name, library, default=None):
wx.Dialog.__init__(self,
- name='BrowseValueDialog', parent=parent,
- style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
- title=_('Browse %s values library') % name)
+ name='BrowseValueDialog', parent=parent,
+ style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
+ title=_('Browse %s values library') % name)
self.staticText1 = wx.StaticText(
label=_('Choose a value for %s:') % name, name='staticText1', parent=self,
--- a/dialogs/ConnectionDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/ConnectionDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -50,7 +50,7 @@
to all connector having the same name in POU (default: False)
"""
BlockPreviewDialog.__init__(self, parent, controller, tagname,
- title=_('Connection Properties'))
+ title=_('Connection Properties'))
# Init common sizers
self._init_sizers(2, 0, 7, 1, 0, None)
@@ -65,7 +65,7 @@
for type, label in [(CONNECTOR, _('Connector')),
(CONTINUATION, _('Continuation'))]:
radio_button = wx.RadioButton(self, label=label,
- style=(wx.RB_GROUP if first else 0))
+ style=(wx.RB_GROUP if first else 0))
radio_button.SetValue(first)
self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button)
self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW)
@@ -88,8 +88,9 @@
self.LeftGridSizer.AddWindow(self.Preview, flag=wx.GROW)
# Add buttons sizer to sizers
- self.MainSizer.AddSizer(self.ButtonSizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ self.MainSizer.AddSizer(
+ self.ButtonSizer, border=20,
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.ColumnSizer.RemoveSizer(self.RightGridSizer)
# Add button for applying connection name modification to all connection
@@ -214,8 +215,8 @@
"""
# Set graphic element displayed, creating a FBD connection element
self.Element = FBD_Connector(self.Preview,
- self.GetConnectionType(),
- self.ConnectionName.GetValue())
+ self.GetConnectionType(),
+ self.ConnectionName.GetValue())
# Call BlockPreviewDialog function
BlockPreviewDialog.RefreshPreview(self)
--- a/dialogs/DiscoveryDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/DiscoveryDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -80,18 +80,21 @@
self.SetSizer(self.MainSizer)
def _init_ctrls(self, prnt):
- wx.Dialog.__init__(self, id=ID_DISCOVERYDIALOG,
- name='DiscoveryDialog', parent=prnt, style=wx.DEFAULT_DIALOG_STYLE,
- title=_('Service Discovery'))
-
- self.staticText1 = wx.StaticText(id=ID_DISCOVERYDIALOGSTATICTEXT1,
- label=_('Services available:'), name='staticText1', parent=self,
- pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+ wx.Dialog.__init__(
+ self, id=ID_DISCOVERYDIALOG,
+ name='DiscoveryDialog', parent=prnt, style=wx.DEFAULT_DIALOG_STYLE,
+ title=_('Service Discovery'))
+
+ self.staticText1 = wx.StaticText(
+ id=ID_DISCOVERYDIALOGSTATICTEXT1,
+ label=_('Services available:'), name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
# Set up list control
- self.ServicesList = AutoWidthListCtrl(id=ID_DISCOVERYDIALOGSERVICESLIST,
- name='ServicesList', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0),
- style=wx.LC_REPORT | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING | wx.LC_SINGLE_SEL)
+ self.ServicesList = AutoWidthListCtrl(
+ id=ID_DISCOVERYDIALOGSERVICESLIST,
+ name='ServicesList', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0),
+ style=wx.LC_REPORT | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING | wx.LC_SINGLE_SEL)
self.ServicesList.InsertColumn(0, _('NAME'))
self.ServicesList.InsertColumn(1, _('TYPE'))
self.ServicesList.InsertColumn(2, _('IP'))
@@ -106,19 +109,22 @@
listmix.ColumnSorterMixin.__init__(self, 4)
- self.RefreshButton = wx.Button(id=ID_DISCOVERYDIALOGREFRESHBUTTON,
- label=_('Refresh'), name='RefreshButton', parent=self,
- pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+ self.RefreshButton = wx.Button(
+ id=ID_DISCOVERYDIALOGREFRESHBUTTON,
+ label=_('Refresh'), name='RefreshButton', parent=self,
+ pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
self.Bind(wx.EVT_BUTTON, self.OnRefreshButton, id=ID_DISCOVERYDIALOGREFRESHBUTTON)
- self.LocalButton = wx.Button(id=ID_DISCOVERYDIALOGLOCALBUTTON,
- label=_('Local'), name='LocalButton', parent=self,
- pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+ self.LocalButton = wx.Button(
+ id=ID_DISCOVERYDIALOGLOCALBUTTON,
+ label=_('Local'), name='LocalButton', parent=self,
+ pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
self.Bind(wx.EVT_BUTTON, self.OnLocalButton, id=ID_DISCOVERYDIALOGLOCALBUTTON)
- self.IpButton = wx.Button(id=ID_DISCOVERYDIALOGIPBUTTON,
- label=_('Add IP'), name='IpButton', parent=self,
- pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+ self.IpButton = wx.Button(
+ id=ID_DISCOVERYDIALOGIPBUTTON,
+ label=_('Add IP'), name='IpButton', parent=self,
+ pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
self.Bind(wx.EVT_BUTTON, self.OnIpButton, id=ID_DISCOVERYDIALOGIPBUTTON)
self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTER)
--- a/dialogs/DurationEditorDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/DurationEditorDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -65,7 +65,7 @@
controls_sizer = wx.FlexGridSizer(cols=len(CONTROLS), hgap=10, rows=2, vgap=10)
main_sizer.AddSizer(controls_sizer, border=20,
- flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)
+ flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)
controls = []
for i, (name, label) in enumerate(CONTROLS):
@@ -89,7 +89,7 @@
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
main_sizer.AddSizer(button_sizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.SetSizer(main_sizer)
self.Fit()
@@ -136,10 +136,10 @@
not_null = False
duration = "T#"
- for value, format in [(int(milliseconds) / DAY, "%dd"),
- ((int(milliseconds) % DAY) / HOUR, "%dh"),
- ((int(milliseconds) % HOUR) / MINUTE, "%dm"),
- ((int(milliseconds) % MINUTE) / SECOND, "%ds")]:
+ for value, format in [((int(milliseconds) / DAY), "%dd"),
+ ((int(milliseconds) % DAY) / HOUR, "%dh"),
+ ((int(milliseconds) % HOUR) / MINUTE, "%dm"),
+ ((int(milliseconds) % MINUTE) / SECOND, "%ds")]:
if value > 0 or not_null:
duration += format % value
--- a/dialogs/FBDBlockDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/FBDBlockDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -58,7 +58,7 @@
@param tagname: Tagname of project POU edited
"""
BlockPreviewDialog.__init__(self, parent, controller, tagname,
- title=_('Block Properties'))
+ title=_('Block Properties'))
# Init common sizers
self._init_sizers(2, 0, 1, 0, 3, 2)
@@ -74,9 +74,9 @@
# Set function to call when selection in Library panel changed
setattr(self.LibraryPanel, "_OnTreeItemSelected",
- self.OnLibraryTreeItemSelected)
+ self.OnLibraryTreeItemSelected)
left_staticboxsizer.AddWindow(self.LibraryPanel, 1, border=5,
- flag=wx.GROW | wx.TOP)
+ flag=wx.GROW | wx.TOP)
# Create sizer for other block parameters
top_right_gridsizer = wx.FlexGridSizer(cols=2, hgap=0, rows=4, vgap=5)
@@ -86,7 +86,7 @@
# Create label for block name
name_label = wx.StaticText(self, label=_('Name:'))
top_right_gridsizer.AddWindow(name_label,
- flag=wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.ALIGN_CENTER_VERTICAL)
# Create text control for defining block name
self.BlockName = wx.TextCtrl(self)
@@ -96,19 +96,19 @@
# Create label for extended block input number
inputs_label = wx.StaticText(self, label=_('Inputs:'))
top_right_gridsizer.AddWindow(inputs_label,
- flag=wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.ALIGN_CENTER_VERTICAL)
# Create spin control for defining extended block input number
self.Inputs = wx.SpinCtrl(self, min=2, max=20,
- style=wx.SP_ARROW_KEYS)
+ style=wx.SP_ARROW_KEYS)
self.Bind(wx.EVT_SPINCTRL, self.OnInputsChanged, self.Inputs)
top_right_gridsizer.AddWindow(self.Inputs, flag=wx.GROW)
# Create label for block execution order
execution_order_label = wx.StaticText(self,
- label=_('Execution Order:'))
+ label=_('Execution Order:'))
top_right_gridsizer.AddWindow(execution_order_label,
- flag=wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.ALIGN_CENTER_VERTICAL)
# Create spin control for defining block execution order
self.ExecutionOrder = wx.SpinCtrl(self, min=0, style=wx.SP_ARROW_KEYS)
@@ -118,9 +118,9 @@
# Create label for block execution control
execution_control_label = wx.StaticText(self,
- label=_('Execution Control:'))
+ label=_('Execution Control:'))
top_right_gridsizer.AddWindow(execution_control_label,
- flag=wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.ALIGN_CENTER_VERTICAL)
# Create check box to enable block execution control
self.ExecutionControl = wx.CheckBox(self)
@@ -134,7 +134,7 @@
# Add buttons sizer to sizers
self.MainSizer.AddSizer(self.ButtonSizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
# Dictionary containing correspondence between parameter exchanged and
# control to fill with parameter value
@@ -340,14 +340,13 @@
# If a block type is selected in library panel
if values is not None:
# Set graphic element displayed, creating a FBD block element
- self.Element = FBD_Block(self.Preview, values["type"],
- (self.BlockName.GetValue()
- if self.BlockName.IsEnabled()
- else ""),
- extension=self.Inputs.GetValue(),
- inputs=values["inputs"],
- executionControl=self.ExecutionControl.GetValue(),
- executionOrder=self.ExecutionOrder.GetValue())
+ self.Element = FBD_Block(
+ self.Preview, values["type"],
+ (self.BlockName.GetValue() if self.BlockName.IsEnabled() else ""),
+ extension=self.Inputs.GetValue(),
+ inputs=values["inputs"],
+ executionControl=self.ExecutionControl.GetValue(),
+ executionOrder=self.ExecutionOrder.GetValue())
# Reset graphic element displayed
else:
--- a/dialogs/FBDVariableDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/FBDVariableDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -64,7 +64,7 @@
@param exclude_input: Exclude input from variable class selection
"""
BlockPreviewDialog.__init__(self, parent, controller, tagname,
- title=_('Variable Properties'))
+ title=_('Variable Properties'))
# Init common sizers
self._init_sizers(4, 2, 4, None, 3, 2)
@@ -80,7 +80,7 @@
# Create label for variable execution order
execution_order_label = wx.StaticText(self,
- label=_('Execution Order:'))
+ label=_('Execution Order:'))
self.LeftGridSizer.AddWindow(execution_order_label, flag=wx.GROW)
# Create spin control for defining variable execution order
@@ -92,7 +92,7 @@
# Create label for variable expression
name_label = wx.StaticText(self, label=_('Expression:'))
self.RightGridSizer.AddWindow(name_label, border=5,
- flag=wx.GROW | wx.BOTTOM)
+ flag=wx.GROW | wx.BOTTOM)
# Create text control for defining variable expression
self.Expression = wx.TextCtrl(self)
@@ -102,19 +102,20 @@
# Create a list box to selected variable expression in the list of
# variables defined in POU
self.VariableName = wx.ListBox(self, size=wx.Size(-1, 120),
- style=wx.LB_SINGLE | wx.LB_SORT)
+ style=wx.LB_SINGLE | wx.LB_SORT)
self.Bind(wx.EVT_LISTBOX, self.OnNameChanged, self.VariableName)
self.RightGridSizer.AddWindow(self.VariableName, border=4, flag=wx.GROW | wx.TOP)
# Add preview panel and associated label to sizers
self.MainSizer.AddWindow(self.PreviewLabel, border=20,
- flag=wx.GROW | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.LEFT | wx.RIGHT)
self.MainSizer.AddWindow(self.Preview, border=20,
- flag=wx.GROW | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.LEFT | wx.RIGHT)
# Add buttons sizer to sizers
- self.MainSizer.AddSizer(self.ButtonSizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ self.MainSizer.AddSizer(
+ self.ButtonSizer, border=20,
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
# Set options that can be selected in class combo box
for var_class, choice in VARIABLE_CLASSES_DICT.iteritems():
@@ -284,12 +285,12 @@
name = self.Expression.GetValue()
# Set graphic element displayed, creating a FBD variable element
- self.Element = FBD_Variable(self.Preview,
- VARIABLE_CLASSES_DICT_REVERSE[
- self.Class.GetStringSelection()],
- name,
- self.VariableList.get(name, ("", ""))[1],
- executionOrder=self.ExecutionOrder.GetValue())
+ self.Element = FBD_Variable(
+ self.Preview,
+ VARIABLE_CLASSES_DICT_REVERSE[self.Class.GetStringSelection()],
+ name,
+ self.VariableList.get(name, ("", ""))[1],
+ executionOrder=self.ExecutionOrder.GetValue())
# Call BlockPreviewDialog function
BlockPreviewDialog.RefreshPreview(self)
--- a/dialogs/FindInPouDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/FindInPouDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -34,8 +34,9 @@
self.SetIcon(parent.icon)
def __init__(self, parent):
- wx.Dialog.__init__(self, parent, title=_("Find"),
- style=wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN | wx.RESIZE_BORDER)
+ wx.Dialog.__init__(
+ self, parent, title=_("Find"),
+ style=wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN | wx.RESIZE_BORDER)
self._init_icon(parent)
panel = wx.Panel(self, style=wx.TAB_TRAVERSAL)
@@ -46,7 +47,7 @@
controls_sizer = wx.BoxSizer(wx.VERTICAL)
main_sizer.AddSizer(controls_sizer, border=20,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
patterns_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=1, vgap=5)
patterns_sizer.AddGrowableCol(1)
@@ -67,16 +68,16 @@
direction_staticboxsizer = wx.StaticBoxSizer(
direction_staticbox, wx.VERTICAL)
params_sizer.AddSizer(direction_staticboxsizer, 1, border=5,
- flag=wx.GROW | wx.RIGHT)
+ flag=wx.GROW | wx.RIGHT)
self.Forward = wx.RadioButton(panel, label=_("Forward"),
- style=wx.RB_GROUP)
+ style=wx.RB_GROUP)
direction_staticboxsizer.AddWindow(self.Forward, border=5,
- flag=wx.ALL | wx.GROW)
+ flag=wx.ALL | wx.GROW)
self.Backward = wx.RadioButton(panel, label=_("Backward"))
direction_staticboxsizer.AddWindow(self.Backward, border=5,
- flag=wx.ALL | wx.GROW)
+ flag=wx.ALL | wx.GROW)
options_staticbox = wx.StaticBox(panel, label=_("Options"))
options_staticboxsizer = wx.StaticBoxSizer(
@@ -86,20 +87,20 @@
self.CaseSensitive = wx.CheckBox(panel, label=_("Case sensitive"))
self.CaseSensitive.SetValue(True)
options_staticboxsizer.AddWindow(self.CaseSensitive, border=5,
- flag=wx.ALL | wx.GROW)
+ flag=wx.ALL | wx.GROW)
self.WrapSearch = wx.CheckBox(panel, label=_("Wrap search"))
self.WrapSearch.SetValue(True)
options_staticboxsizer.AddWindow(self.WrapSearch, border=5,
- flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.GROW)
+ flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.GROW)
self.RegularExpressions = wx.CheckBox(panel, label=_("Regular expressions"))
options_staticboxsizer.AddWindow(self.RegularExpressions, border=5,
- flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.GROW)
+ flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.GROW)
buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
main_sizer.AddSizer(buttons_sizer, border=20,
- flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_RIGHT)
+ flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_RIGHT)
self.FindButton = wx.Button(panel, label=_("Find"))
self.FindButton.SetDefault()
@@ -177,6 +178,6 @@
self.SetStatusText(message)
if len(self.criteria) > 0:
wx.CallAfter(self.ParentWindow.FindInPou,
- {True: 1, False: -1}[self.Forward.GetValue()],
- self.criteria)
+ {True: 1, False: -1}[self.Forward.GetValue()],
+ self.criteria)
event.Skip()
--- a/dialogs/ForceVariableDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/ForceVariableDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -169,14 +169,18 @@
class ForceVariableDialog(wx.TextEntryDialog):
def __init__(self, parent, iec_type, defaultValue=""):
- wx.TextEntryDialog.__init__(self, parent, message=_("Forcing Variable Value"),
- caption=_("Please enter value for a \"%s\" variable:") % iec_type, defaultValue=defaultValue,
- style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition)
+ wx.TextEntryDialog.__init__(
+ self, parent,
+ message=_("Forcing Variable Value"),
+ caption=_("Please enter value for a \"%s\" variable:") % iec_type,
+ defaultValue=defaultValue,
+ style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition)
self.IEC_Type = iec_type
self.Bind(wx.EVT_BUTTON, self.OnOK,
- self.GetSizer().GetItem(2).GetSizer().GetItem(1).GetSizer().GetAffirmativeButton())
+ self.GetSizer().GetItem(2).GetSizer().GetItem(1).
+ GetSizer().GetAffirmativeButton())
self.ValueTextCtrl = self.GetSizer().GetItem(1).GetWindow()
if self.IEC_Type == "BOOL":
self.ToggleButton = wx.ToggleButton(self, label=_("Toggle value"))
--- a/dialogs/LDElementDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/LDElementDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -51,18 +51,18 @@
@param type: Type of LD element ('contact or 'coil')
"""
BlockPreviewDialog.__init__(self, parent, controller, tagname,
- title=(_("Edit Contact Values")
- if type == "contact"
- else _("Edit Coil Values")))
+ title=(_("Edit Contact Values")
+ if type == "contact"
+ else _("Edit Coil Values")))
# Init common sizers
- self._init_sizers(2, 0,
- (7 if type == "contact" else 9), None, 2, 1)
+ self._init_sizers(2, 0, (7 if type == "contact" else 9),
+ None, 2, 1)
# Create label for LD element modifier
modifier_label = wx.StaticText(self, label=_('Modifier:'))
self.LeftGridSizer.AddWindow(modifier_label, border=5,
- flag=wx.GROW | wx.BOTTOM)
+ flag=wx.GROW | wx.BOTTOM)
# Create radio buttons for selecting LD element modifier
self.ModifierRadioButtons = {}
@@ -79,7 +79,7 @@
for modifier, label in zip(element_modifiers, modifiers_label):
radio_button = wx.RadioButton(self, label=label,
- style=(wx.RB_GROUP if first else 0))
+ style=(wx.RB_GROUP if first else 0))
radio_button.SetValue(first)
self.Bind(wx.EVT_RADIOBUTTON, self.OnModifierChanged, radio_button)
self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW)
@@ -89,7 +89,7 @@
# Create label for LD element variable
element_variable_label = wx.StaticText(self, label=_('Variable:'))
self.LeftGridSizer.AddWindow(element_variable_label, border=5,
- flag=wx.GROW | wx.TOP)
+ flag=wx.GROW | wx.TOP)
# Create a combo box for defining LD element variable
self.ElementVariable = wx.ComboBox(self, style=wx.CB_SORT)
@@ -98,7 +98,7 @@
self.Bind(wx.EVT_TEXT, self.OnVariableChanged,
self.ElementVariable)
self.LeftGridSizer.AddWindow(self.ElementVariable, border=5,
- flag=wx.GROW | wx.TOP)
+ flag=wx.GROW | wx.TOP)
# Add preview panel and associated label to sizers
self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
@@ -106,7 +106,7 @@
# Add buttons sizer to sizers
self.MainSizer.AddSizer(self.ButtonSizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
# Save LD element class
self.ElementClass = (LD_Contact if type == "contact" else LD_Coil)
--- a/dialogs/LDPowerRailDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/LDPowerRailDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -47,7 +47,7 @@
@param tagname: Tagname of project POU edited
"""
BlockPreviewDialog.__init__(self, parent, controller, tagname,
- title=_('Power Rail Properties'))
+ title=_('Power Rail Properties'))
# Init common sizers
self._init_sizers(2, 0, 5, None, 2, 1)
@@ -62,7 +62,7 @@
for type, label in [(LEFTRAIL, _('Left PowerRail')),
(RIGHTRAIL, _('Right PowerRail'))]:
radio_button = wx.RadioButton(self, label=label,
- style=(wx.RB_GROUP if first else 0))
+ style=(wx.RB_GROUP if first else 0))
radio_button.SetValue(first)
self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button)
self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW)
@@ -75,7 +75,7 @@
# Create spin control for defining power rail pin number
self.PinNumber = wx.SpinCtrl(self, min=1, max=50,
- style=wx.SP_ARROW_KEYS)
+ style=wx.SP_ARROW_KEYS)
self.PinNumber.SetValue(1)
self.Bind(wx.EVT_SPINCTRL, self.OnPinNumberChanged, self.PinNumber)
self.LeftGridSizer.AddWindow(self.PinNumber, flag=wx.GROW)
@@ -85,8 +85,9 @@
self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)
# Add buttons sizer to sizers
- self.MainSizer.AddSizer(self.ButtonSizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ self.MainSizer.AddSizer(
+ self.ButtonSizer, border=20,
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.Fit()
# Left Power Rail radio button is default control having keyboard focus
@@ -160,8 +161,8 @@
# Set graphic element displayed, creating a power rail element
self.Element = LD_PowerRail(self.Preview,
- self.GetPowerRailType(),
- connectors=self.PinNumber.GetValue())
+ self.GetPowerRailType(),
+ connectors=self.PinNumber.GetValue())
# Call BlockPreviewDialog function
BlockPreviewDialog.RefreshPreview(self)
--- a/dialogs/PouActionDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/PouActionDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -49,27 +49,27 @@
infos_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=15)
infos_sizer.AddGrowableCol(1)
main_sizer.AddSizer(infos_sizer, border=20,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
actionname_label = wx.StaticText(self, label=_('Action Name:'))
infos_sizer.AddWindow(actionname_label, border=4,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
self.ActionName = wx.TextCtrl(self, size=wx.Size(180, -1))
infos_sizer.AddWindow(self.ActionName, flag=wx.GROW)
language_label = wx.StaticText(self, label=_('Language:'))
infos_sizer.AddWindow(language_label, border=4,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
self.Language = wx.ComboBox(self, style=wx.CB_READONLY)
infos_sizer.AddWindow(self.Language, flag=wx.GROW)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK,
- button_sizer.GetAffirmativeButton())
+ button_sizer.GetAffirmativeButton())
main_sizer.AddSizer(button_sizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.SetSizer(main_sizer)
--- a/dialogs/PouDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/PouDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -49,8 +49,8 @@
def __init__(self, parent, pou_type=None, type_readonly=False):
wx.Dialog.__init__(self, id=-1, parent=parent,
- name='PouDialog', title=_('Create a new POU'),
- style=wx.DEFAULT_DIALOG_STYLE)
+ name='PouDialog', title=_('Create a new POU'),
+ style=wx.DEFAULT_DIALOG_STYLE)
main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
main_sizer.AddGrowableCol(0)
@@ -59,18 +59,18 @@
infos_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=15)
infos_sizer.AddGrowableCol(1)
main_sizer.AddSizer(infos_sizer, border=20,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
pouname_label = wx.StaticText(self, label=_('POU Name:'))
infos_sizer.AddWindow(pouname_label, border=4,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
self.PouName = wx.TextCtrl(self)
infos_sizer.AddWindow(self.PouName, flag=wx.GROW)
poutype_label = wx.StaticText(self, label=_('POU Type:'))
infos_sizer.AddWindow(poutype_label, border=4,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
self.PouType = wx.ComboBox(self, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnTypeChanged, self.PouType)
@@ -78,7 +78,7 @@
language_label = wx.StaticText(self, label=_('Language:'))
infos_sizer.AddWindow(language_label, border=4,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
self.Language = wx.ComboBox(self, style=wx.CB_READONLY)
infos_sizer.AddWindow(self.Language, flag=wx.GROW)
@@ -86,7 +86,7 @@
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
main_sizer.AddSizer(button_sizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.SetSizer(main_sizer)
--- a/dialogs/PouNameDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/PouNameDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -38,7 +38,7 @@
self.PouNames = []
self.Bind(wx.EVT_BUTTON, self.OnOK,
- self.GetSizer().GetItem(2).GetSizer().GetItem(1).GetSizer().GetAffirmativeButton())
+ self.GetSizer().GetItem(2).GetSizer().GetItem(1).GetSizer().GetAffirmativeButton())
def OnOK(self, event):
message = None
--- a/dialogs/PouTransitionDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/PouTransitionDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -53,18 +53,18 @@
infos_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=10)
infos_sizer.AddGrowableCol(1)
main_sizer.AddSizer(infos_sizer, border=20,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
transitionname_label = wx.StaticText(self, label=_('Transition Name:'))
infos_sizer.AddWindow(transitionname_label, border=4,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
self.TransitionName = wx.TextCtrl(self, size=wx.Size(180, -1))
infos_sizer.AddWindow(self.TransitionName, flag=wx.GROW)
language_label = wx.StaticText(self, label=_('Language:'))
infos_sizer.AddWindow(language_label, border=4,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)
self.Language = wx.ComboBox(self, style=wx.CB_READONLY)
infos_sizer.AddWindow(self.Language, flag=wx.GROW)
--- a/dialogs/ProjectDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/ProjectDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -32,21 +32,23 @@
def __init__(self, parent, enable_required=True):
wx.Dialog.__init__(self, parent, title=_('Project properties'),
- style=wx.DEFAULT_DIALOG_STYLE)
+ style=wx.DEFAULT_DIALOG_STYLE)
main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
main_sizer.AddGrowableCol(0)
main_sizer.AddGrowableRow(0)
- self.ProjectProperties = ProjectPropertiesPanel(self,
- enable_required=enable_required)
+ self.ProjectProperties = ProjectPropertiesPanel(
+ self,
+ enable_required=enable_required)
+
main_sizer.AddWindow(self.ProjectProperties, flag=wx.GROW)
self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK,
self.ButtonSizer.GetAffirmativeButton())
main_sizer.AddSizer(self.ButtonSizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.SetSizer(main_sizer)
self.ProjectProperties.Fit()
@@ -70,7 +72,8 @@
text += _(" and %s") % item
else:
text += ", %s" % item
- dialog = wx.MessageDialog(self,
+ dialog = wx.MessageDialog(
+ self,
_("Form isn't complete. %s must be filled!") % text,
_("Error"), wx.OK | wx.ICON_ERROR)
dialog.ShowModal()
--- a/dialogs/SFCDivergenceDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/SFCDivergenceDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -50,7 +50,7 @@
@param poss_div_types: Types of divergence that will be available in the dialog window
"""
BlockPreviewDialog.__init__(self, parent, controller, tagname,
- title=_('Create a new divergence or convergence'))
+ title=_('Create a new divergence or convergence'))
# Init common sizers
self._init_sizers(2, 0, 7, None, 2, 1)
@@ -76,7 +76,7 @@
focusbtn = None
for type, label in poss_div_btns:
radio_button = wx.RadioButton(self, label=label,
- style=(wx.RB_GROUP if first else 0))
+ style=(wx.RB_GROUP if first else 0))
radio_button.SetValue(first)
self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button)
self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW)
@@ -87,7 +87,7 @@
# Create label for number of divergence sequences
sequences_label = wx.StaticText(self,
- label=_('Number of sequences:'))
+ label=_('Number of sequences:'))
self.LeftGridSizer.AddWindow(sequences_label, flag=wx.GROW)
# Create spin control for defining number of divergence sequences
@@ -100,8 +100,9 @@
self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)
# Add buttons sizer to sizers
- self.MainSizer.AddSizer(self.ButtonSizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ self.MainSizer.AddSizer(
+ self.ButtonSizer, border=20,
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.Fit()
--- a/dialogs/SFCStepDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/SFCStepDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -48,7 +48,7 @@
@param initial: True if step is initial (default: False)
"""
BlockPreviewDialog.__init__(self, parent, controller, tagname,
- title=_('Edit Step'))
+ title=_('Edit Step'))
# Init common sizers
self._init_sizers(2, 0, 6, None, 2, 1)
@@ -83,8 +83,9 @@
self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)
# Add buttons sizer to sizers
- self.MainSizer.AddSizer(self.ButtonSizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ self.MainSizer.AddSizer(
+ self.ButtonSizer, border=20,
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
# Save flag that indicates that step is initial
self.Initial = initial
--- a/dialogs/SFCStepNameDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/SFCStepNameDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -40,7 +40,7 @@
self.StepNames = []
self.Bind(wx.EVT_BUTTON, self.OnOK,
- self.GetSizer().GetItem(2).GetSizer().GetItem(1).GetSizer().GetAffirmativeButton())
+ self.GetSizer().GetItem(2).GetSizer().GetItem(1).GetSizer().GetAffirmativeButton())
def OnOK(self, event):
message = None
--- a/dialogs/SFCTransitionDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/SFCTransitionDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -49,7 +49,7 @@
connection (default: True)
"""
BlockPreviewDialog.__init__(self, parent, controller, tagname,
- title=_('Edit transition'))
+ title=_('Edit transition'))
# Init common sizers
self._init_sizers(2, 0, 8, None, 2, 1)
@@ -76,7 +76,7 @@
('inline', _('Inline'), inline),
('connection', _('Connection'), None)]:
radio_button = wx.RadioButton(self, label=label,
- style=(wx.RB_GROUP if first else 0))
+ style=(wx.RB_GROUP if first else 0))
radio_button.SetValue(first)
self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button)
self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW)
@@ -100,8 +100,9 @@
self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)
# Add buttons sizer to sizers
- self.MainSizer.AddSizer(self.ButtonSizer, border=20,
- flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ self.MainSizer.AddSizer(
+ self.ButtonSizer, border=20,
+ flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.Fit()
--- a/dialogs/SearchInProjectDialog.py Fri Aug 18 12:36:31 2017 +0300
+++ b/dialogs/SearchInProjectDialog.py Fri Aug 18 20:14:38 2017 +0300
@@ -54,7 +54,7 @@
pattern_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5)
pattern_sizer.AddGrowableCol(0)
main_sizer.AddSizer(pattern_sizer, border=20,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
pattern_label = wx.StaticText(self, label=_('Pattern to search:'))
pattern_sizer.AddWindow(pattern_label, flag=wx.ALIGN_BOTTOM)
@@ -72,17 +72,17 @@
scope_staticbox = wx.StaticBox(self, label=_('Scope'))
scope_sizer = wx.StaticBoxSizer(scope_staticbox, wx.HORIZONTAL)
main_sizer.AddSizer(scope_sizer, border=20,
- flag=wx.GROW | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.LEFT | wx.RIGHT)
scope_selection_sizer = wx.BoxSizer(wx.VERTICAL)
scope_sizer.AddSizer(scope_selection_sizer, 1, border=5,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.BOTTOM)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.BOTTOM)
self.WholeProject = wx.RadioButton(self, label=_('Whole Project'), style=wx.RB_GROUP)
self.WholeProject.SetValue(True)
self.Bind(wx.EVT_RADIOBUTTON, self.OnScopeChanged, self.WholeProject)
scope_selection_sizer.AddWindow(self.WholeProject, border=5,
- flag=wx.GROW | wx.BOTTOM)
+ flag=wx.GROW | wx.BOTTOM)
self.OnlyElements = wx.RadioButton(self, label=_('Only Elements'))
self.Bind(wx.EVT_RADIOBUTTON, self.OnScopeChanged, self.OnlyElements)
@@ -92,7 +92,7 @@
self.ElementsList = wx.CheckListBox(self)
self.ElementsList.Enable(False)
scope_sizer.AddWindow(self.ElementsList, 1, border=5,
- flag=wx.GROW | wx.TOP | wx.RIGHT | wx.BOTTOM)
+ flag=wx.GROW | wx.TOP | wx.RIGHT | wx.BOTTOM)
buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
main_sizer.AddSizer(buttons_sizer, border=20,
--- a/docutil/dochtml.py Fri Aug 18 12:36:31 2017 +0300
+++ b/docutil/dochtml.py Fri Aug 18 20:14:38 2017 +0300
@@ -69,14 +69,14 @@
class HtmlFrame(wx.Frame):
def _init_ctrls(self, prnt):
wx.Frame.__init__(self, id=ID_HTMLFRAME, name='HtmlFrame',
- parent=prnt, pos=wx.Point(320, 231), size=wx.Size(853, 616),
- style=wx.DEFAULT_FRAME_STYLE, title='')
+ parent=prnt, pos=wx.Point(320, 231), size=wx.Size(853, 616),
+ style=wx.DEFAULT_FRAME_STYLE, title='')
self.SetIcon(prnt.icon)
self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
self.HtmlContent = UrlClickHtmlWindow(id=ID_HTMLFRAMEHTMLCONTENT,
- name='HtmlContent', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(-1, -1), style=wx.html.HW_SCROLLBAR_AUTO | wx.html.HW_NO_SELECTION)
+ name='HtmlContent', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(-1, -1), style=wx.html.HW_SCROLLBAR_AUTO | wx.html.HW_NO_SELECTION)
self.HtmlContent.Bind(HtmlWindowUrlClick, self.OnLinkClick)
def __init__(self, parent, opened):
--- a/docutil/docsvg.py Fri Aug 18 12:36:31 2017 +0300
+++ b/docutil/docsvg.py Fri Aug 18 20:14:38 2017 +0300
@@ -31,7 +31,7 @@
""" Return the Inkscape path """
import _winreg
svgexepath = _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE,
- 'Software\\Classes\\svgfile\\shell\\Inkscape\\command')
+ 'Software\\Classes\\svgfile\\shell\\Inkscape\\command')
svgexepath = svgexepath.replace('"%1"', '')
return svgexepath.replace('"', '')
--- a/editors/CodeFileEditor.py Fri Aug 18 12:36:31 2017 +0300
+++ b/editors/CodeFileEditor.py Fri Aug 18 20:14:38 2017 +0300
@@ -57,7 +57,7 @@
def __init__(self, parent, window, controler):
CustomStyledTextCtrl.__init__(self, parent, -1, wx.DefaultPosition,
- wx.Size(-1, 300), 0)
+ wx.Size(-1, 300), 0)
self.SetMarginType(1, stc.STC_MARGIN_NUMBER)
self.SetMarginWidth(1, 25)
@@ -661,7 +661,7 @@
("UpVariableButton", "up", _("Move variable up")),
("DownVariableButton", "down", _("Move variable down"))]:
button = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap(bitmap),
- size=wx.Size(28, 28), style=wx.NO_BORDER)
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
button.SetToolTipString(help)
setattr(self, name, button)
controls_sizer.AddWindow(button, border=5, flag=wx.BOTTOM)
@@ -838,7 +838,7 @@
data_type = self.Table.GetValueByName(row, "Type")
var_name = self.Table.GetValueByName(row, "Name")
data = wx.TextDataObject(str((var_name, "Global", data_type,
- self.Controler.GetCurrentLocation())))
+ self.Controler.GetCurrentLocation())))
dragSource = wx.DropSource(self.VariablesGrid)
dragSource.SetData(data)
dragSource.DoDragDrop()
@@ -860,14 +860,15 @@
self.CodeEditorPanel.SetMinimumPaneSize(1)
self.VariablesPanel = VariablesEditor(self.CodeEditorPanel,
- self.ParentWindow, self.Controler)
+ self.ParentWindow,
+ self.Controler)
if self.CODE_EDITOR is not None:
self.CodeEditor = self.CODE_EDITOR(self.CodeEditorPanel,
- self.ParentWindow, self.Controler)
+ self.ParentWindow, self.Controler)
self.CodeEditorPanel.SplitHorizontally(self.VariablesPanel,
- self.CodeEditor, 150)
+ self.CodeEditor, 150)
else:
self.CodeEditorPanel.Initialize(self.VariablesPanel)
--- a/editors/ConfTreeNodeEditor.py Fri Aug 18 12:36:31 2017 +0300
+++ b/editors/ConfTreeNodeEditor.py Fri Aug 18 20:14:38 2017 +0300
@@ -122,10 +122,10 @@
bitmap = wx.EmptyBitmap(0, 0)
wx.StaticBitmap.__init__(self, parent, ID,
- bitmap,
- pos, size,
- style,
- name)
+ bitmap,
+ pos, size,
+ style,
+ name)
class ConfTreeNodeEditor(EditorPanel):
@@ -141,48 +141,54 @@
if tabs_num > 1 or self.SHOW_BASE_PARAMS:
self.Editor = wx.Panel(parent,
- style=wx.SUNKEN_BORDER | wx.SP_3D)
+ style=wx.SUNKEN_BORDER | wx.SP_3D)
self.MainSizer = wx.BoxSizer(wx.VERTICAL)
if self.SHOW_BASE_PARAMS:
baseparamseditor_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.MainSizer.AddSizer(baseparamseditor_sizer, border=5,
- flag=wx.GROW | wx.ALL)
+ flag=wx.GROW | wx.ALL)
self.FullIECChannel = wx.StaticText(self.Editor, -1)
self.FullIECChannel.SetFont(
wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL,
wx.BOLD, faceName=faces["helv"]))
baseparamseditor_sizer.AddWindow(self.FullIECChannel,
- flag=wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.ALIGN_CENTER_VERTICAL)
updownsizer = wx.BoxSizer(wx.VERTICAL)
baseparamseditor_sizer.AddSizer(updownsizer, border=5,
- flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
-
- self.IECCUpButton = wx.lib.buttons.GenBitmapTextButton(self.Editor,
- bitmap=GetBitmap('IECCDown'), size=wx.Size(16, 16), style=wx.NO_BORDER)
+ flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
+
+ self.IECCUpButton = wx.lib.buttons.GenBitmapTextButton(
+ self.Editor,
+ bitmap=GetBitmap('IECCDown'),
+ size=wx.Size(16, 16),
+ style=wx.NO_BORDER)
self.IECCUpButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(1),
- self.IECCUpButton)
+ self.IECCUpButton)
updownsizer.AddWindow(self.IECCUpButton, flag=wx.ALIGN_LEFT)
- self.IECCDownButton = wx.lib.buttons.GenBitmapButton(self.Editor,
- bitmap=GetBitmap('IECCUp'), size=wx.Size(16, 16), style=wx.NO_BORDER)
+ self.IECCDownButton = wx.lib.buttons.GenBitmapButton(
+ self.Editor, bitmap=GetBitmap('IECCUp'),
+ size=wx.Size(16, 16), style=wx.NO_BORDER)
self.IECCDownButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(-1),
- self.IECCDownButton)
+ self.IECCDownButton)
updownsizer.AddWindow(self.IECCDownButton, flag=wx.ALIGN_LEFT)
self.ConfNodeName = wx.TextCtrl(self.Editor,
- size=wx.Size(150, 25))
+ size=wx.Size(150, 25))
self.ConfNodeName.SetFont(
wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL,
wx.BOLD, faceName=faces["helv"]))
- self.ConfNodeName.Bind(wx.EVT_TEXT,
- self.GetTextCtrlCallBackFunction(self.ConfNodeName, "BaseParams.Name", True),
- self.ConfNodeName)
- baseparamseditor_sizer.AddWindow(self.ConfNodeName, border=5,
- flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL)
+ self.ConfNodeName.Bind(
+ wx.EVT_TEXT,
+ self.GetTextCtrlCallBackFunction(self.ConfNodeName, "BaseParams.Name", True),
+ self.ConfNodeName)
+ baseparamseditor_sizer.AddWindow(
+ self.ConfNodeName, border=5,
+ flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL)
buttons_sizer = self.GenerateMethodButtonSizer()
baseparamseditor_sizer.AddSizer(buttons_sizer, flag=wx.ALIGN_CENTER)
@@ -215,7 +221,7 @@
if self.ConfNodeNoteBook is None and parent != self.Editor:
panel_style |= wx.SUNKEN_BORDER
self.ParamsEditor = wx.ScrolledWindow(parent,
- style=panel_style)
+ style=panel_style)
self.ParamsEditor.Bind(wx.EVT_SIZE, self.OnParamsEditorResize)
self.ParamsEditor.Bind(wx.EVT_SCROLLWIN, self.OnParamsEditorScroll)
@@ -226,7 +232,7 @@
self.ConfNodeParamsSizer = wx.BoxSizer(wx.VERTICAL)
self.ParamsEditorSizer.AddSizer(self.ConfNodeParamsSizer, border=5,
- flag=wx.LEFT | wx.RIGHT | wx.BOTTOM)
+ flag=wx.LEFT | wx.RIGHT | wx.BOTTOM)
self.RefreshConfNodeParamsSizer()
@@ -306,8 +312,9 @@
for confnode_method in self.Controler.ConfNodeMethods:
if "method" in confnode_method and confnode_method.get("shown", True):
button = GenBitmapTextButton(self.Editor,
- bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")),
- label=confnode_method["name"], style=wx.NO_BORDER)
+ bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")),
+ label=confnode_method["name"],
+ style=wx.NO_BORDER)
button.SetFont(normal_bt_font)
button.SetToolTipString(confnode_method["tooltip"])
if confnode_method.get("push", False):
@@ -346,7 +353,7 @@
if value is not None:
label += " - %s" % _(value)
staticbox = wx.StaticBox(self.ParamsEditor,
- label=_(label), size=wx.Size(10, 0))
+ label=_(label), size=wx.Size(10, 0))
staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
flags = (wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
if first:
@@ -362,15 +369,16 @@
if first:
flags |= wx.TOP
sizer.AddSizer(boxsizer, border=5, flag=flags)
- staticbitmap = GenStaticBitmap(ID=-1, bitmapname=element_infos["name"],
+ staticbitmap = GenStaticBitmap(
+ ID=-1, bitmapname=element_infos["name"],
name="%s_bitmap" % element_infos["name"], parent=self.ParamsEditor,
pos=wx.Point(0, 0), size=wx.Size(24, 24), style=0)
boxsizer.AddWindow(staticbitmap, border=5, flag=wx.RIGHT)
statictext = wx.StaticText(self.ParamsEditor,
- label="%s:" % _(element_infos["name"]))
+ label="%s:" % _(element_infos["name"]))
boxsizer.AddWindow(statictext, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT)
if isinstance(element_infos["type"], types.ListType):
if isinstance(element_infos["value"], types.TupleType):
@@ -378,7 +386,7 @@
boxsizer.AddSizer(browse_boxsizer)
textctrl = wx.TextCtrl(self.ParamsEditor,
- size=wx.Size(275, -1), style=wx.TE_READONLY)
+ size=wx.Size(275, -1), style=wx.TE_READONLY)
if element_infos["value"] is not None:
textctrl.SetValue(element_infos["value"][0])
value_infos = element_infos["value"][1]
@@ -394,7 +402,7 @@
button)
else:
combobox = wx.ComboBox(self.ParamsEditor,
- size=wx.Size(300, -1), style=wx.CB_READONLY)
+ size=wx.Size(300, -1), style=wx.CB_READONLY)
boxsizer.AddWindow(combobox)
if element_infos["use"] == "optional":
@@ -406,7 +414,8 @@
value = element_infos["value"]
staticbox = wx.StaticBox(self.ParamsEditor,
- label="%s - %s" % (_(name), _(value)), size=wx.Size(10, 0))
+ label="%s - %s" % (_(name), _(value)),
+ size=wx.Size(10, 0))
staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
sizer.AddSizer(staticboxsizer, border=5, flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path)
@@ -429,7 +438,8 @@
if "max" in element_infos["type"]:
scmax = element_infos["type"]["max"]
spinctrl = wx.SpinCtrl(self.ParamsEditor,
- size=wx.Size(300, -1), style=wx.SP_ARROW_KEYS | wx.ALIGN_RIGHT)
+ size=wx.Size(300, -1),
+ style=wx.SP_ARROW_KEYS | wx.ALIGN_RIGHT)
spinctrl.SetRange(scmin, scmax)
boxsizer.AddWindow(spinctrl)
if element_infos["value"] is not None:
@@ -455,7 +465,8 @@
scmin = -(2**31)
scmax = 2**31-1
spinctrl = wx.SpinCtrl(self.ParamsEditor,
- size=wx.Size(300, -1), style=wx.SP_ARROW_KEYS | wx.ALIGN_RIGHT)
+ size=wx.Size(300, -1),
+ style=wx.SP_ARROW_KEYS | wx.ALIGN_RIGHT)
spinctrl.SetRange(scmin, scmax)
boxsizer.AddWindow(spinctrl)
if element_infos["value"] is not None:
@@ -571,7 +582,8 @@
posy = max(0, min(ystart, (maxy - window_size[1]) / SCROLLBAR_UNIT))
self.ParamsEditor.Scroll(posx, posy)
self.ParamsEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
- maxx / SCROLLBAR_UNIT, maxy / SCROLLBAR_UNIT, posx, posy)
+ maxx / SCROLLBAR_UNIT, maxy / SCROLLBAR_UNIT,
+ posx, posy)
def OnParamsEditorResize(self, event):
self.RefreshScrollbars()
--- a/editors/DataTypeEditor.py Fri Aug 18 12:36:31 2017 +0300
+++ b/editors/DataTypeEditor.py Fri Aug 18 20:14:38 2017 +0300
@@ -156,21 +156,21 @@
top_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.MainSizer.AddSizer(top_sizer, border=5,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
derivation_type_label = wx.StaticText(self.Editor, label=_('Derivation Type:'))
top_sizer.AddWindow(derivation_type_label, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT)
self.DerivationType = wx.ComboBox(self.Editor,
- size=wx.Size(200, -1), style=wx.CB_READONLY)
+ size=wx.Size(200, -1), style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnDerivationTypeChanged, self.DerivationType)
top_sizer.AddWindow(self.DerivationType, border=5, flag=wx.GROW | wx.RIGHT)
typeinfos_staticbox = wx.StaticBox(self.Editor, label=_('Type infos:'))
typeinfos_sizer = wx.StaticBoxSizer(typeinfos_staticbox, wx.HORIZONTAL)
self.MainSizer.AddSizer(typeinfos_sizer, border=5,
- flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
# Panel for Directly derived data types
@@ -180,25 +180,25 @@
directly_panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
directly_basetype_label = wx.StaticText(self.DirectlyPanel,
- label=_('Base Type:'))
+ label=_('Base Type:'))
directly_panel_sizer.AddWindow(directly_basetype_label, 1, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.DirectlyBaseType = wx.ComboBox(self.DirectlyPanel, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnInfosChanged, self.DirectlyBaseType)
directly_panel_sizer.AddWindow(self.DirectlyBaseType, 1, border=5,
- flag=wx.GROW | wx.ALL)
+ flag=wx.GROW | wx.ALL)
directly_initialvalue_label = wx.StaticText(self.DirectlyPanel,
- label=_('Initial Value:'))
+ label=_('Initial Value:'))
directly_panel_sizer.AddWindow(directly_initialvalue_label, 1, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.DirectlyInitialValue = wx.TextCtrl(self.DirectlyPanel,
- style=wx.TE_PROCESS_ENTER | wx.TE_RICH)
+ style=wx.TE_PROCESS_ENTER | wx.TE_RICH)
self.Bind(wx.EVT_TEXT_ENTER, self.OnReturnKeyPressed, self.DirectlyInitialValue)
directly_panel_sizer.AddWindow(self.DirectlyInitialValue, 1, border=5,
- flag=wx.ALL)
+ flag=wx.ALL)
self.DirectlyPanel.SetSizer(directly_panel_sizer)
@@ -210,49 +210,49 @@
subrange_panel_sizer = wx.GridSizer(cols=4, hgap=5, rows=3, vgap=0)
subrange_basetype_label = wx.StaticText(self.SubrangePanel,
- label=_('Base Type:'))
+ label=_('Base Type:'))
subrange_panel_sizer.AddWindow(subrange_basetype_label, 1, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.SubrangeBaseType = wx.ComboBox(self.SubrangePanel, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnSubrangeBaseTypeChanged,
- self.SubrangeBaseType)
+ self.SubrangeBaseType)
subrange_panel_sizer.AddWindow(self.SubrangeBaseType, 1, border=5,
- flag=wx.GROW | wx.ALL)
+ flag=wx.GROW | wx.ALL)
subrange_initialvalue_label = wx.StaticText(self.SubrangePanel,
- label=_('Initial Value:'))
+ label=_('Initial Value:'))
subrange_panel_sizer.AddWindow(subrange_initialvalue_label, 1, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.SubrangeInitialValue = wx.SpinCtrl(self.SubrangePanel,
- style=wx.TAB_TRAVERSAL)
+ style=wx.TAB_TRAVERSAL)
self.Bind(wx.EVT_SPINCTRL, self.OnInfosChanged, self.SubrangeInitialValue)
subrange_panel_sizer.AddWindow(self.SubrangeInitialValue, 1, border=5,
- flag=wx.GROW | wx.ALL)
+ flag=wx.GROW | wx.ALL)
subrange_minimum_label = wx.StaticText(self.SubrangePanel, label=_('Minimum:'))
subrange_panel_sizer.AddWindow(subrange_minimum_label, 1, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.SubrangeMinimum = wx.SpinCtrl(self.SubrangePanel, style=wx.TAB_TRAVERSAL)
self.Bind(wx.EVT_SPINCTRL, self.OnSubrangeMinimumChanged, self.SubrangeMinimum)
subrange_panel_sizer.AddWindow(self.SubrangeMinimum, 1, border=5,
- flag=wx.GROW | wx.ALL)
+ flag=wx.GROW | wx.ALL)
for i in xrange(2):
subrange_panel_sizer.AddWindow(wx.Size(0, 0), 1)
subrange_maximum_label = wx.StaticText(self.SubrangePanel,
- label=_('Maximum:'))
+ label=_('Maximum:'))
subrange_panel_sizer.AddWindow(subrange_maximum_label, 1, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.SubrangeMaximum = wx.SpinCtrl(self.SubrangePanel, style=wx.TAB_TRAVERSAL)
self.Bind(wx.EVT_SPINCTRL, self.OnSubrangeMaximumChanged, self.SubrangeMaximum)
subrange_panel_sizer.AddWindow(self.SubrangeMaximum, 1, border=5,
- flag=wx.GROW | wx.ALL)
+ flag=wx.GROW | wx.ALL)
self.SubrangePanel.SetSizer(subrange_panel_sizer)
@@ -263,29 +263,32 @@
enumerated_panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
- self.EnumeratedValues = CustomEditableListBox(self.EnumeratedPanel,
- label=_("Values:"), style=wx.gizmos.EL_ALLOW_NEW |
- wx.gizmos.EL_ALLOW_EDIT |
- wx.gizmos.EL_ALLOW_DELETE)
+ self.EnumeratedValues = CustomEditableListBox(
+ self.EnumeratedPanel,
+ label=_("Values:"),
+ style=(wx.gizmos.EL_ALLOW_NEW |
+ wx.gizmos.EL_ALLOW_EDIT |
+ wx.gizmos.EL_ALLOW_DELETE))
setattr(self.EnumeratedValues, "_OnLabelEndEdit", self.OnEnumeratedValueEndEdit)
for func in ["_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]:
setattr(self.EnumeratedValues, func, self.OnEnumeratedValuesChanged)
enumerated_panel_sizer.AddWindow(self.EnumeratedValues, 1, border=5,
- flag=wx.GROW | wx.ALL)
+ flag=wx.GROW | wx.ALL)
enumerated_panel_rightsizer = wx.BoxSizer(wx.HORIZONTAL)
enumerated_panel_sizer.AddSizer(enumerated_panel_rightsizer, 1)
enumerated_initialvalue_label = wx.StaticText(self.EnumeratedPanel,
- label=_('Initial Value:'))
+ label=_('Initial Value:'))
enumerated_panel_rightsizer.AddWindow(enumerated_initialvalue_label, 1,
- border=5, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ border=5,
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.EnumeratedInitialValue = wx.ComboBox(self.EnumeratedPanel,
- style=wx.CB_READONLY)
+ style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnInfosChanged, self.EnumeratedInitialValue)
enumerated_panel_rightsizer.AddWindow(self.EnumeratedInitialValue, 1,
- border=5, flag=wx.ALL)
+ border=5, flag=wx.ALL)
self.EnumeratedPanel.SetSizer(enumerated_panel_sizer)
@@ -304,36 +307,38 @@
array_basetype_label = wx.StaticText(self.ArrayPanel, label=_('Base Type:'))
array_panel_leftSizer.AddWindow(array_basetype_label, 1, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.ArrayBaseType = wx.ComboBox(self.ArrayPanel, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnInfosChanged, self.ArrayBaseType)
array_panel_leftSizer.AddWindow(self.ArrayBaseType, 1, border=5,
- flag=wx.GROW | wx.ALL)
+ flag=wx.GROW | wx.ALL)
array_panel_rightsizer = wx.BoxSizer(wx.HORIZONTAL)
array_panel_sizer.AddSizer(array_panel_rightsizer, flag=wx.GROW)
array_initialvalue_label = wx.StaticText(self.ArrayPanel,
- label=_('Initial Value:'))
+ label=_('Initial Value:'))
array_panel_rightsizer.AddWindow(array_initialvalue_label, 1, border=5,
- flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.ArrayInitialValue = wx.TextCtrl(self.ArrayPanel,
- style=wx.TE_PROCESS_ENTER | wx.TE_RICH)
+ style=wx.TE_PROCESS_ENTER | wx.TE_RICH)
self.Bind(wx.EVT_TEXT_ENTER, self.OnReturnKeyPressed, self.ArrayInitialValue)
array_panel_rightsizer.AddWindow(self.ArrayInitialValue, 1, border=5,
- flag=wx.ALL)
-
- self.ArrayDimensions = CustomEditableListBox(self.ArrayPanel,
- label=_("Dimensions:"), style=wx.gizmos.EL_ALLOW_NEW |
- wx.gizmos.EL_ALLOW_EDIT |
- wx.gizmos.EL_ALLOW_DELETE)
+ flag=wx.ALL)
+
+ self.ArrayDimensions = CustomEditableListBox(
+ self.ArrayPanel,
+ label=_("Dimensions:"),
+ style=(wx.gizmos.EL_ALLOW_NEW |
+ wx.gizmos.EL_ALLOW_EDIT |
+ wx.gizmos.EL_ALLOW_DELETE))
for func in ["_OnLabelEndEdit", "_OnAddButton", "_OnDelButton",
"_OnUpButton", "_OnDownButton"]:
setattr(self.ArrayDimensions, func, self.OnDimensionsChanged)
array_panel_sizer.AddWindow(self.ArrayDimensions, 0, border=5,
- flag=wx.GROW | wx.ALL)
+ flag=wx.GROW | wx.ALL)
self.ArrayPanel.SetSizer(array_panel_sizer)
@@ -350,10 +355,10 @@
structure_button_sizer.AddGrowableCol(0)
structure_button_sizer.AddGrowableRow(0)
structure_panel_sizer.AddSizer(structure_button_sizer, 0, border=5,
- flag=wx.ALL | wx.GROW)
+ flag=wx.ALL | wx.GROW)
structure_elements_label = wx.StaticText(self.StructurePanel,
- label=_('Elements :'))
+ label=_('Elements :'))
structure_button_sizer.AddWindow(structure_elements_label, flag=wx.ALIGN_BOTTOM)
for name, bitmap, help in [
@@ -362,17 +367,19 @@
("StructureUpButton", "up", _("Move element up")),
("StructureDownButton", "down", _("Move element down"))]:
button = wx.lib.buttons.GenBitmapButton(self.StructurePanel,
- bitmap=GetBitmap(bitmap), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ bitmap=GetBitmap(bitmap),
+ size=wx.Size(28, 28),
+ style=wx.NO_BORDER)
button.SetToolTipString(help)
setattr(self, name, button)
structure_button_sizer.AddWindow(button)
self.StructureElementsGrid = CustomGrid(self.StructurePanel,
- size=wx.Size(0, 150), style=wx.VSCROLL)
+ size=wx.Size(0, 150), style=wx.VSCROLL)
self.StructureElementsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
- self.OnStructureElementsGridCellChange)
+ self.OnStructureElementsGridCellChange)
self.StructureElementsGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN,
- self.OnStructureElementsGridEditorShown)
+ self.OnStructureElementsGridEditorShown)
structure_panel_sizer.AddWindow(self.StructureElementsGrid, flag=wx.GROW)
self.StructurePanel.SetSizer(structure_panel_sizer)
--- a/editors/EditorPanel.py Fri Aug 18 12:36:31 2017 +0300
+++ b/editors/EditorPanel.py Fri Aug 18 20:14:38 2017 +0300
@@ -39,7 +39,7 @@
def _init_ctrls(self, parent):
wx.SplitterWindow.__init__(self, parent,
- style=wx.SUNKEN_BORDER | wx.SP_3D)
+ style=wx.SUNKEN_BORDER | wx.SP_3D)
self.SetMinimumPaneSize(1)
self._init_MenuItems()
--- a/editors/FileManagementPanel.py Fri Aug 18 12:36:31 2017 +0300
+++ b/editors/FileManagementPanel.py Fri Aug 18 20:14:38 2017 +0300
@@ -58,16 +58,17 @@
button_sizer = wx.BoxSizer(wx.VERTICAL)
main_sizer.AddSizer(button_sizer, border=5,
- flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
+ flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
for idx, (name, bitmap, help) in enumerate([
("DeleteButton", "remove_element", _("Remove file from left folder")),
("LeftCopyButton", "LeftCopy", _("Copy file from right folder to left")),
("RightCopyButton", "RightCopy", _("Copy file from left folder to right")),
("EditButton", "edit", _("Edit file"))]):
- button = wx.lib.buttons.GenBitmapButton(self.Editor,
- bitmap=GetBitmap(bitmap),
- size=wx.Size(28, 28), style=wx.NO_BORDER)
+ button = wx.lib.buttons.GenBitmapButton(
+ self.Editor,
+ bitmap=GetBitmap(bitmap),
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
button.SetToolTipString(help)
setattr(self, name, button)
if idx > 0:
@@ -150,8 +151,9 @@
folder, filename = os.path.split(filepath)
dialog = wx.MessageDialog(self,
- _("Do you really want to delete the file '%s'?") % filename,
- _("Delete File"), wx.YES_NO | wx.ICON_QUESTION)
+ _("Do you really want to delete the file '%s'?") % filename,
+ _("Delete File"),
+ wx.YES_NO | wx.ICON_QUESTION)
remove = dialog.ShowModal() == wx.ID_YES
dialog.Destroy()
@@ -177,9 +179,10 @@
dst_filepath = os.path.join(dst_folder, src_filename)
if os.path.isfile(dst_filepath):
- dialog = wx.MessageDialog(self,
- _("The file '%s' already exist.\nDo you want to replace it?") % src_filename,
- _("Replace File"), wx.YES_NO | wx.ICON_QUESTION)
+ dialog = wx.MessageDialog(
+ self,
+ _("The file '%s' already exist.\nDo you want to replace it?") % src_filename,
+ _("Replace File"), wx.YES_NO | wx.ICON_QUESTION)
copy = dialog.ShowModal() == wx.ID_YES
dialog.Destroy()
else:
--- a/editors/ResourceEditor.py Fri Aug 18 12:36:31 2017 +0300
+++ b/editors/ResourceEditor.py Fri Aug 18 20:14:38 2017 +0300
@@ -233,7 +233,7 @@
tasks_sizer.AddGrowableCol(0)
tasks_sizer.AddGrowableRow(1)
main_sizer.AddSizer(tasks_sizer, border=5,
- flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
tasks_buttons_sizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
tasks_buttons_sizer.AddGrowableCol(0)
@@ -249,7 +249,9 @@
("UpTaskButton", "up", _("Move task up")),
("DownTaskButton", "down", _("Move task down"))]:
button = wx.lib.buttons.GenBitmapButton(self.Editor,
- bitmap=GetBitmap(bitmap), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ bitmap=GetBitmap(bitmap),
+ size=wx.Size(28, 28),
+ style=wx.NO_BORDER)
button.SetToolTipString(help)
setattr(self, name, button)
tasks_buttons_sizer.AddWindow(button)
@@ -262,7 +264,7 @@
instances_sizer.AddGrowableCol(0)
instances_sizer.AddGrowableRow(1)
main_sizer.AddSizer(instances_sizer, border=5,
- flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
+ flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
instances_buttons_sizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
instances_buttons_sizer.AddGrowableCol(0)
@@ -277,15 +279,15 @@
("DeleteInstanceButton", "remove_element", _("Remove instance")),
("UpInstanceButton", "up", _("Move instance up")),
("DownInstanceButton", "down", _("Move instance down"))]:
- button = wx.lib.buttons.GenBitmapButton(self.Editor,
- bitmap=GetBitmap(bitmap), size=wx.Size(28, 28), style=wx.NO_BORDER)
+ button = wx.lib.buttons.GenBitmapButton(
+ self.Editor, bitmap=GetBitmap(bitmap),
+ size=wx.Size(28, 28), style=wx.NO_BORDER)
button.SetToolTipString(help)
setattr(self, name, button)
instances_buttons_sizer.AddWindow(button)
self.InstancesGrid = CustomGrid(self.Editor, style=wx.VSCROLL)
- self.InstancesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
- self.OnInstancesGridCellChange)
+ self.InstancesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnInstancesGridCellChange)
instances_sizer.AddWindow(self.InstancesGrid, flag=wx.GROW)
self.Editor.SetSizer(main_sizer)
@@ -370,9 +372,11 @@
rows = self.InstancesTable.GetNumberRows()
row = self.InstancesGrid.GetGridCursorRow()
self.DeleteInstanceButton.Enable(rows > 0)
- self.UpInstanceButton.Enable(row > 0 and
+ self.UpInstanceButton.Enable(
+ row > 0 and
self.InstancesTable.GetValueByName(row, "Task") == self.InstancesTable.GetValueByName(row - 1, "Task"))
- self.DownInstanceButton.Enable(0 <= row < rows - 1 and
+ self.DownInstanceButton.Enable(
+ 0 <= row < rows - 1 and
self.InstancesTable.GetValueByName(row, "Task") == self.InstancesTable.GetValueByName(row + 1, "Task"))
setattr(self.InstancesGrid, "RefreshButtons", _RefreshInstanceButtons)
--- a/editors/SFCViewer.py Fri Aug 18 12:36:31 2017 +0300
+++ b/editors/SFCViewer.py Fri Aug 18 20:14:38 2017 +0300
@@ -767,8 +767,10 @@
if isinstance(block, SFC_Step):
choices.append(block.GetName())
dialog = wx.SingleChoiceDialog(self.ParentWindow,
- _("Add a new jump"), _("Please choose a target"),
- choices, wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
+ _("Add a new jump"),
+ _("Please choose a target"),
+ choices,
+ wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetStringSelection()
self.SelectedElement.AddOutput()
@@ -980,7 +982,7 @@
wire_size = GetWireSize(previous_block)
previous_block.RefreshOutputPosition((0, previous_pos.y + wire_size - next_pos.y))
wire.SetPoints([wx.Point(previous_pos.x, previous_pos.y + wire_size),
- wx.Point(previous_pos.x, previous_pos.y)])
+ wx.Point(previous_pos.x, previous_pos.y)])
if isinstance(next_block, SFC_Divergence):
next_block.RefreshPosition()
previous_block.RefreshOutputModel(True)
@@ -1010,7 +1012,7 @@
wire_size = GetWireSize(previous_block)
previous_block.RefreshOutputPosition((previous_pos.x - next_pos.x, previous_pos.y + wire_size - next_pos.y))
wire.SetPoints([wx.Point(previous_pos.x, previous_pos.y + wire_size),
- wx.Point(previous_pos.x, previous_pos.y)])
+ wx.Point(previous_pos.x, previous_pos.y)])
if isinstance(next_block, SFC_Divergence):
next_block.RefreshPosition()
previous_block.RefreshOutputModel(True)
--- a/editors/TextViewer.py Fri Aug 18 12:36:31 2017 +0300
+++ b/editors/TextViewer.py Fri Aug 18 20:14:38 2017 +0300
@@ -85,7 +85,7 @@
def _init_Editor(self, prnt):
self.Editor = CustomStyledTextCtrl(id=ID_TEXTVIEWERTEXTCTRL,
- parent=prnt, name="TextViewer", size=wx.Size(0, 0), style=0)
+ parent=prnt, name="TextViewer", size=wx.Size(0, 0), style=0)
self.Editor.ParentWindow = self
self.Editor.CmdKeyAssign(ord('+'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMIN)
@@ -304,10 +304,12 @@
else:
location = values[0]
if not location.startswith("%"):
- dialog = wx.SingleChoiceDialog(self.ParentWindow,
- _("Select a variable class:"), _("Variable class"),
- [_("Input"), _("Output"), _("Memory")],
- wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
+ dialog = wx.SingleChoiceDialog(
+ self.ParentWindow,
+ _("Select a variable class:"),
+ _("Variable class"),
+ [_("Input"), _("Output"), _("Memory")],
+ wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetSelection()
else:
@@ -326,7 +328,8 @@
var_type = values[2]
else:
var_type = LOCATIONDATATYPES.get(location[2], ["BOOL"])[0]
- self.Controler.AddEditedElementPouVar(self.TagName,
+ self.Controler.AddEditedElementPouVar(
+ self.TagName,
var_type, var_name,
location=location, description=values[4])
self.RefreshVariablePanel()
--- a/editors/Viewer.py Fri Aug 18 12:36:31 2017 +0300
+++ b/editors/Viewer.py Fri Aug 18 20:14:38 2017 +0300
@@ -321,10 +321,12 @@
if pou_type == "program":
location = values[0]
if not location.startswith("%"):
- dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow,
- _("Select a variable class:"), _("Variable class"),
- [_("Input"), _("Output"), _("Memory")],
- wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
+ dialog = wx.SingleChoiceDialog(
+ self.ParentWindow.ParentWindow,
+ _("Select a variable class:"),
+ _("Variable class"),
+ [_("Input"), _("Output"), _("Memory")],
+ wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetSelection()
else:
@@ -697,8 +699,8 @@
def _init_Editor(self, prnt):
self.Editor = wx.ScrolledWindow(prnt, name="Viewer",
- pos=wx.Point(0, 0), size=wx.Size(0, 0),
- style=wx.HSCROLL | wx.VSCROLL)
+ pos=wx.Point(0, 0), size=wx.Size(0, 0),
+ style=wx.HSCROLL | wx.VSCROLL)
self.Editor.ParentWindow = self
# Create a new Viewer
@@ -811,7 +813,7 @@
def GetScrolledRect(self, rect):
rect.x, rect.y = self.Editor.CalcScrolledPosition(int(rect.x * self.ViewScale[0]),
- int(rect.y * self.ViewScale[1]))
+ int(rect.y * self.ViewScale[1]))
rect.width = int(rect.width * self.ViewScale[0]) + 2
rect.height = int(rect.height * self.ViewScale[1]) + 2
return rect
@@ -1335,7 +1337,8 @@
maxy = max(maxy, extent.y + extent.height)
maxx = int(maxx * self.ViewScale[0])
maxy = int(maxy * self.ViewScale[1])
- self.Editor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
+ self.Editor.SetScrollbars(
+ SCROLLBAR_UNIT, SCROLLBAR_UNIT,
round(maxx / SCROLLBAR_UNIT) + width_incr, round(maxy / SCROLLBAR_UNIT) + height_incr,
xstart, ystart, True)
@@ -1417,10 +1420,11 @@
connectors["outputs"].pop(0)
executionControl = True
block_name = specific_values.name if specific_values.name is not None else ""
- element = FBD_Block(self, instance.type, block_name,
- instance.id, len(connectors["inputs"]),
- connectors=connectors, executionControl=executionControl,
- executionOrder=specific_values.execution_order)
+ element = FBD_Block(
+ self, instance.type, block_name,
+ instance.id, len(connectors["inputs"]),
+ connectors=connectors, executionControl=executionControl,
+ executionOrder=specific_values.execution_order)
if isinstance(element, Comment):
self.AddComment(element)
else:
@@ -1432,7 +1436,7 @@
connector_pos = wx.Point(*output_connector.position)
if isinstance(element, FBD_Block):
connector = element.GetConnector(connector_pos,
- output_name=output_connector.name)
+ output_name=output_connector.name)
elif i < len(connectors["outputs"]):
connector = connectors["outputs"][i]
else:
@@ -1448,7 +1452,7 @@
connector_pos = wx.Point(*input_connector.position)
if isinstance(element, FBD_Block):
connector = element.GetConnector(connector_pos,
- input_name=input_connector.name)
+ input_name=input_connector.name)
elif i < len(connectors["inputs"]):
connector = connectors["inputs"][i]
else:
@@ -1494,11 +1498,10 @@
wire = Wire(self)
wire.SetPoints(points)
else:
- wire = Wire(self,
- [wx.Point(*start_connector.GetPosition()),
- start_connector.GetDirection()],
- [wx.Point(*end_connector.GetPosition()),
- end_connector.GetDirection()])
+ wire = Wire(
+ self,
+ [wx.Point(*start_connector.GetPosition()), start_connector.GetDirection()],
+ [wx.Point(*end_connector.GetPosition()), end_connector.GetDirection()])
start_connector.Wires.append((wire, 0))
end_connector.Wires.append((wire, -1))
wire.StartConnected = start_connector
@@ -1696,7 +1699,8 @@
if self.SelectedElement.GetStartConnected() in connected
else self.SelectedElement.GetStartConnected())
- self.AddWireMenuItems(menu, delete,
+ self.AddWireMenuItems(
+ menu, delete,
start_connector.GetDirection() == EAST and
not isinstance(start_connector.GetParentBlock(), SFC_Step))
@@ -1876,8 +1880,8 @@
# Add Wire to Viewer and connect it to blocks
new_wire = Wire(self,
- [wx.Point(*start_point), connector.GetDirection()],
- [wx.Point(*end_point), end_connector.GetDirection()])
+ [wx.Point(*start_point), connector.GetDirection()],
+ [wx.Point(*end_point), end_connector.GetDirection()])
self.AddWire(new_wire)
connector.Connect((new_wire, 0), False)
end_connector.Connect((new_wire, -1), False)
@@ -1967,7 +1971,7 @@
if event.Leaving() and self.ToolTipElement is not None:
self.ToolTipElement.DestroyToolTip()
elif (not event.Entering() and
- gettime() - self.LastToolTipCheckTime > REFRESH_PERIOD):
+ gettime() - self.LastToolTipCheckTime > REFRESH_PERIOD):
self.LastToolTipCheckTime = gettime()
element = None
if not event.Leaving() and not event.LeftUp() and not event.LeftDClick():
@@ -2163,8 +2167,8 @@
# Popup contextual menu
menu = wx.Menu()
self.AddMenuItems(menu,
- [(wx.NewId(), wx.ITEM_NORMAL, text, '', callback)
- for text, callback in items])
+ [(wx.NewId(), wx.ITEM_NORMAL, text, '', callback)
+ for text, callback in items])
self.PopupMenu(menu)
self.SelectedElement.StartConnected.HighlightParentBlock(False)
@@ -2270,7 +2274,8 @@
"functionBlock": ITEM_FUNCTIONBLOCK,
}.get(self.Controler.GetPouType(instance_type))
if pou_type is not None and instance_type in self.Controler.GetProjectPouNames(self.Debug):
- self.ParentWindow.OpenDebugViewer(pou_type,
+ self.ParentWindow.OpenDebugViewer(
+ pou_type,
"%s.%s" % (self.GetInstancePath(True), self.SelectedElement.GetName()),
self.Controler.ComputePouName(instance_type))
else:
@@ -2278,8 +2283,9 @@
if iec_path is not None:
if isinstance(self.SelectedElement, Wire):
if self.SelectedElement.EndConnected is not None:
- self.ParentWindow.OpenDebugViewer(ITEM_VAR_LOCAL, iec_path,
- self.SelectedElement.EndConnected.GetType())
+ self.ParentWindow.OpenDebugViewer(
+ ITEM_VAR_LOCAL, iec_path,
+ self.SelectedElement.EndConnected.GetType())
else:
self.ParentWindow.OpenDebugViewer(ITEM_VAR_LOCAL, iec_path, "BOOL")
elif event.ControlDown() and not event.ShiftDown():
@@ -2289,8 +2295,9 @@
else:
instance_type = None
if instance_type in self.Controler.GetProjectPouNames(self.Debug):
- self.ParentWindow.EditProjectElement(ITEM_POU,
- self.Controler.ComputePouName(instance_type))
+ self.ParentWindow.EditProjectElement(
+ ITEM_POU,
+ self.Controler.ComputePouName(instance_type))
else:
self.SelectedElement.OnLeftDClick(event, self.GetLogicalDC(), self.Scaling)
elif event.ControlDown() and event.ShiftDown():
@@ -2603,10 +2610,11 @@
id = self.GetNewId()
values = dialog.GetValues()
values.setdefault("name", "")
- block = FBD_Block(self, values["type"], values["name"], id,
- values["extension"], values["inputs"],
- executionControl=values["executionControl"],
- executionOrder=values["executionOrder"])
+ block = FBD_Block(
+ self, values["type"], values["name"], id,
+ values["extension"], values["inputs"],
+ executionControl=values["executionControl"],
+ executionOrder=values["executionOrder"])
self.Controler.AddEditedElementBlock(self.TagName, id, values["type"], values.get("name", None))
connector = None
if wire is not None:
@@ -2786,8 +2794,10 @@
if isinstance(block, SFC_Step):
choices.append(block.GetName())
dialog = wx.SingleChoiceDialog(self.ParentWindow,
- _("Add a new jump"), _("Please choose a target"),
- choices, wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
+ _("Add a new jump"),
+ _("Please choose a target"),
+ choices,
+ wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
jump = SFC_Jump(self, dialog.GetStringSelection(), id)
@@ -3052,8 +3062,10 @@
if isinstance(block, SFC_Step):
choices.append(block.GetName())
dialog = wx.SingleChoiceDialog(self.ParentWindow,
- _("Edit jump target"), _("Please choose a target"),
- choices, wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
+ _("Edit jump target"),
+ _("Please choose a target"),
+ choices,
+ wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
try:
indx = choices.index(jump.GetTarget())
dialog.SetSelection(indx)
--- a/graphics/FBD_Objects.py Fri Aug 18 12:36:31 2017 +0300
+++ b/graphics/FBD_Objects.py Fri Aug 18 20:14:38 2017 +0300
@@ -488,7 +488,7 @@
if self.ExecutionOrder != 0:
# Draw block execution order
dc.DrawText(str(self.ExecutionOrder), self.Pos.x + self.Size[0] - executionorder_size[0],
- self.Pos.y + self.Size[1] + 2)
+ self.Pos.y + self.Size[1] + 2)
if not getattr(dc, "printing", False):
DrawHighlightedText(dc, self.Name, self.Highlights.get("name", []), name_pos[0], name_pos[1])
@@ -727,8 +727,8 @@
if event.ControlDown():
# Change variable type
types = [INPUT, OUTPUT, INOUT]
- self.Parent.ChangeVariableType(self,
- types[(types.index(self.Type) + 1) % len(types)])
+ self.Parent.ChangeVariableType(
+ self, types[(types.index(self.Type) + 1) % len(types)])
else:
# Edit the variable properties
self.Parent.EditVariableContent(self)
@@ -787,7 +787,7 @@
if self.ExecutionOrder != 0:
# Draw variable execution order
dc.DrawText(str(self.ExecutionOrder), self.Pos.x + self.Size[0] - executionorder_size[0],
- self.Pos.y + self.Size[1] + 2)
+ self.Pos.y + self.Size[1] + 2)
if not getattr(dc, "printing", False):
DrawHighlightedText(dc, self.Name, self.Highlights, text_pos[0], text_pos[1])
@@ -1014,13 +1014,13 @@
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
arrowsize = min(self.Size[1] / 2, (self.Size[0] - name_size[0] - 10) / 2)
dc.DrawLine(self.Pos.x, self.Pos.y, self.Pos.x + arrowsize,
- self.Pos.y + self.Size[1] / 2)
+ self.Pos.y + self.Size[1] / 2)
dc.DrawLine(self.Pos.x + arrowsize, self.Pos.y + self.Size[1] / 2,
- self.Pos.x, self.Pos.y + self.Size[1])
+ self.Pos.x, self.Pos.y + self.Size[1])
dc.DrawLine(self.Pos.x + self.Size[0] - arrowsize, self.Pos.y,
- self.Pos.x + self.Size[0], self.Pos.y + self.Size[1] / 2)
+ self.Pos.x + self.Size[0], self.Pos.y + self.Size[1] / 2)
dc.DrawLine(self.Pos.x + self.Size[0], self.Pos.y + self.Size[1] / 2,
- self.Pos.x + self.Size[0] - arrowsize, self.Pos.y + self.Size[1])
+ self.Pos.x + self.Size[0] - arrowsize, self.Pos.y + self.Size[1])
# Draw connection name
text_pos = (self.Pos.x + (self.Size[0] - name_size[0]) / 2,
self.Pos.y + (self.Size[1] - name_size[1]) / 2)
--- a/graphics/GraphicCommons.py Fri Aug 18 12:36:31 2017 +0300
+++ b/graphics/GraphicCommons.py Fri Aug 18 20:14:38 2017 +0300
@@ -1105,7 +1105,7 @@
if parent is None:
parent = self.ParentBlock
return Connector(parent, self.Name, self.Type, wx.Point(self.Pos[0], self.Pos[1]),
- self.Direction, self.Negated)
+ self.Direction, self.Negated)
# Returns the connector parent block
def GetParentBlock(self):
@@ -1934,7 +1934,7 @@
x2, y2 = self.Points[i + 1].x, self.Points[i + 1].y
# Calculate a rectangle around the segment
rect = wx.Rect(min(x1, x2) - ANCHOR_DISTANCE, min(y1, y2) - ANCHOR_DISTANCE,
- abs(x1 - x2) + 2 * ANCHOR_DISTANCE, abs(y1 - y2) + 2 * ANCHOR_DISTANCE)
+ abs(x1 - x2) + 2 * ANCHOR_DISTANCE, abs(y1 - y2) + 2 * ANCHOR_DISTANCE)
test |= rect.InsideXY(pt.x, pt.y)
return test
@@ -1942,13 +1942,13 @@
def TestPoint(self, pt):
# Test the wire start point
rect = wx.Rect(self.Points[0].x - ANCHOR_DISTANCE, self.Points[0].y - ANCHOR_DISTANCE,
- 2 * ANCHOR_DISTANCE, 2 * ANCHOR_DISTANCE)
+ 2 * ANCHOR_DISTANCE, 2 * ANCHOR_DISTANCE)
if rect.InsideXY(pt.x, pt.y):
return 0
# Test the wire end point
if len(self.Points) > 1:
rect = wx.Rect(self.Points[-1].x - ANCHOR_DISTANCE, self.Points[-1].y - ANCHOR_DISTANCE,
- 2 * ANCHOR_DISTANCE, 2 * ANCHOR_DISTANCE)
+ 2 * ANCHOR_DISTANCE, 2 * ANCHOR_DISTANCE)
if rect.InsideXY(pt.x, pt.y):
return -1
return None
@@ -1962,7 +1962,7 @@
x2, y2 = self.Points[i + 1].x, self.Points[i + 1].y
# Calculate a rectangle around the segment
rect = wx.Rect(min(x1, x2) - ANCHOR_DISTANCE, min(y1, y2) - ANCHOR_DISTANCE,
- abs(x1 - x2) + 2 * ANCHOR_DISTANCE, abs(y1 - y2) + 2 * ANCHOR_DISTANCE)
+ abs(x1 - x2) + 2 * ANCHOR_DISTANCE, abs(y1 - y2) + 2 * ANCHOR_DISTANCE)
if rect.InsideXY(pt.x, pt.y):
return i, self.Segments[i]
return None
@@ -1976,9 +1976,9 @@
self.EndPoint = [None, vector(self.Points[-1], self.Points[-2])]
# Calculate the start and end points
self.StartPoint[0] = wx.Point(self.Points[0].x + CONNECTOR_SIZE * self.StartPoint[1][0],
- self.Points[0].y + CONNECTOR_SIZE * self.StartPoint[1][1])
+ self.Points[0].y + CONNECTOR_SIZE * self.StartPoint[1][1])
self.EndPoint[0] = wx.Point(self.Points[-1].x + CONNECTOR_SIZE * self.EndPoint[1][0],
- self.Points[-1].y + CONNECTOR_SIZE * self.EndPoint[1][1])
+ self.Points[-1].y + CONNECTOR_SIZE * self.EndPoint[1][1])
self.Points[0] = self.StartPoint[0]
self.Points[-1] = self.EndPoint[0]
# Calculate the segments directions
@@ -2013,9 +2013,9 @@
def GetPoints(self, invert=False):
points = self.VerifyPoints()
points[0] = wx.Point(points[0].x - CONNECTOR_SIZE * self.StartPoint[1][0],
- points[0].y - CONNECTOR_SIZE * self.StartPoint[1][1])
+ points[0].y - CONNECTOR_SIZE * self.StartPoint[1][1])
points[-1] = wx.Point(points[-1].x - CONNECTOR_SIZE * self.EndPoint[1][0],
- points[-1].y - CONNECTOR_SIZE * self.EndPoint[1][1])
+ points[-1].y - CONNECTOR_SIZE * self.EndPoint[1][1])
# An inversion of the list is asked
if invert:
points.reverse()
@@ -2055,9 +2055,9 @@
i = 0
# Calculate the start enad end points with the minimum segment size in the right direction
end = wx.Point(self.EndPoint[0].x + self.EndPoint[1][0] * MIN_SEGMENT_SIZE,
- self.EndPoint[0].y + self.EndPoint[1][1] * MIN_SEGMENT_SIZE)
+ self.EndPoint[0].y + self.EndPoint[1][1] * MIN_SEGMENT_SIZE)
start = wx.Point(self.StartPoint[0].x + self.StartPoint[1][0] * MIN_SEGMENT_SIZE,
- self.StartPoint[0].y + self.StartPoint[1][1] * MIN_SEGMENT_SIZE)
+ self.StartPoint[0].y + self.StartPoint[1][1] * MIN_SEGMENT_SIZE)
# Evaluate the point till it's the last
while i < len(self.Points) - 1:
# The next point is the last
@@ -2069,15 +2069,17 @@
# If the end point is not in the start direction, a point is added
if v_end != self.Segments[0] or v_end == self.EndPoint[1]:
self.Points.insert(1, wx.Point(start.x, start.y))
- self.Segments.insert(1, DirectionChoice((self.Segments[0][1],
- self.Segments[0][0]), v_end, self.EndPoint[1]))
+ self.Segments.insert(1, DirectionChoice(
+ (self.Segments[0][1],
+ self.Segments[0][0]), v_end, self.EndPoint[1]))
# The current point is the second
elif i == 1:
# The previous direction and the target direction are mainly opposed, a point is added
if product(v_end, self.Segments[0]) < 0:
self.Points.insert(2, wx.Point(self.Points[1].x, self.Points[1].y))
- self.Segments.insert(2, DirectionChoice((self.Segments[1][1],
- self.Segments[1][0]), v_end, self.EndPoint[1]))
+ self.Segments.insert(2, DirectionChoice(
+ (self.Segments[1][1],
+ self.Segments[1][0]), v_end, self.EndPoint[1]))
# The previous direction and the end direction are the same or they are
# perpendiculars and the end direction points towards current segment
elif product(self.Segments[0], self.EndPoint[1]) >= 0 and product(self.Segments[1], self.EndPoint[1]) <= 0:
@@ -2089,8 +2091,9 @@
# If the previous direction and the end direction are the same, a point is added
if product(self.Segments[0], self.EndPoint[1]) > 0:
self.Points.insert(2, wx.Point(self.Points[1].x, self.Points[1].y))
- self.Segments.insert(2, DirectionChoice((self.Segments[1][1],
- self.Segments[1][0]), v_end, self.EndPoint[1]))
+ self.Segments.insert(2, DirectionChoice(
+ (self.Segments[1][1],
+ self.Segments[1][0]), v_end, self.EndPoint[1]))
else:
# Current point is positioned in the middle of start point
# and end point on the current direction and a point is added
@@ -2099,8 +2102,9 @@
if self.Segments[0][1] != 0:
self.Points[1].y = (end.y + start.y) / 2
self.Points.insert(2, wx.Point(self.Points[1].x, self.Points[1].y))
- self.Segments.insert(2, DirectionChoice((self.Segments[1][1],
- self.Segments[1][0]), v_end, self.EndPoint[1]))
+ self.Segments.insert(2, DirectionChoice(
+ (self.Segments[1][1],
+ self.Segments[1][0]), v_end, self.EndPoint[1]))
else:
# The previous direction and the end direction are perpendiculars
if product(self.Segments[i - 1], self.EndPoint[1]) == 0:
@@ -2142,8 +2146,12 @@
if self.Segments[1][1] != 0:
self.Points[2].y = (self.Points[1].y + end.y) / 2
self.Points.insert(3, wx.Point(self.Points[2].x, self.Points[2].y))
- self.Segments.insert(3, DirectionChoice((self.Segments[2][1],
- self.Segments[2][0]), v_end, self.EndPoint[1]))
+ self.Segments.insert(
+ 3,
+ DirectionChoice((self.Segments[2][1],
+ self.Segments[2][0]),
+ v_end,
+ self.EndPoint[1]))
else:
# Current point is aligned with end point
if self.Segments[i - 1][0] != 0:
@@ -2163,16 +2171,22 @@
self.Points[i].y = (end.y + self.Points[i - 1].y) / 2
# A point is added
self.Points.insert(i + 1, wx.Point(self.Points[i].x, self.Points[i].y))
- self.Segments.insert(i + 1, DirectionChoice((self.Segments[i][1],
- self.Segments[i][0]), v_end, self.EndPoint[1]))
+ self.Segments.insert(
+ i + 1,
+ DirectionChoice((self.Segments[i][1],
+ self.Segments[i][0]), v_end, self.EndPoint[1]))
else:
# Current point is the first, and second is not mainly in the first direction
if i == 0 and product(vector(start, self.Points[1]), self.Segments[0]) < 0:
# If first and second directions aren't perpendiculars, a point is added
if product(self.Segments[0], self.Segments[1]) != 0:
self.Points.insert(1, wx.Point(start.x, start.y))
- self.Segments.insert(1, DirectionChoice((self.Segments[0][1],
- self.Segments[0][0]), vector(start, self.Points[1]), self.Segments[1]))
+ self.Segments.insert(
+ 1,
+ DirectionChoice((self.Segments[0][1],
+ self.Segments[0][0]),
+ vector(start, self.Points[1]),
+ self.Segments[1]))
else:
self.Points[1].x, self.Points[1].y = start.x, start.y
else:
@@ -2235,9 +2249,9 @@
else:
dir = (0, 0)
pointx = max(-dir[0] * MIN_SEGMENT_SIZE, min(int(round(point[0] * width / float(max(lastwidth, 1)))),
- width - dir[0] * MIN_SEGMENT_SIZE))
+ width - dir[0] * MIN_SEGMENT_SIZE))
pointy = max(-dir[1] * MIN_SEGMENT_SIZE, min(int(round(point[1] * height / float(max(lastheight, 1)))),
- height - dir[1] * MIN_SEGMENT_SIZE))
+ height - dir[1] * MIN_SEGMENT_SIZE))
self.Points[i] = wx.Point(minx + x + pointx, miny + y + pointy)
self.StartPoint[0] = self.Points[0]
self.EndPoint[0] = self.Points[-1]
@@ -2269,10 +2283,12 @@
dir = self.EndPoint[1]
else:
dir = (0, 0)
- realpointx = max(-dir[0] * MIN_SEGMENT_SIZE, min(int(round(point[0])),
- width - dir[0] * MIN_SEGMENT_SIZE))
- realpointy = max(-dir[1] * MIN_SEGMENT_SIZE, min(int(round(point[1])),
- height - dir[1] * MIN_SEGMENT_SIZE))
+ realpointx = max(-dir[0] * MIN_SEGMENT_SIZE,
+ min(int(round(point[0])),
+ width - dir[0] * MIN_SEGMENT_SIZE))
+ realpointy = max(-dir[1] * MIN_SEGMENT_SIZE,
+ min(int(round(point[1])),
+ height - dir[1] * MIN_SEGMENT_SIZE))
self.Points[i] = wx.Point(minx + x + realpointx, miny + y + realpointy)
self.StartPoint[0] = self.Points[0]
self.EndPoint[0] = self.Points[-1]
--- a/graphics/SFC_Objects.py Fri Aug 18 12:36:31 2017 +0300
+++ b/graphics/SFC_Objects.py Fri Aug 18 20:14:38 2017 +0300
@@ -401,7 +401,7 @@
if isinstance(output_block, SFC_Step):
output_block.MoveActionBlock((diffx, diffy))
wires[0][0].SetPoints([wx.Point(current_pos.x, current_pos.y + wire_size),
- wx.Point(current_pos.x, current_pos.y)])
+ wx.Point(current_pos.x, current_pos.y)])
if not isinstance(output_block, SFC_Divergence) or output_block.GetConnectors()["inputs"].index(output) == 0:
output_block.Move(diffx, diffy, self.Parent.Wires)
output_block.RefreshOutputPosition((diffx, diffy))
@@ -1202,10 +1202,11 @@
# Refresh the divergence bounding box
def RefreshBoundingBox(self):
if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
- self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y,
- self.Size[0] + 1, self.Size[1] + 1)
+ self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y,
+ self.Size[0] + 1, self.Size[1] + 1)
elif self.Type in [SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE]:
- self.BoundingBox = wx.Rect(self.Pos.x - SFC_SIMULTANEOUS_SEQUENCE_EXTRA, self.Pos.y,
+ self.BoundingBox = wx.Rect(
+ self.Pos.x - SFC_SIMULTANEOUS_SEQUENCE_EXTRA, self.Pos.y,
self.Size[0] + 2 * SFC_SIMULTANEOUS_SEQUENCE_EXTRA + 1, self.Size[1] + 1)
# Refresh the position of wires connected to divergence
@@ -1593,8 +1594,8 @@
text_width, text_height = self.Parent.GetTextExtent(self.Target)
# Calculate the bounding box size
bbx_width = self.Size[0] + 2 + text_width
- self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y - CONNECTOR_SIZE,
- bbx_width + 1, self.Size[1] + CONNECTOR_SIZE + 1)
+ self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y - CONNECTOR_SIZE,
+ bbx_width + 1, self.Size[1] + CONNECTOR_SIZE + 1)
# Returns the connector connected to input
def GetPreviousConnector(self):
@@ -1917,13 +1918,14 @@
if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
self.Size = wx.Size(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], max(min_height, SFC_ACTION_MIN_SIZE[1], self.Size[1]))
self.MinSize = max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2],
- SFC_ACTION_MIN_SIZE[0]), max(SFC_ACTION_MIN_SIZE[1], min_height)
+ SFC_ACTION_MIN_SIZE[0]), max(SFC_ACTION_MIN_SIZE[1], min_height)
self.RefreshBoundingBox()
else:
self.Size = wx.Size(max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2],
- SFC_ACTION_MIN_SIZE[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1])
+ SFC_ACTION_MIN_SIZE[0]),
+ len(self.Actions) * SFC_ACTION_MIN_SIZE[1])
self.MinSize = max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2],
- SFC_ACTION_MIN_SIZE[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1]
+ SFC_ACTION_MIN_SIZE[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1]
self.RefreshBoundingBox()
if self.Input is not None:
wires = self.Input.GetWires()
@@ -2018,14 +2020,14 @@
# Draw plain rectangle for representing the action block
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
dc.DrawLine(self.Pos.x + colsize[0], self.Pos.y,
- self.Pos.x + colsize[0], self.Pos.y + self.Size[1])
+ self.Pos.x + colsize[0], self.Pos.y + self.Size[1])
dc.DrawLine(self.Pos.x + colsize[0] + colsize[1], self.Pos.y,
- self.Pos.x + colsize[0] + colsize[1], self.Pos.y + self.Size[1])
+ self.Pos.x + colsize[0] + colsize[1], self.Pos.y + self.Size[1])
line_size = self.GetLineSize()
for i, action in enumerate(self.Actions):
if i != 0:
dc.DrawLine(self.Pos.x, self.Pos.y + i * line_size,
- self.Pos.x + self.Size[0], self.Pos.y + i * line_size)
+ self.Pos.x + self.Size[0], self.Pos.y + i * line_size)
qualifier_size = dc.GetTextExtent(action.qualifier)
if action.duration != "":
qualifier_pos = (self.Pos.x + (colsize[0] - qualifier_size[0]) / 2,
--- a/graphics/ToolTipProducer.py Fri Aug 18 12:36:31 2017 +0300
+++ b/graphics/ToolTipProducer.py Fri Aug 18 20:14:38 2017 +0300
@@ -49,8 +49,8 @@
# Timer for firing Tool tip display
self.ToolTipTimer = wx.Timer(self.Parent, -1)
self.Parent.Bind(wx.EVT_TIMER,
- self.OnToolTipTimer,
- self.ToolTipTimer)
+ self.OnToolTipTimer,
+ self.ToolTipTimer)
def __del__(self):
"""
--- a/plcopen/plcopen.py Fri Aug 18 12:36:31 2017 +0300
+++ b/plcopen/plcopen.py Fri Aug 18 20:14:38 2017 +0300
@@ -59,7 +59,8 @@
"""
Define which action qualifier must be associated with a duration
"""
-QualifierList = OrderedDict([("N", False), ("R", False), ("S", False),
+QualifierList = OrderedDict([
+ ("N", False), ("R", False), ("S", False),
("L", True), ("D", True), ("P", False), ("P0", False),
("P1", False), ("SD", True), ("DS", True), ("SL", True)])
@@ -1130,10 +1131,10 @@
for var in block_outputs_xpath(self)])
block_infos["usage"] = ("\n (%s) => (%s)" %
- (", ".join(["%s:%s" % (input[1], input[0])
- for input in block_infos["inputs"]]),
- ", ".join(["%s:%s" % (output[1], output[0])
- for output in block_infos["outputs"]])))
+ (", ".join(["%s:%s" % (input[1], input[0])
+ for input in block_infos["inputs"]]),
+ ", ".join(["%s:%s" % (output[1], output[0])
+ for output in block_infos["outputs"]])))
return block_infos
setattr(cls, "getblockInfos", getblockInfos)
@@ -1961,8 +1962,8 @@
"single": _getBoundingBoxSingle,
"multiple": _getBoundingBoxMultiple},
"translate": {"none": _translate,
- "single": _translateSingle,
- "multiple": _translateMultiple},
+ "single": _translateSingle,
+ "multiple": _translateMultiple},
"filter": {"none": lambda self, connections: None,
"single": _filterConnectionsSingle,
"multiple": _filterConnectionsMultiple},
--- a/plcopen/structures.py Fri Aug 18 12:36:31 2017 +0300
+++ b/plcopen/structures.py Fri Aug 18 20:14:38 2017 +0300
@@ -72,10 +72,10 @@
"""
StdBlckLibs = {libname: LoadProject(tc6fname)[0]
- for libname, tc6fname in StdTC6Libs}
+ for libname, tc6fname in StdTC6Libs}
StdBlckLst = [{"name": libname, "list":
[GetBlockInfos(pous) for pous in lib.getpous()]}
- for libname, lib in StdBlckLibs.iteritems()]
+ for libname, lib in StdBlckLibs.iteritems()]
#-------------------------------------------------------------------------------
# Test identifier
@@ -245,13 +245,13 @@
store = True
for (InTypes, OutTypes) in ANY_TO_ANY_FILTERS.get(filter_name, []):
outs = reduce(lambda a, b: a or b,
- map(lambda testtype: IsOfType(
- Function_decl["outputs"][0][1],
- testtype), OutTypes))
+ map(lambda testtype: IsOfType(
+ Function_decl["outputs"][0][1],
+ testtype), OutTypes))
inps = reduce(lambda a, b: a or b,
- map(lambda testtype: IsOfType(
- Function_decl["inputs"][0][1],
- testtype), InTypes))
+ map(lambda testtype: IsOfType(
+ Function_decl["inputs"][0][1],
+ testtype), InTypes))
if inps and outs and Function_decl["outputs"][0][1] != Function_decl["inputs"][0][1]:
store = True
break
@@ -278,10 +278,10 @@
if len(words) > 1:
desc["comment"] = words[1]
desc["usage"] = ("\n (%s) => (%s)" %
- (", ".join(["%s:%s" % (input[1], input[0])
- for input in desc["inputs"]]),
- ", ".join(["%s:%s" % (output[1], output[0])
- for output in desc["outputs"]])))
+ (", ".join(["%s:%s" % (input[1], input[0])
+ for input in desc["inputs"]]),
+ ", ".join(["%s:%s" % (output[1], output[0])
+ for output in desc["outputs"]])))
BlkLst = StdBlckDct.setdefault(desc["name"], [])
BlkLst.append((section["name"], desc))
@@ -324,16 +324,20 @@
# Keywords for Instruction List
-IL_KEYWORDS = ["TRUE", "FALSE", "LD", "LDN", "ST", "STN", "S", "R", "AND", "ANDN", "OR", "ORN",
- "XOR", "XORN", "NOT", "ADD", "SUB", "MUL", "DIV", "MOD", "GT", "GE", "EQ", "NE",
- "LE", "LT", "JMP", "JMPC", "JMPCN", "CAL", "CALC", "CALCN", "RET", "RETC", "RETCN"]
+IL_KEYWORDS = [
+ "TRUE", "FALSE", "LD", "LDN", "ST", "STN", "S", "R", "AND", "ANDN", "OR", "ORN",
+ "XOR", "XORN", "NOT", "ADD", "SUB", "MUL", "DIV", "MOD", "GT", "GE", "EQ", "NE",
+ "LE", "LT", "JMP", "JMPC", "JMPCN", "CAL", "CALC", "CALCN", "RET", "RETC", "RETCN"
+]
# Keywords for Structured Text
ST_BLOCK_START_KEYWORDS = ["IF", "ELSIF", "ELSE", "CASE", "FOR", "WHILE", "REPEAT"]
ST_BLOCK_END_KEYWORDS = ["END_IF", "END_CASE", "END_FOR", "END_WHILE", "END_REPEAT"]
-ST_KEYWORDS = ["TRUE", "FALSE", "THEN", "OF", "TO", "BY", "DO", "DO", "UNTIL", "EXIT",
- "RETURN", "NOT", "MOD", "AND", "XOR", "OR"] + ST_BLOCK_START_KEYWORDS + ST_BLOCK_END_KEYWORDS
+ST_KEYWORDS = [
+ "TRUE", "FALSE", "THEN", "OF", "TO", "BY", "DO", "DO", "UNTIL", "EXIT",
+ "RETURN", "NOT", "MOD", "AND", "XOR", "OR"
+] + ST_BLOCK_START_KEYWORDS + ST_BLOCK_END_KEYWORDS
# All the keywords of IEC
IEC_BLOCK_START_KEYWORDS = []
--- a/py_ext/PythonFileCTNMixin.py Fri Aug 18 12:36:31 2017 +0300
+++ b/py_ext/PythonFileCTNMixin.py Fri Aug 18 20:14:38 2017 +0300
@@ -115,7 +115,8 @@
"pyextname": pyextname},
self.CodeFile.variables.variable)
# python side PLC global variables access stub
- globalstubs = "\n".join(["""\
+ globalstubs = "\n".join([
+ """\
_%(name)s_ctype, _%(name)s_unpack, _%(name)s_pack = \\
TypeTranslator["%(IECtype)s"]
_PySafeGetPLCGlob_%(name)s = PLCBinary.__SafeGetPLCGlob_%(name)s
@@ -130,8 +131,7 @@
%(desc)s,
%(onchange)s,
%(opts)s))
-""" % varinfo
- for varinfo in varinfos])
+""" % varinfo for varinfo in varinfos])
# Runtime calls (start, stop, init, and cleanup)
rtcalls = ""
@@ -173,7 +173,7 @@
# write generated content to python file
runtimefile_path = os.path.join(buildpath,
- "runtime_%s.py" % location_str)
+ "runtime_%s.py" % location_str)
runtimefile = open(runtimefile_path, 'w')
runtimefile.write(PyFileContent.encode('utf-8'))
runtimefile.close()
--- a/runtime/PLCObject.py Fri Aug 18 12:36:31 2017 +0300
+++ b/runtime/PLCObject.py Fri Aug 18 20:14:38 2017 +0300
@@ -123,10 +123,10 @@
if self._GetLogMessage is not None:
maxsz = len(self._log_read_buffer)-1
sz = self._GetLogMessage(level, msgid,
- self._log_read_buffer, maxsz,
- ctypes.byref(tick),
- ctypes.byref(tv_sec),
- ctypes.byref(tv_nsec))
+ self._log_read_buffer, maxsz,
+ ctypes.byref(tick),
+ ctypes.byref(tv_sec),
+ ctypes.byref(tv_nsec))
if sz and sz <= maxsz:
self._log_read_buffer[sz] = '\x00'
return self._log_read_buffer.value, tick.value, tv_sec.value, tv_nsec.value
@@ -349,8 +349,8 @@
result, exp = self.evaluator(eval, AST, self.python_runtime_vars)
if exp is not None:
res = "#EXCEPTION : "+str(exp[1])
- self.LogMessage(1, ('PyEval@0x%x(Code="%s") Exception "%s"') % (FBID, cmd,
- '\n'.join(traceback.format_exception(*exp))))
+ self.LogMessage(1, ('PyEval@0x%x(Code="%s") Exception "%s"') % (
+ FBID, cmd, '\n'.join(traceback.format_exception(*exp))))
else:
res = str(result)
self.python_runtime_vars["FBID"] = None
--- a/svgui/pyjs/build.py Fri Aug 18 12:36:31 2017 +0300
+++ b/svgui/pyjs/build.py Fri Aug 18 20:14:38 2017 +0300
@@ -672,27 +672,58 @@
global app_platforms
parser = OptionParser(usage=usage, version=version)
- parser.add_option("-o", "--output", dest="output",
- help="directory to which the webapp should be written")
- parser.add_option("-j", "--include-js", dest="js_includes", action="append",
- help="javascripts to load into the same frame as the rest of the script")
- parser.add_option("-I", "--library_dir", dest="library_dirs",
- action="append", help="additional paths appended to PYJSPATH")
- parser.add_option("-D", "--data_dir", dest="data_dir",
- help="path for data directory")
- parser.add_option("-m", "--dynamic-modules", action="store_true",
- dest="dynamic", default=False,
- help="Split output into separate dynamically-loaded modules (experimental)")
- parser.add_option("-P", "--platforms", dest="platforms",
- help="platforms to build for, comma-separated")
- parser.add_option("-d", "--debug", action="store_true", dest="debug")
- parser.add_option("-O", "--optimize", action="store_true",
- dest="optimize", default=False,
+ parser.add_option("-o",
+ "--output",
+ dest="output",
+ help="directory to which the webapp should be written"
+ )
+ parser.add_option("-j",
+ "--include-js",
+ dest="js_includes",
+ action="append",
+ help="javascripts to load into the same frame as the rest of the script"
+ )
+ parser.add_option("-I",
+ "--library_dir",
+ dest="library_dirs",
+ action="append",
+ help="additional paths appended to PYJSPATH"
+ )
+ parser.add_option("-D",
+ "--data_dir",
+ dest="data_dir",
+ help="path for data directory"
+ )
+ parser.add_option("-m",
+ "--dynamic-modules",
+ action="store_true",
+ dest="dynamic",
+ default=False,
+ help="Split output into separate dynamically-loaded modules (experimental)"
+ )
+ parser.add_option("-P",
+ "--platforms",
+ dest="platforms",
+ help="platforms to build for, comma-separated"
+ )
+ parser.add_option("-d",
+ "--debug",
+ action="store_true",
+ dest="debug"
+ )
+ parser.add_option("-O",
+ "--optimize",
+ action="store_true",
+ dest="optimize",
+ default=False,
help="Optimize generated code (removes all print statements)",
- )
- parser.add_option("-c", "--cache_buster", action="store_true",
- dest="cache_buster",
- help="Enable browser cache-busting (MD5 hash added to output filenames)")
+ )
+ parser.add_option("-c",
+ "--cache_buster",
+ action="store_true",
+ dest="cache_buster",
+ help="Enable browser cache-busting (MD5 hash added to output filenames)"
+ )
parser.set_defaults(output="output", js_includes=[], library_dirs=[],
platforms=(','.join(app_platforms)),
--- a/svgui/pyjs/pyjs.py Fri Aug 18 12:36:31 2017 +0300
+++ b/svgui/pyjs/pyjs.py Fri Aug 18 20:14:38 2017 +0300
@@ -797,19 +797,19 @@
#self._method(init_method, current_klass, class_name)
# Generate a function which constructs the object
- clsfunc = ast.Function([],
- node.name,
- init_method.argnames[1:],
- init_method.defaults,
- init_method.flags,
- None,
- [ast.Discard(ast.CallFunc(ast.Name("JS"), [ast.Const(
-# I attempted lazy initialization, but then you can't access static class members
-# " if(!__"+base_class+".__was_initialized__)"+
-# " __" + class_name + "_initialize();\n" +
+ clsfunc = ast.Function(
+ [], node.name,
+ init_method.argnames[1:],
+ init_method.defaults,
+ init_method.flags,
+ None,
+ [ast.Discard(ast.CallFunc(ast.Name("JS"), [ast.Const(
+ # I attempted lazy initialization, but then you can't access static class members
+ # " if(!__"+base_class+".__was_initialized__)"+
+ # " __" + class_name + "_initialize();\n" +
" var instance = new " + UU + class_name_ + "();\n" +
- " if(instance.__init__) instance.__init__.apply(instance, arguments);\n" +
- " return instance;"
+ " if(instance.__init__) instance.__init__.apply(instance, arguments);\n" +
+ " return instance;"
)]))])
self._function(clsfunc, False)
--- a/targets/typemapping.py Fri Aug 18 12:36:31 2017 +0300
+++ b/targets/typemapping.py Fri Aug 18 20:14:38 2017 +0300
@@ -104,7 +104,7 @@
if c_type is not None and buffoffset < buffsize:
cursor = c_void_p(buffptr + buffoffset)
value = unpack_func(cast(cursor,
- POINTER(c_type)).contents)
+ POINTER(c_type)).contents)
buffoffset += sizeof(c_type) if iectype != "STRING" else len(value)+1
res.append(value)
else:
--- a/version.py Fri Aug 18 12:36:31 2017 +0300
+++ b/version.py Fri Aug 18 20:14:38 2017 +0300
@@ -30,14 +30,16 @@
def GetCommunityHelpMsg():
- return _("The best place to ask questions about Beremiz/PLCOpenEditor\n"
- "is project's mailing list: beremiz-devel@lists.sourceforge.net\n"
- "\n"
- "This is the main community support channel.\n"
- "For posting it is required to be subscribed to the mailing list.\n"
- "\n"
- "You can subscribe to the list here:\n"
- "https://lists.sourceforge.net/lists/listinfo/beremiz-devel")
+ return _(
+ "The best place to ask questions about Beremiz/PLCOpenEditor\n"
+ "is project's mailing list: beremiz-devel@lists.sourceforge.net\n"
+ "\n"
+ "This is the main community support channel.\n"
+ "For posting it is required to be subscribed to the mailing list.\n"
+ "\n"
+ "You can subscribe to the list here:\n"
+ "https://lists.sourceforge.net/lists/listinfo/beremiz-devel"
+ )
def GetAppRevision():
@@ -84,24 +86,27 @@
"implemented IEC 61131 IDE with constantly growing set of extensions "
"and flexible PLC runtime.")
- info.Developers = ("Andrey Skvortsov <andrej.skvortzov@gmail.com>",
- "Sergey Surkov <surkov.sv@summatechnology.ru>",
- "Edouard Tisserant <edouard.tisserant@gmail.com>",
- "Laurent Bessard <laurent.bessard@gmail.com>")
+ info.Developers = (
+ "Andrey Skvortsov <andrej.skvortzov@gmail.com>",
+ "Sergey Surkov <surkov.sv@summatechnology.ru>",
+ "Edouard Tisserant <edouard.tisserant@gmail.com>",
+ "Laurent Bessard <laurent.bessard@gmail.com>")
- info.License = ('\n This program is free software; you can redistribute it and/or\n'
- ' modify it under the terms of the GNU General Public License\n'
- ' as published by the Free Software Foundation; either version 2\n'
- ' of the License, or (at your option) any later version.\n'
- '\n'
- ' This program is distributed in the hope that it will be useful,\n'
- ' but WITHOUT ANY WARRANTY; without even the implied warranty of\n'
- ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n'
- ' GNU General Public License below for more details.\n'
- '\n'
- '\n'
- '\n'
- '')
+ info.License = (
+ '\n This program is free software; you can redistribute it and/or\n'
+ ' modify it under the terms of the GNU General Public License\n'
+ ' as published by the Free Software Foundation; either version 2\n'
+ ' of the License, or (at your option) any later version.\n'
+ '\n'
+ ' This program is distributed in the hope that it will be useful,\n'
+ ' but WITHOUT ANY WARRANTY; without even the implied warranty of\n'
+ ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n'
+ ' GNU General Public License below for more details.\n'
+ '\n'
+ '\n'
+ '\n'
+ ''
+ )
# read license file
path = paths.AbsDir(__file__)
@@ -113,13 +118,14 @@
info.Icon = wx.Icon(os.path.join(path, "images", "about_brz_logo.png"), wx.BITMAP_TYPE_PNG)
- info.Translators = ("Russian\t- Andrey Skvortsov <andrej.skvortzov@gmail.com>",
- "Korean\t- Reinhard Lee <lij3105@gmail.com>",
- "German\t- Mark Muzenhardt <mark.muzenhardt@gmail.com>",
- "French\t- Laurent Bessard <laurent.bessard@gmail.com>",
- " \t Fabien M <mail@fabienm.eu>",
- "Slovenian\t- Janez Pregelj",
- "Portuguese\t- Thiago Alves <thiagoralves@gmail.com>"
+ info.Translators = (
+ "Russian\t- Andrey Skvortsov <andrej.skvortzov@gmail.com>",
+ "Korean\t- Reinhard Lee <lij3105@gmail.com>",
+ "German\t- Mark Muzenhardt <mark.muzenhardt@gmail.com>",
+ "French\t- Laurent Bessard <laurent.bessard@gmail.com>",
+ " \t Fabien M <mail@fabienm.eu>",
+ "Slovenian\t- Janez Pregelj",
+ "Portuguese\t- Thiago Alves <thiagoralves@gmail.com>"
)
return info
--- a/wxglade_hmi/wxglade_hmi.py Fri Aug 18 12:36:31 2017 +0300
+++ b/wxglade_hmi/wxglade_hmi.py Fri Aug 18 20:14:38 2017 +0300
@@ -120,8 +120,8 @@
define_hmi = ""
declare_hmi = "\n".join(["%(name)s = None\n" % x +
- "\n".join(["%(class)s.%(h)s = %(h)s" %
- dict(x, h=h) for h in x['handlers']])
+ "\n".join(["%(class)s.%(h)s = %(h)s" %
+ dict(x, h=h) for h in x['handlers']])
for x in hmi_frames])
global_hmi = ("global %s\n" % ",".join(
[x["name"] for x in hmi_frames])
--- a/xmlclass/xmlclass.py Fri Aug 18 12:36:31 2017 +0300
+++ b/xmlclass/xmlclass.py Fri Aug 18 20:14:38 2017 +0300
@@ -1004,8 +1004,8 @@
def GetEquivalentParents(self, parent):
return reduce(lambda x, y: x + y,
- [[p] + self.GetEquivalentParents(p)
- for p in self.EquivalentClassesParent.get(parent, {}).keys()], [])
+ [[p] + self.GetEquivalentParents(p)
+ for p in self.EquivalentClassesParent.get(parent, {}).keys()], [])
"""
Methods that generates the classes
@@ -1310,8 +1310,8 @@
values = self.findall(element_name)
if element_infos["elmt_type"]["type"] == SIMPLETYPE:
return map(lambda value:
- element_infos["elmt_type"]["extract"](value.text, extract=False),
- values)
+ element_infos["elmt_type"]["extract"](value.text, extract=False),
+ values)
return values
else:
value = self.find(element_name)
@@ -1421,7 +1421,9 @@
attr_list.extend(classinfos["base"].getElementAttributes(self))
for attr in classinfos["attributes"]:
if attr["use"] != "prohibited":
- attr_params = {"name": attr["name"], "use": attr["use"],
+ attr_params = {
+ "name": attr["name"],
+ "use": attr["use"],
"type": gettypeinfos(attr["attr_type"]["basename"], attr["attr_type"]["facets"]),
"value": getattr(self, attr["name"], "")}
attr_list.append(attr_params)
@@ -1487,7 +1489,9 @@
if self.content is not None:
children.extend(self.content.getElementInfos(value)["children"])
elif element["elmt_type"]["type"] == SIMPLETYPE:
- children.append({"name": element_name, "require": element["minOccurs"] != 0,
+ children.append({
+ "name": element_name,
+ "require": element["minOccurs"] != 0,
"type": gettypeinfos(element["elmt_type"]["basename"],
element["elmt_type"]["facets"]),
"value": getattr(self, element_name, None)})
@@ -1515,8 +1519,8 @@
elif attributes[parts[0]]["use"] == "optional" and value == "":
if "default" in attributes[parts[0]]:
setattr(self, parts[0],
- attributes[parts[0]]["attr_type"]["extract"](
- attributes[parts[0]]["default"], False))
+ attributes[parts[0]]["attr_type"]["extract"](
+ attributes[parts[0]]["default"], False))
else:
setattr(self, parts[0], None)
else:
@@ -1757,8 +1761,8 @@
def lookup(self, document, element):
parent = element.getparent()
- element_class = self.GetElementClass(element.tag,
- parent.tag if parent is not None else None)
+ element_class = self.GetElementClass(
+ element.tag, parent.tag if parent is not None else None)
if isinstance(element_class, ListType):
children = "".join([
"%s " % etree.QName(child.tag).localname
--- a/xmlclass/xsdschema.py Fri Aug 18 12:36:31 2017 +0300
+++ b/xmlclass/xsdschema.py Fri Aug 18 20:14:38 2017 +0300
@@ -75,8 +75,8 @@
STRING_FACETS = GenerateDictFacets(DEFAULT_FACETS.keys() + ["length", "minLength", "maxLength"])
ALL_FACETS = ["pattern", "whiteSpace", "enumeration", "maxInclusive",
- "maxExclusive", "minInclusive", "minExclusive", "totalDigits",
- "fractionDigits", "length", "minLength", "maxLength"]
+ "maxExclusive", "minInclusive", "minExclusive", "totalDigits",
+ "fractionDigits", "length", "minLength", "maxLength"]
#-------------------------------------------------------------------------------
@@ -1143,7 +1143,8 @@
# Syntax elements definition
#-------------------------------------------------------------------------------
- "all": {"struct": """
+ "all": {
+ "struct": """
<all
id = ID
maxOccurs = 1 : 1
@@ -1153,13 +1154,15 @@
</all>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("all", ["id", "maxOccurs", "minOccurs"],
+ "default": GenerateElement(
+ "all", ["id", "maxOccurs", "minOccurs"],
re.compile("((?:annotation )?(?:element )*)"))
},
"reduce": ReduceAll
},
- "annotation": {"struct": """
+ "annotation": {
+ "struct": """
<annotation
id = ID
{any attributes with non-schema namespace . . .}>
@@ -1167,13 +1170,15 @@
</annotation>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("annotation", ["id"],
+ "default": GenerateElement(
+ "annotation", ["id"],
re.compile("((?:app_info |documentation )*)"))
},
"reduce": ReduceAnnotation
},
- "any": {"struct": """
+ "any": {
+ "struct": """
<any
id = ID
maxOccurs = (nonNegativeInteger | unbounded) : 1
@@ -1185,14 +1190,16 @@
</any>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("any",
+ "default": GenerateElement(
+ "any",
["id", "maxOccurs", "minOccurs", "namespace", "processContents"],
re.compile("((?:annotation )?(?:simpleType )*)"))
},
"reduce": ReduceAny
},
- "anyAttribute": {"struct": """
+ "anyAttribute": {
+ "struct": """
<anyAttribute
id = ID
namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) ) : ##any
@@ -1202,13 +1209,14 @@
</anyAttribute>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("anyAttribute",
- ["id", "namespace", "processContents"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "anyAttribute", ["id", "namespace", "processContents"], ONLY_ANNOTATION)
},
"reduce": ReduceAnyAttribute
},
- "appinfo": {"struct": """
+ "appinfo": {
+ "struct": """
<appinfo
source = anyURI
{any attributes with non-schema namespace . . .}>
@@ -1221,7 +1229,8 @@
"reduce": ReduceAppInfo
},
- "attribute": {"struct": """
+ "attribute": {
+ "struct": """
<attribute
default = string
fixed = string
@@ -1236,17 +1245,20 @@
</attribute>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("attribute",
+ "default": GenerateElement(
+ "attribute",
["default", "fixed", "form", "id", "name", "ref", "type", "use"],
re.compile("((?:annotation )?(?:simpleType )?)")),
- "schema": GenerateElement("attribute",
+ "schema": GenerateElement(
+ "attribute",
["default", "fixed", "form", "id", "name", "type"],
re.compile("((?:annotation )?(?:simpleType )?)"))
},
"reduce": ReduceAttribute
},
- "attributeGroup": {"struct": """
+ "attributeGroup": {
+ "struct": """
<attributeGroup
id = ID
name = NCName
@@ -1256,16 +1268,19 @@
</attributeGroup>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("attributeGroup",
+ "default": GenerateElement(
+ "attributeGroup",
["id", "ref"], ONLY_ANNOTATION),
- "schema": GenerateElement("attributeGroup",
+ "schema": GenerateElement(
+ "attributeGroup",
["id", "name"],
re.compile("((?:annotation )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))"))
},
"reduce": ReduceAttributeGroup
},
- "choice": {"struct": """
+ "choice": {
+ "struct": """
<choice
id = ID
maxOccurs = (nonNegativeInteger | unbounded) : 1
@@ -1275,13 +1290,16 @@
</choice>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("choice", ["id", "maxOccurs", "minOccurs"],
+ "default": GenerateElement(
+ "choice",
+ ["id", "maxOccurs", "minOccurs"],
re.compile("((?:annotation )?(?:element |group |choice |sequence |any )*)"))
},
"reduce": ReduceChoice
},
- "complexContent": {"struct": """
+ "complexContent": {
+ "struct": """
<complexContent
id = ID
mixed = boolean
@@ -1290,13 +1308,16 @@
</complexContent>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("complexContent", ["id", "mixed"],
+ "default": GenerateElement(
+ "complexContent",
+ ["id", "mixed"],
re.compile("((?:annotation )?(?:restriction |extension ))"))
},
"reduce": ReduceComplexContent
},
- "complexType": {"struct": """
+ "complexType": {
+ "struct": """
<complexType
abstract = boolean : false
block = (#all | List of (extension | restriction))
@@ -1309,14 +1330,16 @@
</complexType>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("complexType",
+ "default": GenerateElement(
+ "complexType",
["abstract", "block", "final", "id", "mixed", "name"],
re.compile("((?:annotation )?(?:simpleContent |complexContent |(?:(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))))"))
},
"reduce": ReduceComplexType
},
- "documentation": {"struct": """
+ "documentation": {
+ "struct": """
<documentation
source = anyURI
xml:lang = language
@@ -1325,13 +1348,16 @@
</documentation>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("documentation",
- ["source", "lang"], re.compile("(.*)"), True)
+ "default": GenerateElement(
+ "documentation",
+ ["source", "lang"],
+ re.compile("(.*)"), True)
},
"reduce": ReduceDocumentation
},
- "element": {"struct": """
+ "element": {
+ "struct": """
<element
abstract = boolean : false
block = (#all | List of (extension | restriction | substitution))
@@ -1352,17 +1378,20 @@
</element>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("element",
+ "default": GenerateElement(
+ "element",
["abstract", "block", "default", "final", "fixed", "form", "id", "maxOccurs", "minOccurs", "name", "nillable", "ref", "substitutionGroup", "type"],
re.compile("((?:annotation )?(?:simpleType |complexType )?(?:unique |key |keyref )*)")),
- "schema": GenerateElement("element",
+ "schema": GenerateElement(
+ "element",
["abstract", "block", "default", "final", "fixed", "form", "id", "name", "nillable", "substitutionGroup", "type"],
re.compile("((?:annotation )?(?:simpleType |complexType )?(?:unique |key |keyref )*)"))
},
"reduce": ReduceElement
},
- "enumeration": {"struct": """
+ "enumeration": {
+ "struct": """
<enumeration
id = ID
value = anySimpleType
@@ -1376,7 +1405,8 @@
"reduce": GenerateFacetReducing("enumeration", False)
},
- "extension": {"struct": """
+ "extension": {
+ "struct": """
<extension
base = QName
id = ID
@@ -1385,15 +1415,20 @@
</extension>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("extension", ["base", "id"],
+ "default": GenerateElement(
+ "extension",
+ ["base", "id"],
re.compile("((?:annotation )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))")),
- "complexContent": GenerateElement("extension", ["base", "id"],
+ "complexContent": GenerateElement(
+ "extension",
+ ["base", "id"],
re.compile("((?:annotation )?(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))"))
},
"reduce": ReduceExtension
},
- "field": {"struct": """
+ "field": {
+ "struct": """
<field
id = ID
xpath = a subset of XPath expression, see below
@@ -1407,7 +1442,8 @@
"reduce": ReduceField
},
- "fractionDigits": {"struct": """
+ "fractionDigits": {
+ "struct": """
<fractionDigits
fixed = boolean : false
id = ID
@@ -1417,13 +1453,16 @@
</fractionDigits>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("fractionDigits",
- ["fixed", "id", "value"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "fractionDigits",
+ ["fixed", "id", "value"],
+ ONLY_ANNOTATION)
},
"reduce": GenerateFacetReducing("fractionDigits", True)
},
- "group": {"struct": """
+ "group": {
+ "struct": """
<group
id = ID
maxOccurs = (nonNegativeInteger | unbounded) : 1
@@ -1435,17 +1474,20 @@
</group>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("group",
+ "default": GenerateElement(
+ "group",
["id", "maxOccurs", "minOccurs", "ref"],
re.compile("((?:annotation )?(?:all |choice |sequence )?)")),
- "schema": GenerateElement("group",
+ "schema": GenerateElement(
+ "group",
["id", "name"],
re.compile("((?:annotation )?(?:all |choice |sequence )?)"))
},
"reduce": ReduceGroup
},
- "import": {"struct": """
+ "import": {
+ "struct": """
<import
id = ID
namespace = anyURI
@@ -1455,13 +1497,16 @@
</import>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("import",
- ["id", "namespace", "schemaLocation"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "import",
+ ["id", "namespace", "schemaLocation"],
+ ONLY_ANNOTATION)
},
"reduce": ReduceImport
},
- "include": {"struct": """
+ "include": {
+ "struct": """
<include
id = ID
schemaLocation = anyURI
@@ -1470,13 +1515,16 @@
</include>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("include",
- ["id", "schemaLocation"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "include",
+ ["id", "schemaLocation"],
+ ONLY_ANNOTATION)
},
"reduce": ReduceInclude
},
- "key": {"struct": """
+ "key": {
+ "struct": """
<key
id = ID
name = NCName
@@ -1485,13 +1533,15 @@
</key>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("key", ["id", "name"],
+ "default": GenerateElement(
+ "key", ["id", "name"],
re.compile("((?:annotation )?(?:selector (?:field )+))"))
},
"reduce": ReduceKey
},
- "keyref": {"struct": """
+ "keyref": {
+ "struct": """
<keyref
id = ID
name = NCName
@@ -1501,13 +1551,15 @@
</keyref>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("keyref", ["id", "name", "refer"],
+ "default": GenerateElement(
+ "keyref", ["id", "name", "refer"],
re.compile("((?:annotation )?(?:selector (?:field )+))"))
},
"reduce": ReduceKeyRef
},
- "length": {"struct": """
+ "length": {
+ "struct": """
<length
fixed = boolean : false
id = ID
@@ -1517,13 +1569,14 @@
</length>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("length",
- ["fixed", "id", "value"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "length", ["fixed", "id", "value"], ONLY_ANNOTATION)
},
"reduce": GenerateFacetReducing("length", True)
},
- "list": {"struct": """
+ "list": {
+ "struct": """
<list
id = ID
itemType = QName
@@ -1532,13 +1585,15 @@
</list>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("list", ["id", "itemType"],
+ "default": GenerateElement(
+ "list", ["id", "itemType"],
re.compile("((?:annotation )?(?:simpleType )?)$"))
},
"reduce": ReduceList
},
- "maxExclusive": {"struct": """
+ "maxExclusive": {
+ "struct": """
<maxInclusive
fixed = boolean : false
id = ID
@@ -1548,13 +1603,14 @@
</maxInclusive>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("maxExclusive",
- ["fixed", "id", "value"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "maxExclusive", ["fixed", "id", "value"], ONLY_ANNOTATION)
},
"reduce": GenerateFacetReducing("maxExclusive", True)
},
- "maxInclusive": {"struct": """
+ "maxInclusive": {
+ "struct": """
<maxExclusive
fixed = boolean : false
id = ID
@@ -1564,13 +1620,14 @@
</maxExclusive>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("maxInclusive",
- ["fixed", "id", "value"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "maxInclusive", ["fixed", "id", "value"], ONLY_ANNOTATION)
},
"reduce": GenerateFacetReducing("maxInclusive", True)
},
- "maxLength": {"struct": """
+ "maxLength": {
+ "struct": """
<maxLength
fixed = boolean : false
id = ID
@@ -1580,13 +1637,14 @@
</maxLength>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("maxLength",
- ["fixed", "id", "value"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "maxLength", ["fixed", "id", "value"], ONLY_ANNOTATION)
},
"reduce": GenerateFacetReducing("maxLength", True)
},
- "minExclusive": {"struct": """
+ "minExclusive": {
+ "struct": """
<minExclusive
fixed = boolean : false
id = ID
@@ -1596,13 +1654,14 @@
</minExclusive>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("minExclusive",
- ["fixed", "id", "value"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "minExclusive", ["fixed", "id", "value"], ONLY_ANNOTATION)
},
"reduce": GenerateFacetReducing("minExclusive", True)
},
- "minInclusive": {"struct": """
+ "minInclusive": {
+ "struct": """
<minInclusive
fixed = boolean : false
id = ID
@@ -1612,13 +1671,14 @@
</minInclusive>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("minInclusive",
- ["fixed", "id", "value"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "minInclusive", ["fixed", "id", "value"], ONLY_ANNOTATION)
},
"reduce": GenerateFacetReducing("minInclusive", True)
},
- "minLength": {"struct": """
+ "minLength": {
+ "struct": """
<minLength
fixed = boolean : false
id = ID
@@ -1628,13 +1688,14 @@
</minLength>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("minLength",
- ["fixed", "id", "value"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "minLength", ["fixed", "id", "value"], ONLY_ANNOTATION)
},
"reduce": GenerateFacetReducing("minLength", True)
},
- "pattern": {"struct": """
+ "pattern": {
+ "struct": """
<pattern
id = ID
value = string
@@ -1648,7 +1709,8 @@
"reduce": GenerateFacetReducing("pattern", False)
},
- "redefine": {"struct": """
+ "redefine": {
+ "struct": """
<redefine
id = ID
schemaLocation = anyURI
@@ -1657,13 +1719,15 @@
</redefine>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("refine", ["id", "schemaLocation"],
+ "default": GenerateElement(
+ "refine", ["id", "schemaLocation"],
re.compile("((?:annotation |(?:simpleType |complexType |group |attributeGroup ))*)"))
},
"reduce": ReduceRedefine
},
- "restriction": {"struct": """
+ "restriction": {
+ "struct": """
<restriction
base = QName
id = ID
@@ -1672,17 +1736,24 @@
</restriction>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("restriction", ["base", "id"],
+ "default": GenerateElement(
+ "restriction",
+ ["base", "id"],
re.compile("((?:annotation )?(?:(?:simpleType )?(?:(?:minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern )*)))")),
- "simpleContent": GenerateElement("restriction", ["base", "id"],
+ "simpleContent": GenerateElement(
+ "restriction",
+ ["base", "id"],
re.compile("((?:annotation )?(?:(?:simpleType )?(?:(?:minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern )*)?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?)))")),
- "complexContent": GenerateElement("restriction", ["base", "id"],
+ "complexContent": GenerateElement(
+ "restriction",
+ ["base", "id"],
re.compile("((?:annotation )?(?:(?:simpleType )?(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?)))")),
},
"reduce": ReduceRestriction
},
- "schema": {"struct": """
+ "schema": {
+ "struct": """
<schema
attributeFormDefault = (qualified | unqualified) : unqualified
blockDefault = (#all | List of (extension | restriction | substitution)) : ''
@@ -1697,13 +1768,22 @@
</schema>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("schema",
- ["attributeFormDefault", "blockDefault", "elementFormDefault", "finalDefault", "id", "targetNamespace", "version", "lang"],
+ "default": GenerateElement(
+ "schema",
+ ["attributeFormDefault",
+ "blockDefault",
+ "elementFormDefault",
+ "finalDefault",
+ "id",
+ "targetNamespace",
+ "version",
+ "lang"],
re.compile("((?:include |import |redefine |annotation )*(?:(?:(?:simpleType |complexType |group |attributeGroup )|element |attribute |annotation )(?:annotation )*)*)"))
}
},
- "selector": {"struct": """
+ "selector": {
+ "struct": """
<selector
id = ID
xpath = a subset of XPath expression, see below
@@ -1717,7 +1797,8 @@
"reduce": ReduceSelector
},
- "sequence": {"struct": """
+ "sequence": {
+ "struct": """
<sequence
id = ID
maxOccurs = (nonNegativeInteger | unbounded) : 1
@@ -1727,13 +1808,15 @@
</sequence>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("sequence", ["id", "maxOccurs", "minOccurs"],
+ "default": GenerateElement(
+ "sequence", ["id", "maxOccurs", "minOccurs"],
re.compile("((?:annotation )?(?:element |group |choice |sequence |any )*)"))
},
"reduce": ReduceSequence
},
- "simpleContent": {"struct": """
+ "simpleContent": {
+ "struct": """
<simpleContent
id = ID
{any attributes with non-schema namespace . . .}>
@@ -1741,13 +1824,15 @@
</simpleContent>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("simpleContent", ["id"],
+ "default": GenerateElement(
+ "simpleContent", ["id"],
re.compile("((?:annotation )?(?:restriction |extension ))"))
},
"reduce": ReduceSimpleContent
},
- "simpleType": {"struct": """
+ "simpleType": {
+ "struct": """
<simpleType
final = (#all | List of (list | union | restriction))
id = ID
@@ -1757,13 +1842,15 @@
</simpleType>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("simpleType", ["final", "id", "name"],
+ "default": GenerateElement(
+ "simpleType", ["final", "id", "name"],
re.compile("((?:annotation )?(?:restriction |list |union ))"))
},
"reduce": ReduceSimpleType
},
- "totalDigits": {"struct": """
+ "totalDigits": {
+ "struct": """
<totalDigits
fixed = boolean : false
id = ID
@@ -1773,13 +1860,14 @@
</totalDigits>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("totalDigits",
- ["fixed", "id", "value"], ONLY_ANNOTATION),
+ "default": GenerateElement(
+ "totalDigits", ["fixed", "id", "value"], ONLY_ANNOTATION),
},
"reduce": GenerateFacetReducing("totalDigits", True)
},
- "union": {"struct": """
+ "union": {
+ "struct": """
<union
id = ID
memberTypes = List of QName
@@ -1788,13 +1876,15 @@
</union>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("union", ["id", "memberTypes"],
+ "default": GenerateElement(
+ "union", ["id", "memberTypes"],
re.compile("((?:annotation )?(?:simpleType )*)"))
},
"reduce": ReduceUnion
},
- "unique": {"struct": """
+ "unique": {
+ "struct": """
<unique
id = ID
name = NCName
@@ -1803,13 +1893,15 @@
</unique>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("unique", ["id", "name"],
+ "default": GenerateElement(
+ "unique", ["id", "name"],
re.compile("((?:annotation )?(?:selector |(?:field )+))"))
},
"reduce": ReduceUnique
},
- "whiteSpace": {"struct": """
+ "whiteSpace": {
+ "struct": """
<whiteSpace
fixed = boolean : false
id = ID
@@ -1819,8 +1911,8 @@
</whiteSpace>""",
"type": SYNTAXELEMENT,
"extract": {
- "default": GenerateElement("whiteSpace",
- ["fixed", "id", "value"], ONLY_ANNOTATION)
+ "default": GenerateElement(
+ "whiteSpace", ["fixed", "id", "value"], ONLY_ANNOTATION)
},
"reduce": GenerateFacetReducing("whiteSpace", True)
},
@@ -1842,7 +1934,8 @@
"attributeFormDefault": {
"type": SYNTAXATTRIBUTE,
"extract": {
- "default": GenerateEnumeratedExtraction("member attributeFormDefault", ["qualified", "unqualified"])
+ "default": GenerateEnumeratedExtraction(
+ "member attributeFormDefault", ["qualified", "unqualified"])
},
"default": {
"default": "unqualified"