dialogs/ForceVariableDialog.py
changeset 516 40290ddff19c
parent 479 2fab0eefa66e
child 519 722714c04dcd
--- a/dialogs/ForceVariableDialog.py	Thu Mar 31 17:37:47 2011 +0200
+++ b/dialogs/ForceVariableDialog.py	Thu Mar 31 19:10:47 2011 +0200
@@ -22,6 +22,7 @@
 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 import wx
+import datetime
 
 #-------------------------------------------------------------------------------
 #                            Force Variable Dialog
@@ -45,6 +46,13 @@
 getfloat = gen_get_function(float)
 getstring = gen_get_function(str)
 
+def gettime(v):
+    try:
+        return datetime.timedelta(0, float(v))
+    except: 
+        return None
+
+
 GetTypeValue = {"BOOL": lambda x: {"TRUE": True, "FALSE": False}.get(x.upper(), None),
                 "SINT": getinteger,
                 "INT": getinteger,
@@ -61,7 +69,8 @@
                 "REAL": getfloat,
                 "LREAL": getfloat,
                 "STRING": getstring,
-                "WSTRING": getstring}
+                "WSTRING": getstring,
+                "TIME": gettime}
 
 
 class ForceVariableDialog(wx.TextEntryDialog):