fix bug with indelible values in some 'optional' fields in project properties panel
authorSurkov Sergey <surkovsv93@gmail.com>
Mon, 19 Feb 2018 19:36:43 +0300
changeset 1972 38e912c8bd31
parent 1971 62403f9b6ca9
child 1973 cc7a46953471
fix bug with indelible values in some 'optional' fields in project properties panel

only 'required' fields should be indelible
controls/ProjectPropertiesPanel.py
plcopen/plcopen.py
--- a/controls/ProjectPropertiesPanel.py	Mon Feb 19 19:10:07 2018 +0300
+++ b/controls/ProjectPropertiesPanel.py	Mon Feb 19 19:36:43 2018 +0300
@@ -285,7 +285,7 @@
             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 == "":
+                if name in REQUIRED_PARAMS and new_value == "":
                     new_value = None
                 if name == 'companyURL':
                     if not URI_model.match(new_value):
--- a/plcopen/plcopen.py	Mon Feb 19 19:10:07 2018 +0300
+++ b/plcopen/plcopen.py	Mon Feb 19 19:36:43 2018 +0300
@@ -441,7 +441,7 @@
                     "authorName": contentheader_obj.setauthor,
                     "pageSize": lambda v: contentheader_obj.setpageSize(*v),
                     "scaling": contentheader_obj.setscaling}.get(attr)
-            if func is not None:
+            if func is not None and value is not None:
                 func(value)
             elif attr in ["modificationDateTime", "organization", "language"]:
                 setattr(contentheader_obj, attr, value)