# HG changeset patch # User Laurent Bessard # Date 1338766037 -7200 # Node ID ece862b07321cb5cba839d4915c85a17df7e3d39 # Parent 25fbbb005a308e0468eb509a34a4930f64b053cd Fixing bugs with properties panel when resetting optional value and saving project diff -r 25fbbb005a30 -r ece862b07321 PLCControler.py --- a/PLCControler.py Sun Jun 03 23:47:56 2012 +0200 +++ b/PLCControler.py Mon Jun 04 01:27:17 2012 +0200 @@ -2899,8 +2899,7 @@ if not filepath and self.FilePath == "": return False else: - contentheader = self.Project.getcontentHeader() - contentheader["modificationDateTime"] = datetime.datetime(*localtime()[:6]) + contentheader = {"modificationDateTime": datetime.datetime(*localtime()[:6])} self.Project.setcontentHeader(contentheader) text = "\n" diff -r 25fbbb005a30 -r ece862b07321 controls/ProjectPropertiesPanel.py --- a/controls/ProjectPropertiesPanel.py Sun Jun 03 23:47:56 2012 +0200 +++ b/controls/ProjectPropertiesPanel.py Mon Jun 04 01:27:17 2012 +0200 @@ -259,10 +259,18 @@ value = getattr(self, param).GetValue() if param in REQUIRED_PARAMS or value != "": values[param] = value - if self.Language.GetStringSelection() != "": - values["language"] = self.Language.GetStringSelection() - if self.ContentDescription.GetValue() != "": - values["contentDescription"] = self.ContentDescription.GetValue() + else: + values[param] = None + language = self.Language.GetStringSelection() + if language != "": + values["language"] = language + else: + values["language"] = None + content_description = self.ContentDescription.GetValue() + if content_description != "": + values["contentDescription"] = content_description + else: + values["contentDescription"] = None values["pageSize"] = (self.PageWidth.GetValue(), self.PageHeight.GetValue()) values["scaling"] = {} for language in ["FBD", "LD", "SFC"]: @@ -278,6 +286,8 @@ else: old_value = None new_value = textctrl.GetValue() + if name not in REQUIRED_PARAMS and new_value == "": + new_value = None if old_value != new_value: self.Controller.SetProjectProperties(properties={name: new_value}) self.ParentWindow.RefreshTitle() @@ -341,6 +351,9 @@ else: old_value = None new_value = self.Language.GetStringSelection() + if new_value == "": + new_value = None + print old_value, new_value if old_value != new_value: self.Controller.SetProjectProperties(properties={"language": new_value}) self.ParentWindow.RefreshTitle() @@ -357,6 +370,8 @@ else: old_value = None new_value = self.ContentDescription.GetValue() + if new_value == "": + new_value = None if old_value != new_value: self.Controller.SetProjectProperties(properties={"contentDescription": new_value}) self.ParentWindow.RefreshTitle()