Пример #1
0
 def generate_directory_chooser(self, option_name, label_text, value=None):
     """Generate a file chooser button to select a directory."""
     label = Label(label_text)
     directory_chooser = FileChooserEntry(
         action=Gtk.FileChooserAction.SELECT_FOLDER,
         default=reverse_expanduser(value)
     )
     directory_chooser.entry.connect('changed', self.on_chooser_dir_set,
                                     option_name)
     directory_chooser.set_valign(Gtk.Align.CENTER)
     label.set_alignment(0.5, 0.5)
     self.wrapper.pack_start(label, False, False, 0)
     self.wrapper.pack_start(directory_chooser, True, True, 0)
     self.option_widget = directory_chooser
Пример #2
0
 def generate_directory_chooser(self, option_name, label_text, value=None):
     """Generate a file chooser button to select a directory."""
     label = Label(label_text)
     directory_chooser = FileChooserEntry(
         title='Select folder',
         action=Gtk.FileChooserAction.SELECT_FOLDER,
         default_path=reverse_expanduser(value))
     directory_chooser.entry.connect('changed', self.on_chooser_dir_set,
                                     option_name)
     directory_chooser.set_valign(Gtk.Align.CENTER)
     label.set_alignment(0.5, 0.5)
     self.wrapper.pack_start(label, False, False, 0)
     self.wrapper.pack_start(directory_chooser, True, True, 0)
     self.option_widget = directory_chooser