def extrDataDialog(initial=[]): win = Toplevel() win.title('Select Paths for Data Extraction') toolbar = Frame(win) toolbar.pack(side=BOTTOM) col = Frame(win) col.pack(expand=YES, fill=X) raw_path = Dirbar(extr_opts[1][1][0], widthB=max_len, name='raw', parent=col, expand=YES, fill=X, side=TOP, padx=15) sur_file = Dirbar(extr_opts[1][1][1], widthB=max_len, name='sur', parent=col, expand=YES, fill=X, DorF='file', side=BOTTOM, padx=15) rstCmd = (lambda arg1=raw_path, arg2=sur_file: \ Restart([arg1, arg2], ('mode','Data Extraction'), win)) Button(toolbar, text='OK', command=win.destroy).pack(side=LEFT) Button(toolbar, text='BACK', command=rstCmd).pack(side=RIGHT) for item in [raw_path, sur_file]: setInitial(item, initial) win.grab_set() win.focus_set() # go modal: mouse grab, key focus, wiat win.wait_window() # wait till destroy; else returns now return raw_path.get_loc(), sur_file.get_loc()
def extrDataDialog(initial=[]): win = Toplevel() win.title('Select Paths for Data Extraction') toolbar = Frame(win) toolbar.pack(side=BOTTOM) col = Frame(win) col.pack(expand=YES, fill=X) raw_path = Dirbar(extr_opts[1][1][0], widthB=max_len, name='raw', parent=col, expand=YES, fill=X, side=TOP, padx=15) sur_file = Dirbar(extr_opts[1][1][1], widthB=max_len, name='sur', parent=col,expand=YES, fill=X, DorF='file', side=BOTTOM, padx=15) rstCmd = (lambda arg1=raw_path, arg2=sur_file: \ Restart([arg1, arg2], ('mode','Data Extraction'), win)) Button(toolbar, text='OK', command=win.destroy).pack(side=LEFT) Button(toolbar, text='BACK', command=rstCmd).pack(side=RIGHT) for item in [raw_path, sur_file]: setInitial(item, initial) win.grab_set() win.focus_set() # go modal: mouse grab, key focus, wiat win.wait_window() # wait till destroy; else returns now return raw_path.get_loc(), sur_file.get_loc()
def filesDialog(initial): win = Toplevel() win.title('Choose Sync Directories and Mode') toolbar = Frame(win) toolbar.pack(side=BOTTOM) col = Frame(win) dir1 = Dirbar(sync_options[0][1][0], widthB=max_len, name='dir1', parent=col, pos=0, expand=YES, fill=X) dir2 = Dirbar(sync_options[0][1][1], widthB=max_len, name='dir2', parent=col, pos=1, expand=YES, fill=X) # silly update function for label names; func = (lambda dir1=dir1, dir2=dir2: \ updateDirLab(dir1, dir2, mode.state())) mode = Radiobar(parent=win, picks=[options[0] for options in sync_options], side=LEFT, orientation='VERT', func=func) mode.name = 'mode' # for some reason, this sets th vars as the string 'None', not a None QUIT = (lambda dir1=dir1, dir2=dir2, mode=mode:\ (dir1.set_(None), dir2.set_(None), mode.set_(None), \ win.destroy())) Button(toolbar, text='OK', command=win.destroy).pack(side=LEFT) Button(toolbar, text='QUIT', command=QUIT).pack(side=RIGHT) for item in [dir1, dir2, mode]: setInitial(item, initial) dir1.pack(side=TOP, padx=15) dir2.pack(side=BOTTOM, padx=15) mode.pack(side=LEFT, padx=15) col.pack(side=RIGHT, expand=YES, fill=X) win.grab_set() win.focus_set() # go modal: mouse grab, key focus, wiat win.wait_window() # wait till destroy; else returns now return dir1, dir2, mode
def extrPinsDialog(initial=[]): win = Toplevel() win.title('Select Paths for Pin Extraction') toolbar = Frame(win) toolbar.pack(side=BOTTOM) col = Frame(win) raw_path = Dirbar(extr_opts[0][1][0], widthB=max_len, name='raw', parent=col, expand=YES, fill=X, side=TOP, padx=15) sur_file = Dirbar(extr_opts[0][1][1], widthB=max_len, name='sur', parent=col,expand=YES, fill=X, DorF='file', side=TOP, padx=15) out_dir = Dirbar(extr_opts[0][1][2], widthB=max_len, name='outd', parent=col, expand=YES, fill=X, padx=15) out_file = Dirbar(extr_opts[0][1][3], widthB=max_len, name='outf', parent=col,expand=YES, fill=X, DorF=None, side=BOTTOM, padx=15) chk = Checkbar(parent=win, picks=['MF', 'USAMP', 'TSN']) for item in [raw_path, sur_file, out_dir, out_file]: setInitial(item, initial) rstCmd = (lambda arg1=raw_path, arg2=sur_file, arg3=out_dir, arg4=out_file: \ Restart([arg1, arg2, arg3, arg4], ('mode','Pin Extraction'), win)) Button(toolbar, text='OK', command=win.destroy).pack(side=LEFT) Button(toolbar, text='BACK', command=rstCmd).pack(side=RIGHT) chk.pack(side=LEFT, padx=15) col.pack(expand=YES, fill=X) win.grab_set() win.focus_set() # go modal: mouse grab, key focus, wiat win.wait_window() # wait till destroy; else returns now return raw_path.get_loc(), sur_file.get_loc(),\ os.path.join(out_dir.get_loc(), out_file.get_loc()),\ chk.state()
def extrPinsDialog(initial=[]): win = Toplevel() win.title('Select Paths for Pin Extraction') toolbar = Frame(win) toolbar.pack(side=BOTTOM) col = Frame(win) raw_path = Dirbar(extr_opts[0][1][0], widthB=max_len, name='raw', parent=col, expand=YES, fill=X, side=TOP, padx=15) sur_file = Dirbar(extr_opts[0][1][1], widthB=max_len, name='sur', parent=col, expand=YES, fill=X, DorF='file', side=TOP, padx=15) out_dir = Dirbar(extr_opts[0][1][2], widthB=max_len, name='outd', parent=col, expand=YES, fill=X, padx=15) out_file = Dirbar(extr_opts[0][1][3], widthB=max_len, name='outf', parent=col, expand=YES, fill=X, DorF=None, side=BOTTOM, padx=15) chk = Checkbar(parent=win, picks=['MF', 'USAMP', 'TSN']) for item in [raw_path, sur_file, out_dir, out_file]: setInitial(item, initial) rstCmd = (lambda arg1=raw_path, arg2=sur_file, arg3=out_dir, arg4=out_file: \ Restart([arg1, arg2, arg3, arg4], ('mode','Pin Extraction'), win)) Button(toolbar, text='OK', command=win.destroy).pack(side=LEFT) Button(toolbar, text='BACK', command=rstCmd).pack(side=RIGHT) chk.pack(side=LEFT, padx=15) col.pack(expand=YES, fill=X) win.grab_set() win.focus_set() # go modal: mouse grab, key focus, wiat win.wait_window() # wait till destroy; else returns now return raw_path.get_loc(), sur_file.get_loc(),\ os.path.join(out_dir.get_loc(), out_file.get_loc()),\ chk.state()