def change_download_save_dir(self, widget): local_dir = FolderChooseDialog(False).run() if local_dir: local_dir = os.path.expanduser(local_dir) if local_dir != get_software_download_dir(): self.dir_entry.set_editable(True) self.dir_entry.set_text(local_dir) self.dir_entry.set_editable(False) set_software_download_dir(local_dir) global_event.emit('download-directory-changed')
def create_download_dir_table(self): main_table = gtk.Table(4, 2) main_table.set_row_spacings(CONTENT_ROW_SPACING) dir_title_label = Label(_("Download settings")) dir_title_label.set_size_request(200, 12) label_align = gtk.Alignment() label_align.set_padding(0, 0, 0, 0) label_align.add(dir_title_label) download_number_label = Label(_('Maximum number of download tasks: ')) self.download_number_comobox = ComboBox( items = [(str(i+1), i+1) for i in range(10)], select_index = int(get_download_number())-1, ) self.download_number_comobox.connect("item-selected", self.download_number_comobox_changed) download_number_hbox = gtk.HBox(spacing=5) download_number_hbox.pack_start(download_number_label, False, False) download_number_hbox.pack_start(self.download_number_comobox, False, False) change_download_dir_label = Label(_("Download directory: ")) self.dir_entry = InputEntry() self.dir_entry.set_text(get_software_download_dir()) self.dir_entry.set_editable(False) self.dir_entry.set_size(200, 25) modify_button = Button(_("Change")) modify_button.connect("clicked", self.change_download_save_dir) download_dir_hbox = gtk.HBox(spacing=5) download_dir_hbox.pack_start(change_download_dir_label, False, False) download_dir_hbox.pack_start(self.dir_entry, False, False) download_dir_hbox.pack_start(modify_button, False, False) main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL) main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL) main_table.attach(download_number_hbox, 0, 2, 2, 3, xoptions=gtk.FILL) main_table.attach(download_dir_hbox, 0, 2, 3, 4, xoptions=gtk.FILL) return main_table
def open_download_directory(self): run_command("xdg-open %s" % get_software_download_dir())
def set_software_download_dir(self): self.bus_interface.set_download_dir( get_software_download_dir(), reply_handler=lambda :handle_dbus_reply("set_download_dir"), error_handler=lambda e:handle_dbus_error("set_download_dir", e))