def notify(self, event): """F.notify (...) -> None Notifies the FileList about an event. """ if not self.sensitive: return if event.signal == SIG_DOUBLECLICKED: eventarea = self.rect_to_client() if eventarea.collidepoint(event.data.pos): self.run_signal_handlers(SIG_DOUBLECLICKED) if event.data.button == 1: # Get the item and switch to the directory on demand. item = self.child.get_item_at_pos(event.data.pos) if item and item.selected and stat.S_ISDIR(item.filetype): self.set_directory( os.path.join(self.directory, item.text)) event.handled = True elif event.signal == SIG_KEYDOWN: if event.data.key == K_RETURN: if self.cursor and stat.S_ISDIR(self.cursor.filetype): self.set_directory( os.path.join(self.directory, self.cursor.text)) event.handled = True ScrolledList.notify(self, event)
def notify (self, event): """F.notify (...) -> None Notifies the FileList about an event. """ if not self.sensitive: return if event.signal == SIG_DOUBLECLICKED: eventarea = self.rect_to_client () if eventarea.collidepoint (event.data.pos): self.run_signal_handlers (SIG_DOUBLECLICKED) if event.data.button == 1: # Get the item and switch to the directory on demand. item = self.child.get_item_at_pos (event.data.pos) if item and item.selected and stat.S_ISDIR (item.filetype): self.set_directory (os.path.join (self.directory, item.text)) event.handled = True elif event.signal == SIG_KEYDOWN: if event.data.key == K_RETURN: if self.cursor and stat.S_ISDIR (self.cursor.filetype): self.set_directory (os.path.join (self.directory, self.cursor.text)) event.handled = True ScrolledList.notify (self, event)
def __init__(self, width, height, directory=None): ScrolledList.__init__(self, width, height) self._signals[SIG_DOUBLECLICKED] = [] self._directory = None self.selectionmode = SELECTION_SINGLE self.set_directory(directory)
def __init__ (self, width, height, directory=None): ScrolledList.__init__ (self, width, height) self._signals[SIG_DOUBLECLICKED] = [] self._directory = None self.selectionmode = SELECTION_SINGLE self.set_directory (directory)
def __init__(self, master, flist, gui): if macosxSupport.isAquaTk(): # At least on with the stock AquaTk version on OSX 10.4 you'll # get an shaking GUI that eventually kills IDLE if the width # argument is specified. ScrolledList.__init__(self, master) else: ScrolledList.__init__(self, master, width=80) self.flist = flist self.gui = gui self.stack = []
def __init__(self, root, nlists=2): assert nlists >= 1 self.root = root self.nlists = nlists self.path = [] # create top self.top = top = ListedToplevel(root) top.protocol("WM_DELETE_WINDOW", self.close) top.bind("<Escape>", self.close) self.settitle() # create frames and separators in between self.frames = [] self.separators = [] last = top for i in range(nlists - 1): sepa = HSeparator(last) self.separators.append(sepa) frame, last = sepa.parts() self.frames.append(frame) self.frames.append(last) # create labels and lists self.labels = [] self.lists = [] for i in range(nlists): frame = self.frames[i] label = Label(frame, text=self.subtitle(i), relief="groove", borderwidth=2) label.pack(fill="x") self.labels.append(label) list = ScrolledList(frame, width=self.width(i), height=self.height(i)) self.lists.append(list) list.on_select = \ lambda index, i=i, self=self: self.on_select(index, i) list.on_double = \ lambda index, i=i, self=self: self.on_double(index, i) # fill leftmost list (rest get filled on demand) self.fill(0) # XXX one after_idle isn't enough; two are... top.after_idle(self.call_pack_propagate_1)
def __init__(self, root, nlists=2): assert nlists >= 1 self.root = root self.nlists = nlists self.path = [] # create top self.top = top = ListedToplevel(root) top.protocol("WM_DELETE_WINDOW", self.close) top.bind("<Escape>", self.close) self.settitle() # create frames and separators in between self.frames = [] self.separators = [] last = top for i in range(nlists-1): sepa = HSeparator(last) self.separators.append(sepa) frame, last = sepa.parts() self.frames.append(frame) self.frames.append(last) # create labels and lists self.labels = [] self.lists = [] for i in range(nlists): frame = self.frames[i] label = Label(frame, text=self.subtitle(i), relief="groove", borderwidth=2) label.pack(fill="x") self.labels.append(label) list = ScrolledList(frame, width=self.width(i), height=self.height(i)) self.lists.append(list) list.on_select = \ lambda index, i=i, self=self: self.on_select(index, i) list.on_double = \ lambda index, i=i, self=self: self.on_double(index, i) # fill leftmost list (rest get filled on demand) self.fill(0) # XXX one after_idle isn't enough; two are... top.after_idle(self.call_pack_propagate_1)
def popup_event(self, event): "override base method" if self.stack: return ScrolledList.popup_event(self, event)
# One or more ScrolledLists with HSeparators between them.