def create_widgets(self): self.top = tktools.make_toplevel(self.app.root, title="Grail: I/O Status", class_="IOStatusPanel") self.closebutton = Button(self.top, name="close", command=self.close, default="active") self.closebutton.pack(side=BOTTOM, pady="1m", padx="1m", anchor=E) self.closebutton.focus_set() self.infobox, self.frame = tktools.make_list_box(self.top, width=40) self.infobox.pack(expand=1, fill=BOTH, side=TOP) self.top.protocol("WM_DELETE_WINDOW", self.close) self.top.bind("<Alt-w>", self.close) self.top.bind("<Alt-W>", self.close)
def __init__(self, mp, name, showinfo=None): self.mp = mp self.name = name self.showinfo = showinfo self.panel = mp.addpanel(name) self.list, self.frame = tktools.make_list_box( self.panel, width=60, height=5) self.list.config(exportselection=0) if showinfo: self.list.bind('<Double-Button-1>', self.doubleclick) self.items = []
def create_widgets(self): self.top = tktools.make_toplevel(self.app.root, title="Grail: I/O Status", class_="IOStatusPanel") self.closebutton = Button(self.top, name="close", command=self.close, default="active") self.closebutton.pack(side=BOTTOM, pady='1m', padx='1m', anchor=E) self.closebutton.focus_set() self.infobox, self.frame = tktools.make_list_box(self.top, width=40) self.infobox.pack(expand=1, fill=BOTH, side=TOP) self.top.protocol('WM_DELETE_WINDOW', self.close) self.top.bind("<Alt-w>", self.close) self.top.bind("<Alt-W>", self.close)
def __init__(self, context, historyobj=None): if not historyobj: # XXX I guess this is here for testing? (It's used nowhere.) self._history = History() else: self._history = historyobj # self._context = context self._history.set_dialog(self) self._frame = tktools.make_toplevel(self._context.viewer.frame, class_="History", title="History Dialog") self._frame.protocol("WM_DELETE_WINDOW", self._close) # get preferences self._viewby = StringVar(self._frame) self._prefs = prefs = get_grailapp().prefs prefs.AddGroupCallback(HISTORY_PREFGROUP, self._notify) try: viewby = prefs.Get(HISTORY_PREFGROUP, VIEW_BY_PREF) if viewby not in [VIEW_BY_TITLES, VIEW_BY_URLS]: raise TypeError except (KeyError, TypeError): viewby = VIEW_BY_TITLES self._viewby.set(viewby) # add a couple of buttons btnbar = Frame(self._frame) btnbar.pack(fill=BOTH, side=BOTTOM) gotobtn = Button(self._frame, name='goto', command=self._goto) gotobtn.pack(side=LEFT, padx='1m', pady='1m', in_=btnbar) closebtn = Button(self._frame, name='close', command=self._close) closebtn.pack(side=LEFT, in_=btnbar) tktools.unify_button_widths(gotobtn, closebtn) # radio button for view option rbframe = Frame(btnbar) rbframe.pack() rb1 = Radiobutton(self._frame, name='titles', command=self._viewby_command, variable=self._viewby, value=VIEW_BY_TITLES) rb2 = Radiobutton(self._frame, name='uris', command=self._viewby_command, variable=self._viewby, value=VIEW_BY_URLS) rb1.pack(anchor='w', in_=rbframe) rb2.pack(anchor='w', in_=rbframe) # create listbox self._listbox, frame = tktools.make_list_box(self._frame, 40, 24, 1, 1, name="list") self.refresh() self._listbox.config(takefocus=0, exportselection=0) self._listbox.bind('<Double-Button-1>', self._goto) self._listbox.bind('<Double-Button-2>', self._goto_new) self._listbox.bind('<ButtonPress-2>', self._highlight) # Yes, yes, the mapping seems inverted, but it has to do with # the way history elements are displayed in reverse order in # the listbox. These mappings mirror those used in the Bookmarks # dialog. self._frame.bind("<Right>", self.next_cmd) self._frame.bind("<Alt-Right>", self.next_cmd) self._frame.bind("<Left>", self.previous_cmd) self._frame.bind("<Alt-Left>", self.previous_cmd) self._frame.bind("<Up>", self.up_cmd) self._frame.bind("p", self.up_cmd) self._frame.bind("P", self.up_cmd) self._frame.bind("<Down>", self.down_cmd) self._frame.bind("n", self.down_cmd) self._frame.bind("N", self.down_cmd) self._frame.bind("g", self._goto) self._frame.bind("G", self._goto) self._frame.bind("<Return>", self._goto) self._frame.bind('<Alt-W>', self._close) self._frame.bind('<Alt-w>', self._close) tktools.set_transient(self._frame, self._context.root)
def __init__(self, context, historyobj=None): if not historyobj: # XXX I guess this is here for testing? (It's used nowhere.) self._history = History() else: self._history = historyobj # self._context = context self._history.set_dialog(self) self._frame = tktools.make_toplevel(self._context.viewer.frame, class_="History", title="History Dialog") self._frame.protocol("WM_DELETE_WINDOW", self._close) # get preferences self._viewby = StringVar(self._frame) self._prefs = prefs = get_grailapp().prefs prefs.AddGroupCallback(HISTORY_PREFGROUP, self._notify) try: viewby = prefs.Get(HISTORY_PREFGROUP, VIEW_BY_PREF) if viewby not in [VIEW_BY_TITLES, VIEW_BY_URLS]: raise TypeError except (KeyError, TypeError): viewby = VIEW_BY_TITLES self._viewby.set(viewby) # add a couple of buttons btnbar = Frame(self._frame) btnbar.pack(fill=BOTH, side=BOTTOM) gotobtn = Button(self._frame, name='goto', command=self._goto) gotobtn.pack(side=LEFT, padx='1m', pady='1m', in_=btnbar) closebtn = Button(self._frame, name='close', command=self._close) closebtn.pack(side=LEFT, in_=btnbar) tktools.unify_button_widths(gotobtn, closebtn) # radio button for view option rbframe = Frame(btnbar) rbframe.pack() rb1 = Radiobutton(self._frame, name='titles', command=self._viewby_command, variable=self._viewby, value=VIEW_BY_TITLES) rb2 = Radiobutton(self._frame, name='uris', command=self._viewby_command, variable=self._viewby, value=VIEW_BY_URLS) rb1.pack(anchor='w', in_=rbframe) rb2.pack(anchor='w', in_=rbframe) # create listbox self._listbox, frame = tktools.make_list_box( self._frame, 40, 24, 1, 1, name="list") self.refresh() self._listbox.config(takefocus=0, exportselection=0) self._listbox.bind('<Double-Button-1>', self._goto) self._listbox.bind('<Double-Button-2>', self._goto_new) self._listbox.bind('<ButtonPress-2>', self._highlight) # Yes, yes, the mapping seems inverted, but it has to do with # the way history elements are displayed in reverse order in # the listbox. These mappings mirror those used in the Bookmarks # dialog. self._frame.bind("<Right>", self.next_cmd) self._frame.bind("<Alt-Right>", self.next_cmd) self._frame.bind("<Left>", self.previous_cmd) self._frame.bind("<Alt-Left>", self.previous_cmd) self._frame.bind("<Up>", self.up_cmd) self._frame.bind("p", self.up_cmd) self._frame.bind("P", self.up_cmd) self._frame.bind("<Down>", self.down_cmd) self._frame.bind("n", self.down_cmd) self._frame.bind("N", self.down_cmd) self._frame.bind("g", self._goto) self._frame.bind("G", self._goto) self._frame.bind("<Return>", self._goto) self._frame.bind('<Alt-W>', self._close) self._frame.bind('<Alt-w>', self._close) tktools.set_transient(self._frame, self._context.root)
#! /usr/bin/env python