--- a/PLCControler.py Tue Jul 17 12:25:50 2007 +0200
+++ b/PLCControler.py Wed Jul 18 11:51:30 2007 +0200
@@ -33,7 +33,7 @@
from graphics.GraphicCommons import *
from PLCGenerator import *
-duration_model = re.compile("(?:([0-9]{1,2})h)?(?:([0-9]{1,2})m)?(?:([0-9]{1,2})s)?(?:([0-9]{1,3})ms)?")
+duration_model = re.compile("(?:([0-9]{1,2})h)?(?:([0-9]{1,2})m(?!s))?(?:([0-9]{1,2})s)?(?:([0-9]{1,3}(?:.[0-9]*)?)ms)?")
[ITEM_UNEDITABLE, ITEM_PROJECT, ITEM_POU, ITEM_CLASS, ITEM_VARIABLE,
ITEM_TRANSITION, ITEM_ACTION, ITEM_CONFIGURATION, ITEM_RESOURCE] = range(9)
@@ -164,6 +164,7 @@
self.ProjectBuffer = None
self.FilePath = ""
self.FileName = ""
+ self.ProgramFilePath = ""
self.ElementsOpened = []
self.CurrentElementEditing = None
self.RefreshPouUsingTree()
@@ -222,6 +223,10 @@
def GetFilePath(self):
return self.FilePath
+ # Return file path if project is an open file
+ def GetProgramFilePath(self):
+ return self.ProgramFilePath
+
# Return file name and point out if file is up to date
def GetFilename(self):
if self.ProjectBuffer.IsCurrentSaved():
@@ -375,6 +380,7 @@
programfile = open(filepath, "w")
programfile.write(program)
programfile.close()
+ self.ProgramFilePath = filepath
return True
#except:
# pass
@@ -552,7 +558,6 @@
# Extract varlists from a list of vars
def ExtractVarLists(self, vars):
- print "extract varlist"
varlist_list = []
current_varlist = None
current_type = None
@@ -1790,12 +1795,12 @@
result = duration_model.match(task["Interval"]).groups()
if reduce(lambda x, y: x or y != None, result):
values = []
- for value in result:
+ for value in result[:-1]:
if value != None:
values.append(int(value))
else:
values.append(0)
- values[3] = values[3] * 1000
+ values.append(int(float(result[-1]) * 1000))
new_task.setInterval(time(*values))
new_task.priority.setValue(int(task["Priority"]))
if task["Name"] != "":
@@ -1834,7 +1839,10 @@
if interval.second != 0:
text += "%ds"%interval.second
if interval.microsecond != 0:
- text += "%dms"%(interval.microsecond / 1000)
+ if interval.microsecond % 1000 != 0:
+ text += "%.3fms"%(float(interval.microsecond) / 1000)
+ else:
+ text += "%dms"%(interval.microsecond / 1000)
new_task["Interval"] = text
else:
new_task["Interval"] = ""