--- a/PLCOpenEditor.py Fri Jan 04 17:49:17 2008 +0100
+++ b/PLCOpenEditor.py Fri Jan 11 17:51:56 2008 +0100
@@ -22,7 +22,6 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from time import localtime
from datetime import datetime
import wx, wx.grid
@@ -423,11 +422,11 @@
self.OnPouSelectedChanged)
if wx.VERSION < (2, 8, 0):
- self.VariablePanelIndexer = VariablePanelIndexer(self.SecondSplitter, self.Controler)
+ self.VariablePanelIndexer = VariablePanelIndexer(self.SecondSplitter, self, self.Controler)
self.SecondSplitter.SplitHorizontally(self.TabsOpened, self.VariablePanelIndexer, -200)
else:
- self.VariablePanelIndexer = VariablePanelIndexer(self, self.Controler)
+ self.VariablePanelIndexer = VariablePanelIndexer(self, self, self.Controler)
self.AUIManager.AddPane(self.VariablePanelIndexer, wx.aui.AuiPaneInfo().Caption("Variable Panel").Bottom().Layer(0).BestSize(wx.Size(800, 200)).CloseButton(False))
self.AUIManager.Update()
@@ -644,10 +643,16 @@
dialog.SetValues(old_values)
if dialog.ShowModal() == wx.ID_OK:
new_values = dialog.GetValues()
- projectname = new_values.pop("projectName")
new_values["creationDateTime"] = old_values["creationDateTime"]
- self.Controler.SetProjectProperties(projectname, new_values)
- self.RefreshProjectTree()
+ if new_values != old_values:
+ self.Controler.SetProjectProperties(None, new_values)
+ self.RefreshTitle()
+ self.RefreshFileMenu()
+ self.RefreshEditMenu()
+ self.RefreshProjectTree()
+ for i in xrange(self.GetPageCount()):
+ editor = self.GetPage(i)
+ editor.RefreshScaling()
dialog.Destroy()
def OnCloseFrame(self, event):
@@ -675,11 +680,8 @@
def OnNewProjectMenu(self, event):
dialog = ProjectDialog(self)
if dialog.ShowModal() == wx.ID_OK:
- values = dialog.GetValues()
- projectname = values.pop("projectName")
- values["creationDateTime"] = datetime(*localtime()[:6])
- self.Controler.CreateNewProject(projectname)
- self.Controler.SetProjectProperties(projectname, values)
+ properties = dialog.GetValues()
+ self.Controler.CreateNewProject(properties)
self.RefreshTitle()
self.RefreshFileMenu()
self.RefreshEditMenu()
@@ -1036,10 +1038,12 @@
dragSource.DoDragDrop()
self.ResetSelectedItem()
- def RefreshEditorNames(self, item_type, old_name, new_name):
+ def RefreshEditorNames(self, old_tagname, new_tagname):
for i in xrange(self.GetPageCount()):
editor = self.GetPage(i)
- editor.RefreshName(item_type, old_name, new_name)
+ if editor.GetTagName() == old_tagname:
+ editor.SetTagName(new_tagname)
+ self.VariablePanelIndexer.UpdateVariablePanelTagName(old_tagname, new_tagname)
def OnProjectTreeItemEndEdit(self, event):
message = None
@@ -1062,7 +1066,8 @@
abort = True
if not abort:
self.Controler.ChangeDataTypeName(old_name, new_name)
- self.RefreshEditorNames(itemtype, old_name, new_name)
+ self.RefreshEditorNames(self.Controler.ComputeDataTypeName(old_name),
+ self.Controler.ComputeDataTypeName(new_name))
self.RefreshPageTitles()
elif itemtype == ITEM_POU:
if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames() if name != old_name]:
@@ -1075,7 +1080,8 @@
messageDialog.Destroy()
if not abort:
self.Controler.ChangePouName(old_name, new_name)
- self.RefreshEditorNames(itemtype, old_name, new_name)
+ self.RefreshEditorNames(self.Controler.ComputePouName(old_name),
+ self.Controler.ComputePouName(new_name))
self.RefreshPageTitles()
elif itemtype == ITEM_TRANSITION:
parent = self.ProjectTree.GetItemParent(item)
@@ -1090,7 +1096,8 @@
message = "A variable with \"%s\" as name already exists in this pou!"%new_name
else:
self.Controler.ChangePouTransitionName(pou_name, old_name, new_name)
- self.RefreshEditorNames(itemtype, old_name, new_name)
+ self.RefreshEditorNames(self.Controler.ComputePouTransitionName(pou_name, old_name),
+ self.Controler.ComputePouTransitionName(pou_name, new_name))
self.RefreshPageTitles()
elif itemtype == ITEM_ACTION:
parent = self.ProjectTree.GetItemParent(item)
@@ -1105,7 +1112,8 @@
message = "A variable with \"%s\" as name already exists in this pou!"%new_name
else:
self.Controler.ChangePouActionName(pou_name, old_name, new_name)
- self.RefreshEditorNames(itemtype, old_name, new_name)
+ self.RefreshEditorNames(self.Controler.ComputePouActionName(pou_name, old_name),
+ self.Controler.ComputePouActionName(pou_name, new_name))
self.RefreshPageTitles()
elif itemtype == ITEM_CONFIGURATION:
if new_name.upper() in [name.upper() for name in self.Controler.GetProjectConfigNames() if name != old_name]:
@@ -1123,7 +1131,8 @@
messageDialog.Destroy()
if not abort:
self.Controler.ChangeConfigurationName(old_name, new_name)
- self.RefreshEditorNames(itemtype, old_name, new_name)
+ self.RefreshEditorNames(self.Controler.ComputeConfigurationName(old_name),
+ self.Controler.ComputeConfigurationName(new_name))
self.RefreshPageTitles()
elif itemtype == ITEM_RESOURCE:
parent = self.ProjectTree.GetItemParent(item)
@@ -1147,7 +1156,8 @@
messageDialog.Destroy()
if not abort:
self.Controler.ChangeConfigurationResourceName(config_name, old_name, new_name)
- self.RefreshEditorNames(itemtype, old_name, new_name)
+ self.RefreshEditorNames(self.Controler.ComputeConfigurationResourceName(config_name, old_name),
+ self.Controler.ComputeConfigurationResourceName(config_name, new_name))
self.RefreshPageTitles()
if message or abort:
if message:
@@ -1287,10 +1297,13 @@
bodytype = self.Controler.GetEditedElementBodyType(tagname)
if bodytype == "FBD":
new_window = MDIViewer(self, tagname, self, self.Controler)
+ new_window.GetViewer().RefreshScaling(False)
elif bodytype == "LD":
new_window = LD_MDIViewer(self, tagname, self, self.Controler)
+ new_window.GetViewer().RefreshScaling(False)
elif bodytype == "SFC":
new_window = SFC_MDIViewer(self, tagname, self, self.Controler)
+ new_window.GetViewer().RefreshScaling(False)
else:
new_window = TextMDIViewer(self, tagname, self, self.Controler)
viewer = new_window.GetViewer()
@@ -1315,10 +1328,13 @@
bodytype = self.Controler.GetEditedElementBodyType(tagname)
if bodytype == "FBD":
new_window = Viewer(self.TabsOpened, tagname, self, self.Controler)
+ new_window.RefreshScaling(False)
elif bodytype == "LD":
new_window = LD_Viewer(self.TabsOpened, tagname, self, self.Controler)
+ new_window.RefreshScaling(False)
elif bodytype == "SFC":
new_window = SFC_Viewer(self.TabsOpened, tagname, self, self.Controler)
+ new_window.RefreshScaling(False)
else:
new_window = TextViewer(self.TabsOpened, tagname, self, self.Controler)
new_window.SetTextSyntax(elementtype)
@@ -1741,16 +1757,83 @@
# Create Project Dialog
#-------------------------------------------------------------------------------
-[ID_PROJECTDIALOG, ID_PROJECTDIALOGPROJECTNAME,
- ID_PROJECTDIALOGCOMPANYNAME, ID_PROJECTDIALOGCOMPANYURL,
+[ID_SCALINGPANEL, ID_SCALINGPANELXSCALE,
+ ID_SCALINGPANELYSCALE, ID_SCALINGPANELSTATICTEXT1,
+ ID_SCALINGPANELSTATICTEXT2,
+] = [wx.NewId() for _init_ctrls in range(5)]
+
+class ScalingPanel(wx.Panel):
+
+ def _init_coll_ScalingPanelSizer_Items(self, parent):
+ parent.AddWindow(self.staticText1, 0, border=10, flag=wx.GROW|wx.TOP|wx.LEFT)
+ parent.AddWindow(self.XScale, 0, border=10, flag=wx.GROW|wx.TOP|wx.RIGHT)
+ parent.AddWindow(self.staticText2, 0, border=10, flag=wx.GROW|wx.BOTTOM|wx.LEFT)
+ parent.AddWindow(self.YScale, 0, border=10, flag=wx.GROW|wx.BOTTOM|wx.RIGHT)
+
+ def _init_coll_ScalingPanelSizer_Growables(self, parent):
+ parent.AddGrowableCol(1)
+
+ def _init_sizers(self):
+ self.ScalingPanelSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=2, vgap=5)
+
+ self._init_coll_ScalingPanelSizer_Items(self.ScalingPanelSizer)
+ self._init_coll_ScalingPanelSizer_Growables(self.ScalingPanelSizer)
+
+ self.SetSizer(self.ScalingPanelSizer)
+
+ def _init_ctrls(self, prnt):
+ wx.Panel.__init__(self, id=ID_SCALINGPANEL,
+ name='ScalingPanel', parent=prnt, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=0)
+
+ self.staticText1 = wx.StaticText(id=ID_SCALINGPANELSTATICTEXT1,
+ label='X Scale:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0)
+
+ self.XScale = wx.SpinCtrl(id=ID_SCALINGPANELXSCALE,
+ name='XScale', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0, min=0, max=2**16)
+
+ self.staticText2 = wx.StaticText(id=ID_SCALINGPANELSTATICTEXT2,
+ label='Y Scale:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0)
+
+ self.YScale = wx.SpinCtrl(id=ID_SCALINGPANELYSCALE,
+ name='YScale', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0, min=0, max=2**16)
+
+ self._init_sizers()
+
+ def __init__(self, parent):
+ self._init_ctrls(parent)
+
+ def SetScaling(self, x, y):
+ self.XScale.SetValue(x)
+ self.YScale.SetValue(y)
+
+ def GetScaling(self):
+ return self.XScale.GetValue(), self.YScale.GetValue()
+
+[ID_PROJECTDIALOG, ID_PROJECTDIALOGMAINNOTEBOOK,
+ ID_PROJECTDIALOGPROJECTPANEL, ID_PROJECTDIALOGAUTHORPANEL,
+ ID_PROJECTDIALOGGRAPHICSPANEL, ID_PROJECTDIALOGMISCELLANEOUSPANEL,
+ ID_PROJECTDIALOGPROJECTNAME, ID_PROJECTDIALOGPROJECTVERSION,
ID_PROJECTDIALOGPRODUCTNAME, ID_PROJECTDIALOGPRODUCTVERSION,
- ID_PROJECTDIALOGPRODUCTRELEASE, ID_PROJECTDIALOGCONTENTDESCRIPTION,
+ ID_PROJECTDIALOGPRODUCTRELEASE, ID_PROJECTDIALOGCOMPANYNAME,
+ ID_PROJECTDIALOGCOMPANYURL, ID_PROJECTDIALOGAUTHORNAME,
+ ID_PROJECTDIALOGORGANIZATION, ID_PROJECTDIALOGLANGUAGE,
+ ID_PROJECTDIALOGCONTENTDESCRIPTION, ID_PROJECTDIALOGSCALINGNOTEBOOK,
+ ID_PROJECTDIALOGPAGEWIDTH, ID_PROJECTDIALOGPAGEHEIGHT,
ID_PROJECTDIALOGSTATICTEXT1, ID_PROJECTDIALOGSTATICTEXT2,
ID_PROJECTDIALOGSTATICTEXT3, ID_PROJECTDIALOGSTATICTEXT4,
ID_PROJECTDIALOGSTATICTEXT5, ID_PROJECTDIALOGSTATICTEXT6,
- ID_PROJECTDIALOGSTATICTEXT7,
-] = [wx.NewId() for _init_ctrls in range(15)]
-
+ ID_PROJECTDIALOGSTATICTEXT7, ID_PROJECTDIALOGSTATICTEXT8,
+ ID_PROJECTDIALOGSTATICTEXT9, ID_PROJECTDIALOGSTATICTEXT10,
+ ID_PROJECTDIALOGSTATICTEXT11, ID_PROJECTDIALOGSTATICTEXT12,
+ ID_PROJECTDIALOGSTATICTEXT13, ID_PROJECTDIALOGSTATICTEXT14,
+ ID_PROJECTDIALOGSTATICTEXT15,
+] = [wx.NewId() for _init_ctrls in range(35)]
+
class ProjectDialog(wx.Dialog):
if wx.VERSION < (2, 6, 0):
def Bind(self, event, function, id = None):
@@ -1760,106 +1843,261 @@
event(self, function)
def _init_coll_flexGridSizer1_Items(self, parent):
- parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.MainNotebook, 0, border=0, flag=wx.GROW)
parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
def _init_coll_flexGridSizer1_Growables(self, parent):
parent.AddGrowableCol(0)
parent.AddGrowableRow(0)
- def _init_coll_MainSizer_Items(self, parent):
- parent.AddWindow(self.staticText1, 0, border=4, flag=wx.GROW|wx.TOP)
- parent.AddWindow(self.ProjectName, 0, border=0, flag=wx.GROW)
- parent.AddWindow(self.staticText2, 0, border=4, flag=wx.GROW|wx.TOP)
- parent.AddWindow(self.CompanyName, 0, border=0, flag=wx.GROW)
- parent.AddWindow(self.staticText3, 0, border=4, flag=wx.GROW|wx.TOP)
- parent.AddWindow(self.CompanyURL, 0, border=0, flag=wx.GROW)
- parent.AddWindow(self.staticText4, 0, border=4, flag=wx.GROW|wx.TOP)
- parent.AddWindow(self.ProductName, 0, border=0, flag=wx.GROW)
- parent.AddWindow(self.staticText5, 0, border=4, flag=wx.GROW|wx.TOP)
- parent.AddWindow(self.ProductVersion, 0, border=0, flag=wx.GROW)
- parent.AddWindow(self.staticText6, 0, border=4, flag=wx.GROW|wx.TOP)
- parent.AddWindow(self.ProductRelease, 0, border=0, flag=wx.GROW)
- parent.AddWindow(self.staticText7, 0, border=4, flag=wx.GROW|wx.TOP)
- parent.AddWindow(self.ContentDescription, 0, border=0, flag=wx.GROW)
-
- def _init_coll_MainSizer_Growables(self, parent):
+ def _init_coll_ProjectPanelSizer_Items(self, parent):
+ parent.AddWindow(self.staticText1, 0, border=10, flag=wx.GROW|wx.TOP|wx.LEFT)
+ parent.AddWindow(self.ProjectName, 0, border=10, flag=wx.GROW|wx.TOP|wx.RIGHT)
+ parent.AddWindow(self.staticText2, 0, border=10, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.ProjectVersion, 0, border=10, flag=wx.GROW|wx.RIGHT)
+ parent.AddWindow(self.staticText3, 0, border=10, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.ProductName, 0, border=10, flag=wx.GROW|wx.RIGHT)
+ parent.AddWindow(self.staticText4, 0, border=10, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.ProductVersion, 0, border=10, flag=wx.GROW|wx.RIGHT)
+ parent.AddWindow(self.staticText5, 0, border=10, flag=wx.GROW|wx.BOTTOM|wx.LEFT)
+ parent.AddWindow(self.ProductRelease, 0, border=10, flag=wx.GROW|wx.BOTTOM|wx.RIGHT)
+
+ def _init_coll_ProjectPanelSizer_Growables(self, parent):
parent.AddGrowableCol(1)
- parent.AddGrowableRow(6)
+
+ def _init_coll_AuthorPanelSizer_Items(self, parent):
+ parent.AddWindow(self.staticText6, 0, border=10, flag=wx.GROW|wx.TOP|wx.LEFT)
+ parent.AddWindow(self.CompanyName, 0, border=10, flag=wx.GROW|wx.TOP|wx.RIGHT)
+ parent.AddWindow(self.staticText7, 0, border=10, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.CompanyURL, 0, border=10, flag=wx.GROW|wx.RIGHT)
+ parent.AddWindow(self.staticText8, 0, border=10, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.AuthorName, 0, border=10, flag=wx.GROW|wx.RIGHT)
+ parent.AddWindow(self.staticText9, 0, border=10, flag=wx.GROW|wx.BOTTOM|wx.LEFT)
+ parent.AddWindow(self.Organization, 0, border=10, flag=wx.GROW|wx.BOTTOM|wx.RIGHT)
+
+ def _init_coll_AuthorPanelSizer_Growables(self, parent):
+ parent.AddGrowableCol(1)
+
+ def _init_coll_GraphicsPanelSizer_Items(self, parent):
+ parent.AddWindow(self.staticText12, 0, border=10, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.GraphicsPageSizeSizer, 0, border=10, flag=wx.GROW|wx.LEFT|wx.RIGHT)
+ parent.AddWindow(self.staticText15, 0, border=10, flag=wx.GROW|wx.LEFT|wx.RIGHT)
+ parent.AddWindow(self.ScalingNotebook, 0, border=10, flag=wx.GROW|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+
+ def _init_coll_GraphicsPanelSizer_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(3)
+
+ def _init_coll_GraphicsPageSizeSizer_Items(self, parent):
+ parent.AddWindow(self.staticText13, 0, border=12, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.PageWidth, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText14, 0, border=12, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.PageHeight, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_GraphicsPageSizeSizer_Growables(self, parent):
+ parent.AddGrowableCol(1)
+
+ def _init_coll_MiscellaneousPanelSizer_Items(self, parent):
+ parent.AddWindow(self.staticText10, 0, border=10, flag=wx.GROW|wx.TOP|wx.LEFT)
+ parent.AddWindow(self.Language, 0, border=10, flag=wx.GROW|wx.TOP|wx.RIGHT)
+ parent.AddWindow(self.staticText11, 0, border=10, flag=wx.GROW|wx.BOTTOM|wx.LEFT)
+ parent.AddWindow(self.ContentDescription, 0, border=10, flag=wx.GROW|wx.BOTTOM|wx.RIGHT)
+
+ def _init_coll_MiscellaneousPanelSizer_Growables(self, parent):
+ parent.AddGrowableCol(1)
+ parent.AddGrowableRow(1)
def _init_sizers(self):
self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
- self.MainSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=7, vgap=15)
+ self.ProjectPanelSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=5, vgap=15)
+ self.AuthorPanelSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=4, vgap=15)
+ self.GraphicsPanelSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=4, vgap=5)
+ self.GraphicsPageSizeSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=2, vgap=5)
+ self.MiscellaneousPanelSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=2, vgap=15)
self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
- self._init_coll_MainSizer_Items(self.MainSizer)
- self._init_coll_MainSizer_Growables(self.MainSizer)
+ self._init_coll_ProjectPanelSizer_Items(self.ProjectPanelSizer)
+ self._init_coll_ProjectPanelSizer_Growables(self.ProjectPanelSizer)
+ self._init_coll_AuthorPanelSizer_Items(self.AuthorPanelSizer)
+ self._init_coll_AuthorPanelSizer_Growables(self.AuthorPanelSizer)
+ self._init_coll_GraphicsPanelSizer_Items(self.GraphicsPanelSizer)
+ self._init_coll_GraphicsPanelSizer_Growables(self.GraphicsPanelSizer)
+ self._init_coll_GraphicsPageSizeSizer_Items(self.GraphicsPageSizeSizer)
+ self._init_coll_GraphicsPageSizeSizer_Growables(self.GraphicsPageSizeSizer)
+ self._init_coll_MiscellaneousPanelSizer_Items(self.MiscellaneousPanelSizer)
+ self._init_coll_MiscellaneousPanelSizer_Growables(self.MiscellaneousPanelSizer)
self.SetSizer(self.flexGridSizer1)
+ self.ProjectPanel.SetSizer(self.ProjectPanelSizer)
+ self.AuthorPanel.SetSizer(self.AuthorPanelSizer)
+ self.GraphicsPanel.SetSizer(self.GraphicsPanelSizer)
+ self.MiscellaneousPanel.SetSizer(self.MiscellaneousPanelSizer)
def _init_ctrls(self, prnt):
wx.Dialog.__init__(self, id=ID_PROJECTDIALOG,
name='ProjectDialog', parent=prnt, pos=wx.Point(376, 223),
- size=wx.Size(550, 450), style=wx.DEFAULT_DIALOG_STYLE,
+ size=wx.Size(500, 350), style=wx.DEFAULT_DIALOG_STYLE,
title='Create a new project')
- self.SetClientSize(wx.Size(550, 450))
+ self.SetClientSize(wx.Size(500, 350))
+
+ self.MainNotebook = wx.Notebook(id=ID_PROJECTDIALOGMAINNOTEBOOK,
+ name='MainNotebook', parent=self, pos=wx.Point(0,
+ 0), size=wx.Size(0, 0), style=0)
+
+ # Project Panel elements
+
+ self.ProjectPanel = wx.Panel(id=ID_PROJECTDIALOGPROJECTPANEL,
+ name='ProjectPanel', parent=self.MainNotebook, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
self.staticText1 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT1,
- label='Project Name (required):', name='staticText1', parent=self,
+ label='Project Name (required):', name='staticText1', parent=self.ProjectPanel,
pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
self.ProjectName = wx.TextCtrl(id=ID_PROJECTDIALOGPROJECTNAME,
- name='ProjectName', parent=self, pos=wx.Point(0, 0),
+ name='ProjectName', parent=self.ProjectPanel, pos=wx.Point(0, 0),
size=wx.Size(0, 24), style=0)
self.staticText2 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT2,
- label='Company Name (required):', name='staticText2', parent=self,
+ label='Project Version (optional):', name='staticText2', parent=self.ProjectPanel,
pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+ self.ProjectVersion = wx.TextCtrl(id=ID_PROJECTDIALOGPROJECTVERSION,
+ name='ProjectVersion', parent=self.ProjectPanel, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText3 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT3,
+ label='Product Name (required):', name='staticText3', parent=self.ProjectPanel,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.ProductName = wx.TextCtrl(id=ID_PROJECTDIALOGPRODUCTNAME,
+ name='ProductName', parent=self.ProjectPanel, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText4 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT4,
+ label='Product Version (required):', name='staticText4', parent=self.ProjectPanel,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.ProductVersion = wx.TextCtrl(id=ID_PROJECTDIALOGPRODUCTVERSION,
+ name='ProductVersion', parent=self.ProjectPanel, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText5 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT5,
+ label='Product Release (optional):', name='staticText5', parent=self.ProjectPanel,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.ProductRelease = wx.TextCtrl(id=ID_PROJECTDIALOGPRODUCTRELEASE,
+ name='ProductRelease', parent=self.ProjectPanel, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.MainNotebook.AddPage(self.ProjectPanel, "Project")
+
+ # Author Panel elements
+
+ self.AuthorPanel = wx.Panel(id=ID_PROJECTDIALOGAUTHORPANEL,
+ name='AuthorPanel', parent=self.MainNotebook, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
+ self.staticText6 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT6,
+ label='Company Name (required):', name='staticText6', parent=self.AuthorPanel,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
self.CompanyName = wx.TextCtrl(id=ID_PROJECTDIALOGCOMPANYNAME,
- name='CompanyName', parent=self, pos=wx.Point(0, 0),
+ name='CompanyName', parent=self.AuthorPanel, pos=wx.Point(0, 0),
size=wx.Size(0, 24), style=0)
- self.staticText3 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT3,
- label='Company URL (optional):', name='staticText3', parent=self,
+ self.staticText7 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT7,
+ label='Company URL (optional):', name='staticText7', parent=self.AuthorPanel,
pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
self.CompanyURL = wx.TextCtrl(id=ID_PROJECTDIALOGCOMPANYURL,
- name='CompanyURL', parent=self, pos=wx.Point(0, 0),
+ name='CompanyURL', parent=self.AuthorPanel, pos=wx.Point(0, 0),
size=wx.Size(0, 24), style=0)
- self.staticText4 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT4,
- label='Product Name (required):', name='staticText4', parent=self,
+ self.staticText8 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT8,
+ label='Author Name (optional):', name='staticText8', parent=self.AuthorPanel,
pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
- self.ProductName = wx.TextCtrl(id=ID_PROJECTDIALOGPRODUCTNAME,
- name='ProductName', parent=self, pos=wx.Point(0, 0),
+ self.AuthorName = wx.TextCtrl(id=ID_PROJECTDIALOGAUTHORNAME,
+ name='AuthorName', parent=self.AuthorPanel, pos=wx.Point(0, 0),
size=wx.Size(0, 24), style=0)
- self.staticText5 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT5,
- label='Product Version (required):', name='staticText5', parent=self,
+ self.staticText9 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT9,
+ label='Organization (optional):', name='staticText9', parent=self.AuthorPanel,
pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
- self.ProductVersion = wx.TextCtrl(id=ID_PROJECTDIALOGPRODUCTVERSION,
- name='ProductVersion', parent=self, pos=wx.Point(0, 0),
+ self.Organization = wx.TextCtrl(id=ID_PROJECTDIALOGORGANIZATION,
+ name='Organization', parent=self.AuthorPanel, pos=wx.Point(0, 0),
size=wx.Size(0, 24), style=0)
- self.staticText6 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT6,
- label='Product Release (optional):', name='staticText6', parent=self,
+ self.MainNotebook.AddPage(self.AuthorPanel, "Author")
+
+ # Graphics Panel elements
+
+ self.GraphicsPanel = wx.Panel(id=ID_PROJECTDIALOGGRAPHICSPANEL,
+ name='GraphicsPanel', parent=self.MainNotebook, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
+ self.staticText12 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT12,
+ label='Page Size (optional):', name='staticText12', parent=self.GraphicsPanel,
pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
- self.ProductRelease = wx.TextCtrl(id=ID_PROJECTDIALOGPRODUCTRELEASE,
- name='ProductRelease', parent=self, pos=wx.Point(0, 0),
+ self.staticText13 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT13,
+ label='Width:', name='staticText13', parent=self.GraphicsPanel,
+ pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0)
+
+ self.PageWidth = wx.SpinCtrl(id=ID_PROJECTDIALOGPAGEWIDTH,
+ name='PageWidth', parent=self.GraphicsPanel, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0, min=0, max=2**16)
+
+ self.staticText14 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT14,
+ label='Height:', name='staticText14', parent=self.GraphicsPanel,
+ pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0)
+
+ self.PageHeight = wx.SpinCtrl(id=ID_PROJECTDIALOGPAGEHEIGHT,
+ name='PageHeight', parent=self.GraphicsPanel, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0, min=0, max=2**16)
+
+ self.staticText15 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT15,
+ label='Scaling:', name='staticText15', parent=self.GraphicsPanel,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.ScalingNotebook = wx.Notebook(id=ID_PROJECTDIALOGSCALINGNOTEBOOK,
+ name='ScalingNotebook', parent=self.GraphicsPanel, pos=wx.Point(0,
+ 0), size=wx.Size(0, 0), style=0)
+
+ self.Scalings = {}
+ for language in ["FBD", "LD", "SFC"]:
+ window = ScalingPanel(self.ScalingNotebook)
+ self.Scalings[language] = window
+ self.ScalingNotebook.AddPage(window, language)
+
+ self.MainNotebook.AddPage(self.GraphicsPanel, "Graphics")
+
+ # Miscellaneous Panel elements
+
+ self.MiscellaneousPanel = wx.Panel(id=ID_PROJECTDIALOGMISCELLANEOUSPANEL,
+ name='MiscellaneousPanel', parent=self.MainNotebook, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
+ self.staticText10 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT10,
+ label='Language (optional):', name='staticText10', parent=self.MiscellaneousPanel,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.Language = wx.Choice(id=ID_PROJECTDIALOGLANGUAGE,
+ name='Language', parent=self.MiscellaneousPanel, pos=wx.Point(0, 0),
size=wx.Size(0, 24), style=0)
- self.staticText7 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT7,
- label='Content Description (optional):', name='staticText7', parent=self,
+ self.staticText11 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT11,
+ label='Content Description (optional):', name='staticText11', parent=self.MiscellaneousPanel,
pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
self.ContentDescription = wx.TextCtrl(id=ID_PROJECTDIALOGCONTENTDESCRIPTION,
- name='ProductRelease', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(0, 120), style=wx.TE_MULTILINE)
+ name='ContentDescription', parent=self.MiscellaneousPanel, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=wx.TE_MULTILINE)
+
+ self.MainNotebook.AddPage(self.MiscellaneousPanel, "Miscellaneous")
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
@@ -1869,6 +2107,11 @@
def __init__(self, parent):
self._init_ctrls(parent)
+ languages = ["", "en-US", "fr-FR"]
+
+ for language in languages:
+ self.Language.Append(language)
+
def OnOK(self, event):
error = []
if self.ProjectName.GetValue() == "":
@@ -1887,7 +2130,7 @@
elif i == len(error) - 1:
text += " and %s"%item
else:
- text += ", %s"%item
+ text += ", %s"%item
message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
@@ -1898,31 +2141,58 @@
for item, value in values.items():
if item == "projectName":
self.ProjectName.SetValue(value)
- elif item == "companyName":
- self.CompanyName.SetValue(value)
- elif item == "companyURL":
- self.CompanyURL.SetValue(value)
+ elif item == "projectVersion":
+ self.ProjectVersion.SetValue(value)
elif item == "productName":
self.ProductName.SetValue(value)
elif item == "productVersion":
self.ProductVersion.SetValue(value)
elif item == "productRelease":
self.ProductRelease.SetValue(value)
+ elif item == "companyName":
+ self.CompanyName.SetValue(value)
+ elif item == "companyURL":
+ self.CompanyURL.SetValue(value)
+ elif item == "authorName":
+ self.AuthorName.SetValue(value)
+ elif item == "organization":
+ self.Organization.SetValue(value)
+ elif item == "language":
+ self.Language.SetStringSelection(value)
elif item == "contentDescription":
self.ContentDescription.SetValue(value)
-
+ elif item == "pageSize":
+ self.PageWidth.SetValue(value[0])
+ self.PageHeight.SetValue(value[1])
+ elif item == "scaling":
+ for language, (x, y) in value.items():
+ if language in self.Scalings:
+ self.Scalings[language].SetScaling(x, y)
+
def GetValues(self):
values = {}
values["projectName"] = self.ProjectName.GetValue()
- values["companyName"] = self.CompanyName.GetValue()
- if self.CompanyURL.GetValue() != None:
- values["companyURL"] = self.CompanyURL.GetValue()
+ if self.ProjectVersion.GetValue() != "":
+ values["projectVersion"] = self.ProjectVersion.GetValue()
values["productName"] = self.ProductName.GetValue()
values["productVersion"] = self.ProductVersion.GetValue()
- if self.ProductRelease.GetValue() != None:
+ if self.ProductRelease.GetValue() != "":
values["productRelease"] = self.ProductRelease.GetValue()
- if self.ProductRelease.GetValue() != None:
+ values["companyName"] = self.CompanyName.GetValue()
+ if self.CompanyURL.GetValue() != "":
+ values["companyURL"] = self.CompanyURL.GetValue()
+ if self.AuthorName.GetValue() != "":
+ values["authorName"] = self.AuthorName.GetValue()
+ if self.Organization.GetValue() != "":
+ values["organization"] = self.Organization.GetValue()
+ if self.Language.GetStringSelection() != "":
+ values["language"] = self.Language.GetStringSelection()
+ if self.ProductRelease.GetValue() != "":
values["contentDescription"] = self.ContentDescription.GetValue()
+ values["pageSize"] = (self.PageWidth.GetValue(), self.PageHeight.GetValue())
+ values["scaling"] = {}
+ for language in ["FBD", "LD", "SFC"]:
+ values["scaling"][language] = self.Scalings[language].GetScaling()
return values
#-------------------------------------------------------------------------------
@@ -2572,10 +2842,10 @@
self._init_sizers()
- def __init__(self, parent, controler):
+ def __init__(self, parent, window, controler):
self._init_ctrls(parent)
- self.ParentWindow = parent
+ self.ParentWindow = window
self.Controler = controler
self.VariablePanelList = {}
@@ -2605,7 +2875,7 @@
self.CurrentPanel = None
def UpdateVariablePanelTagName(self, old_tagname, new_tagname):
- if old_name in self.VariablePanelList:
+ if old_tagname in self.VariablePanelList:
self.VariablePanelList[new_tagname] = self.VariablePanelList.pop(old_tagname)
if self.CurrentPanel == old_tagname:
self.CurrentPanel = new_tagname