diff options
Diffstat (limited to 'Tools/pynche/ListViewer.py')
-rw-r--r-- | Tools/pynche/ListViewer.py | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/Tools/pynche/ListViewer.py b/Tools/pynche/ListViewer.py index eb43a92..424e462 100644 --- a/Tools/pynche/ListViewer.py +++ b/Tools/pynche/ListViewer.py @@ -45,9 +45,29 @@ class ListViewer: canvas.pack(fill=BOTH, expand=1) canvas.configure(yscrollcommand=(self.__scrollbar, 'set')) self.__scrollbar.configure(command=(canvas, 'yview')) + self.__populate() + # + # Update on click + self.__uoc = BooleanVar() + self.__uoc.set(optiondb.get('UPONCLICK', 1)) + self.__uocbtn = Checkbutton(root, + text='Update on Click', + variable=self.__uoc, + command=self.__toggleupdate) + self.__uocbtn.pack(expand=1, fill=BOTH) + # + # alias list + self.__alabel = Label(root, text='Aliases:') + self.__alabel.pack() + self.__aliases = Listbox(root, height=5, + selectmode=BROWSE) + self.__aliases.pack(expand=1, fill=BOTH) + + def __populate(self): # # create all the buttons - colordb = switchboard.colordb() + colordb = self.__sb.colordb() + canvas = self.__canvas row = 0 widest = 0 bboxes = self.__bboxes = [] @@ -63,7 +83,7 @@ class ListViewer: boxid = canvas.create_rectangle(3, row*20+3, textend+3, row*20 + 23, outline='', - tags=(exactcolor,)) + tags=(exactcolor, 'all')) canvas.bind('<ButtonRelease>', self.__onrelease) bboxes.append(boxid) if textend+3 > widest: @@ -74,22 +94,6 @@ class ListViewer: for box in bboxes: x1, y1, x2, y2 = canvas.coords(box) canvas.coords(box, x1, y1, widest, y2) - # - # Update on click - self.__uoc = BooleanVar() - self.__uoc.set(optiondb.get('UPONCLICK', 1)) - self.__uocbtn = Checkbutton(root, - text='Update on Click', - variable=self.__uoc, - command=self.__toggleupdate) - self.__uocbtn.pack(expand=1, fill=BOTH) - # - # alias list - self.__alabel = Label(root, text='Aliases:') - self.__alabel.pack() - self.__aliases = Listbox(root, height=5, - selectmode=BROWSE) - self.__aliases.pack(expand=1, fill=BOTH) def __onrelease(self, event=None): canvas = self.__canvas @@ -164,3 +168,7 @@ class ListViewer: def save_options(self, optiondb): optiondb['UPONCLICK'] = self.__uoc.get() + + def flush(self): + self.__canvas.delete('all') + self.__populate() |