def __middle_click(self): if self.config.ask_for_location: add = dialogs.AddDownloadDialog() add.dialog.show() else: uri = gui.get_uri_from_clipboard() if uri: self.main_window.download_list.add_download(uri, self.config.default_folder)
def __init__(self, uri="", headers={}): self.headers = headers self.config = config.Configuration() self.__get_widgets() self.__connect_widgets() self.clipboard = gtk.Clipboard(selection="PRIMARY") self.owner_change_id = self.clipboard.connect("owner-change", self.__clipboard_owner_change) if uri: self.uri_entry.set_text(uri) else: self.uri_entry.set_text(gui.get_uri_from_clipboard() or "") # self.uri_entry.paste_clipboard() # self.uri_entry.select_region(0, -1) folder = utils.get_folder_for_extension(uri) if not folder: folder = self.config.default_folder self.download_filechooserbutton.set_current_folder(folder) self.download = None
def __clipboard_owner_change(self, clipboard, event): uri = gui.get_uri_from_clipboard() if uri: self.uri_entry.set_text(uri)