Esempio n. 1
0
    def __init__(self, title, buttons, results, directory=None):
        GenericDialog.__init__(self, title, buttons, results)

        if directory == None:
            directory = os.curdir
        directory = os.path.abspath(directory)

        # Path access.
        self._pathframe = HFrame()
        self._pathframe.minsize = 200, self._pathframe.minsize[1]
        self._pathframe.padding = 0
        self._pathframe.border = BORDER_NONE
        self._lblpath = Label("#Path:")
        self._txtpath = Entry(directory)
        self._txtpath.minsize = 165, self._txtpath.minsize[1]
        self._lblpath.widget = self._txtpath
        self._pathframe.add_child(self._lblpath, self._txtpath)

        # File list browser.
        self._filelist = FileList(200, 160, directory)
        self.content.add_child(self._pathframe, self._filelist)

        # Align anything on the right.
        self.main.align = ALIGN_RIGHT

        # Events.
        self._txtpath.connect_signal(SIG_INPUT, self._set_directory)
        self._filelist.connect_signal(SIG_LISTCHANGED, self._set_path)
Esempio n. 2
0
    def __init__(self, title, buttons, results):
        DialogWindow.__init__(self, title)

        # The main frame holds the whole content for the window.
        # The basic design idea of the dialog looks like:
        # +----------------------+
        # | Title caption        |
        # +----------------------+
        # | main frame           |
        # | ++++++++++++++++++++ |
        # | +                  + |
        # | +    with          + |
        # | +                  + |
        # | +   user content   + |
        # | +                  + |
        # | +------------------+ |
        # | +  Action frame    + |
        # | ++++++++++++++++++++ |
        # +----------------------+
        self.padding = 5

        self._mainframe = VFrame()
        self._mainframe.border = BORDER_NONE
        self._mainframe.spacing = 5
        self._mainframe.padding = 0

        self._contentframe = VFrame()
        self._contentframe.border = BORDER_NONE
        self._contentframe.spacing = 0
        self._contentframe.padding = 0
        self._mainframe.add_child(self._contentframe)

        # Buttons will be placed in the action frame.
        self._actionframe = HFrame()
        self._actionframe.border = BORDER_NONE
        self._actionframe.padding = 0
        self._mainframe.add_child(self._actionframe)

        self.set_buttons(buttons, results)

        self._signals[SIG_DIALOGRESPONSE] = []
        self.set_child(self._mainframe)