equal
deleted
inserted
replaced
20 #You should have received a copy of the GNU General Public |
20 #You should have received a copy of the GNU General Public |
21 #License along with this library; if not, write to the Free Software |
21 #License along with this library; if not, write to the Free Software |
22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 |
23 |
24 import wx |
24 import wx |
|
25 import datetime |
25 |
26 |
26 #------------------------------------------------------------------------------- |
27 #------------------------------------------------------------------------------- |
27 # Force Variable Dialog |
28 # Force Variable Dialog |
28 #------------------------------------------------------------------------------- |
29 #------------------------------------------------------------------------------- |
29 |
30 |
43 |
44 |
44 getinteger = gen_get_function(int) |
45 getinteger = gen_get_function(int) |
45 getfloat = gen_get_function(float) |
46 getfloat = gen_get_function(float) |
46 getstring = gen_get_function(str) |
47 getstring = gen_get_function(str) |
47 |
48 |
|
49 def gettime(v): |
|
50 try: |
|
51 return datetime.timedelta(0, float(v)) |
|
52 except: |
|
53 return None |
|
54 |
|
55 |
48 GetTypeValue = {"BOOL": lambda x: {"TRUE": True, "FALSE": False}.get(x.upper(), None), |
56 GetTypeValue = {"BOOL": lambda x: {"TRUE": True, "FALSE": False}.get(x.upper(), None), |
49 "SINT": getinteger, |
57 "SINT": getinteger, |
50 "INT": getinteger, |
58 "INT": getinteger, |
51 "DINT": getinteger, |
59 "DINT": getinteger, |
52 "LINT": getinteger, |
60 "LINT": getinteger, |
59 "DWORD": getinteger, |
67 "DWORD": getinteger, |
60 "LWORD": getinteger, |
68 "LWORD": getinteger, |
61 "REAL": getfloat, |
69 "REAL": getfloat, |
62 "LREAL": getfloat, |
70 "LREAL": getfloat, |
63 "STRING": getstring, |
71 "STRING": getstring, |
64 "WSTRING": getstring} |
72 "WSTRING": getstring, |
|
73 "TIME": gettime} |
65 |
74 |
66 |
75 |
67 class ForceVariableDialog(wx.TextEntryDialog): |
76 class ForceVariableDialog(wx.TextEntryDialog): |
68 |
77 |
69 if wx.VERSION < (2, 6, 0): |
78 if wx.VERSION < (2, 6, 0): |