--- a/LPCBeremiz.py Thu Dec 10 12:29:27 2009 +0100
+++ b/LPCBeremiz.py Thu Dec 10 12:30:49 2009 +0100
@@ -66,7 +66,7 @@
from plcopen.structures import LOCATIONDATATYPES
from PLCControler import LOCATION_PLUGIN, LOCATION_MODULE, LOCATION_GROUP,\
LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
-from PLCOpenEditor import IDEFrame
+from PLCOpenEditor import IDEFrame, ProjectDialog #-------------------------------------------------------------------------------
@@ -489,19 +489,29 @@
if os.path.basename(ProjectPath) == "":
ProjectPath = os.path.dirname(ProjectPath)
# Verify that project contains a PLCOpen program
plc_file = os.path.join(ProjectPath, "plc.xml")
- if not os.path.isfile(plc_file):
- return _("Chosen folder doesn't contain a program. It's not a valid project!")
- result = self.OpenXMLFile(plc_file)
+ if os.path.isfile(plc_file): + result = self.OpenXMLFile(plc_file) + self.CreateNewProject({"companyName": "", # Change XSD into class members
# Keep track of the root plugin (i.e. project path)
self.ProjectPath = ProjectPath
self.BuildPath = self._getBuildPath()
if BuildPath is not None:
mycopytree(BuildPath, self.BuildPath)
@@ -514,6 +524,10 @@
#Load and init all the childs
+ if self.PlugTestModified(): self.RefreshPluginsBlockLists()
@@ -771,6 +785,19 @@
+ def ShowProperties(self): + old_values = self.Controler.GetProjectProperties() + dialog = ProjectDialog(self ,False) + dialog.SetValues(old_values) + if dialog.ShowModal() == wx.ID_OK: + new_values = dialog.GetValues() + new_values["creationDateTime"] = old_values["creationDateTime"] + if new_values != old_values: + self.Controler.SetProjectProperties(None, new_values) + self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, + TYPESTREE, INSTANCESTREE, SCALING) def RefreshFileMenu(self):
if self.PluginRoot is not None:
selected = self.TabsOpened.GetSelection()
@@ -791,7 +818,7 @@
self.FileMenu.Enable(wx.ID_PREVIEW, False)
self.FileMenu.Enable(wx.ID_PRINT, False)
self.FileMenu.Enable(wx.ID_PAGE_SETUP, True)
- self.FileMenu.Enable(wx.ID_SAVE, True)
+ self.FileMenu.Enable(wx.ID_SAVE, self.PluginRoot.PlugTestModified()) self.FileMenu.Enable(wx.ID_PROPERTIES, True)
self.FileMenu.Enable(wx.ID_CLOSE, False)
@@ -1057,8 +1084,13 @@
wx.CallAfter(self.PluginRoot._build)
- def SetProjectName(self, name):
- self.PluginRoot.SetProjectName(name)
+ def SetProjectProperties(self, projectname, productname, productversion, companyname): + properties = self.PluginRoot.GetProjectProperties() + properties["projectName"] = projectname + properties["productName"] = productname + properties["productVersion"] = productversion + properties["companyName"] = companyname + self.PluginRoot.SetProjectProperties(properties=properties) def SetOnlineMode(self, mode, path=None):
@@ -1286,7 +1318,7 @@
- "SetProjectName": ([str], 0),
+ "SetProjectProperties": ([str, str, str, str], 0), "SetOnlineMode": ([int, str], 1),
"AddBus": ([int, str, str], 1),
"RenameBus": ([int, str], 0),