예제 #1
0
    def __add_button_clicked(self, button):
        download_list = DownloadList()
        self.download = download_list.add_download(self.uri_entry.get_text(),
                self.download_filechooserbutton.get_current_folder(),
                self.headers)

        self.clipboard.disconnect(self.owner_change_id)
        self.dialog.destroy()
예제 #2
0
    def __init(self, *args):
        gobject.GObject.__init__(self)
        self.config = config.Configuration()
        self.download_list = DownloadList()
        self.download_list.connect("download-added", self.__download_added)

        metalink.USER_AGENT = "%s %s" % (NAME, VERSION)

        self.__set_proxies()
예제 #3
0
    def run(self):
        self.__init_i18n()
        [args, headers] = self.__get_options()

        gnome.init(NAME, VERSION)
        gtk.gdk.threads_init()
        gtk.window_set_default_icon_list(*gui.get_icon_list([16, 22, 24, 32]))

        self.download_list = DownloadList()
        self.download_manager = DownloadManager()

        self.dbus_service = dbus_service.DBusService()

        # If the DBus service is already running, add downloads using it
        if not self.dbus_service.register():
            for uri in args:
                self.dbus_service.download_manager.AddDownload(
                    uri, os.getcwd(), headers)
            return 0

        self.dbus_service.register_object(dbus_service.DOWNLOAD_MGR_OBJ_PATH,
                                          self.download_list)

        self.main_window = MainWindow(self.config, self.download_list)
        self.dbus_service.register_object(dbus_service.MAIN_WINDOW_OBJ_PATH,
                                          self.main_window)
        if self.config.show_main_window:
            self.main_window.window.show()

        self.status_icon = TrayIcon(self.main_window)
        if not self.config.show_status_icon:
            self.status_icon.icon.hide_all()

        sys.excepthook = self.main_window.on_unhandled_exception

        self.download_list.load_from_xml()

        for uri in args:
            if self.config.ask_for_location:
                add = AddDownloadDialog(uri, headers)
                add.dialog.run()
            else:
                self.download_list.add_download(uri,
                                                self.config.default_folder,
                                                headers)

        gtk.main()