--- a/Dialogs.py Wed Jan 23 18:25:57 2008 +0100
+++ b/Dialogs.py Wed Jan 23 18:26:49 2008 +0100
@@ -2262,26 +2262,14 @@
event.Skip()
def SetQualifierList(self, list):
- self.QualifierList = ""
- sep = ""
- for qualifier in list.keys():
- self.QualifierList += "%s%s"%(sep, qualifier)
- sep = ","
+ self.QualifierList = "," + ",".join(list)
self.DurationList = list
def SetVariableList(self, list):
- self.VariableList = ""
- sep = ""
- for variable in list:
- self.VariableList += "%s%s"%(sep, variable["Name"])
- sep = ","
-
+ self.VariableList = "," + ",".join([variable["Name"] for variable in list])
+
def SetActionList(self, list):
- self.ActionList = ""
- sep = ""
- for action in list:
- self.ActionList += "%s%s"%(sep, action)
- sep = ","
+ self.ActionList = "," + ",".join(list)
def SetValues(self, actions):
for action in actions:
--- a/PLCControler.py Wed Jan 23 18:25:57 2008 +0100
+++ b/PLCControler.py Wed Jan 23 18:26:49 2008 +0100
@@ -1427,7 +1427,7 @@
infos["connector"] = {}
infos["connector"]["position"] = instance.connectionPointOut.getrelPositionXY()
elif isinstance(instance, plcopen.commonObjects_connector):
- infos["name"] = instance.getName()
+ infos["name"] = instance.getname()
infos["type"] = "connection"
infos["connector"] = {}
infos["connector"]["position"] = instance.connectionPointIn.getrelPositionXY()
@@ -1667,6 +1667,12 @@
pou = self.Project.getpou(words[1])
pou.changepouVar(old_type, old_name, new_type, new_name)
+ def RemoveEditedElementPouVar(self, tagname, type, name):
+ words = tagname.split("::")
+ if words[0] in ['P', 'T', 'A']:
+ pou = self.Project.getpou(words[1])
+ pou.removepouVar(type, name)
+
def AddEditedElementBlock(self, tagname, id, blocktype, blockname = None):
element = self.GetEditedElement(tagname)
if element is not None:
@@ -1684,15 +1690,19 @@
element = self.GetEditedElement(tagname)
if element is not None:
block = element.getinstance(id)
- blocktype = infos.get("type", block.gettypeName())
- blocktype_infos = GetBlockType(blocktype)
- if blocktype_infos["type"] != "function":
- if "name" in infos or "type" in infos:
- old_name = block.getinstanceName()
- old_type = block.gettypeName()
- new_name = infos.get("name", old_name)
- new_type = infos.get("type", old_type)
- self.ChangeEditedElementPouVar(tagname, old_type, old_name, new_type, new_name)
+ old_name = block.getinstanceName()
+ old_type = block.gettypeName()
+ new_name = infos.get("name", old_name)
+ new_type = infos.get("type", old_type)
+ old_typeinfos = GetBlockType(old_type)
+ new_typeinfos = GetBlockType(new_type)
+ if new_typeinfos["type"] != old_typeinfos["type"]:
+ if new_typeinfos["type"] == "function":
+ self.RemoveEditedElementPouVar(tagname, old_type, old_name)
+ else:
+ self.AddEditedElementPouVar(tagname, new_type, new_name)
+ elif new_typeinfos["type"] != "function" and old_name != new_name:
+ self.ChangeEditedElementPouVar(tagname, old_type, old_name, new_type, new_name)
for param, value in infos.items():
if param == "name":
block.setinstanceName(value)
@@ -2212,8 +2222,7 @@
if element is not None:
instance = element.getinstance(id)
if isinstance(instance, plcopen.fbdObjects_block):
- blocktype = instance.gettypeName()
- element.removepouVar(blocktype, instance.getinstanceName())
+ self.RemoveEditedElementPouVar(tagname, instance.gettypeName(), instance.getinstanceName())
element.removeinstance(id)
self.RefreshPouUsingTree()
--- a/Viewer.py Wed Jan 23 18:25:57 2008 +0100
+++ b/Viewer.py Wed Jan 23 18:26:49 2008 +0100
@@ -1643,18 +1643,22 @@
dialog.SetValues(old_values)
if dialog.ShowModal() == wx.ID_OK:
new_values = dialog.GetValues()
+ rect = block.GetRedrawRect(1, 1)
if "name" in new_values:
block.SetName(new_values["name"])
+ else:
+ block.SetName("")
block.SetSize(*self.GetScaledSize(new_values["width"], new_values["height"]))
block.SetType(new_values["type"], new_values["extension"])
block.SetExecutionOrder(new_values["executionOrder"])
+ rect = rect.Union(block.GetRedrawRect())
self.RefreshBlockModel(block)
if old_values["executionOrder"] != new_values["executionOrder"]:
self.RefreshView()
self.RefreshBuffer()
self.RefreshScrollBars()
self.ParentWindow.RefreshVariablePanel(self.TagName)
- block.Refresh()
+ block.Refresh(rect)
dialog.Destroy()
def EditVariableContent(self, variable):
@@ -1675,10 +1679,12 @@
dialog.SetValues(old_values)
if dialog.ShowModal() == wx.ID_OK:
new_values = dialog.GetValues()
+ rect = variable.GetRedrawRect(1, 1)
variable.SetName(new_values["name"])
variable.SetType(new_values["type"], new_values["value_type"])
variable.SetSize(*self.GetScaledSize(new_values["width"], new_values["height"]))
variable.SetExecutionOrder(new_values["executionOrder"])
+ rect = rect.Union(variable.GetRedrawRect())
if old_values["type"] != new_values["type"]:
id = variable.GetId()
self.Controler.RemoveEditedElementInstance(self.TagName, id)
@@ -1688,7 +1694,7 @@
self.RefreshView()
self.RefreshBuffer()
self.RefreshScrollBars()
- variable.Refresh()
+ variable.Refresh(rect)
dialog.Destroy()
def EditConnectionContent(self, connection):
@@ -1699,9 +1705,11 @@
if dialog.ShowModal() == wx.ID_OK:
old_type = connection.GetType()
values = dialog.GetValues()
+ rect = connection.GetRedrawRect(1, 1)
connection.SetName(values["name"])
connection.SetType(values["type"])
connection.SetSize(*self.GetScaledSize(values["width"], values["height"]))
+ rect = rect.Union(connection.GetRedrawRect())
if old_type != values["type"]:
id = connection.GetId()
self.Controler.RemoveEditedElementInstance(self.TagName, id)
@@ -1709,7 +1717,7 @@
self.RefreshConnectionModel(connection)
self.RefreshBuffer()
self.RefreshScrollBars()
- connection.Refresh()
+ connection.Refresh(rect)
dialog.Destroy()
def EditContactContent(self, contact):
@@ -1726,13 +1734,15 @@
dialog.SetElementSize(contact.GetSize())
if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
+ rect = contact.GetRedrawRect(1, 1)
contact.SetName(values["name"])
contact.SetType(values["type"])
contact.SetSize(*self.GetScaledSize(values["width"], values["height"]))
+ rect = rect.Union(contact.GetRedrawRect())
self.RefreshContactModel(contact)
self.RefreshBuffer()
self.RefreshScrollBars()
- contact.Refresh()
+ contact.Refresh(rect)
dialog.Destroy()
def EditCoilContent(self, coil):
@@ -1752,13 +1762,15 @@
dialog.SetElementSize(coil.GetSize())
if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
+ rect = coil.GetRedrawRect(1, 1)
coil.SetName(values["name"])
coil.SetType(values["type"])
coil.SetSize(*self.GetScaledSize(values["width"], values["height"]))
+ rect = rect.Union(coil.GetRedrawRect())
self.RefreshCoilModel(coil)
self.RefreshBuffer()
self.RefreshScrollBars()
- coil.Refresh()
+ coil.Refresh(rect)
dialog.Destroy()
def EditPowerRailContent(self, powerrail):
@@ -1767,8 +1779,10 @@
if dialog.ShowModal() == wx.ID_OK:
old_type = powerrail.GetType()
values = dialog.GetValues()
+ rect = powerrail.GetRedrawRect(1, 1)
powerrail.SetType(values["type"], [True for i in xrange(values["number"])])
powerrail.SetSize(*self.GetScaledSize(values["width"], values["height"]))
+ rect = rect.Union(powerrail.GetRedrawRect())
if old_type != values["type"]:
id = powerrail.GetId()
self.Controler.RemoveEditedElementInstance(self.TagName, id)
@@ -1776,7 +1790,7 @@
self.RefreshPowerRailModel(powerrail)
self.RefreshBuffer()
self.RefreshScrollBars()
- powerrail.Refresh()
+ powerrail.Refresh(rect)
dialog.Destroy()
def EditStepContent(self, step):
@@ -1793,6 +1807,7 @@
dialog.SetValues(values)
if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
+ rect = step.GetRedrawRect(1, 1)
step.SetName(values["name"])
if values["input"]:
step.AddInput()
@@ -1807,10 +1822,11 @@
else:
step.RemoveAction()
step.UpdateSize(*self.GetScaledSize(values["width"], values["height"]))
- step.RefreshModel()
- self.RefreshBuffer()
- self.RefreshScrollBars()
- step.Refresh()
+ rect = rect.Union(step.GetRedrawRect())
+ self.RefreshStepModel(step)
+ self.RefreshBuffer()
+ self.RefreshScrollBars()
+ step.Refresh(rect)
def EditTransitionContent(self, transition):
dialog = TransitionContentDialog(self.ParentWindow, self.GetDrawingMode() == FREEDRAWING_MODE)
@@ -1819,12 +1835,14 @@
dialog.SetElementSize(transition.GetSize())
if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
+ rect = transition.GetRedrawRect(1, 1)
transition.SetType(values["type"],values["value"])
transition.SetPriority(values["priority"])
- transition.RefreshModel()
- self.RefreshBuffer()
- self.RefreshScrollBars()
- transition.Refresh()
+ rect = rect.Union(transition.GetRedrawRect())
+ self.RefreshTransitionModel(transition)
+ self.RefreshBuffer()
+ self.RefreshScrollBars()
+ transition.Refresh(rect)
dialog.Destroy()
def EditJumpContent(self, jump):
@@ -1836,11 +1854,13 @@
dialog.SetSelection(choices.index(jump.GetTarget()))
if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetStringSelection()
+ rect = jump.GetRedrawRect(1, 1)
jump.SetTarget(value)
- jump.RefreshModel()
- self.RefreshBuffer()
- self.RefreshScrollBars()
- jump.Refresh()
+ rect = rect.Union(jump.GetRedrawRect())
+ self.RefreshJumpModel(jump)
+ self.RefreshBuffer()
+ self.RefreshScrollBars()
+ jump.Refresh(rect)
dialog.Destroy()
def EditActionBlockContent(self, actionblock):
@@ -1851,12 +1871,14 @@
dialog.SetValues(actionblock.GetActions())
if dialog.ShowModal() == wx.ID_OK:
actions = dialog.GetValues()
+ rect = actionblock.GetRedrawRect(1, 1)
actionblock.SetActions(actions)
actionblock.SetSize(*self.GetScaledSize(*actionblock.GetSize()))
- actionblock.RefreshModel()
- self.RefreshBuffer()
- self.RefreshScrollBars()
- actionblock.Refresh()
+ rect = rect.Union(actionblock.GetRedrawRect())
+ self.RefreshActionBlockModel(actionblock)
+ self.RefreshBuffer()
+ self.RefreshScrollBars()
+ actionblock.Refresh(rect)
dialog.Destroy()
def EditCommentContent(self, comment):
@@ -1866,12 +1888,14 @@
dialog = wx.TextEntryDialog(self.ParentWindow, "Edit comment", "Please enter comment text", comment.GetContent(), wx.OK|wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValue()
+ rect = comment.GetRedrawRect(1, 1)
comment.SetContent(value)
comment.SetSize(*self.GetScaledSize(*comment.GetSize()))
- comment.RefreshModel()
- self.RefreshBuffer()
- self.RefreshScrollBars()
- comment.Refresh()
+ rect = rect.Union(comment.GetRedrawRect())
+ self.RefreshCommentModel(comment)
+ self.RefreshBuffer()
+ self.RefreshScrollBars()
+ comment.Refresh(rect)
dialog.Destroy()
#-------------------------------------------------------------------------------
--- a/graphics/SFC_Objects.py Wed Jan 23 18:25:57 2008 +0100
+++ b/graphics/SFC_Objects.py Wed Jan 23 18:26:49 2008 +0100
@@ -118,7 +118,7 @@
# Remove output connector from step
def RemoveInput(self):
if self.Input:
- self.Input.UnConnect()
+ self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
self.Input = None
self.RefreshBoundingBox()
@@ -131,7 +131,7 @@
# Remove output connector from step
def RemoveOutput(self):
if self.Output:
- self.Output.UnConnect()
+ self.Output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
self.Output = None
self.RefreshBoundingBox()
@@ -144,7 +144,7 @@
# Remove action connector from step
def RemoveAction(self):
if self.Action:
- self.Action.UnConnect()
+ self.Action.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
self.Action = None
self.RefreshBoundingBox()
@@ -674,7 +674,7 @@
def SetType(self, type, condition = None):
if self.Type != type:
if self.Type == "connection":
- self.Condition.UnConnect()
+ self.Condition.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
self.Type = type
if type == "connection":
self.Condition = Connector(self, "", "BOOL", wx.Point(0, self.Size[1] / 2), WEST)