--- a/BeremizIDE.py Sat Aug 19 21:06:54 2017 +0300
+++ b/BeremizIDE.py Mon Aug 21 21:55:18 2017 +0300
@@ -367,12 +367,12 @@
self.MainTabs["LogConsole"] = (self.LogConsole, _("Console"))
self.BottomNoteBook.AddPage(*self.MainTabs["LogConsole"])
- #self.BottomNoteBook.Split(self.BottomNoteBook.GetPageIndex(self.LogConsole), wx.RIGHT)
+ # self.BottomNoteBook.Split(self.BottomNoteBook.GetPageIndex(self.LogConsole), wx.RIGHT) self.LogViewer = LogViewer(self.BottomNoteBook, self)
self.MainTabs["LogViewer"] = (self.LogViewer, _("PLC Log"))
self.BottomNoteBook.AddPage(*self.MainTabs["LogViewer"])
- #self.BottomNoteBook.Split(self.BottomNoteBook.GetPageIndex(self.LogViewer), wx.RIGHT)
+ # 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)
@@ -1076,9 +1076,9 @@
self._Refresh(TITLE, FILEMENU, PROJECTTREE)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Highlights showing functions
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- def ShowHighlight(self, infos, start, end, highlight_type):
config_name = self.Controler.GetProjectMainConfigurationName()
@@ -1092,9 +1092,9 @@
IDEFrame.ShowHighlight(self, infos, start, end, highlight_type)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- -#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- @@ -1198,7 +1198,7 @@
bug_report_path = path + os.sep + "bug_report_" + time.strftime("%Y_%m_%d__%H-%M-%S") + ".txt"
save_bug_report(e_type, e_value, e_traceback, bug_report_path, date)
Display_Exception_Dialog(e_type, e_value, e_traceback, bug_report_path)
- #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args)
+ # sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args) sys.excepthook = handle_exception
init_old = threading.Thread.__init__
--- a/IDEFrame.py Sat Aug 19 21:06:54 2017 +0300
+++ b/IDEFrame.py Mon Aug 21 21:55:18 2017 +0300
@@ -72,9 +72,9 @@
ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE,
] = [wx.NewId() for _init_coll_DisplayMenu_Items in range(2)]
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # EditorToolBar definitions
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Define PLCOpenEditor Toolbar items id
@@ -190,9 +190,9 @@
"move", _("Move the view"))],
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- -#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- @@ -332,16 +332,12 @@
return ComputeTabsLayout(tabs, rect)
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
UNEDITABLE_NAMES_DICT = dict([(_(name), name) for name in UNEDITABLE_NAMES])
class IDEFrame(wx.Frame):
+ """IDEFrame Base Class""" # Compatibility function for wx versions < 2.6
if wx.VERSION < (2, 6, 0):
def Bind(self, event, function, id=None):
@@ -379,7 +375,7 @@
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')
- #AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO,
+ # 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
@@ -409,7 +405,7 @@
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)
+ # self.Bind(wx.EVT_MENU, self.OnEnableUndoRedoMenu, id=ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO) self.Bind(wx.EVT_MENU, self.OnCutMenu, id=wx.ID_CUT)
self.Bind(wx.EVT_MENU, self.OnCopyMenu, id=wx.ID_COPY)
self.Bind(wx.EVT_MENU, self.OnPasteMenu, id=wx.ID_PASTE)
@@ -508,9 +504,9 @@
self.TabsImageList = wx.ImageList(31, 16)
self.TabsImageListIndexes = {}
- #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- # Creating main structure
- #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- self.AUIManager = wx.aui.AuiManager(self)
self.AUIManager.SetDockSizeConstraint(0.5, 0.5)
@@ -573,9 +569,9 @@
self.AUIManager.AddPane(self.TabsOpened,
wx.aui.AuiPaneInfo().CentrePane().Name("TabsPane"))
- #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- # Creating PLCopen Project Types Tree
- #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- @@ -612,9 +608,9 @@
id=ID_PLCOPENEDITORPROJECTTREE)
self.ProjectTree.Bind(wx.EVT_MOTION, self.OnProjectTreeMotion)
- #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- # Creating PLCopen Project POU Instance Variables Panel
- #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- self.PouInstanceVariablesPanel = PouInstanceVariablesPanel(self.ProjectPanel, self, self.Controler, self.EnableDebug)
@@ -623,9 +619,9 @@
self.ProjectPanel.SplitHorizontally(self.ProjectTree, self.PouInstanceVariablesPanel, 300)
- #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- - #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- MenuToolBar = wx.ToolBar(self, ID_PLCOPENEDITOREDITORMENUTOOLBAR,
wx.DefaultPosition, wx.DefaultSize,
@@ -656,17 +652,17 @@
self.Bind(wx.EVT_MENU, self.OnSelectionTool,
id=ID_PLCOPENEDITOREDITORTOOLBARSELECTION)
- #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- - #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- self.SearchResultPanel = SearchResultPanel(self.BottomNoteBook, self)
self.MainTabs["SearchResultPanel"] = (self.SearchResultPanel, _("Search"))
self.BottomNoteBook.AddPage(*self.MainTabs["SearchResultPanel"])
- #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- - #-----------------------------------------------------------------------
+ # ----------------------------------------------------------------------- self.LibraryPanel = LibraryPanel(self, True)
self.MainTabs["LibraryPanel"] = (self.LibraryPanel, _("Library"))
@@ -701,8 +697,8 @@
for imgname, itemtype in [
("PROJECT", ITEM_PROJECT),
- #("VARIABLE", ITEM_VARIABLE),
+ # ("VARIABLE", ITEM_VARIABLE), ("TRANSITION", ITEM_TRANSITION),
("CONFIGURATION", ITEM_CONFIGURATION),
@@ -738,7 +734,7 @@
self.DrawingMode = FREEDRAWING_MODE
- #self.DrawingMode = DRIVENDRAWING_MODE
+ # self.DrawingMode = DRIVENDRAWING_MODE # Save default perspective
@@ -788,9 +784,9 @@
notebook.SetSelection(idx)
-#-------------------------------------------------------------------------------
-# Saving and restoring frame organization functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Saving and restoring frame organization functions + # ------------------------------------------------------------------------------- def GetTabInfos(self, tab):
for page_name, (page_ref, page_title) in self.MainTabs.iteritems():
@@ -901,9 +897,9 @@
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- def SetRefreshFunctions(self):
self.RefreshFunctions = {
@@ -996,9 +992,9 @@
PROJECTTREE, POUINSTANCEVARIABLESPANEL, SCALING)
-#-------------------------------------------------------------------------------
-# Notebook Unified Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Notebook Unified Functions + # ------------------------------------------------------------------------------- def AddPage(self, window, text):
"""Function that add a tab in Notebook, calling refresh for tab DClick event
@@ -1035,9 +1031,9 @@
return self.TabsOpened.SetPageBitmap(idx, bitmap)
-#-------------------------------------------------------------------------------
-# Dialog Message Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Dialog Message Functions + # ------------------------------------------------------------------------------- def ShowErrorMessage(self, message):
"""Function displaying an Error dialog in editor.
@@ -1069,9 +1065,9 @@
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- def RefreshFileMenu(self):
@@ -1150,9 +1146,9 @@
def OnQuitMenu(self, event):
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- def RefreshEditMenu(self):
MenuToolBar = self.Panes["MenuToolBar"]
@@ -1167,8 +1163,8 @@
MenuToolBar.EnableTool(wx.ID_UNDO, undo)
self.EditMenu.Enable(wx.ID_REDO, redo)
MenuToolBar.EnableTool(wx.ID_REDO, redo)
- #self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO, True)
- #self.EditMenu.Check(ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO,
+ # self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO, True) + # self.EditMenu.Check(ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO, # self.Controler.IsProjectBufferEnabled())
self.EditMenu.Enable(wx.ID_FIND, selected > -1)
self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUFINDNEXT,
@@ -1204,7 +1200,7 @@
MenuToolBar.EnableTool(wx.ID_UNDO, False)
self.EditMenu.Enable(wx.ID_REDO, False)
MenuToolBar.EnableTool(wx.ID_REDO, False)
- #self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO, False)
+ # self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO, False) self.EditMenu.Enable(wx.ID_CUT, False)
MenuToolBar.EnableTool(wx.ID_CUT, False)
self.EditMenu.Enable(wx.ID_COPY, False)
@@ -1337,9 +1333,9 @@
self.SearchResultPanel.SetSearchResults(criteria, result)
self.SelectTab(self.SearchResultPanel)
-#-------------------------------------------------------------------------------
-# Display Menu Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Display Menu Functions + # ------------------------------------------------------------------------------- def RefreshDisplayMenu(self):
if self.Controler is not None:
@@ -1388,9 +1384,9 @@
def OnResetPerspective(self, event):
-#-------------------------------------------------------------------------------
-# Project Editor Panels Management Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Project Editor Panels Management Functions + # ------------------------------------------------------------------------------- def OnPageDragged(self, event):
wx.CallAfter(self.RefreshTabCtrlEvent)
@@ -1503,9 +1499,9 @@
self.AUIManager.MaximizePane(pane)
-#-------------------------------------------------------------------------------
-# Types Tree Management Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Types Tree Management Functions + # ------------------------------------------------------------------------------- def RefreshProjectTree(self):
# Extract current selected item tagname
@@ -2012,10 +2008,9 @@
-#-------------------------------------------------------------------------------
-# Instances Tree Management Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Instances Tree Management Functions + # ------------------------------------------------------------------------------- def GetTreeImage(self, var_class):
return self.TreeImageDict[var_class]
@@ -2098,16 +2093,16 @@
self.DebugVariablePanel.InsertValue(iec_path, force=force, graph=graph)
self.EnsureTabVisible(self.DebugVariablePanel)
-#-------------------------------------------------------------------------------
-# Library Panel Management Function
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Library Panel Management Function + # ------------------------------------------------------------------------------- def RefreshLibraryPanel(self):
self.LibraryPanel.RefreshTree()
-#-------------------------------------------------------------------------------
-# ToolBars Management Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ToolBars Management Functions + # ------------------------------------------------------------------------------- def AddToMenuToolBar(self, items):
MenuToolBar = self.Panes["MenuToolBar"]
@@ -2175,10 +2170,9 @@
-#-------------------------------------------------------------------------------
-# EditorToolBar Items Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # EditorToolBar Items Functions + # ------------------------------------------------------------------------------- def ResetCurrentMode(self):
selected = self.TabsOpened.GetSelection()
@@ -2314,10 +2308,9 @@
self.TabsOpened.GetPage(selected).AddJump()
-#-------------------------------------------------------------------------------
-# Add Project Elements Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Add Project Elements Functions + # ------------------------------------------------------------------------------- def OnAddNewProject(self, event):
# Asks user to create main program after creating new project
@@ -2440,9 +2433,9 @@
self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, PROJECTTREE, LIBRARYTREE)
self.EditProjectElement(ITEM_POU, result[0])
-#-------------------------------------------------------------------------------
-# Remove Project Elements Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Remove Project Elements Functions + # ------------------------------------------------------------------------------- def CheckElementIsUsedBeforeDeletion(self, check_function, title, name):
if not check_function(name):
@@ -2545,9 +2538,9 @@
self.TabsOpened.DeletePage(idx)
self._Refresh(TITLE, FILEMENU, EDITMENU, PROJECTTREE, POUINSTANCEVARIABLESPANEL)
-#-------------------------------------------------------------------------------
-# Highlights showing functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Highlights showing functions + # ------------------------------------------------------------------------------- def ShowHighlight(self, infos, start, end, highlight_type):
self.SelectProjectTreeItem(infos[0])
@@ -2584,9 +2577,9 @@
def ClearSearchResults(self):
self.ClearHighlights(SEARCH_RESULT_HIGHLIGHT)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- -#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- @@ -2671,8 +2664,6 @@
dc.SetClippingRegion(posX, posY, self.PageSize[0] * scale, self.PageSize[1] * scale)
dc.SetUserScale(scale, scale)
- #-------------------------------------------
self.Viewer.DoDrawing(dc, True)
--- a/PLCControler.py Sat Aug 19 21:06:54 2017 +0300
+++ b/PLCControler.py Mon Aug 21 21:55:18 2017 +0300
@@ -111,12 +111,9 @@
DATA_TYPES, TRANSITIONS, ACTIONS, CONFIGURATIONS,
RESOURCES, PROPERTIES] = UNEDITABLE_NAMES
-#-------------------------------------------------------------------------------
-# Helper object for loading library in xslt stylesheets
-#-------------------------------------------------------------------------------
class LibraryResolver(etree.Resolver):
+ """Helper object for loading library in xslt stylesheets""" def __init__(self, controller, debug=False):
self.Controller = controller
@@ -136,10 +133,10 @@
lib_el.append(deepcopy(ctn["types"]))
return self.resolve_string(etree.tostring(lib_el), context)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Helpers functions for translating list of arguments
# from xslt to valid arguments
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- @@ -155,9 +152,9 @@
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Helpers object for generating pou var list
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class _VariableInfos(object):
@@ -208,9 +205,9 @@
[_StringValue] * 5 + [_BoolValue] + [_StringValue], args) +
[self.GetType(), self.GetTree()])))
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Helpers object for generating pou variable instance list
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- def class_extraction(value):
@@ -266,25 +263,18 @@
[_StringValue, class_extraction, _StringValue] +
[_BoolValue] * 2, args) + [[]])))
-#-------------------------------------------------------------------------------
-# Helpers object for generating instances path list
-#-------------------------------------------------------------------------------
class InstancesPathFactory:
+ """Helpers object for generating instances path list""" def __init__(self, instances):
self.Instances = instances
def AddInstance(self, context, *args):
self.Instances.append(args[0][0])
-#-------------------------------------------------------------------------------
-# Helpers object for generating instance tagname
-#-------------------------------------------------------------------------------
+ """Helpers object for generating instance tagname""" def __init__(self, controller):
self.Controller = controller
@@ -308,9 +298,10 @@
def TransitionTagName(self, context, *args):
self.TagName = self.Controller.ComputePouTransitionName(args[0][0], args[0][1])
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Helpers object for generating pou block instances list
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- _Point = namedtuple("Point", ["x", "y"])
@@ -465,9 +456,6 @@
pou_block_instances_xslt = etree.parse(
os.path.join(ScriptDirectory, "plcopen", "pou_block_instances.xslt"))
-#-------------------------------------------------------------------------------
-# Undo Buffer for PLCOpenEditor
-#-------------------------------------------------------------------------------
@@ -475,6 +463,7 @@
+ Undo Buffer for PLCOpenEditor Class implementing a buffer of changes made on the current editing model
@@ -555,13 +544,9 @@
return self.LastSave == self.CurrentIndex
-#-------------------------------------------------------------------------------
-# Controler for PLCOpenEditor
-#-------------------------------------------------------------------------------
+ Controler for PLCOpenEditor Class which controls the operations made on the plcopen model and answers to view requests
@@ -597,9 +582,9 @@
-#-------------------------------------------------------------------------------
-# Project management functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Project management functions + # ------------------------------------------------------------------------------- # Return if a project is opened
def HasOpenedProject(self):
@@ -961,9 +946,9 @@
row, col = next_row, next_col
-#-------------------------------------------------------------------------------
-# Project Pous management functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Project Pous management functions + # ------------------------------------------------------------------------------- # Add a Data Type to Project
def ProjectAddDataType(self, datatype_name=None):
@@ -1957,9 +1942,9 @@
values.extend(confnodetype["types"].GetEnumeratedDataTypeValues())
-#-------------------------------------------------------------------------------
-# Project Element tag name computation functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Project Element tag name computation functions + # ------------------------------------------------------------------------------- # Compute a data type name
def ComputeDataTypeName(self, datatype):
@@ -1996,9 +1981,9 @@
-#-------------------------------------------------------------------------------
-# Project opened Data types management functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Project opened Data types management functions + # ------------------------------------------------------------------------------- # Return the data type informations
def GetDataTypeInfos(self, tagname, debug=False):
@@ -2197,9 +2182,9 @@
datatype.initialValue = None
-#-------------------------------------------------------------------------------
-# Project opened Pous management functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Project opened Pous management functions + # ------------------------------------------------------------------------------- def GetEditedElement(self, tagname, debug=False):
@@ -3271,9 +3256,9 @@
self.SetFilePath(filepath)
-#-------------------------------------------------------------------------------
-# Search in Current Project Functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Search in Current Project Functions + # ------------------------------------------------------------------------------- def SearchInProject(self, criteria):
return self.Project.Search(criteria)
@@ -3291,14 +3276,12 @@
-#-------------------------------------------------------------------------------
-# Current Buffering Management Functions
-#-------------------------------------------------------------------------------
- Return a copy of the project
+ # ------------------------------------------------------------------------------- + # Current Buffering Management Functions + # ------------------------------------------------------------------------------- + """Return a copy of the project""" def CreateProjectBuffer(self, saved):
--- a/PLCOpenEditor.py Sat Aug 19 21:06:54 2017 +0300
+++ b/PLCOpenEditor.py Mon Aug 21 21:55:18 2017 +0300
@@ -85,9 +85,9 @@
from dialogs import ProjectDialog
from dialogs.AboutDialog import ShowAboutDialog
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # PLCOpenEditor Main Class
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Define PLCOpenEditor FileMenu extra items id
@@ -158,9 +158,9 @@
def _init_coll_HelpMenu_Items(self, parent):
AppendMenu(parent, help='', id=wx.ID_HELP,
kind=wx.ITEM_NORMAL, text=_(u'PLCOpenEditor') + '\tF1')
- #AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS,
+ # AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS, # kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2')
- #AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT,
+ # AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT, # kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3')
@@ -176,7 +176,7 @@
AppendMenu(parent, help='', id=wx.ID_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.OnPLCOpenMenu, id=wx.ID_HELP_CONTENTS) self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
def __init__(self, parent, fileOpen=None):
@@ -231,9 +231,9 @@
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- def RefreshFileMenu(self):
MenuToolBar = self.Panes["MenuToolBar"]
@@ -401,9 +401,9 @@
self._Refresh(TITLE, FILEMENU, PAGETITLES)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- -#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- Max_Traceback_List_Size = 20
@@ -506,7 +506,7 @@
output.write(a+":\n"+str(info[a])+"\n\n")
- #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args)
+ # sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args) sys.excepthook = handle_exception
--- a/ProjectController.py Sat Aug 19 21:06:54 2017 +0300
+++ b/ProjectController.py Mon Aug 21 21:55:18 2017 +0300
@@ -1027,7 +1027,7 @@
"init_calls": "\n ".join([
"init_level=%d; " % (i+1) +
"if((res = __init_%s(argc,argv))){" % locstr +
- #"printf(\"%s\"); "%locstr + #for debug
+ # "printf(\"%s\"); "%locstr + #for debug "return res;}" for i, locstr in enumerate(locstrs)]),
"cleanup_calls": "\n ".join([
"if(init_level >= %d) " % i +
@@ -1557,7 +1557,7 @@
data_tuple = self.IECdebug_datas.get(IECPath, None)
if data_tuple is not None:
WeakCallableDict, data_log, status, fvalue, buffer_list = data_tuple
- #data_log.append((debug_tick, value))
+ # data_log.append((debug_tick, value)) for weakcallable, buffer_list in WeakCallableDict.iteritems():
function = getattr(weakcallable, function_name, None)
@@ -1583,7 +1583,7 @@
while (not self.debug_break) and (self._connector is not None):
plc_status, Traces = self._connector.GetTraceVariables()
- #print [dict.keys() for IECPath, (dict, log, status, fvalue) in self.IECdebug_datas.items()]
+ # print [dict.keys() for IECPath, (dict, log, status, fvalue) in self.IECdebug_datas.items()] if plc_status == "Started":
@@ -1681,7 +1681,7 @@
self.logger.write_error(_("Couldn't stop PLC !\n"))
# debugthread should die on his own
- #self.KillDebugThread()
+ # self.KillDebugThread() wx.CallAfter(self.UpdateMethodsFromPLCStatus)
@@ -1763,7 +1763,7 @@
- #self.logger.write(_("PLC is %s\n")%status)
+ # self.logger.write(_("PLC is %s\n")%status) if self.previous_plcstate in ["Started", "Stopped"]:
if self.DebugAvailable() and self.GetIECProgramsAndVariables():
@@ -1789,7 +1789,7 @@
self.EnableMethod("_Transfer", True)
# warns controller that program match
self.ProgramTransferred()
- #self.EnableMethod("_Transfer", False)
+ # self.EnableMethod("_Transfer", False) # self.logger.write_warning(
# _("Cannot compare latest build to target. Please build.\n"))
--- a/canfestival/config_utils.py Sat Aug 19 21:06:54 2017 +0300
+++ b/canfestival/config_utils.py Mon Aug 21 21:55:18 2017 +0300
@@ -61,9 +61,9 @@
TrashVariables = [(1, 0x01), (8, 0x05), (16, 0x06), (32, 0x07), (64, 0x1B)]
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Specific exception for PDO mapping errors
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class PDOmappingException(Exception):
@@ -340,9 +340,9 @@
@param sync_TPDOs: indicate if TPDO must be synchronous
- #-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- # Verify that locations correspond to real slave variables
- #-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- # Get list of locations check if exists and mappables -> put them in IECLocations
for location in locations:
@@ -420,9 +420,9 @@
_("Not PDO mappable variable : '{a1}' (ID:{a2},Idx:{a3},sIdx:{a4}))").
format(a1=name, a2=nodeid, a3="%x" % index, a4="%x" % subindex))
- #-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- # Search for locations already mapped
- #-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- for name, locationinfos in self.IECLocations.items():
node = self.NodeList.SlaveNodes[locationinfos["nodeid"]]["Node"]
@@ -472,9 +472,9 @@
self.LocationsNotMapped[locationinfos["nodeid"]] = {TPDO: [], RPDO: []}
self.LocationsNotMapped[locationinfos["nodeid"]][locationinfos["pdotype"]].append((name, locationinfos))
- #-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- # Build concise DCF for the others locations
- #-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- for nodeid, locations in self.LocationsNotMapped.items():
node = self.NodeList.SlaveNodes[nodeid]["Node"]
@@ -520,9 +520,9 @@
# Add number of params and data to node DCF
self.AddParamsToDCF(nodeid, dataparams, nbparams)
- #-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- # Master Node Configuration
- #-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- # Generate Master's Configuration from informations stored in MasterMapping
for cobid, pdo_infos in self.MasterMapping.items():
--- a/doc/conf.py Sat Aug 19 21:06:54 2017 +0300
+++ b/doc/conf.py Mon Aug 21 21:55:18 2017 +0300
@@ -17,12 +17,12 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
+# sys.path.insert(0, os.path.abspath('.')) # -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -35,7 +35,7 @@
# The encoding of source files.
-#source_encoding = 'utf-8-sig'
+# source_encoding = 'utf-8-sig' # The master toctree document.
@@ -55,40 +55,40 @@
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
locale_dirs = ["locale/"]
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
+# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
+# add_function_parentheses = True # If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
-#add_module_names = True
+# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = [] # -- Options for HTML output ---------------------------------------------------
@@ -100,26 +100,26 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
-#html_theme_options = {}
+# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory.
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
+# html_short_title = None # The name of an image file (relative to this directory) to place at the top
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
@@ -128,44 +128,44 @@
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-#html_use_smartypants = True
+# html_use_smartypants = True # Custom sidebar templates, maps document names to template names.
# Additional templates that should be rendered to pages, maps page names to
-#html_additional_pages = {}
+# html_additional_pages = {} # If false, no module index is generated.
-#html_domain_indices = True
+# html_domain_indices = True # If false, no index is generated.
# If true, the index is split into individual pages for each letter.
-#html_split_index = False
+# html_split_index = False # If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
+# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
+# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
+# html_file_suffix = None # Output file base name for HTML help builder.
htmlhelp_basename = 'Beremizdoc'
@@ -175,13 +175,13 @@
# The paper size ('letterpaper' or 'a4paper').
- #'papersize': 'letterpaper',
+ # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt').
# Additional stuff for the LaTeX preamble.
# Grouping the document tree into LaTeX files. List of tuples
@@ -193,23 +193,23 @@
# The name of an image file (relative to this directory) to place at the top of
# For "manual" documents, if this is true, then toplevel headings are parts,
-#latex_use_parts = False
+# latex_use_parts = False # If true, show page references after internal links.
-#latex_show_pagerefs = False
+# latex_show_pagerefs = False # If true, show URL addresses after external links.
-#latex_show_urls = False
+# latex_show_urls = False # Documents to append as an appendix to all manuals.
# If false, no module index is generated.
-#latex_domain_indices = True
+# latex_domain_indices = True # -- Options for manual page output --------------------------------------------
@@ -222,7 +222,7 @@
# If true, show URL addresses after external links.
# -- Options for Texinfo output ------------------------------------------------
@@ -237,10 +237,10 @@
# Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
+# texinfo_appendices = [] # If false, no module index is generated.
-#texinfo_domain_indices = True
+# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
+# texinfo_show_urls = 'footnote' --- a/editors/LDViewer.py Sat Aug 19 21:06:54 2017 +0300
+++ b/editors/LDViewer.py Mon Aug 21 21:55:18 2017 +0300
@@ -160,9 +160,9 @@
element_tree[element]["weight"] = max(1, weight / parts)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Ladder Diagram Graphic elements Viewer class
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- @@ -176,9 +176,9 @@
self.CurrentLanguage = "LD"
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- @@ -258,9 +258,9 @@
self.RungComments.append(element)
-#-------------------------------------------------------------------------------
-# Search Element functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Search Element functions + # ------------------------------------------------------------------------------- def FindRung(self, element):
for i, rung in enumerate(self.Rungs):
@@ -302,9 +302,9 @@
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Mouse event functions + # ------------------------------------------------------------------------------- def OnViewerLeftDown(self, event):
if self.GetDrawingMode() == FREEDRAWING_MODE:
@@ -392,9 +392,9 @@
wx.CallAfter(self.SetCurrentCursor, 0)
-#-------------------------------------------------------------------------------
-# Keyboard event functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Keyboard event functions + # ------------------------------------------------------------------------------- if self.GetDrawingMode() == FREEDRAWING_MODE:
@@ -443,9 +443,9 @@
-#-------------------------------------------------------------------------------
-# Model adding functions from Drop Target
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Model adding functions from Drop Target + # ------------------------------------------------------------------------------- def AddVariableBlock(self, x, y, scaling, var_class, var_name, var_type):
@@ -483,9 +483,9 @@
Viewer.AddVariableBlock(self, x, y, scaling, var_class, var_name, var_type)
-#-------------------------------------------------------------------------------
-# Adding element functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Adding element functions + # ------------------------------------------------------------------------------- dialog = LDElementDialog(self.ParentWindow, self.Controler, "coil")
@@ -901,9 +901,9 @@
-#-------------------------------------------------------------------------------
-# Delete element functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Delete element functions + # ------------------------------------------------------------------------------- def DeleteContact(self, contact):
if self.GetDrawingMode() == FREEDRAWING_MODE:
@@ -1089,9 +1089,9 @@
self.RefreshRungs(new_bbox.height - old_bbox.height, rungindex + 1)
self.SelectedElement = None
-#-------------------------------------------------------------------------------
-# Refresh element position functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Refresh element position functions + # ------------------------------------------------------------------------------- def RefreshPosition(self, element, recursive=True):
# If element is LeftPowerRail, no need to update position
@@ -1194,9 +1194,9 @@
if self.IsBlock(element):
self.RefreshPosition(element)
-#-------------------------------------------------------------------------------
-# Edit element content functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Edit element content functions + # ------------------------------------------------------------------------------- def EditPowerRailContent(self, powerrail):
if self.GetDrawingMode() == FREEDRAWING_MODE:
--- a/editors/Viewer.py Sat Aug 19 21:06:54 2017 +0300
+++ b/editors/Viewer.py Mon Aug 21 21:55:18 2017 +0300
@@ -227,9 +227,9 @@
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Graphic elements Viewer base class
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # ID Constants for alignment menu items
@@ -941,9 +941,9 @@
return self.MiniTextDC.GetFont()
-#-------------------------------------------------------------------------------
-# Element management functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Element management functions + # ------------------------------------------------------------------------------- def AddBlock(self, block):
self.Blocks[block.GetId()] = block
@@ -1084,9 +1084,9 @@
element.SetSize(width, height)
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- @@ -1204,10 +1204,9 @@
self.RefreshVisibleElements()
self.Editor.Refresh(False)
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- def ElementNeedRefresh(self, element):
self.ElementRefreshList_lock.acquire()
@@ -1531,9 +1530,9 @@
def GetBlockType(self, type, inputs=None):
return self.Controler.GetBlockType(type, inputs, self.Debug)
-#-------------------------------------------------------------------------------
-# Search Element functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Search Element functions + # ------------------------------------------------------------------------------- def FindBlock(self, event):
@@ -1604,9 +1603,9 @@
self.SelectedElement.SetElements(self.GetElements())
self.SelectedElement.SetSelected(True)
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- def GetForceVariableMenuFunction(self, iec_path, element):
iec_type = self.GetDataType(iec_path)
@@ -1738,9 +1737,9 @@
self.Editor.PopupMenu(menu)
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- def OnAlignLeftMenu(self, event):
if self.SelectedElement is not None and isinstance(self.SelectedElement, Graphic_Group):
@@ -1967,9 +1966,9 @@
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Mouse event functions + # ------------------------------------------------------------------------------- def OnViewerMouseEvent(self, event):
@@ -2467,9 +2466,9 @@
(_(u'Variable'), self.GetAddToWireMenuCallBack(self.AddNewVariable, True)))
-#-------------------------------------------------------------------------------
-# Keyboard event functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Keyboard event functions + # ------------------------------------------------------------------------------- @@ -2545,9 +2544,9 @@
-#-------------------------------------------------------------------------------
-# Model adding functions from Drop Target
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Model adding functions from Drop Target + # ------------------------------------------------------------------------------- def AddVariableBlock(self, x, y, scaling, var_class, var_name, var_type):
@@ -2568,9 +2567,9 @@
self.RefreshVisibleElements()
self.Editor.Refresh(False)
-#-------------------------------------------------------------------------------
-# Model adding functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Model adding functions + # ------------------------------------------------------------------------------- def GetScaledSize(self, width, height):
if self.Scaling is not None:
@@ -2822,9 +2821,9 @@
self.AddNewElement(actionblock, bbox, wire)
-#-------------------------------------------------------------------------------
-# Edit element content functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Edit element content functions + # ------------------------------------------------------------------------------- def EditBlockContent(self, block):
dialog = FBDBlockDialog(self.ParentWindow, self.Controler, self.TagName)
@@ -3130,9 +3129,9 @@
-#-------------------------------------------------------------------------------
-# Model update functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Model update functions + # ------------------------------------------------------------------------------- def RefreshBlockModel(self, block):
@@ -3279,10 +3278,9 @@
infos["connector"] = actionblock.GetConnector()
self.Controler.SetEditedElementActionBlockInfos(self.TagName, actionblockid, infos)
-#-------------------------------------------------------------------------------
-# Model delete functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Model delete functions + # ------------------------------------------------------------------------------- def DeleteBlock(self, block):
@@ -3429,10 +3427,9 @@
self.RemoveBlock(actionblock)
self.Controler.RemoveEditedElementInstance(self.TagName, actionblock.GetId())
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- if not self.Debug and (self.IsBlock(self.SelectedElement) or self.IsComment(self.SelectedElement) or isinstance(self.SelectedElement, Graphic_Group)):
@@ -3563,9 +3560,9 @@
self.Controler.AddEditedElementActionBlock(self.TagName, block.GetId())
self.RefreshActionBlockModel(block)
-#-------------------------------------------------------------------------------
-# Find and Replace functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Find and Replace functions + # ------------------------------------------------------------------------------- def Find(self, direction, search_params):
if self.SearchParams != search_params:
@@ -3606,9 +3603,9 @@
self.RemoveHighlight(*self.CurrentFindHighlight)
self.CurrentFindHighlight = None
-#-------------------------------------------------------------------------------
-# Highlights showing functions
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # Highlights showing functions + # ------------------------------------------------------------------------------- def OnRefreshHighlightsTimer(self, event):
@@ -3647,9 +3644,9 @@
block.AddHighlight(infos[2:], start, end, highlight_type)
-#-------------------------------------------------------------------------------
-#-------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------- def OnScrollWindow(self, event):
if self.Editor.HasCapture() and self.StartMousePos is not None:
--- a/graphics/GraphicCommons.py Sat Aug 19 21:06:54 2017 +0300
+++ b/graphics/GraphicCommons.py Mon Aug 21 21:55:18 2017 +0300
@@ -31,9 +31,9 @@
from graphics.ToolTipProducer import ToolTipProducer
from graphics.DebugDataConsumer import DebugDataConsumer
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- -#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- Definition of constants for dimensions of graphic elements
@@ -211,9 +211,10 @@
pen.SetCap(wx.CAP_PROJECTING)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Helpers for highlighting text
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- def AddHighlight(highlights, infos):
@@ -248,9 +249,10 @@
dc.SetTextForeground(wx.BLACK)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Graphic element base class
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class Graphic_Element(ToolTipProducer):
@@ -703,9 +705,9 @@
dc.SetUserScale(scalex, scaley)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Group of graphic elements
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class Graphic_Group(Graphic_Element):
@@ -1021,9 +1023,10 @@
for element in self.Elements:
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Connector for all types of blocks
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class Connector(DebugDataConsumer, ToolTipProducer):
@@ -1471,7 +1474,7 @@
dc.SetPen(MiterPen(wx.BLUE, 3))
dc.SetBrush(wx.WHITE_BRUSH)
- #elif len(self.Highlights) > 0:
+ # elif len(self.Highlights) > 0: # dc.SetPen(MiterPen(self.Highlights[-1][1]))
# dc.SetBrush(wx.Brush(self.Highlights[-1][0]))
@@ -1556,9 +1559,10 @@
dc.SetFont(self.ParentBlock.Parent.GetFont())
dc.SetTextForeground(wx.BLACK)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- -#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class Wire(Graphic_Element, DebugDataConsumer):
@@ -2447,11 +2451,11 @@
def OnLeftDown(self, event, dc, scaling):
pos = GetScaledEventPosition(event, dc, scaling)
# Test if a point have been handled
- #result = self.TestPoint(pos)
+ # result = self.TestPoint(pos) # self.Handle = (HANDLE_POINT, result)
# wx.CallAfter(self.Parent.SetCurrentCursor, 1)
# Test if a segment have been handled
result = self.TestSegment(pos)
@@ -2752,9 +2756,9 @@
dc.SetTextForeground(wx.BLACK)
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Graphic comment element
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- def FilterHighlightsByRow(highlights, row, length):
--- a/graphics/SFC_Objects.py Sat Aug 19 21:06:54 2017 +0300
+++ b/graphics/SFC_Objects.py Mon Aug 21 21:55:18 2017 +0300
@@ -35,9 +35,9 @@
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Sequencial Function Chart Step
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class SFC_Step(Graphic_Element, DebugDataConsumer):
@@ -221,7 +221,7 @@
bbx_height = self.Size[1] + CONNECTOR_SIZE
bbx_height += CONNECTOR_SIZE
- #self.BoundingBox = wx.Rect(self.Pos.x, bbx_y, bbx_width + 1, bbx_height + 1)
+ # self.BoundingBox = wx.Rect(self.Pos.x, bbx_y, bbx_width + 1, bbx_height + 1) self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Refresh the positions of the step connectors
@@ -257,7 +257,7 @@
# Test input, output and action connector if they exists
- #if self.Input and name == self.Input.GetName():
+ # if self.Input and name == self.Input.GetName(): if self.Output and name == self.Output.GetName():
@@ -568,9 +568,9 @@
DrawHighlightedText(dc, self.Name, self.Highlights, name_pos[0], name_pos[1])
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Sequencial Function Chart Transition
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class SFC_Transition(Graphic_Element, DebugDataConsumer):
@@ -777,7 +777,7 @@
# Test input and output connector
- #if name == self.Input.GetName():
+ # if name == self.Input.GetName(): if name == self.Output.GetName():
@@ -1037,9 +1037,10 @@
DrawHighlightedText(dc, condition, highlights, condition_pos[0], condition_pos[1])
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Sequencial Function Chart Divergence and Convergence
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class SFC_Divergence(Graphic_Element):
@@ -1249,7 +1250,7 @@
# Test each input and output connector
- #for input in self.Inputs:
+ # for input in self.Inputs: # if name == input.GetName():
for output in self.Outputs:
@@ -1500,9 +1501,10 @@
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Sequencial Function Chart Jump to Step
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class SFC_Jump(Graphic_Element):
@@ -1775,9 +1777,9 @@
DrawHighlightedText(dc, self.Target, self.Highlights, target_pos[0], target_pos[1])
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- # Sequencial Function Chart Action Block
-#-------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------- class SFC_ActionBlock(Graphic_Element):
--- a/svgui/pyjs/build.py Sat Aug 19 21:06:54 2017 +0300
+++ b/svgui/pyjs/build.py Mon Aug 21 21:55:18 2017 +0300
@@ -334,12 +334,12 @@
- #mod_code[platform][app_name] = appcode
+ # mod_code[platform][app_name] = appcode # platform.Module.cache.js
modules_done = ['pyjslib', 'sys', '_pyjs.js']
- #modules_to_do = [app_name] + app_translator.library_modules
+ # modules_to_do = [app_name] + app_translator.library_modules modules_to_do = [app_name] + app_translator.library_modules
@@ -349,13 +349,13 @@
sublist = add_subdeps(dependencies, d)
- #dependencies[app_name] = deps
+ # dependencies[app_name] = deps modules[platform] = modules_done + modules_to_do
- #print "modules to do", modules_to_do
+ # print "modules to do", modules_to_do mod_name = pyjs.strip_py(mn)
@@ -389,18 +389,18 @@
- #print "modname preadd:", mod_name, deps
+ # print "modname preadd:", mod_name, deps sublist = add_subdeps(dependencies, d)
modules_to_do += add_subdeps(dependencies, mod_name)
- #print "modname:", mod_name, deps
+ # print "modname:", mod_name, deps - #print "modname:", mod_name, deps
+ # print "modname:", mod_name, deps dependencies[mod_name] = deps
# work out the dependency ordering of the modules
@@ -414,7 +414,7 @@
early_app_libs_ = early_app_libs[platform]
app_libs_ = app_libs[platform]
app_code_ = app_code[platform]
- #modules_ = filter_mods(app_name, modules[platform])
+ # modules_ = filter_mods(app_name, modules[platform]) mods = flattenlist(mod_levels[platform])
modules_ = filter_mods(None, mods)
@@ -488,8 +488,8 @@
overnames = map(lambda x: "'%s': '%s'" % x, pover[platform].items())
overnames = "new pyjslib.Dict({\n\t\t%s\n\t})" % ',\n\t\t'.join(overnames)
- #print "platform names", platform, overnames
+ # print "platform names", platform, overnames # now write app.allcache including dependency-ordered list of
@@ -549,8 +549,8 @@
- #print "subdeps", mod_name, sd
+ # print "subdeps", mod_name, sd for i in range(0, len(sd)-1):
@@ -560,7 +560,7 @@
@@ -628,26 +628,26 @@
for m, dl in deps.items():
raise Exception('Circular Imports found: \n%s %s -> %s %s'
- #raise Exception('Could not calculate dependencies: \n%s' % deps)
+ # raise Exception('Could not calculate dependencies: \n%s' % deps) - #print "modlist", mod_list
+ # print "modlist", mod_list nodeps = nodeps_list(mod_list, deps)
- #print "nodeps", nodeps
+ # print "nodeps", nodeps mod_list = filter(lambda x: x not in nodeps, mod_list)
@@ -655,10 +655,10 @@
depslist = filter(lambda x: x not in nodeps, depslist)
- #print "newdeps", newdeps
+ # print "newdeps", newdeps ordered_deps.append(nodeps)
ordered_deps.append(mod_list) # last dependencies - usually the app(s)
--- a/svgui/pyjs/pyjs.py Sat Aug 19 21:06:54 2017 +0300
+++ b/svgui/pyjs/pyjs.py Mon Aug 21 21:55:18 2017 +0300
@@ -182,7 +182,7 @@
def gen_mod_import(parentName, importName, dynamic=1):
- #pyjs_ajax_eval("%(n)s.cache.js", null, true);
+ # pyjs_ajax_eval("%(n)s.cache.js", null, true); pyjslib.import_module(sys.loadpath, '%(p)s', '%(n)s', %(d)d, false);
""" % ({'p': parentName, 'd': dynamic, 'n': importName}) + \
@@ -322,11 +322,11 @@
raise TranslationError("unsupported type (in __init__)", child)
# Initialize all classes for this module
- #print >> self.output, "__"+self.modpfx()+\
+ # print >> self.output, "__"+self.modpfx()+\ # "classes_initialize = function() {\n"
- #for className in self.top_level_classes:
+ # for className in self.top_level_classes: # print >> self.output, "\t"+UU+self.modpfx()+"__"+className+"_initialize();"
- #print >> self.output, "};\n"
+ # print >> self.output, "};\n" print >> self.output, "return this;\n"
print >> self.output, "}; /* end %s */ \n" % module_name
@@ -407,7 +407,7 @@
print >>self.output, " %s=__kwargs.%s;" % (default_name, default_name)
- #self._default_args_handler(node, arg_names, current_klass)
+ # self._default_args_handler(node, arg_names, current_klass) arg_names += ["pyjslib.Dict(__kwargs)"]
print >>self.output, " var __r = "+"".join(["[", ", ".join(arg_names), "]"])+";"
@@ -594,7 +594,7 @@
for stmt in node.handlers[0][2]:
self._stmt(stmt, current_klass)
- #print >> self.output, "} else { throw(%s); } " % errName
+ # print >> self.output, "} else { throw(%s); } " % errName print >> self.output, "}"
if node.else_ is not None:
print >>self.output, " } finally {"
@@ -612,9 +612,9 @@
# XXX TODO: distinguish between module import classes
# and variables. right now, this is a hack to get
# the sys module working.
- #if v.expr.name == 'sys':
+ # if v.expr.name == 'sys': return v.expr.name+'.'+attr_name
- #return v.expr.name+'.__'+attr_name+'.prototype.__class__'
+ # return v.expr.name+'.__'+attr_name+'.prototype.__class__' if not use_getattr or attr_name == '__class__' or \
return obj + "." + attr_name
@@ -697,8 +697,8 @@
if obj in self.method_imported_globals:
call_name = UU+self.modpfx() + obj + "." + attr_name
elif obj in self.imported_classes:
- #if attr_name != "__init__":
+ # if attr_name != "__init__": attr_str = ".prototype.__class__." + attr_name
call_name = UU+self.imported_classes[obj] + '.__' + obj + attr_str
elif obj in self.module_imports():
@@ -787,13 +787,13 @@
print >>self.output, UU+class_name_ + " = function () {"
# print >>self.output, " __" + base_class + ".call(this);"
init_method = ast.Function([], "__init__", ["self"], [], 0, None, [])
- #self._method(init_method, current_klass, class_name)
+ # self._method(init_method, current_klass, class_name) # Generate a function which constructs the object
@@ -882,7 +882,7 @@
raise TranslationError("methods must take an argument 'self' (in _method)", node)
self.method_self = arg_names[0]
- #if not classmethod and arg_names[0] != "self":
+ # if not classmethod and arg_names[0] != "self": # raise TranslationError("first arg not 'self' (in _method)", node)
normal_arg_names = arg_names[1:]
@@ -1700,8 +1700,8 @@
for module in t.imported_modules:
if module not in self.library_modules:
self.library_modules.append(module)
- #imported_js.update(set(t.imported_js))
- #imported_modules_str += self._translate(
+ # imported_js.update(set(t.imported_js)) + # imported_modules_str += self._translate( # module, False, debug=debug, imported_js=imported_js)
return imported_modules_str + module_str