fix clearing project name on opening project properties page.
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 11 Apr 2017 19:09:34 +0300
changeset 1678 55b6db51eb63
parent 1677 db05cb9e0439
child 1679 2fcea15858a5
fix clearing project name on opening project properties page.

The problem exists only on Windows with wxPython-3.0.

This happens because callback for EVT_KILL_FOCUS for a first text
control (project name) is called just after creating page with project
properties. It happens before initializing text controls from PLCController.
controls/ProjectPropertiesPanel.py
--- a/controls/ProjectPropertiesPanel.py	Tue Apr 11 17:45:49 2017 +0300
+++ b/controls/ProjectPropertiesPanel.py	Tue Apr 11 19:09:34 2017 +0300
@@ -272,11 +272,8 @@
     
     def GetTextCtrlChangedFunction(self, textctrl, name):
         def TextCtrlChangedFunction(event):
-            if self.Controller is not None:
-                if self.Values is not None:
-                    old_value = self.Values.get(name)
-                else:
-                    old_value = None
+            if self.Controller is not None and self.Values is not None:
+                old_value = self.Values.get(name)
                 new_value = textctrl.GetValue()
                 if name not in REQUIRED_PARAMS and new_value == "":
                     new_value = None