# HG changeset patch # User Edouard Tisserant # Date 1301591447 -7200 # Node ID 40290ddff19c1f5079a2f1325bade4b8cfa6e429 # Parent 55213a347f1678d0966f08c5fe61bb988f41a58c Initial TIME support in forcing diff -r 55213a347f16 -r 40290ddff19c dialogs/ForceVariableDialog.py --- 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):