2 from tkMessageBox
import *
12 ret = askokcancel(
"waitInputConfirm", msg)
15 _, e, _ = sys.exc_info()
16 if "couldn't connect to display" in str(e):
17 c = raw_input(msg+
' (Enter [Y/y] to proceed) ').lower()
18 return c ==
'y' or c ==
'' 28 ret = askyesno(
"waitInputSelect", msg)
33 def __init__(self, frame, wimf, label, cmd, isFirst):
40 self.
bCmd.pack(side=LEFT)
42 self.
nstr = cmd.count(
"#T")
43 self.
nint = cmd.count(
"#I")
44 self.
ndbl = cmd.count(
"#D")
46 for i
in range(self.
nstr):
47 tf = Text(self.
panel, height=1, width=10)
53 for i
in range(self.
nint):
54 tf = Text(self.
panel, height=1, width=10)
58 for i
in range(self.
ndbl):
59 tf = Text(self.
panel, height=1, width=10)
63 if cmd.count(
"#continuous"):
79 jfc = JFileChooser(
".")
81 jfc.addChoosableFileFilter(pf)
82 ret = jfc.showOpenDialog(
None)
84 path = jfc.getSelectedFile().toString()
87 base = file.split(
".")[0]
88 self.
args[0].setText(base)
92 for i
in range(self.
nstr):
93 str = self.
args[i].get(
"1.0",END)
94 cmd = cmd.replace(
"#T", str[0:len(str)-1], 1)
96 for i
in range(self.
nint):
97 str = self.
args[i].get(
"1.0",END)
98 cmd = cmd.replace(
"#I", str[0:len(str)-1], 1)
100 for i
in range(self.
ndbl):
101 str = self.
args[i].get(
"1.0",END)
102 cmd = cmd.replace(
"#D", str[0:len(str)-1], 1)
103 self.
wimf.addHistory(cmd)
107 self.
wimf.advancePage()
112 Frame.__init__(self, master, width=400, height=600)
113 self.master.title(
'waitInputMenu')
119 panel1 = LabelFrame(self, relief=GROOVE)
122 la.pack(padx = 5, pady = 5, side = LEFT)
124 lb.pack(padx = 5, pady = 5, side = LEFT)
126 lc.pack(padx = 5, pady = 5, side = LEFT)
143 self.
bPrev.pack(padx=5, pady=5, side=LEFT)
145 self.
bNext.pack(padx=5, pady=5, side=LEFT)
147 self.
bSkip.pack(padx=5, pady=5, side=LEFT)
150 cb.pack(padx=5, pady=5, side=LEFT)
157 bQuit.pack(padx = 5, pady = 5)
159 bRestart.pack(padx = 5, pady = 5)
160 for i
in range(len(gmenu)/2):
162 content = gmenu[i*2+1]
163 if content ==
"#label":
181 for i
in range(len(pmenu)/2):
184 cp.bCmd.configure(state=
'disabled')
186 cp.bCmd.configure(state=
'active')
189 self.
lPage.configure(text=str(self.
page+1)+
"/"+str(len(self.
lmenu)))
191 self.
bPrev.configure(state=
'disabled')
193 self.
bPrev.configure(state=
'active')
195 self.
bNext.configure(state=
'disabled')
196 self.
bSkip.configure(state=
'disabled')
198 self.
bNext.configure(state=
'active')
199 self.
bSkip.configure(state=
'active')
218 dstr = datetime.datetime.today().strftime(
"%Y-%m-%d %H:%M:%S")
219 str = dstr+
":"+msg+
"\n" 244 thr = threading.Thread(target=waitInputMenuMain, args=(menu,))
248 __builtin__.waitInputConfirm = waitInputConfirm
249 __builtin__.waitInputSelect = waitInputSelect
250 __builtin__.waitInputMenu = waitInputMenu