Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
 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 = []
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 def popup_event(self, event):
     "override base method"
     if self.stack:
         return ScrolledList.popup_event(self, event)
Exemplo n.º 9
0
# One or more ScrolledLists with HSeparators between them.
Exemplo n.º 10
0
# One or more ScrolledLists with HSeparators between them.