--- a/PLCControler.py Fri Jul 24 11:55:46 2009 +0200
+++ b/PLCControler.py Fri Jul 24 12:29:48 2009 +0200
@@ -369,11 +369,11 @@
resource_infos = {"name" : resource.getname(), "type": ITEM_RESOURCE, "values": []}
for task in resource.gettask():
for pou in task.getpouInstance():
- instance_infos = self.GetPouTopology(pou.getname(), pou.gettype(), debug=debug)
+ instance_infos = self.GetPouTopology(pou.getname(), pou.gettypeName(), debug=debug)
if instance_infos is not None:
resource_infos["values"].append(instance_infos)
for pou in resource.getpouInstance():
- instance_infos = self.GetPouTopology(pou.getname(), pou.gettype(), debug=debug)
+ instance_infos = self.GetPouTopology(pou.getname(), pou.gettypeName(), debug=debug)
if instance_infos is not None:
resource_infos["values"].append(instance_infos)
for varlist in resource.getglobalVars():
@@ -2266,7 +2266,7 @@
transition.connectionPointOut.setrelPositionXY(position.x, position.y)
elif infos.get("type", None) == "connection" and param == "connection" and value:
transition.setconditionContent("connection", None)
- self.SetConnectionWires(transition, value)
+ self.SetConnectionWires(transition.condition.content["value"], value)
def AddEditedElementDivergence(self, tagname, id, type):
element = self.GetEditedElement(tagname)
@@ -2426,17 +2426,19 @@
new_task.setname(task["Name"])
if task["Single"] != "":
new_task.setsingle(task["Single"])
- result = duration_model.match(task["Interval"]).groups()
- if reduce(lambda x, y: x or y != None, result):
- values = []
- for value in result[:-1]:
- if value != None:
- values.append(int(value))
- else:
- values.append(0)
- if result[-1] is not None:
- values.append(int(float(result[-1]) * 1000))
- new_task.setinterval(datetime.time(*values))
+## result = duration_model.match(task["Interval"]).groups()
+## if reduce(lambda x, y: x or y != None, result):
+## values = []
+## for value in result[:-1]:
+## if value != None:
+## values.append(int(value))
+## else:
+## values.append(0)
+## if result[-1] is not None:
+## values.append(int(float(result[-1]) * 1000))
+## new_task.setinterval(datetime.time(*values))
+ if task["Interval"] != "":
+ new_task.setinterval(task["Interval"])
new_task.setpriority(int(task["Priority"]))
if task["Name"] != "":
task_list[task["Name"]] = new_task
@@ -2444,7 +2446,7 @@
for instance in instances:
new_instance = plcopen.pouInstance()
new_instance.setname(instance["Name"])
- new_instance.settype(instance["Type"])
+ new_instance.settypeName(instance["Type"])
if instance["Task"] != "":
task_list[instance["Task"]].appendpouInstance(new_instance)
else:
@@ -2467,19 +2469,20 @@
new_task["Single"] = ""
interval = task.getinterval()
if interval:
- text = ""
- if interval.hour != 0:
- text += "%dh"%interval.hour
- if interval.minute != 0:
- text += "%dm"%interval.minute
- if interval.second != 0:
- text += "%ds"%interval.second
- if interval.microsecond != 0:
- if interval.microsecond % 1000 != 0:
- text += "%.3fms"%(float(interval.microsecond) / 1000)
- else:
- text += "%dms"%(interval.microsecond / 1000)
- new_task["Interval"] = text
+## text = ""
+## if interval.hour != 0:
+## text += "%dh"%interval.hour
+## if interval.minute != 0:
+## text += "%dm"%interval.minute
+## if interval.second != 0:
+## text += "%ds"%interval.second
+## if interval.microsecond != 0:
+## if interval.microsecond % 1000 != 0:
+## text += "%.3fms"%(float(interval.microsecond) / 1000)
+## else:
+## text += "%dms"%(interval.microsecond / 1000)
+## new_task["Interval"] = text
+ new_task["Interval"] = interval
else:
new_task["Interval"] = ""
new_task["Priority"] = str(task.getpriority())
@@ -2487,13 +2490,13 @@
for instance in task.getpouInstance():
new_instance = {}
new_instance["Name"] = instance.getname()
- new_instance["Type"] = instance.gettype()
+ new_instance["Type"] = instance.gettypeName()
new_instance["Task"] = task.getname()
instances_data.append(new_instance)
for instance in instances:
new_instance = {}
new_instance["Name"] = instance.getname()
- new_instance["Type"] = instance.gettype()
+ new_instance["Type"] = instance.gettypeName()
new_instance["Task"] = ""
instances_data.append(new_instance)
return tasks_data, instances_data