editors/Viewer.py
changeset 1736 7e61baa047f0
parent 1734 750eeb7230a1
child 1739 ec153828ded2
--- a/editors/Viewer.py	Mon Aug 14 22:30:41 2017 +0300
+++ b/editors/Viewer.py	Mon Aug 14 23:27:15 2017 +0300
@@ -46,6 +46,7 @@
 CURSORS = None
 SFC_Objects = (SFC_Step, SFC_ActionBlock, SFC_Transition, SFC_Divergence, SFC_Jump)
 
+
 def ResetCursors():
     global CURSORS
     if CURSORS == None:
@@ -56,6 +57,7 @@
                    wx.StockCursor(wx.CURSOR_SIZEWE),
                    wx.StockCursor(wx.CURSOR_SIZENS)]
 
+
 def AppendMenu(parent, help, id, kind, text):
     if wx.VERSION >= (2, 6, 0):
         parent.Append(help=help, id=id, kind=kind, text=text)
@@ -83,6 +85,7 @@
     MAX_ZOOMIN = 7
 ZOOM_FACTORS = [math.sqrt(2) ** x for x in xrange(-6, MAX_ZOOMIN)]
 
+
 def GetVariableCreationFunction(variable_type):
     def variableCreationFunction(viewer, id, specific_values):
         return FBD_Variable(viewer, variable_type,
@@ -92,15 +95,18 @@
                                     specific_values.execution_order)
     return variableCreationFunction
 
+
 def GetConnectorCreationFunction(connector_type):
     def connectorCreationFunction(viewer, id, specific_values):
         return FBD_Connector(viewer, connector_type,
                                      specific_values.name, id)
     return connectorCreationFunction
 
+
 def commentCreationFunction(viewer, id, specific_values):
     return Comment(viewer, specific_values.content, id)
 
+
 def GetPowerRailCreationFunction(powerrail_type):
     def powerRailCreationFunction(viewer, id, specific_values):
         return LD_PowerRail(viewer, powerrail_type, id,
@@ -114,6 +120,7 @@
                  (False, "rising"): CONTACT_RISING,
                  (False, "falling"): CONTACT_FALLING}
 
+
 def contactCreationFunction(viewer, id, specific_values):
     contact_type = CONTACT_TYPES.get((NEGATED_VALUE(specific_values.negated),
                                       MODIFIER_VALUE(specific_values.edge)),
@@ -126,6 +133,7 @@
               (False, "rising", "none"): COIL_RISING,
               (False, "falling", "none"): COIL_FALLING}
 
+
 def coilCreationFunction(viewer, id, specific_values):
     coil_type = COIL_TYPES.get((NEGATED_VALUE(specific_values.negated),
                                 MODIFIER_VALUE(specific_values.edge),
@@ -133,6 +141,7 @@
                                COIL_NORMAL)
     return LD_Coil(viewer, coil_type, specific_values.name, id)
 
+
 def stepCreationFunction(viewer, id, specific_values):
     step = SFC_Step(viewer, specific_values.name,
                             specific_values.initial, id)
@@ -142,6 +151,7 @@
         connector.SetPosition(wx.Point(*specific_values.action.position))
     return step
 
+
 def transitionCreationFunction(viewer, id, specific_values):
     transition = SFC_Transition(viewer, specific_values.condition_type,
                                         specific_values.condition,
@@ -151,15 +161,18 @@
 divergence_types = [SELECTION_DIVERGENCE,
                     SELECTION_CONVERGENCE, SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE]
 
+
 def GetDivergenceCreationFunction(divergence_type):
     def divergenceCreationFunction(viewer, id, specific_values):
         return SFC_Divergence(viewer, divergence_type,
                                       specific_values.connectors, id)
     return divergenceCreationFunction
 
+
 def jumpCreationFunction(viewer, id, specific_values):
     return SFC_Jump(viewer, specific_values.target, id)
 
+
 def actionBlockCreationFunction(viewer, id, specific_values):
     return SFC_ActionBlock(viewer, specific_values.actions, id)
 
@@ -184,6 +197,7 @@
     "actionBlock": actionBlockCreationFunction,
 }
 
+
 def sort_blocks(block_infos1, block_infos2):
     x1, y1 = block_infos1[0].GetPosition()
     x2, y2 = block_infos2[0].GetPosition()
@@ -483,12 +497,12 @@
             dc.DrawText(text, x + tw, y)
         dc.SetUserScale(scalex, scaley)
 
-"""
-Class that implements a Viewer based on a wx.ScrolledWindow for drawing and
-manipulating graphic elements
-"""
 
 class Viewer(EditorPanel, DebugViewer):
+    """
+    Class that implements a Viewer based on a wx.ScrolledWindow for drawing and
+    manipulating graphic elements
+    """
 
     if wx.VERSION < (2, 6, 0):
         def Bind(self, event, function, id = None):