Fix bug name kept when changing a function block to a function
authorLaurent Bessard
Sat, 25 Aug 2012 14:45:44 +0200
changeset 746 963123fb4917
parent 745 ecd2effd4660
child 747 f36838792511
Fix bug name kept when changing a function block to a function
dialogs/FBDBlockDialog.py
--- a/dialogs/FBDBlockDialog.py	Sat Aug 25 14:44:49 2012 +0200
+++ b/dialogs/FBDBlockDialog.py	Sat Aug 25 14:45:44 2012 +0200
@@ -193,7 +193,7 @@
 
     def GetValues(self):
         values = self.LibraryPanel.GetSelectedBlock()
-        if self.BlockName.GetValue() != "":
+        if self.BlockName.IsEnabled() and self.BlockName.GetValue() != "":
             values["name"] = self.BlockName.GetValue()
         values["width"], values["height"] = self.Block.GetSize()
         values["extension"] = self.Inputs.GetValue()
@@ -247,8 +247,12 @@
         dc.Clear()
         values = self.LibraryPanel.GetSelectedBlock()
         if values is not None:
+            if self.BlockName.IsEnabled():
+                blockname = self.BlockName.GetValue()
+            else:
+                blockname = ""
             self.Block = FBD_Block(self.Preview, values["type"], 
-                    self.BlockName.GetValue(), 
+                    blockname, 
                     extension = self.Inputs.GetValue(), 
                     inputs = values["inputs"], 
                     executionControl = self.ExecutionControl.GetValue(),