# HG changeset patch
# User lbessard
# Date 1186066318 -7200
# Node ID 39cd981ff2421eb6111fd1286856b74fd7f1e7b8
# Parent 9bf197698af073b6cc9b5df4e8dc1d9ed423fd16
Changing file headers
Adding support for automatically modifying variable and POU names when changing
diff -r 9bf197698af0 -r 39cd981ff242 Dialogs.py
--- a/Dialogs.py Fri Jul 27 10:03:24 2007 +0200
+++ b/Dialogs.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
@@ -32,13 +32,12 @@
# Create New Block Dialog
#-------------------------------------------------------------------------------
-[wxID_BLOCKPROPERTIESDIALOG, wxID_BLOCKPROPERTIESDIALOGMAINPANEL,
- wxID_BLOCKPROPERTIESDIALOGNAME, wxID_BLOCKPROPERTIESDIALOGTYPETREE,
- wxID_BLOCKPROPERTIESDIALOGTYPEDESC, wxID_BLOCKPROPERTIESDIALOGINPUTS,
- wxID_BLOCKPROPERTIESDIALOGPREVIEW, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT1,
- wxID_BLOCKPROPERTIESDIALOGSTATICTEXT2, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT3,
- wxID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
-] = [wx.NewId() for _init_ctrls in range(11)]
+[wxID_BLOCKPROPERTIESDIALOG, wxID_BLOCKPROPERTIESDIALOGNAME,
+ wxID_BLOCKPROPERTIESDIALOGTYPETREE, wxID_BLOCKPROPERTIESDIALOGTYPEDESC,
+ wxID_BLOCKPROPERTIESDIALOGINPUTS, wxID_BLOCKPROPERTIESDIALOGPREVIEW,
+ wxID_BLOCKPROPERTIESDIALOGSTATICTEXT1, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
+ wxID_BLOCKPROPERTIESDIALOGSTATICTEXT3, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
+] = [wx.NewId() for _init_ctrls in range(10)]
[CATEGORY, BLOCK] = range(2)
@@ -46,76 +45,121 @@
def _init_coll_flexGridSizer1_Items(self, parent):
# generated method, don't edit
- parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wxGROW|wxTOP|wxLEFT|wxRIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddSizer(self.LeftBoxSizer, 1, border=5, flag=wxGROW|wxRIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wxGROW|wxLEFT)
+
+ def _init_coll_LeftBoxSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.TypeTree, 3, border=5, flag=wxGROW|wxBOTTOM)
+ parent.AddWindow(self.TypeDesc, 1, border=0, flag=wxGROW)
+
+ def _init_coll_RightGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddSizer(self.RightUpGridSizer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.staticText4, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wxGROW)
+
+ def _init_coll_RightGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(2)
+
+ def _init_coll_RightUpGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wxGROW|wxALIGN_BOTTOM)
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wxGROW|wxALIGN_BOTTOM)
+ parent.AddWindow(self.Name, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Inputs, 0, border=0, flag=wxGROW)
def _init_sizers(self):
# generated method, don't edit
- self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-
+ self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
+ self.MainSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.LeftBoxSizer = wx.StaticBoxSizer(self.staticbox1, wxVERTICAL)
+ self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
+ self.RightUpGridSizer = wx.GridSizer(cols=2, hgap=5, rows=2, vgap=5)
+
self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
-
+ self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
+ self._init_coll_MainSizer_Items(self.MainSizer)
+ self._init_coll_LeftBoxSizer_Items(self.LeftBoxSizer)
+ self._init_coll_RightGridSizer_Items(self.RightGridSizer)
+ self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
+ self._init_coll_RightUpGridSizer_Items(self.RightUpGridSizer)
+
self.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Dialog.__init__(self, id=wxID_BLOCKPROPERTIESDIALOG,
name='BlockPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
- size=wx.Size(600, 360), style=wx.DEFAULT_DIALOG_STYLE,
+ size=wx.Size(600, 360), style=wx.DEFAULT_DIALOG_STYLE|wxRESIZE_BORDER,
title='Block Properties')
self.SetClientSize(wx.Size(600, 360))
- self.MainPanel = wx.Panel(id=wxID_BLOCKPROPERTIESDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(600, 320), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
self.staticbox1 = wx.StaticBox(id=wxID_BLOCKPROPERTIESDIALOGSTATICTEXT1,
- label='Type:', name='staticBox1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(245, 280), style=0)
+ label='Type:', name='staticBox1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 0), style=0)
self.staticText2 = wx.StaticText(id=wxID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
- label='Name:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(274, 24), size=wx.Size(70, 17), style=0)
+ label='Name:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText3 = wx.StaticText(id=wxID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
- label='Inputs:', name='staticText4', parent=self.MainPanel,
- pos=wx.Point(424, 24), size=wx.Size(70, 17), style=0)
+ label='Inputs:', name='staticText4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText4 = wx.StaticText(id=wxID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
- label='Preview:', name='staticText4', parent=self.MainPanel,
- pos=wx.Point(274, 80), size=wx.Size(100, 17), style=0)
+ label='Preview:', name='staticText4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.TypeTree = wx.TreeCtrl(id=wxID_BLOCKPROPERTIESDIALOGTYPETREE,
- name='TypeTree', parent=self.MainPanel, pos=wx.Point(34, 44),
- size=wx.Size(225, 180), style=wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_SINGLE|wx.SUNKEN_BORDER)
+ name='TypeTree', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_SINGLE|wx.SUNKEN_BORDER)
EVT_TREE_SEL_CHANGED(self, wxID_BLOCKPROPERTIESDIALOGTYPETREE, self.OnTypeTreeItemSelected)
self.TypeDesc = wx.TextCtrl(id=wxID_BLOCKPROPERTIESDIALOGTYPEDESC,
- name='TypeDesc', parent=self.MainPanel, pos=wx.Point(34, 230),
- size=wx.Size(225, 65), style=wx.TE_READONLY|wx.TE_MULTILINE)
+ name='TypeDesc', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.Name = wx.TextCtrl(id=wxID_BLOCKPROPERTIESDIALOGNAME, value='',
- name='Name', parent=self.MainPanel, pos=wx.Point(274, 48),
- size=wx.Size(145, 24), style=0)
+ name='Name', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
EVT_TEXT(self, wxID_BLOCKPROPERTIESDIALOGNAME, self.OnNameChanged)
self.Inputs = wx.SpinCtrl(id=wxID_BLOCKPROPERTIESDIALOGINPUTS,
- name='Inputs', parent=self.MainPanel, pos=wx.Point(424, 48),
- size=wx.Size(145, 24), style=wxSP_ARROW_KEYS, min=2, max=20)
+ name='Inputs', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=wxSP_ARROW_KEYS, min=2, max=20)
EVT_SPINCTRL(self, wxID_BLOCKPROPERTIESDIALOGINPUTS, self.OnInputsChanged)
self.Preview = wx.Panel(id=wxID_BLOCKPROPERTIESDIALOGPREVIEW,
- name='Preview', parent=self.MainPanel, pos=wx.Point(274, 104),
- size=wx.Size(300, 200), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
+ name='Preview', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
self.Preview.SetBackgroundColour(wxColour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
+ self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
+
self._init_sizers()
def __init__(self, parent):
self._init_ctrls(parent)
- self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
- self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_RIGHT)
self.Name.SetValue("")
self.Name.Enable(False)
self.Inputs.Enable(False)
@@ -269,7 +313,7 @@
# Create New Variable Dialog
#-------------------------------------------------------------------------------
-[wxID_VARIABLEPROPERTIESDIALOG, wxID_VARIABLEPROPERTIESDIALOGMAINPANEL,
+[wxID_VARIABLEPROPERTIESDIALOG, wxID_VARIABLEPROPERTIESDIALOGSPACER,
wxID_VARIABLEPROPERTIESDIALOGNAME, wxID_VARIABLEPROPERTIESDIALOGCLASS,
wxID_VARIABLEPROPERTIESDIALOGPREVIEW, wxID_VARIABLEPROPERTIESDIALOGEXPRESSION,
wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT1, wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
@@ -280,14 +324,79 @@
def _init_coll_flexGridSizer1_Items(self, parent):
# generated method, don't edit
- parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
-
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wxGROW|wxTOP|wxLEFT|wxRIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddSizer(self.TopSizer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.staticText4, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wxGROW)
+
+ def _init_coll_MainSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(2)
+
+ def _init_coll_TopSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wxGROW|wxRIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wxGROW|wxLEFT)
+
+ def _init_coll_LeftGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Class, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Expression, 0, border=0, flag=wxGROW)
+
+ def _init_coll_LeftGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(2)
+
+ def _init_coll_RightGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Name, 0, border=0, flag=wxGROW)
+
+ def _init_coll_RightGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(1)
+
def _init_sizers(self):
# generated method, don't edit
- self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+ self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
+ self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
+ self.TopSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=5, vgap=5)
+ self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
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_TopSizer_Items(self.TopSizer)
+ self._init_coll_LeftGridSizer_Items(self.LeftGridSizer)
+ self._init_coll_LeftGridSizer_Growables(self.LeftGridSizer)
+ self._init_coll_RightGridSizer_Items(self.RightGridSizer)
+ self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
+
self.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
@@ -298,54 +407,53 @@
title='Variable Properties')
self.SetClientSize(wx.Size(400, 380))
- self.MainPanel = wx.Panel(id=wxID_VARIABLEPROPERTIESDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(400, 280), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
self.staticText1 = wx.StaticText(id=wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT1,
- label='Class:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(70, 17), style=0)
+ label='Class:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText2 = wx.StaticText(id=wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
- label='Expression:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 90), size=wx.Size(100, 17), style=0)
+ label='Expression:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText3 = wx.StaticText(id=wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT3,
- label='Name:', name='staticText3', parent=self.MainPanel,
- pos=wx.Point(204, 24), size=wx.Size(70, 17), style=0)
+ label='Name:', name='staticText3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText4 = wx.StaticText(id=wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT4,
- label='Preview:', name='staticText4', parent=self.MainPanel,
- pos=wx.Point(24, 144), size=wx.Size(100, 17), style=0)
+ label='Preview:', name='staticText4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.Class = wx.Choice(id=wxID_VARIABLEPROPERTIESDIALOGCLASS,
- name='Class', parent=self.MainPanel, pos=wx.Point(24, 48),
- size=wx.Size(145, 24), style=0)
+ name='Class', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
EVT_CHOICE(self, wxID_VARIABLEPROPERTIESDIALOGCLASS, self.OnClassChanged)
self.Name = wx.ListBox(id=wxID_VARIABLEPROPERTIESDIALOGNAME,
- name='Name', parent=self.MainPanel, pos=wx.Point(204, 48),
- size=wx.Size(145, 90), style=wx.LB_SINGLE)
+ name='Name', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 90), style=wx.LB_SINGLE)
EVT_LISTBOX(self, wxID_VARIABLEPROPERTIESDIALOGNAME, self.OnNameChanged)
self.Expression = wx.TextCtrl(id=wxID_VARIABLEPROPERTIESDIALOGEXPRESSION,
- name='Expression', parent=self.MainPanel, pos=wx.Point(24, 114),
- size=wx.Size(145, 24), style=0)
+ name='Expression', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
EVT_TEXT(self, wxID_VARIABLEPROPERTIESDIALOGEXPRESSION, self.OnExpressionChanged)
+ self.Spacer = wx.Panel(id=wxID_VARIABLEPROPERTIESDIALOGSPACER,
+ name='Spacer', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
self.Preview = wx.Panel(id=wxID_VARIABLEPROPERTIESDIALOGPREVIEW,
- name='Preview', parent=self.MainPanel, pos=wx.Point(24, 170),
- size=wx.Size(350, 150), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
+ name='Preview', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
self.Preview.SetBackgroundColour(wxColour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
+ self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
+
self._init_sizers()
def __init__(self, parent):
self._init_ctrls(parent)
- self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
- self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_RIGHT)
self.Variable = None
self.VarList = []
self.MinVariableSize = None
diff -r 9bf197698af0 -r 39cd981ff242 LDViewer.py
--- a/LDViewer.py Fri Jul 27 10:03:24 2007 +0200
+++ b/LDViewer.py Thu Aug 02 16:51:58 2007 +0200
@@ -2,9 +2,9 @@
# -*- coding: utf-8 -*-
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
-#based on the plcopen standard.
+#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 PLCControler.py
--- a/PLCControler.py Fri Jul 27 10:03:24 2007 +0200
+++ b/PLCControler.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
@@ -476,6 +476,7 @@
if old_name in self.ElementsOpened:
idx = self.ElementsOpened.index(old_name)
self.ElementsOpened[idx] = new_name
+ self.Project.updateElementName(old_name, new_name)
self.RefreshPouUsingTree()
self.RefreshBlockTypes()
self.BufferProject()
@@ -649,7 +650,6 @@
for vartype, varlist in self.ExtractVarLists(vars):
configuration.globalVars.append(varlist)
self.RefreshBlockTypes()
- self.BufferProject()
# Return the configuration globalvars
def GetConfigurationGlobalVars(self, name):
@@ -692,7 +692,6 @@
for vartype, varlist in self.ExtractVarLists(vars):
resource.globalVars.append(varlist)
self.RefreshBlockTypes()
- self.BufferProject()
# Return the resource globalvars
def GetConfigurationResourceGlobalVars(self, config_name, name):
@@ -769,7 +768,6 @@
# Set Pou interface
pou.setVars(self.ExtractVarLists(vars))
self.RefreshBlockTypes()
- self.BufferProject()
# Replace the return type of the pou given by its name (only for functions)
def SetPouInterfaceReturnType(self, name, type):
@@ -784,7 +782,15 @@
# Change return type
return_type.setValue(type)
self.RefreshBlockTypes()
- self.BufferProject()
+
+ def UpdateProjectUsedPous(self, old_name, new_name):
+ if self.Project:
+ self.Project.updateElementName(old_name, new_name)
+
+ def UpdateCurrentPouEditingUsedVariable(self, old_name, new_name):
+ pou = self.GetCurrentElementEditing()
+ if pou:
+ pou.updateElementName(old_name, new_name)
# Return the return type of the pou given by its name
def GetPouInterfaceReturnTypeByName(self, name):
@@ -2038,7 +2044,10 @@
self.Buffering = False
def ProjectIsSaved(self):
- return self.ProjectBuffer.IsCurrentSaved()
+ if self.ProjectBuffer:
+ return self.ProjectBuffer.IsCurrentSaved()
+ else:
+ return False
def LoadPrevious(self):
self.Project = self.Copy(self.ProjectBuffer.Previous())
diff -r 9bf197698af0 -r 39cd981ff242 PLCGenerator.py
--- a/PLCGenerator.py Fri Jul 27 10:03:24 2007 +0200
+++ b/PLCGenerator.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 PLCOpenEditor.py
--- a/PLCOpenEditor.py Fri Jul 27 10:03:24 2007 +0200
+++ b/PLCOpenEditor.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
@@ -1951,6 +1951,7 @@
# The base class must be initialized *first*
wxPyGridTableBase.__init__(self)
self.data = data
+ self.old_value = None
self.colnames = colnames
self.Parent = parent
# XXX
@@ -1984,8 +1985,14 @@
def SetValue(self, row, col, value):
if col < len(self.colnames):
- self.data[row][self.GetColLabelValue(col)] = value
-
+ colname = self.GetColLabelValue(col)
+ if colname == "Name":
+ self.old_value = self.data[row][colname]
+ self.data[row][colname] = value
+
+ def GetOldValue(self):
+ return self.old_value
+
def ResetView(self, grid):
"""
(wxGrid) -> Reset the grid view. Call this to
@@ -2515,7 +2522,14 @@
message.Destroy()
event.Veto()
else:
- self.SaveValues()
+ self.SaveValues(False)
+ old_value = self.Table.GetOldValue()
+ if old_value != "":
+ self.Controler.UpdateCurrentPouEditingUsedVariable(old_value, value)
+ self.Controler.BufferProject()
+ self.Parent.RefreshTitle()
+ self.Parent.RefreshEditMenu()
+ self.Viewer.RefreshView()
event.Skip()
else:
self.SaveValues()
@@ -2557,7 +2571,7 @@
self.Table.SetData(data)
self.Table.ResetView(self.VariablesGrid)
- def SaveValues(self):
+ def SaveValues(self, buffer = True):
if self.ElementType == "config":
self.Controler.SetConfigurationGlobalVars(self.ConfigName, self.Values)
elif self.ElementType == "resource":
@@ -2566,6 +2580,10 @@
if self.ReturnType.IsEnabled():
self.Controler.SetPouInterfaceReturnType(self.PouName, self.ReturnType.GetStringSelection())
self.Controler.SetPouInterfaceVars(self.PouName, self.Values)
+ if buffer:
+ self.Controler.BufferProject()
+ self.Parent.RefreshTitle()
+ self.Parent.RefreshEditMenu()
##[wxID_EDITVARIABLEDIALOG, wxID_EDITVARIABLEDIALOGMAINPANEL,
## wxID_EDITVARIABLEDIALOGVARIABLESGRID, wxID_EDITVARIABLEDIALOGRETURNTYPE,
diff -r 9bf197698af0 -r 39cd981ff242 RessourceEditor.py
--- a/RessourceEditor.py Fri Jul 27 10:03:24 2007 +0200
+++ b/RessourceEditor.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 SFCViewer.py
--- a/SFCViewer.py Fri Jul 27 10:03:24 2007 +0200
+++ b/SFCViewer.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 TextViewer.py
--- a/TextViewer.py Fri Jul 27 10:03:24 2007 +0200
+++ b/TextViewer.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 Viewer.py
--- a/Viewer.py Fri Jul 27 10:03:24 2007 +0200
+++ b/Viewer.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 __init__.py
--- a/__init__.py Fri Jul 27 10:03:24 2007 +0200
+++ b/__init__.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 examples/example.xml
--- a/examples/example.xml Fri Jul 27 10:03:24 2007 +0200
+++ b/examples/example.xml Thu Aug 02 16:51:58 2007 +0200
@@ -39,21 +39,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -874,7 +860,7 @@
-
+
diff -r 9bf197698af0 -r 39cd981ff242 generate_IEC_std.py
--- a/generate_IEC_std.py Fri Jul 27 10:03:24 2007 +0200
+++ b/generate_IEC_std.py Thu Aug 02 16:51:58 2007 +0200
@@ -1,3 +1,27 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
+#based on the plcopen standard.
+#
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+#
+#See COPYING file for copyrights details.
+#
+#This library is free software; you can redistribute it and/or
+#modify it under the terms of the GNU General Public
+#License as published by the Free Software Foundation; either
+#version 2.1 of the License, or (at your option) any later version.
+#
+#This library is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+#General Public License for more details.
+#
+#You should have received a copy of the GNU General Public
+#License along with this library; if not, write to the Free Software
+#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
"""
THIS CODE GENARATES C++ CODE FOR IEC2CC COMPILER
@@ -20,6 +44,32 @@
#import pprint
#pp = pprint.PrettyPrinter(indent=4)
+matiec_header = """/*
+ * (c) 2003 Mario de Sousa
+ *
+ * Offered to the public under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * This code is made available on the understanding that it will not be
+ * used in safety-critical situations without a full and competent review.
+ */
+
+/*
+ * An IEC 61131-3 IL and ST compiler.
+ *
+ * Based on the
+ * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
+ *
+ */
+
+ """
+
def ANY_to_compiler_test_type_GEN(typename, paramname):
"""
Convert ANY_XXX IEC type declaration into IEC2CC's generated type test.
@@ -201,7 +251,7 @@
"""
Generate the long enumeration of std function types
"""
-function_type_decl = """
+function_type_decl = matiec_header + """
/****
* IEC 61131-3 standard function lib
* generated code, do not edit by hand
@@ -218,7 +268,7 @@
"""
Generate the funct that return enumerated according function name
"""
-get_function_type_decl = """
+get_function_type_decl = matiec_header + """
/****
* IEC 61131-3 standard function lib
* generated code, do not edit by hand
@@ -241,7 +291,7 @@
Generate the part of generate_cc_st_c::visit(function_invocation)
that is responsible to generate C code for std lib calls.
"""
-st_code_gen = """
+st_code_gen = matiec_header + """
/****
* IEC 61131-3 standard function lib
* generated code, do not edit by hand
@@ -278,7 +328,7 @@
Generate the part of generate_cc_il_c::visit(il_function_call)
that is responsible to generate C code for std lib calls.
"""
-il_code_gen = """
+il_code_gen = matiec_header + """
/****
* IEC 61131-3 standard function lib
* generated code, do not edit by hand
@@ -315,7 +365,7 @@
Generate the part of search_expression_type_c::visit(function_invocation)
that is responsible of returning type symbol for function invocation.
"""
-search_type_code = """
+search_type_code = matiec_header + """
/****
* IEC 61131-3 standard function lib
* generated code, do not edit by hand
@@ -417,7 +467,7 @@
"""
Generate the C implementation of the IEC standard function library.
"""
-iec_std_lib_generated = """
+iec_std_lib_generated = matiec_header + """
/****
* IEC 61131-3 standard function lib
* generated code, do not edit by hand
diff -r 9bf197698af0 -r 39cd981ff242 graphics/FBD_Objects.py
--- a/graphics/FBD_Objects.py Fri Jul 27 10:03:24 2007 +0200
+++ b/graphics/FBD_Objects.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 graphics/GraphicCommons.py
--- a/graphics/GraphicCommons.py Fri Jul 27 10:03:24 2007 +0200
+++ b/graphics/GraphicCommons.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
@@ -86,6 +86,28 @@
# Contants for defining which drawing mode is selected for app
[FREEDRAWING_MODE, DRIVENDRAWING_MODE] = [1, 2]
+CURSORS = None
+
+def ResetCursors():
+ global CURSORS
+ if CURSORS == None:
+ CURSORS = [wxNullCursor,
+ wxStockCursor(wxCURSOR_HAND),
+ wxStockCursor(wxCURSOR_SIZENWSE),
+ wxStockCursor(wxCURSOR_SIZENESW),
+ wxStockCursor(wxCURSOR_SIZEWE),
+ wxStockCursor(wxCURSOR_SIZENS)]
+
+HANDLE_CURSORS = {
+ (1, 1) : 2,
+ (3, 3) : 2,
+ (1, 3) : 3,
+ (3, 1) : 3,
+ (1, 2) : 4,
+ (3, 2) : 4,
+ (2, 1) : 5,
+ (2, 3) : 5
+}
"""
Basic vector operations for calculate wire points
@@ -265,6 +287,8 @@
self.Pos = wxPoint(0, 0)
self.Size = wxSize(0, 0)
self.BoundingBox = wxRect(0, 0, 0, 0)
+ self.CurrentCursor = 0
+ ResetCursors()
# Make a clone of this element
def Clone(self):
@@ -339,8 +363,12 @@
# Test if the point is on a handle of this element
def TestHandle(self, pt):
+ extern_rect = wxRect(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2,
+ self.BoundingBox.width + 2 * HANDLE_SIZE + 4, self.BoundingBox.height + 2 * HANDLE_SIZE + 4)
+ intern_rect = wxRect(self.BoundingBox.x - 2, self.BoundingBox.y - 2,
+ self.BoundingBox.width + 4, self.BoundingBox.height + 4)
# Verify that this element is selected
- if self.Selected:
+ if self.Selected and extern_rect.InsideXY(pt.x, pt.y) and not intern_rect.InsideXY(pt.x, pt.y):
# Find if point is on a handle horizontally
if self.BoundingBox.x - HANDLE_SIZE - 2 <= pt.x < self.BoundingBox.x - 2:
handle_x = 1
@@ -368,25 +396,17 @@
def OnLeftDown(self, event, dc, scaling):
pos = event.GetLogicalPosition(dc)
# Test if an handle have been clicked
- result = self.TestHandle(pos)
+ handle = self.TestHandle(pos)
# Find which type of handle have been clicked,
# Save a resize event and change the cursor
- if result == (1, 1) or result == (3, 3):
- self.Handle = (HANDLE_RESIZE, result)
- self.Parent.SetCursor(wxStockCursor(wxCURSOR_SIZENWSE))
- elif result == (1, 3) or result == (3, 1):
- self.Handle = (HANDLE_RESIZE, result)
- self.Parent.SetCursor(wxStockCursor(wxCURSOR_SIZENESW))
- elif result == (1, 2) or result == (3, 2):
- self.Handle = (HANDLE_RESIZE, result)
- self.Parent.SetCursor(wxStockCursor(wxCURSOR_SIZEWE))
- elif result == (2, 1) or result == (2, 3):
- self.Handle = (HANDLE_RESIZE, result)
- self.Parent.SetCursor(wxStockCursor(wxCURSOR_SIZENS))
- # If no handle have been clicked, save a move event, and change the cursor
+ cursor = HANDLE_CURSORS.get(handle, 1)
+ if cursor != self.CurrentCursor:
+ self.Parent.SetCursor(CURSORS[cursor])
+ self.CurrentCursor = cursor
+ if cursor > 1:
+ self.Handle = (HANDLE_RESIZE, handle)
else:
self.Handle = (HANDLE_MOVE, None)
- self.Parent.SetCursor(wxStockCursor(wxCURSOR_HAND))
self.SetSelected(False)
# Initializes the last position
self.oldPos = GetScaledEventPosition(event, dc, scaling)
@@ -402,6 +422,9 @@
self.ProcessDragging(movex, movey)
self.RefreshModel()
self.Parent.RefreshBuffer()
+ if self.CurrentCursor != 0:
+ self.Parent.SetCursor(CURSORS[0])
+ self.CurrentCursor = 0
self.SetSelected(True)
self.oldPos = None
@@ -433,17 +456,13 @@
else:
pos = event.GetLogicalPosition(dc)
handle = self.TestHandle(pos)
- if handle == (1, 1) or handle == (3, 3):
- wxCallAfter(self.Parent.SetCursor, wxStockCursor(wxCURSOR_SIZENWSE))
- elif handle == (1, 3) or handle == (3, 1):
- wxCallAfter(self.Parent.SetCursor, wxStockCursor(wxCURSOR_SIZENESW))
- elif handle == (1, 2) or handle == (3, 2):
- wxCallAfter(self.Parent.SetCursor, wxStockCursor(wxCURSOR_SIZEWE))
- elif handle == (2, 1) or handle == (2, 3):
- wxCallAfter(self.Parent.SetCursor, wxStockCursor(wxCURSOR_SIZENS))
- else:
- wxCallAfter(self.Parent.SetCursor, wxNullCursor)
-
+ # Find which type of handle have been clicked,
+ # Save a resize event and change the cursor
+ cursor = HANDLE_CURSORS.get(handle, 0)
+ if cursor != self.CurrentCursor:
+ self.Parent.SetCursor(CURSORS[cursor])
+ self.CurrentCursor = cursor
+
# Moves the element
def Move(self, dx, dy, exclude = []):
self.Pos.x += dx
diff -r 9bf197698af0 -r 39cd981ff242 graphics/LD_Objects.py
--- a/graphics/LD_Objects.py Fri Jul 27 10:03:24 2007 +0200
+++ b/graphics/LD_Objects.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 graphics/SFC_Objects.py
--- a/graphics/SFC_Objects.py Fri Jul 27 10:03:24 2007 +0200
+++ b/graphics/SFC_Objects.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 graphics/__init__.py
--- a/graphics/__init__.py Fri Jul 27 10:03:24 2007 +0200
+++ b/graphics/__init__.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 obf.py
--- a/obf.py Fri Jul 27 10:03:24 2007 +0200
+++ b/obf.py Thu Aug 02 16:51:58 2007 +0200
@@ -1,3 +1,27 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
+#based on the plcopen standard.
+#
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+#
+#See COPYING file for copyrights details.
+#
+#This library is free software; you can redistribute it and/or
+#modify it under the terms of the GNU General Public
+#License as published by the Free Software Foundation; either
+#version 2.1 of the License, or (at your option) any later version.
+#
+#This library is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+#General Public License for more details.
+#
+#You should have received a copy of the GNU General Public
+#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 py_compile import compile
from commands import getoutput
from os import remove,getcwd,rename
diff -r 9bf197698af0 -r 39cd981ff242 plcopen/__init__.py
--- a/plcopen/__init__.py Fri Jul 27 10:03:24 2007 +0200
+++ b/plcopen/__init__.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 plcopen/docpdf.py
--- a/plcopen/docpdf.py Fri Jul 27 10:03:24 2007 +0200
+++ b/plcopen/docpdf.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 plcopen/plcopen.py
--- a/plcopen/plcopen.py Fri Jul 27 10:03:24 2007 +0200
+++ b/plcopen/plcopen.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
@@ -106,6 +106,18 @@
return ind1 + "<%s>%s%s>\n"%(name, self.text, name)
setattr(cls, "generateXMLText", generateXMLText)
+ def updateElementName(self, old_name, new_name):
+ index = self.text.find(old_name)
+ while index != -1:
+ if index > 0 and (self.text[index - 1].isalnum() or self.text[index - 1] == "_"):
+ index = self.text.find(old_name, index + len(old_name))
+ elif index < len(self.text) - len(old_name) and (self.text[index + len(old_name)].isalnum() or self.text[index + len(old_name)] == "_"):
+ index = self.text.find(old_name, index + len(old_name))
+ else:
+ self.text = self.text[:index] + new_name + self.text[index + len(old_name):]
+ index = self.text.find(old_name, index + len(new_name))
+ setattr(cls, "updateElementName", updateElementName)
+
if "project" in PLCOpenClasses:
cls = PLCOpenClasses["project"]
cls.singleLineAttributes = False
@@ -233,8 +245,52 @@
raise ValueError, "\"%s\" resource doesn't exist in \"%s\" configuration !!!"%(name, config_name)
setattr(cls, "removeConfigurationResource", removeConfigurationResource)
+ def updateElementName(self, old_name, new_name):
+ for pou in self.types.getPouElements():
+ pou.updateElementName(old_name, new_name)
+ for configuration in self.instances.configurations.getConfiguration():
+ configuration.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
PLCOpenClasses["project_fileHeader"].singleLineAttributes = False
+if "configurations_configuration" in PLCOpenClasses:
+ cls = PLCOpenClasses["configurations_configuration"]
+
+ def updateElementName(self, old_name, new_name):
+ for resource in self.getResource():
+ resource.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
+
+if "configuration_resource" in PLCOpenClasses:
+ cls = PLCOpenClasses["configuration_resource"]
+
+ def updateElementName(self, old_name, new_name):
+ for instance in self.getPouInstance():
+ instance.updateElementName(old_name, new_name)
+ for task in self.getTask():
+ task.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
+if "resource_task" in PLCOpenClasses:
+ cls = PLCOpenClasses["resource_task"]
+
+ def updateElementName(self, old_name, new_name):
+ if self.single == old_name:
+ self.single = new_name
+ for instance in self.getPouInstance():
+ instance.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
+if "pouInstance" in PLCOpenClasses:
+ cls = PLCOpenClasses["pouInstance"]
+
+ def updateElementName(self, old_name, new_name):
+ if self.type == old_name:
+ self.type = new_name
+ setattr(cls, "updateElementName", updateElementName)
+
if "project_types" in PLCOpenClasses:
cls = PLCOpenClasses["project_types"]
@@ -425,6 +481,14 @@
raise ValueError, "Action with name %s doesn't exists!"%name
setattr(cls, "removeAction", removeAction)
+ def updateElementName(self, old_name, new_name):
+ self.body.updateElementName(old_name, new_name)
+ for action in self.getActionList():
+ action.updateElementName(old_name, new_name)
+ for transition in self.getTransitionList():
+ transition.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
if "transitions_transition" in PLCOpenClasses:
cls = PLCOpenClasses["transitions_transition"]
@@ -439,6 +503,10 @@
setattr(cls, "setText", setText)
setattr(cls, "getText", getText)
+ def updateElementName(self, old_name, new_name):
+ self.body.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
if "actions_action" in PLCOpenClasses:
cls = PLCOpenClasses["actions_action"]
@@ -453,6 +521,10 @@
setattr(cls, "setText", setText)
setattr(cls, "getText", getText)
+ def updateElementName(self, old_name, new_name):
+ self.body.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
if "body" in PLCOpenClasses:
cls = PLCOpenClasses["body"]
@@ -531,6 +603,14 @@
else:
raise TypeError, "%s body don't have text!"%self.content["name"]
setattr(cls, "getText", getText)
+
+ def updateElementName(self, old_name, new_name):
+ if self.content["name"] in ["IL", "ST"]:
+ self.content["value"].updateElementName(old_name, new_name)
+ else:
+ for element in self.content["value"].getContent():
+ element["value"].updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
def getX(self):
return self.position.getX()
@@ -558,6 +638,10 @@
def getContentText(self):
return self.content.getText()
setattr(cls, "getContentText", getContentText)
+
+ def updateElementName(self, old_name, new_name):
+ self.content.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
if "block" in PLCOpenClasses:
cls = PLCOpenClasses["block"]
@@ -566,6 +650,11 @@
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+ def updateElementName(self, old_name, new_name):
+ if self.typeName == old_name:
+ self.typeName = new_name
+ setattr(cls, "updateElementName", updateElementName)
+
if "inputVariables_variable" in PLCOpenClasses:
cls = PLCOpenClasses["inputVariables_variable"]
@@ -603,6 +692,10 @@
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
+
if "contact" in PLCOpenClasses:
cls = PLCOpenClasses["contact"]
setattr(cls, "getX", getX)
@@ -622,6 +715,11 @@
return None
setattr(cls, "getContactEdge", getContactEdge)
+ def updateElementName(self, old_name, new_name):
+ if self.variable == old_name:
+ self.variable = new_name
+ setattr(cls, "updateElementName", updateElementName)
+
if "coil" in PLCOpenClasses:
cls = PLCOpenClasses["coil"]
setattr(cls, "getX", getX)
@@ -641,12 +739,21 @@
return None
setattr(cls, "getCoilStorage", getCoilStorage)
+ def updateElementName(self, old_name, new_name):
+ if self.variable == old_name:
+ self.variable = new_name
+ setattr(cls, "updateElementName", updateElementName)
+
if "rightPowerRail" in PLCOpenClasses:
cls = PLCOpenClasses["rightPowerRail"]
setattr(cls, "getX", getX)
setattr(cls, "getY", getY)
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
if "step" in PLCOpenClasses:
cls = PLCOpenClasses["step"]
@@ -655,6 +762,10 @@
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
+
if "transition" in PLCOpenClasses:
cls = PLCOpenClasses["transition"]
setattr(cls, "getX", getX)
@@ -687,6 +798,16 @@
return ""
setattr(cls, "getConditionContent", getConditionContent)
+ def updateElementName(self, old_name, new_name):
+ if self.condition:
+ content = self.condition.getContent()
+ if content["name"] == "reference":
+ if content["value"].getName() == old_name:
+ content["value"].setName(new_name)
+ elif content["name"] == "inline":
+ content["value"].updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
if "selectionDivergence" in PLCOpenClasses:
cls = PLCOpenClasses["selectionDivergence"]
setattr(cls, "getX", getX)
@@ -694,6 +815,10 @@
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
+
if "selectionConvergence" in PLCOpenClasses:
cls = PLCOpenClasses["selectionConvergence"]
setattr(cls, "getX", getX)
@@ -701,6 +826,10 @@
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
+
if "simultaneousDivergence" in PLCOpenClasses:
cls = PLCOpenClasses["simultaneousDivergence"]
setattr(cls, "getX", getX)
@@ -708,12 +837,20 @@
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
+
if "simultaneousDivergence" in PLCOpenClasses:
cls = PLCOpenClasses["simultaneousConvergence"]
setattr(cls, "getX", getX)
setattr(cls, "getY", getY)
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
if "jumpStep" in PLCOpenClasses:
cls = PLCOpenClasses["jumpStep"]
@@ -721,6 +858,11 @@
setattr(cls, "getY", getY)
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
+
if "actionBlock_action" in PLCOpenClasses:
cls = PLCOpenClasses["actionBlock_action"]
@@ -759,6 +901,13 @@
return None
setattr(cls, "getInlineContent", getInlineContent)
+ def updateElementName(self, old_name, new_name):
+ if self.reference and self.reference.getName() == old_name:
+ self.reference.setName(new_name)
+ if self.inline:
+ self.inline.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
if "actionBlock" in PLCOpenClasses:
cls = PLCOpenClasses["actionBlock"]
setattr(cls, "getX", getX)
@@ -806,6 +955,11 @@
return actions
setattr(cls, "getActions", getActions)
+ def updateElementName(self, old_name, new_name):
+ for action in self.action:
+ action.updateElementName(old_name, new_name)
+ setattr(cls, "updateElementName", updateElementName)
+
if "inVariable" in PLCOpenClasses:
cls = PLCOpenClasses["inVariable"]
setattr(cls, "getX", getX)
@@ -824,6 +978,11 @@
return self.edge.getValue()
return None
setattr(cls, "getConnectorEdge", getConnectorEdge)
+
+ def updateElementName(self, old_name, new_name):
+ if self.expression == old_name:
+ self.expression = new_name
+ setattr(cls, "updateElementName", updateElementName)
if "outVariable" in PLCOpenClasses:
cls = PLCOpenClasses["outVariable"]
@@ -844,6 +1003,11 @@
return None
setattr(cls, "getConnectorEdge", getConnectorEdge)
+ def updateElementName(self, old_name, new_name):
+ if self.expression == old_name:
+ self.expression = new_name
+ setattr(cls, "updateElementName", updateElementName)
+
if "inOutVariable" in PLCOpenClasses:
cls = PLCOpenClasses["inOutVariable"]
setattr(cls, "getX", getX)
@@ -875,12 +1039,21 @@
return None
setattr(cls, "getOutputEdge", getOutputEdge)
+ def updateElementName(self, old_name, new_name):
+ if self.expression == old_name:
+ self.expression = new_name
+ setattr(cls, "updateElementName", updateElementName)
+
if "continuation" in PLCOpenClasses:
cls = PLCOpenClasses["continuation"]
setattr(cls, "getX", getX)
setattr(cls, "getY", getY)
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
if "connector" in PLCOpenClasses:
cls = PLCOpenClasses["connector"]
@@ -888,6 +1061,10 @@
setattr(cls, "getY", getY)
setattr(cls, "setX", setX)
setattr(cls, "setY", setY)
+
+ def updateElementName(self, old_name, new_name):
+ pass
+ setattr(cls, "updateElementName", updateElementName)
if "connection" in PLCOpenClasses:
cls = PLCOpenClasses["connection"]
diff -r 9bf197698af0 -r 39cd981ff242 plcopen/structures.py
--- a/plcopen/structures.py Fri Jul 27 10:03:24 2007 +0200
+++ b/plcopen/structures.py Thu Aug 02 16:51:58 2007 +0200
@@ -6,7 +6,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -18,7 +18,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 xmlclass/__init__.py
--- a/xmlclass/__init__.py Fri Jul 27 10:03:24 2007 +0200
+++ b/xmlclass/__init__.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
diff -r 9bf197698af0 -r 39cd981ff242 xmlclass/xmlclass.py
--- a/xmlclass/xmlclass.py Fri Jul 27 10:03:24 2007 +0200
+++ b/xmlclass/xmlclass.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software