dialogs/FBDBlockDialog.py
changeset 1784 64beb9e9c749
parent 1782 5b6ad7a7fd9d
child 1853 47a3f39bead0
equal deleted inserted replaced
1729:31e63e25b4cc 1784:64beb9e9c749
    29 
    29 
    30 from graphics.FBD_Objects import FBD_Block
    30 from graphics.FBD_Objects import FBD_Block
    31 from controls.LibraryPanel import LibraryPanel
    31 from controls.LibraryPanel import LibraryPanel
    32 from BlockPreviewDialog import BlockPreviewDialog
    32 from BlockPreviewDialog import BlockPreviewDialog
    33 
    33 
    34 #-------------------------------------------------------------------------------
    34 # -------------------------------------------------------------------------------
    35 #                                    Helpers
    35 #                                    Helpers
    36 #-------------------------------------------------------------------------------
    36 # -------------------------------------------------------------------------------
       
    37 
    37 
    38 
    38 def GetBlockTypeDefaultNameModel(blocktype):
    39 def GetBlockTypeDefaultNameModel(blocktype):
    39     return re.compile("%s[0-9]+" % blocktype if blocktype is not None else ".*")
    40     return re.compile("%s[0-9]+" % blocktype if blocktype is not None else ".*")
    40 
    41 
    41 #-------------------------------------------------------------------------------
    42 # -------------------------------------------------------------------------------
    42 #                         Set Block Parameters Dialog
    43 #                         Set Block Parameters Dialog
    43 #-------------------------------------------------------------------------------
    44 # -------------------------------------------------------------------------------
    44 
    45 
    45 """
       
    46 Class that implements a dialog for defining parameters of a FBD block graphic
       
    47 element
       
    48 """
       
    49 
    46 
    50 class FBDBlockDialog(BlockPreviewDialog):
    47 class FBDBlockDialog(BlockPreviewDialog):
    51     
    48     """
       
    49     Class that implements a dialog for defining parameters of a FBD block graphic
       
    50     element
       
    51     """
       
    52 
    52     def __init__(self, parent, controller, tagname):
    53     def __init__(self, parent, controller, tagname):
    53         """
    54         """
    54         Constructor
    55         Constructor
    55         @param parent: Parent wx.Window of dialog for modal
    56         @param parent: Parent wx.Window of dialog for modal
    56         @param controller: Reference to project controller
    57         @param controller: Reference to project controller
    57         @param tagname: Tagname of project POU edited
    58         @param tagname: Tagname of project POU edited
    58         """
    59         """
    59         BlockPreviewDialog.__init__(self, parent, controller, tagname,
    60         BlockPreviewDialog.__init__(self, parent, controller, tagname,
    60               title=_('Block Properties'))
    61                                     title=_('Block Properties'))
    61         
    62 
    62         # Init common sizers
    63         # Init common sizers
    63         self._init_sizers(2, 0, 1, 0, 3, 2)
    64         self._init_sizers(2, 0, 1, 0, 3, 2)
    64         
    65 
    65         # Create static box around library panel
    66         # Create static box around library panel
    66         type_staticbox = wx.StaticBox(self, label=_('Type:'))
    67         type_staticbox = wx.StaticBox(self, label=_('Type:'))
    67         left_staticboxsizer = wx.StaticBoxSizer(type_staticbox, wx.VERTICAL)
    68         left_staticboxsizer = wx.StaticBoxSizer(type_staticbox, wx.VERTICAL)
    68         self.LeftGridSizer.AddSizer(left_staticboxsizer, border=5, flag=wx.GROW)
    69         self.LeftGridSizer.AddSizer(left_staticboxsizer, border=5, flag=wx.GROW)
    69         
    70 
    70         # Create Library panel and add it to static box
    71         # Create Library panel and add it to static box
    71         self.LibraryPanel = LibraryPanel(self)
    72         self.LibraryPanel = LibraryPanel(self)
    72         self.LibraryPanel.SetInitialSize(wx.Size(-1, 400))
    73         self.LibraryPanel.SetInitialSize(wx.Size(-1, 400))
    73         
    74 
    74         # Set function to call when selection in Library panel changed
    75         # Set function to call when selection in Library panel changed
    75         setattr(self.LibraryPanel, "_OnTreeItemSelected", 
    76         setattr(self.LibraryPanel, "_OnTreeItemSelected",
    76               self.OnLibraryTreeItemSelected)
    77                 self.OnLibraryTreeItemSelected)
    77         left_staticboxsizer.AddWindow(self.LibraryPanel, 1, border=5, 
    78         left_staticboxsizer.AddWindow(self.LibraryPanel, 1, border=5,
    78               flag=wx.GROW|wx.TOP)
    79                                       flag=wx.GROW | wx.TOP)
    79         
    80 
    80         # Create sizer for other block parameters
    81         # Create sizer for other block parameters
    81         top_right_gridsizer = wx.FlexGridSizer(cols=2, hgap=0, rows=4, vgap=5)
    82         top_right_gridsizer = wx.FlexGridSizer(cols=2, hgap=0, rows=4, vgap=5)
    82         top_right_gridsizer.AddGrowableCol(1)
    83         top_right_gridsizer.AddGrowableCol(1)
    83         self.RightGridSizer.AddSizer(top_right_gridsizer, flag=wx.GROW)
    84         self.RightGridSizer.AddSizer(top_right_gridsizer, flag=wx.GROW)
    84         
    85 
    85         # Create label for block name
    86         # Create label for block name
    86         name_label = wx.StaticText(self, label=_('Name:'))
    87         name_label = wx.StaticText(self, label=_('Name:'))
    87         top_right_gridsizer.AddWindow(name_label, 
    88         top_right_gridsizer.AddWindow(name_label,
    88               flag=wx.ALIGN_CENTER_VERTICAL)
    89                                       flag=wx.ALIGN_CENTER_VERTICAL)
    89         
    90 
    90         # Create text control for defining block name
    91         # Create text control for defining block name
    91         self.BlockName = wx.TextCtrl(self)
    92         self.BlockName = wx.TextCtrl(self)
    92         self.Bind(wx.EVT_TEXT, self.OnNameChanged, self.BlockName)
    93         self.Bind(wx.EVT_TEXT, self.OnNameChanged, self.BlockName)
    93         top_right_gridsizer.AddWindow(self.BlockName, flag=wx.GROW)
    94         top_right_gridsizer.AddWindow(self.BlockName, flag=wx.GROW)
    94         
    95 
    95         # Create label for extended block input number
    96         # Create label for extended block input number
    96         inputs_label = wx.StaticText(self, label=_('Inputs:'))
    97         inputs_label = wx.StaticText(self, label=_('Inputs:'))
    97         top_right_gridsizer.AddWindow(inputs_label, 
    98         top_right_gridsizer.AddWindow(inputs_label,
    98               flag=wx.ALIGN_CENTER_VERTICAL)
    99                                       flag=wx.ALIGN_CENTER_VERTICAL)
    99         
   100 
   100         # Create spin control for defining extended block input number
   101         # Create spin control for defining extended block input number
   101         self.Inputs = wx.SpinCtrl(self, min=2, max=20,
   102         self.Inputs = wx.SpinCtrl(self, min=2, max=20,
   102               style=wx.SP_ARROW_KEYS)
   103                                   style=wx.SP_ARROW_KEYS)
   103         self.Bind(wx.EVT_SPINCTRL, self.OnInputsChanged, self.Inputs)
   104         self.Bind(wx.EVT_SPINCTRL, self.OnInputsChanged, self.Inputs)
   104         top_right_gridsizer.AddWindow(self.Inputs, flag=wx.GROW)
   105         top_right_gridsizer.AddWindow(self.Inputs, flag=wx.GROW)
   105         
   106 
   106         # Create label for block execution order
   107         # Create label for block execution order
   107         execution_order_label = wx.StaticText(self, 
   108         execution_order_label = wx.StaticText(self,
   108               label=_('Execution Order:'))
   109                                               label=_('Execution Order:'))
   109         top_right_gridsizer.AddWindow(execution_order_label, 
   110         top_right_gridsizer.AddWindow(execution_order_label,
   110               flag=wx.ALIGN_CENTER_VERTICAL)
   111                                       flag=wx.ALIGN_CENTER_VERTICAL)
   111         
   112 
   112         # Create spin control for defining block execution order
   113         # Create spin control for defining block execution order
   113         self.ExecutionOrder = wx.SpinCtrl(self, min=0, style=wx.SP_ARROW_KEYS)
   114         self.ExecutionOrder = wx.SpinCtrl(self, min=0, style=wx.SP_ARROW_KEYS)
   114         self.Bind(wx.EVT_SPINCTRL, self.OnExecutionOrderChanged, 
   115         self.Bind(wx.EVT_SPINCTRL, self.OnExecutionOrderChanged,
   115                   self.ExecutionOrder)
   116                   self.ExecutionOrder)
   116         top_right_gridsizer.AddWindow(self.ExecutionOrder, flag=wx.GROW)
   117         top_right_gridsizer.AddWindow(self.ExecutionOrder, flag=wx.GROW)
   117                 
   118 
   118         # Create label for block execution control
   119         # Create label for block execution control
   119         execution_control_label = wx.StaticText(self, 
   120         execution_control_label = wx.StaticText(self,
   120               label=_('Execution Control:'))
   121                                                 label=_('Execution Control:'))
   121         top_right_gridsizer.AddWindow(execution_control_label, 
   122         top_right_gridsizer.AddWindow(execution_control_label,
   122               flag=wx.ALIGN_CENTER_VERTICAL)
   123                                       flag=wx.ALIGN_CENTER_VERTICAL)
   123         
   124 
   124         # Create check box to enable block execution control
   125         # Create check box to enable block execution control
   125         self.ExecutionControl = wx.CheckBox(self)
   126         self.ExecutionControl = wx.CheckBox(self)
   126         self.Bind(wx.EVT_CHECKBOX, self.OnExecutionOrderChanged, 
   127         self.Bind(wx.EVT_CHECKBOX, self.OnExecutionOrderChanged,
   127                   self.ExecutionControl)
   128                   self.ExecutionControl)
   128         top_right_gridsizer.AddWindow(self.ExecutionControl, flag=wx.GROW)
   129         top_right_gridsizer.AddWindow(self.ExecutionControl, flag=wx.GROW)
   129         
   130 
   130         # Add preview panel and associated label to sizers
   131         # Add preview panel and associated label to sizers
   131         self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
   132         self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
   132         self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)
   133         self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)
   133         
   134 
   134         # Add buttons sizer to sizers
   135         # Add buttons sizer to sizers
   135         self.MainSizer.AddSizer(self.ButtonSizer, border=20, 
   136         self.MainSizer.AddSizer(self.ButtonSizer, border=20,
   136               flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   137                                 flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
   137         
   138 
   138         # Dictionary containing correspondence between parameter exchanged and
   139         # Dictionary containing correspondence between parameter exchanged and
   139         # control to fill with parameter value
   140         # control to fill with parameter value
   140         self.ParamsControl = {
   141         self.ParamsControl = {
   141             "extension": self.Inputs,
   142             "extension": self.Inputs,
   142             "executionOrder": self.ExecutionOrder,
   143             "executionOrder": self.ExecutionOrder,
   143             "executionControl": self.ExecutionControl
   144             "executionControl": self.ExecutionControl
   144         }
   145         }
   145         
   146 
   146         # Init controls value and sensibility
   147         # Init controls value and sensibility
   147         self.BlockName.SetValue("")
   148         self.BlockName.SetValue("")
   148         self.BlockName.Enable(False)
   149         self.BlockName.Enable(False)
   149         self.Inputs.Enable(False)
   150         self.Inputs.Enable(False)
   150         
   151 
   151         # Variable containing last name typed
   152         # Variable containing last name typed
   152         self.CurrentBlockName = None
   153         self.CurrentBlockName = None
   153         
   154 
   154         # Refresh Library panel values
   155         # Refresh Library panel values
   155         self.LibraryPanel.SetBlockList(controller.GetBlockTypes(tagname))
   156         self.LibraryPanel.SetBlockList(controller.GetBlockTypes(tagname))
   156         self.Fit()
   157         self.Fit()
   157         self.LibraryPanel.SetFocus()
   158         self.LibraryPanel.SetFocus()
   158     
   159 
   159     def SetValues(self, values):
   160     def SetValues(self, values):
   160         """
   161         """
   161         Set default block parameters
   162         Set default block parameters
   162         @param values: Block parameters values
   163         @param values: Block parameters values
   163         """
   164         """
   164         # Extract block type defined in parameters
   165         # Extract block type defined in parameters
   165         blocktype = values.get("type", None)
   166         blocktype = values.get("type", None)
   166         
   167 
   167         # Select block type in library panel    
   168         # Select block type in library panel
   168         if blocktype is not None:
   169         if blocktype is not None:
   169             self.LibraryPanel.SelectTreeItem(blocktype, 
   170             self.LibraryPanel.SelectTreeItem(blocktype,
   170                                              values.get("inputs", None))
   171                                              values.get("inputs", None))
   171         
   172 
   172         # Define regular expression for determine if block name is block
   173         # Define regular expression for determine if block name is block
   173         # default name
   174         # default name
   174         default_name_model = GetBlockTypeDefaultNameModel(blocktype)
   175         default_name_model = GetBlockTypeDefaultNameModel(blocktype)
   175         
   176 
   176         # For each parameters defined, set corresponding control value
   177         # For each parameters defined, set corresponding control value
   177         for name, value in values.items():
   178         for name, value in values.items():
   178             
   179 
   179             # Parameter is block name
   180             # Parameter is block name
   180             if name == "name":
   181             if name == "name":
   181                 if value != "":
   182                 if value != "":
   182                     # Set default graphic element name for testing
   183                     # Set default graphic element name for testing
   183                     self.DefaultElementName = value
   184                     self.DefaultElementName = value
   184                     
   185 
   185                     # Test if block name is type default block name and save
   186                     # Test if block name is type default block name and save
   186                     # block name if not (name have been typed by user)
   187                     # block name if not (name have been typed by user)
   187                     if default_name_model.match(value) is None:
   188                     if default_name_model.match(value) is None:
   188                         self.CurrentBlockName = value
   189                         self.CurrentBlockName = value
   189             
   190 
   190                 self.BlockName.ChangeValue(value)
   191                 self.BlockName.ChangeValue(value)
   191             
   192 
   192             # Set value of other controls
   193             # Set value of other controls
   193             else:
   194             else:
   194                 control = self.ParamsControl.get(name, None)
   195                 control = self.ParamsControl.get(name, None)
   195                 if control is not None:
   196                 if control is not None:
   196                     control.SetValue(value)
   197                     control.SetValue(value)
   197         
   198 
   198         # Refresh preview panel
   199         # Refresh preview panel
   199         self.RefreshPreview()
   200         self.RefreshPreview()
   200 
   201 
   201     def GetValues(self):
   202     def GetValues(self):
   202         """
   203         """
   209         values["width"], values["height"] = self.Element.GetSize()
   210         values["width"], values["height"] = self.Element.GetSize()
   210         values.update({
   211         values.update({
   211             name: control.GetValue()
   212             name: control.GetValue()
   212             for name, control in self.ParamsControl.iteritems()})
   213             for name, control in self.ParamsControl.iteritems()})
   213         return values
   214         return values
   214     
   215 
   215     def OnOK(self, event):
   216     def OnOK(self, event):
   216         """
   217         """
   217         Called when dialog OK button is pressed
   218         Called when dialog OK button is pressed
   218         Test if parameters defined are valid
   219         Test if parameters defined are valid
   219         @param event: wx.Event from OK button
   220         @param event: wx.Event from OK button
   220         """
   221         """
   221         message = None
   222         message = None
   222         
   223 
   223         # Get block type selected
   224         # Get block type selected
   224         selected = self.LibraryPanel.GetSelectedBlock()
   225         selected = self.LibraryPanel.GetSelectedBlock()
   225         
   226 
   226         # Get block type name and if block is a function block
   227         # Get block type name and if block is a function block
   227         block_name = self.BlockName.GetValue()
   228         block_name = self.BlockName.GetValue()
   228         name_enabled = self.BlockName.IsEnabled()
   229         name_enabled = self.BlockName.IsEnabled()
   229         
   230 
   230         # Test that a type has been selected for block
   231         # Test that a type has been selected for block
   231         if selected is None:
   232         if selected is None:
   232             message = _("Form isn't complete. Valid block type must be selected!")
   233             message = _("Form isn't complete. Valid block type must be selected!")
   233         
   234 
   234         # Test, if block is a function block, that a name have been defined
   235         # Test, if block is a function block, that a name have been defined
   235         elif name_enabled and block_name == "":
   236         elif name_enabled and block_name == "":
   236             message = _("Form isn't complete. Name must be filled!")
   237             message = _("Form isn't complete. Name must be filled!")
   237         
   238 
   238         # Show error message if an error is detected
   239         # Show error message if an error is detected
   239         if message is not None:
   240         if message is not None:
   240             self.ShowErrorMessage(message)
   241             self.ShowErrorMessage(message)
   241         
   242 
   242         # Test block name validity if necessary
   243         # Test block name validity if necessary
   243         elif not name_enabled or self.TestElementName(block_name):
   244         elif not name_enabled or self.TestElementName(block_name):
   244             # Call BlockPreviewDialog function
   245             # Call BlockPreviewDialog function
   245             BlockPreviewDialog.OnOK(self, event)
   246             BlockPreviewDialog.OnOK(self, event)
   246     
   247 
   247     def OnLibraryTreeItemSelected(self, event):
   248     def OnLibraryTreeItemSelected(self, event):
   248         """
   249         """
   249         Called when block type selected in library panel
   250         Called when block type selected in library panel
   250         @param event: wx.TreeEvent
   251         @param event: wx.TreeEvent
   251         """
   252         """
   252         # Get type selected in library panel
   253         # Get type selected in library panel
   253         values = self.LibraryPanel.GetSelectedBlock()
   254         values = self.LibraryPanel.GetSelectedBlock()
   254         
   255 
   255         # Get block type informations
   256         # Get block type informations
   256         blocktype = (self.Controller.GetBlockType(values["type"], 
   257         blocktype = (self.Controller.GetBlockType(values["type"],
   257                                                   values["inputs"])
   258                                                   values["inputs"])
   258                      if values is not None else None)
   259                      if values is not None else None)
   259         
   260 
   260         # Set input number spin control according to block type informations
   261         # Set input number spin control according to block type informations
   261         if blocktype is not None:
   262         if blocktype is not None:
   262             self.Inputs.SetValue(len(blocktype["inputs"]))
   263             self.Inputs.SetValue(len(blocktype["inputs"]))
   263             self.Inputs.Enable(blocktype["extensible"])
   264             self.Inputs.Enable(blocktype["extensible"])
   264         else:
   265         else:
   265             self.Inputs.SetValue(2)
   266             self.Inputs.SetValue(2)
   266             self.Inputs.Enable(False)
   267             self.Inputs.Enable(False)
   267         
   268 
   268         # Update block name with default value if block type is a function and
   269         # Update block name with default value if block type is a function and
   269         # current block name wasn't typed by user
   270         # current block name wasn't typed by user
   270         if blocktype is not None and blocktype["type"] != "function":
   271         if blocktype is not None and blocktype["type"] != "function":
   271             self.BlockName.Enable(True)
   272             self.BlockName.Enable(True)
   272             
   273 
   273             if self.CurrentBlockName is None:
   274             if self.CurrentBlockName is None:
   274                 # Generate new block name according to block type, taking
   275                 # Generate new block name according to block type, taking
   275                 # default element name if it was already a default name for this
   276                 # default element name if it was already a default name for this
   276                 # block type
   277                 # block type
   277                 default_name_model = GetBlockTypeDefaultNameModel(values["type"])
   278                 default_name_model = GetBlockTypeDefaultNameModel(values["type"])
   278                 block_name = (
   279                 block_name = (
   279                     self.DefaultElementName
   280                     self.DefaultElementName
   280                     if (self.DefaultElementName is not None and 
   281                     if (self.DefaultElementName is not None and
   281                         default_name_model.match(self.DefaultElementName))
   282                         default_name_model.match(self.DefaultElementName))
   282                     else self.Controller.GenerateNewName(
   283                     else self.Controller.GenerateNewName(
   283                         self.TagName, None, values["type"]+"%d", 0))
   284                         self.TagName, None, values["type"]+"%d", 0))
   284             else:
   285             else:
   285                 block_name = self.CurrentBlockName
   286                 block_name = self.CurrentBlockName
   286                 
   287 
   287             self.BlockName.ChangeValue(block_name)
   288             self.BlockName.ChangeValue(block_name)
   288         else:
   289         else:
   289             self.BlockName.Enable(False)
   290             self.BlockName.Enable(False)
   290             self.BlockName.ChangeValue("")
   291             self.BlockName.ChangeValue("")
   291         
   292 
   292         # Refresh preview panel
   293         # Refresh preview panel
   293         self.RefreshPreview()
   294         self.RefreshPreview()
   294     
   295 
   295     def OnNameChanged(self, event):
   296     def OnNameChanged(self, event):
   296         """
   297         """
   297         Called when block name value changed
   298         Called when block name value changed
   298         @param event: wx.TextEvent
   299         @param event: wx.TextEvent
   299         """
   300         """
   300         if self.BlockName.IsEnabled():
   301         if self.BlockName.IsEnabled():
   301             # Save block name typed by user
   302             # Save block name typed by user
   302             self.CurrentBlockName = self.BlockName.GetValue()
   303             self.CurrentBlockName = self.BlockName.GetValue()
   303             self.RefreshPreview()
   304             self.RefreshPreview()
   304         event.Skip()
   305         event.Skip()
   305     
   306 
   306     def OnInputsChanged(self, event):
   307     def OnInputsChanged(self, event):
   307         """
   308         """
   308         Called when block inputs number changed
   309         Called when block inputs number changed
   309         @param event: wx.SpinEvent
   310         @param event: wx.SpinEvent
   310         """
   311         """
   311         if self.Inputs.IsEnabled():
   312         if self.Inputs.IsEnabled():
   312             self.RefreshPreview()
   313             self.RefreshPreview()
   313         event.Skip()
   314         event.Skip()
   314     
   315 
   315     def OnExecutionOrderChanged(self, event):
   316     def OnExecutionOrderChanged(self, event):
   316         """
   317         """
   317         Called when block execution order value changed
   318         Called when block execution order value changed
   318         @param event: wx.SpinEvent
   319         @param event: wx.SpinEvent
   319         """
   320         """
   320         self.RefreshPreview()
   321         self.RefreshPreview()
   321         event.Skip()
   322         event.Skip()
   322     
   323 
   323     def OnExecutionControlChanged(self, event):
   324     def OnExecutionControlChanged(self, event):
   324         """
   325         """
   325         Called when block execution control value changed
   326         Called when block execution control value changed
   326         @param event: wx.SpinEvent
   327         @param event: wx.SpinEvent
   327         """
   328         """
   328         self.RefreshPreview()
   329         self.RefreshPreview()
   329         event.Skip()
   330         event.Skip()
   330     
   331 
   331     def RefreshPreview(self):
   332     def RefreshPreview(self):
   332         """
   333         """
   333         Refresh preview panel of graphic element
   334         Refresh preview panel of graphic element
   334         Override BlockPreviewDialog function
   335         Override BlockPreviewDialog function
   335         """
   336         """
   336         # Get type selected in library panel
   337         # Get type selected in library panel
   337         values = self.LibraryPanel.GetSelectedBlock()
   338         values = self.LibraryPanel.GetSelectedBlock()
   338         
   339 
   339         # If a block type is selected in library panel
   340         # If a block type is selected in library panel
   340         if values is not None:
   341         if values is not None:
   341             # Set graphic element displayed, creating a FBD block element
   342             # Set graphic element displayed, creating a FBD block element
   342             self.Element = FBD_Block(self.Preview, values["type"], 
   343             self.Element = FBD_Block(
   343                     (self.BlockName.GetValue()
   344                 self.Preview, values["type"],
   344                      if self.BlockName.IsEnabled()
   345                 (self.BlockName.GetValue() if self.BlockName.IsEnabled() else ""),
   345                      else ""), 
   346                 extension=self.Inputs.GetValue(),
   346                     extension = self.Inputs.GetValue(), 
   347                 inputs=values["inputs"],
   347                     inputs = values["inputs"], 
   348                 executionControl=self.ExecutionControl.GetValue(),
   348                     executionControl = self.ExecutionControl.GetValue(), 
   349                 executionOrder=self.ExecutionOrder.GetValue())
   349                     executionOrder = self.ExecutionOrder.GetValue())
   350 
   350         
       
   351         # Reset graphic element displayed
   351         # Reset graphic element displayed
   352         else:
   352         else:
   353             self.Element = None 
   353             self.Element = None
   354         
   354 
   355         # Call BlockPreviewDialog function
   355         # Call BlockPreviewDialog function
   356         BlockPreviewDialog.RefreshPreview(self)
   356         BlockPreviewDialog.RefreshPreview(self)