dialogs/SFCTransitionDialog.py
changeset 1730 64d8f52bc8c8
parent 1696 8043f32de7b8
child 1736 7e61baa047f0
--- a/dialogs/SFCTransitionDialog.py	Fri Aug 11 15:18:19 2017 +0300
+++ b/dialogs/SFCTransitionDialog.py	Mon Aug 14 19:13:01 2017 +0300
@@ -38,7 +38,7 @@
 """
 
 class SFCTransitionDialog(BlockPreviewDialog):
-    
+
     def __init__(self, parent, controller, tagname, connection=True):
         """
         Constructor
@@ -50,32 +50,32 @@
         """
         BlockPreviewDialog.__init__(self, parent, controller, tagname,
               title=_('Edit transition'))
-        
+
         # Init common sizers
         self._init_sizers(2, 0, 8, None, 2, 1)
-        
+
         # Create label for transition type
         type_label = wx.StaticText(self, label=_('Type:'))
         self.LeftGridSizer.AddWindow(type_label, flag=wx.GROW)
-        
+
         # Create combo box for selecting reference value
         reference = wx.ComboBox(self, style=wx.CB_READONLY)
         reference.Append("")
         for transition in controller.GetEditedElementTransitions(tagname):
             reference.Append(transition)
         self.Bind(wx.EVT_COMBOBOX, self.OnReferenceChanged, reference)
-        
+
         # Create Text control for defining inline value
         inline = wx.TextCtrl(self)
         self.Bind(wx.EVT_TEXT, self.OnInlineChanged, inline)
-        
+
         # Create radio buttons for selecting power rail type
         self.TypeRadioButtons = {}
         first = True
         for type, label, control in [('reference', _('Reference'), reference),
                                      ('inline', _('Inline'), inline),
                                      ('connection', _('Connection'), None)]:
-            radio_button = wx.RadioButton(self, label=label, 
+            radio_button = wx.RadioButton(self, label=label,
                   style=(wx.RB_GROUP if first else 0))
             radio_button.SetValue(first)
             self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button)
@@ -85,29 +85,29 @@
                 self.LeftGridSizer.AddWindow(control, flag=wx.GROW)
             self.TypeRadioButtons[type] = (radio_button, control)
             first = False
-        
+
         # Create label for transition priority
         priority_label = wx.StaticText(self, label=_('Priority:'))
         self.LeftGridSizer.AddWindow(priority_label, flag=wx.GROW)
-        
+
         # Create spin control for defining priority value
         self.Priority = wx.SpinCtrl(self, min=0, style=wx.SP_ARROW_KEYS)
         self.Bind(wx.EVT_TEXT, self.OnPriorityChanged, self.Priority)
         self.LeftGridSizer.AddWindow(self.Priority, flag=wx.GROW)
-        
+
         # Add preview panel and associated label to sizers
         self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
         self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)
-        
+
         # Add buttons sizer to sizers
-        self.MainSizer.AddSizer(self.ButtonSizer, border=20, 
+        self.MainSizer.AddSizer(self.ButtonSizer, border=20,
               flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
 
         self.Fit()
-        
+
         # Reference radio button is default control having keyboard focus
         self.TypeRadioButtons["reference"][0].SetFocus()
-    
+
     def GetTransitionType(self):
         """
         Return type selected for SFC transition and associated value
@@ -124,7 +124,7 @@
                 else:
                     return type, None
         return None, None
-    
+
     def SetValues(self, values):
         """
         Set default SFC transition parameters
@@ -132,14 +132,14 @@
         """
         # Extract transition value according to type
         type_value = values.get("value", None)
-        
+
         # For each parameters defined, set corresponding control value
         for name, value in values.items():
-            
+
             # Parameter is SFC transition priority
             if name == "priority":
                 self.Priority.SetValue(values["priority"])
-            
+
             # Parameter is SFC transition type
             elif name == "type":
                 for type, (radio, control) in self.TypeRadioButtons.iteritems():
@@ -152,10 +152,10 @@
                                 control.SetStringSelection(type_value)
                             elif isinstance(control, wx.TextCtrl):
                                 control.ChangeValue(type_value)
-        
+
         # Refresh preview panel
         self.RefreshPreview()
-        
+
     def GetValues(self):
         """
         Return SFC transition parameters defined in dialog
@@ -165,7 +165,7 @@
         values["type"], values["value"] = self.GetTransitionType()
         values["width"], values["height"] = self.Element.GetSize()
         return values
-    
+
     def OnOK(self, event):
         """
         Called when dialog OK button is pressed
@@ -173,18 +173,18 @@
         @param event: wx.Event from OK button
         """
         message = None
-        
+
         # Get transition type and value associated
         type, value = self.GetTransitionType()
-        
+
         # Test that value associated to type is defined
         if type != "connection" and value == "":
             message = _("Form isn't complete. %s must be filled!") % type
-        
+
         # Show error message if an error is detected
         if message is not None:
             self.ShowErrorMessage(message)
-        
+
         else:
             # Call BlockPreviewDialog function
             BlockPreviewDialog.OnOK(self, event)
@@ -198,7 +198,7 @@
         for type, (radio, control) in self.TypeRadioButtons.iteritems():
             if control is not None:
                 control.Enable(radio.GetValue())
-        
+
         # Refresh preview panel
         self.RefreshPreview()
         event.Skip()
@@ -236,6 +236,6 @@
         self.Element = SFC_Transition(self.Preview)
         self.Element.SetType(*self.GetTransitionType())
         self.Element.SetPriority(self.Priority.GetValue())
-        
+
         # Call BlockPreviewDialog function
         BlockPreviewDialog.RefreshPreview(self)