Ejemplo n.º 1
0
 def on_menuitem_move_activate(self, data=None):
     log.debug("on_menuitem_move_activate")
     if client.is_localhost():
         from deluge.configmanager import ConfigManager
         config = ConfigManager("gtkui.conf")
         chooser = gtk.FileChooserDialog(
             _("Choose a directory to move files to"),
             component.get("MainWindow").window,
             gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
             buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                      gtk.STOCK_OK, gtk.RESPONSE_OK)
         )
         chooser.set_local_only(True)
         if not deluge.common.windows_check():
             chooser.set_icon(common.get_deluge_icon())
             chooser.set_property("skip-taskbar-hint", True)
         chooser.set_current_folder(config["choose_directory_dialog_path"])
         if chooser.run() == gtk.RESPONSE_OK:
             result = chooser.get_filename()
             config["choose_directory_dialog_path"] = result
             client.core.move_storage(
                 component.get("TorrentView").get_selected_torrents(), result)
         chooser.destroy()
     else:
         component.get("SessionProxy").get_torrent_status(
             component.get("TorrentView").get_selected_torrent(),
             ["save_path"]).addCallback(self.show_move_storage_dialog)
Ejemplo n.º 2
0
 def on_menuitem_move_activate(self, data=None):
     log.debug("on_menuitem_move_activate")
     if client.is_localhost():
         from deluge.configmanager import ConfigManager
         config = ConfigManager("gtkui.conf")
         chooser = gtk.FileChooserDialog(
             _("Choose a directory to move files to"),
             component.get("MainWindow").window,
             gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
             buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK,
                      gtk.RESPONSE_OK))
         chooser.set_local_only(True)
         if not deluge.common.windows_check():
             chooser.set_icon(common.get_deluge_icon())
             chooser.set_property("skip-taskbar-hint", True)
         chooser.set_current_folder(config["choose_directory_dialog_path"])
         if chooser.run() == gtk.RESPONSE_OK:
             result = chooser.get_filename()
             config["choose_directory_dialog_path"] = result
             client.core.move_storage(
                 component.get("TorrentView").get_selected_torrents(),
                 result)
         chooser.destroy()
     else:
         component.get("SessionProxy").get_torrent_status(
             component.get("TorrentView").get_selected_torrent(),
             ["save_path"]).addCallback(self.show_move_storage_dialog)
Ejemplo n.º 3
0
    def __init__(self, torrent_id, parent=None):
        self.torrent_id = torrent_id
        self.glade = Gtk.Builder()
        self.glade.add_from_file(
            pkg_resources.resource_filename("deluge.ui.gtkui",
                                            "builder/edit_trackers.ui"))

        self.dialog = self.glade.get_object("edit_trackers_dialog")
        self.treeview = self.glade.get_object("tracker_treeview")
        self.add_tracker_dialog = self.glade.get_object("add_tracker_dialog")
        self.add_tracker_dialog.set_transient_for(self.dialog)
        self.edit_tracker_entry = self.glade.get_object("edit_tracker_entry")
        self.edit_tracker_entry.set_transient_for(self.dialog)
        self.dialog.set_icon(common.get_deluge_icon())

        if parent != None:
            self.dialog.set_transient_for(parent)

        # Connect the signals
        self.glade.connect_signals({
            "on_button_up_clicked":
            self.on_button_up_clicked,
            "on_button_add_clicked":
            self.on_button_add_clicked,
            "on_button_edit_clicked":
            self.on_button_edit_clicked,
            "on_button_edit_cancel_clicked":
            self.on_button_edit_cancel_clicked,
            "on_button_edit_ok_clicked":
            self.on_button_edit_ok_clicked,
            "on_button_remove_clicked":
            self.on_button_remove_clicked,
            "on_button_down_clicked":
            self.on_button_down_clicked,
            "on_button_ok_clicked":
            self.on_button_ok_clicked,
            "on_button_cancel_clicked":
            self.on_button_cancel_clicked,
            "on_button_add_ok_clicked":
            self.on_button_add_ok_clicked,
            "on_button_add_cancel_clicked":
            self.on_button_add_cancel_clicked
        })

        # Create a liststore for tier, url
        self.liststore = Gtk.ListStore(int, str)

        # Create the columns
        self.treeview.append_column(
            Gtk.TreeViewColumn(_("Tier"), Gtk.CellRendererText(), text=0))
        self.treeview.append_column(
            Gtk.TreeViewColumn(_("Tracker"), Gtk.CellRendererText(), text=1))

        self.treeview.set_model(self.liststore)
        self.liststore.set_sort_column_id(0, Gtk.SortType.ASCENDING)
Ejemplo n.º 4
0
    def __init__(self, torrent_id, parent=None):
        self.torrent_id = torrent_id
        self.builder = gtk.Builder()
        # Main dialog
        self.builder.add_from_file(deluge.common.resource_filename(
            "deluge.ui.gtkui", os.path.join("glade", "edit_trackers.ui")
        ))
        # add tracker dialog
        self.builder.add_from_file(deluge.common.resource_filename(
            "deluge.ui.gtkui", os.path.join("glade", "edit_trackers.add.ui")
        ))
        # edit tracker dialog
        self.builder.add_from_file(deluge.common.resource_filename(
            "deluge.ui.gtkui", os.path.join("glade", "edit_trackers.edit.ui")
        ))

        self.dialog = self.builder.get_object("edit_trackers_dialog")
        self.treeview = self.builder.get_object("tracker_treeview")
        self.add_tracker_dialog = self.builder.get_object("add_tracker_dialog")
        self.add_tracker_dialog.set_transient_for(self.dialog)
        self.edit_tracker_entry = self.builder.get_object("edit_tracker_entry")
        self.edit_tracker_entry.set_transient_for(self.dialog)
        self.dialog.set_icon(common.get_deluge_icon())

        if parent != None:
            self.dialog.set_transient_for(parent)

        # Connect the signals
        self.builder.connect_signals({
            "on_button_up_clicked": self.on_button_up_clicked,
            "on_button_add_clicked": self.on_button_add_clicked,
            "on_button_edit_clicked": self.on_button_edit_clicked,
            "on_button_edit_cancel_clicked": self.on_button_edit_cancel_clicked,
            "on_button_edit_ok_clicked": self.on_button_edit_ok_clicked,
            "on_button_remove_clicked": self.on_button_remove_clicked,
            "on_button_down_clicked": self.on_button_down_clicked,
            "on_button_add_ok_clicked": self.on_button_add_ok_clicked,
            "on_button_add_cancel_clicked": self.on_button_add_cancel_clicked
        })

        # Create a liststore for tier, url
        self.liststore = gtk.ListStore(int, str)

        # Create the columns
        self.treeview.append_column(
            gtk.TreeViewColumn(_("Tier"), gtk.CellRendererText(), text=0))
        self.treeview.append_column(
            gtk.TreeViewColumn(_("Tracker"), gtk.CellRendererText(), text=1))

        self.treeview.set_model(self.liststore)
        self.liststore.set_sort_column_id(0, gtk.SORT_ASCENDING)

        self.dialog.connect("delete-event", self._on_delete_event)
        self.dialog.connect("response", self._on_response)
Ejemplo n.º 5
0
    def __init__(self):
        if Wnck:
            self.screen = Wnck.Screen.get_default()
        component.Component.__init__(self, "MainWindow", interval=2)
        self.config = ConfigManager("gtkui.conf")
        # Get the glade file for the main window
        self.main_glade = Gtk.Builder()
        self.main_glade.add_from_file(
            pkg_resources.resource_filename("deluge.ui.gtkui",
                                            "builder/main_window.ui"))

        self.window_signals = {}

        self.window = self.main_glade.get_object("main_window")

        self.window.set_icon(common.get_deluge_icon())

        self.vpaned = self.main_glade.get_object("vpaned")
        self.initial_vpaned_position = self.config["window_pane_position"]

        # Load the window state
        self.load_window_state()

        # Keep track of window's minimization state so that we don't update the
        # UI when it is minimized.
        self.is_minimized = False

        self.window.drag_dest_set(
            Gtk.DestDefaults.ALL,
            [Gtk.TargetEntry.new('text/uri-list', 0, 80)], Gdk.DragAction.COPY)

        # Connect events
        self.window.connect("window-state-event", self.on_window_state_event)
        self.window.connect("configure-event", self.on_window_configure_event)
        self.window.connect("delete-event", self.on_window_delete_event)
        self.window.connect("drag-data-received",
                            self.on_drag_data_received_event)
        self.vpaned.connect("notify::position", self.on_vpaned_position_event)
        self.window.connect("draw", self.on_expose_event)

        self.config.register_set_function("show_rate_in_title",
                                          self._on_set_show_rate_in_title,
                                          apply_now=False)

        client.register_event_handler("NewVersionAvailableEvent",
                                      self.on_newversionavailable_event)
        client.register_event_handler("TorrentFinishedEvent",
                                      self.on_torrentfinished_event)
Ejemplo n.º 6
0
    def __init__(self):
        if wnck:
            self.screen = wnck.screen_get_default()
        component.Component.__init__(self, "MainWindow", interval=2)
        self.config = ConfigManager("gtkui.conf")
        # Get the glade file for the main window
        self.main_glade = gtk.glade.XML(
            pkg_resources.resource_filename("deluge.ui.gtkui",
                                            "glade/main_window.glade"))

        self.window = self.main_glade.get_widget("main_window")

        self.window.set_icon(common.get_deluge_icon())

        self.vpaned = self.main_glade.get_widget("vpaned")
        self.initial_vpaned_position = self.config["window_pane_position"]

        # Load the window state
        self.load_window_state()

        # Keep track of window's minimization state so that we don't update the
        # UI when it is minimized.
        self.is_minimized = False

        self.window.drag_dest_set(gtk.DEST_DEFAULT_ALL,
                                  [('text/uri-list', 0, 80)],
                                  gtk.gdk.ACTION_COPY)

        # Connect events
        self.window.connect("window-state-event", self.on_window_state_event)
        self.window.connect("configure-event", self.on_window_configure_event)
        self.window.connect("delete-event", self.on_window_delete_event)
        self.window.connect("drag-data-received",
                            self.on_drag_data_received_event)
        self.vpaned.connect("notify::position", self.on_vpaned_position_event)
        self.window.connect("expose-event", self.on_expose_event)

        self.config.register_set_function("show_rate_in_title",
                                          self._on_set_show_rate_in_title,
                                          apply_now=False)

        client.register_event_handler("NewVersionAvailableEvent",
                                      self.on_newversionavailable_event)
        client.register_event_handler("TorrentFinishedEvent",
                                      self.on_torrentfinished_event)
Ejemplo n.º 7
0
    def __init__(self, torrent_id, parent=None):
        self.torrent_id = torrent_id
        self.glade = gtk.glade.XML(
                    pkg_resources.resource_filename("deluge.ui.gtkui",
                                            "glade/edit_trackers.glade"))

        self.dialog = self.glade.get_widget("edit_trackers_dialog")
        self.treeview = self.glade.get_widget("tracker_treeview")
        self.add_tracker_dialog = self.glade.get_widget("add_tracker_dialog")
        self.add_tracker_dialog.set_transient_for(self.dialog)
        self.edit_tracker_entry = self.glade.get_widget("edit_tracker_entry")
        self.edit_tracker_entry.set_transient_for(self.dialog)
        self.dialog.set_icon(common.get_deluge_icon())

        if parent != None:
            self.dialog.set_transient_for(parent)

        # Connect the signals
        self.glade.signal_autoconnect({
            "on_button_up_clicked": self.on_button_up_clicked,
            "on_button_add_clicked": self.on_button_add_clicked,
            "on_button_edit_clicked": self.on_button_edit_clicked,
            "on_button_edit_cancel_clicked": self.on_button_edit_cancel_clicked,
            "on_button_edit_ok_clicked": self.on_button_edit_ok_clicked,
            "on_button_remove_clicked": self.on_button_remove_clicked,
            "on_button_down_clicked": self.on_button_down_clicked,
            "on_button_ok_clicked": self.on_button_ok_clicked,
            "on_button_cancel_clicked": self.on_button_cancel_clicked,
            "on_button_add_ok_clicked": self.on_button_add_ok_clicked,
            "on_button_add_cancel_clicked": self.on_button_add_cancel_clicked
        })

        # Create a liststore for tier, url
        self.liststore = gtk.ListStore(int, str)

        # Create the columns
        self.treeview.append_column(
            gtk.TreeViewColumn(_("Tier"), gtk.CellRendererText(), text=0))
        self.treeview.append_column(
            gtk.TreeViewColumn(_("Tracker"), gtk.CellRendererText(), text=1))

        self.treeview.set_model(self.liststore)
        self.liststore.set_sort_column_id(0, gtk.SORT_ASCENDING)
Ejemplo n.º 8
0
    def __init__(self, torrent_id, parent=None):
        self.torrent_id = torrent_id
        self.glade = gtk.glade.XML(deluge.common.resource_filename(
            "deluge.ui.gtkui", os.path.join("glade", "edit_trackers.glade"))
        )
        self.dialog = self.glade.get_widget("edit_trackers_dialog")
        self.treeview = self.glade.get_widget("tracker_treeview")
        self.add_tracker_dialog = self.glade.get_widget("add_tracker_dialog")
        self.add_tracker_dialog.set_transient_for(self.dialog)
        self.edit_tracker_entry = self.glade.get_widget("edit_tracker_entry")
        self.edit_tracker_entry.set_transient_for(self.dialog)
        self.dialog.set_icon(common.get_deluge_icon())

        if parent != None:
            self.dialog.set_transient_for(parent)

        # Connect the signals
        self.glade.signal_autoconnect({
            "on_button_up_clicked": self.on_button_up_clicked,
            "on_button_add_clicked": self.on_button_add_clicked,
            "on_button_edit_clicked": self.on_button_edit_clicked,
            "on_button_edit_cancel_clicked": self.on_button_edit_cancel_clicked,
            "on_button_edit_ok_clicked": self.on_button_edit_ok_clicked,
            "on_button_remove_clicked": self.on_button_remove_clicked,
            "on_button_down_clicked": self.on_button_down_clicked,
            "on_button_add_ok_clicked": self.on_button_add_ok_clicked,
            "on_button_add_cancel_clicked": self.on_button_add_cancel_clicked
        })

        # Create a liststore for tier, url
        self.liststore = gtk.ListStore(int, str)

        # Create the columns
        self.treeview.append_column(
            gtk.TreeViewColumn(_("Tier"), gtk.CellRendererText(), text=0))
        self.treeview.append_column(
            gtk.TreeViewColumn(_("Tracker"), gtk.CellRendererText(), text=1))

        self.treeview.set_model(self.liststore)
        self.liststore.set_sort_column_id(0, gtk.SORT_ASCENDING)

        self.dialog.connect("delete-event", self._on_delete_event)
        self.dialog.connect("response", self._on_response)
Ejemplo n.º 9
0
    def __init__(self):
        if Wnck:
            self.screen = Wnck.Screen.get_default()
        component.Component.__init__(self, "MainWindow", interval=2)
        self.config = ConfigManager("gtkui.conf")
        # Get the glade file for the main window
        self.main_glade = Gtk.Builder()
        self.main_glade.add_from_file(
                    pkg_resources.resource_filename("deluge.ui.gtkui",
                                                    "builder/main_window.ui"))

        self.window_signals = {}

        self.window = self.main_glade.get_object("main_window")

        self.window.set_icon(common.get_deluge_icon())

        self.vpaned = self.main_glade.get_object("vpaned")
        self.initial_vpaned_position = self.config["window_pane_position"]

        # Load the window state
        self.load_window_state()

        # Keep track of window's minimization state so that we don't update the
        # UI when it is minimized.
        self.is_minimized = False

        self.window.drag_dest_set(Gtk.DestDefaults.ALL, [Gtk.TargetEntry.new('text/uri-list', 0,
            80)], Gdk.DragAction.COPY)

        # Connect events
        self.window.connect("window-state-event", self.on_window_state_event)
        self.window.connect("configure-event", self.on_window_configure_event)
        self.window.connect("delete-event", self.on_window_delete_event)
        self.window.connect("drag-data-received", self.on_drag_data_received_event)
        self.vpaned.connect("notify::position", self.on_vpaned_position_event)
        self.window.connect("draw", self.on_expose_event)

        self.config.register_set_function("show_rate_in_title", self._on_set_show_rate_in_title, apply_now=False)

        client.register_event_handler("NewVersionAvailableEvent", self.on_newversionavailable_event)
        client.register_event_handler("TorrentFinishedEvent", self.on_torrentfinished_event)
Ejemplo n.º 10
0
    def __init__(self):
        if wnck:
            self.screen = wnck.screen_get_default()
        component.Component.__init__(self, "MainWindow", interval=2)
        self.config = ConfigManager("gtkui.conf")
        # Get the glade file for the main window
        self.main_glade = gtk.glade.XML(
                    pkg_resources.resource_filename("deluge.ui.gtkui",
                                                    "glade/main_window.glade"))

        self.window = self.main_glade.get_widget("main_window")

        self.window.set_icon(common.get_deluge_icon())

        self.vpaned = self.main_glade.get_widget("vpaned")
        self.initial_vpaned_position = self.config["window_pane_position"]

        # Load the window state
        self.load_window_state()

        # Keep track of window's minimization state so that we don't update the
        # UI when it is minimized.
        self.is_minimized = False

        self.window.drag_dest_set(gtk.DEST_DEFAULT_ALL, [('text/uri-list', 0,
            80)], gtk.gdk.ACTION_COPY)

        # Connect events
        self.window.connect("window-state-event", self.on_window_state_event)
        self.window.connect("configure-event", self.on_window_configure_event)
        self.window.connect("delete-event", self.on_window_delete_event)
        self.window.connect("drag-data-received", self.on_drag_data_received_event)
        self.vpaned.connect("notify::position", self.on_vpaned_position_event)
        self.window.connect("expose-event", self.on_expose_event)

        self.config.register_set_function("show_rate_in_title", self._on_set_show_rate_in_title, apply_now=False)

        client.register_event_handler("NewVersionAvailableEvent", self.on_newversionavailable_event)
        client.register_event_handler("TorrentFinishedEvent", self.on_torrentfinished_event)
Ejemplo n.º 11
0
    def show(self):
        """
        Show the ConnectionManager dialog.
        """
        # Get the glade file for the connection manager
        self.glade = gtk.glade.XML(
                    pkg_resources.resource_filename("deluge.ui.gtkui",
                                            "glade/connection_manager.glade"))
        self.window = component.get("MainWindow")

        # Setup the ConnectionManager dialog
        self.connection_manager = self.glade.get_widget("connection_manager")
        self.connection_manager.set_transient_for(self.window.window)

        self.connection_manager.set_icon(common.get_deluge_icon())

        self.glade.get_widget("image1").set_from_pixbuf(common.get_logo(32))

        self.hostlist = self.glade.get_widget("hostlist")

        # Create status pixbufs
        if not HOSTLIST_PIXBUFS:
            for stock_id in (gtk.STOCK_NO, gtk.STOCK_YES, gtk.STOCK_CONNECT):
                HOSTLIST_PIXBUFS.append(self.connection_manager.render_icon(stock_id, gtk.ICON_SIZE_MENU))

        # Create the host list gtkliststore
        # id-hash, hostname, port, status, username, password, version
        self.liststore = gtk.ListStore(str, str, int, str, str, str, str)

        # Setup host list treeview
        self.hostlist.set_model(self.liststore)
        render = gtk.CellRendererPixbuf()
        column = gtk.TreeViewColumn(_("Status"), render)
        column.set_cell_data_func(render, cell_render_status, 3)
        self.hostlist.append_column(column)
        render = gtk.CellRendererText()
        column = gtk.TreeViewColumn(_("Host"), render, text=HOSTLIST_COL_HOST)
        column.set_cell_data_func(render, cell_render_host, (1, 2, 4))
        column.set_expand(True)
        self.hostlist.append_column(column)
        render = gtk.CellRendererText()
        column = gtk.TreeViewColumn(_("Version"), render, text=HOSTLIST_COL_VERSION)
        self.hostlist.append_column(column)

        # Load any saved host entries
        self.__load_hostlist()
        self.__load_options()

        # Select the first host if possible
        if len(self.liststore) > 0:
            self.hostlist.get_selection().select_path("0")

        # Connect the signals to the handlers
        self.glade.signal_autoconnect(self)
        self.hostlist.get_selection().connect("changed", self.on_hostlist_selection_changed)

        self.__update_list()

        self.running = True
        response = self.connection_manager.run()
        self.running = False

        # Save the toggle options
        self.__save_options()
        self.__save_hostlist()

        self.connection_manager.destroy()
        del self.glade
        del self.window
        del self.connection_manager
        del self.liststore
        del self.hostlist
Ejemplo n.º 12
0
    def __init__(self):
        component.Component.__init__(self, "MainWindow", interval=2)
        self.config = ConfigManager("gtkui.conf")
        self.gtk_builder_signals_holder = _GtkBuilderSignalsHolder()
        self.main_builder = gtk.Builder()
        # Patch this GtkBuilder to avoid connecting signals from elsewhere
        #
        # Think about splitting up the main window gtkbuilder file into the necessary parts
        # in order not to have to monkey patch GtkBuilder. Those parts would then need to
        # be added to the main window "by hand".
        self.main_builder.prev_connect_signals = copy.deepcopy(self.main_builder.connect_signals)

        def patched_connect_signals(*a, **k):
            raise RuntimeError(
                "In order to connect signals to this GtkBuilder instance please use "
                "'component.get(\"MainWindow\").connect_signals()'"
            )

        self.main_builder.connect_signals = patched_connect_signals

        # Get the gtk builder file for the main window
        self.main_builder.add_from_file(
            deluge.common.resource_filename("deluge.ui.gtkui", os.path.join("glade", "main_window.ui"))
        )
        # The new release dialog
        self.main_builder.add_from_file(
            deluge.common.resource_filename("deluge.ui.gtkui", os.path.join("glade", "main_window.new_release.ui"))
        )
        # The move storage dialog
        self.main_builder.add_from_file(
            deluge.common.resource_filename("deluge.ui.gtkui", os.path.join("glade", "main_window.move_storage.ui"))
        )
        # The tabs
        self.main_builder.add_from_file(
            deluge.common.resource_filename("deluge.ui.gtkui", os.path.join("glade", "main_window.tabs.ui"))
        )
        # The tabs file menu
        self.main_builder.add_from_file(
            deluge.common.resource_filename("deluge.ui.gtkui", os.path.join("glade", "main_window.tabs.menu_file.ui"))
        )
        # The tabs peer menu
        self.main_builder.add_from_file(
            deluge.common.resource_filename("deluge.ui.gtkui", os.path.join("glade", "main_window.tabs.menu_peer.ui"))
        )

        self.window = self.main_builder.get_object("main_window")

        self.window.set_icon(common.get_deluge_icon())

        self.vpaned = self.main_builder.get_object("vpaned")
        self.initial_vpaned_position = self.config["window_pane_position"]

        # Load the window state
        self.load_window_state()

        # Keep track of window's minimization state so that we don't update the
        # UI when it is minimized.
        self.is_minimized = False

        self.window.drag_dest_set(gtk.DEST_DEFAULT_ALL, [("text/uri-list", 0, 80)], gtk.gdk.ACTION_COPY)

        # Connect events
        self.window.connect("window-state-event", self.on_window_state_event)
        self.window.connect("configure-event", self.on_window_configure_event)
        self.window.connect("delete-event", self.on_window_delete_event)
        self.window.connect("drag-data-received", self.on_drag_data_received_event)
        self.vpaned.connect("notify::position", self.on_vpaned_position_event)
        self.window.connect("expose-event", self.on_expose_event)

        self.config.register_set_function("show_rate_in_title", self._on_set_show_rate_in_title, apply_now=False)

        client.register_event_handler("NewVersionAvailableEvent", self.on_newversionavailable_event)
        client.register_event_handler("TorrentFinishedEvent", self.on_torrentfinished_event)
Ejemplo n.º 13
0
    def __init__(self):
        component.Component.__init__(self, "MainWindow", interval=2)
        self.config = ConfigManager("gtkui.conf")
        self.gtk_builder_signals_holder = _GtkBuilderSignalsHolder()
        self.main_builder = gtk.Builder()
        # Patch this GtkBuilder to avoid connecting signals from elsewhere
        #
        # Think about splitting up the main window gtkbuilder file into the necessary parts
        # in order not to have to monkey patch GtkBuilder. Those parts would then need to
        # be added to the main window "by hand".
        self.main_builder.prev_connect_signals = copy.deepcopy(
            self.main_builder.connect_signals)

        def patched_connect_signals(*a, **k):
            raise RuntimeError(
                "In order to connect signals to this GtkBuilder instance please use "
                "'component.get(\"MainWindow\").connect_signals()'")

        self.main_builder.connect_signals = patched_connect_signals

        # Get the gtk builder file for the main window
        self.main_builder.add_from_file(
            deluge.common.resource_filename(
                "deluge.ui.gtkui", os.path.join("glade", "main_window.ui")))
        # The new release dialog
        self.main_builder.add_from_file(
            deluge.common.resource_filename(
                "deluge.ui.gtkui",
                os.path.join("glade", "main_window.new_release.ui")))
        # The move storage dialog
        self.main_builder.add_from_file(
            deluge.common.resource_filename(
                "deluge.ui.gtkui",
                os.path.join("glade", "main_window.move_storage.ui")))
        # The tabs
        self.main_builder.add_from_file(
            deluge.common.resource_filename(
                "deluge.ui.gtkui", os.path.join("glade",
                                                "main_window.tabs.ui")))
        # The tabs file menu
        self.main_builder.add_from_file(
            deluge.common.resource_filename(
                "deluge.ui.gtkui",
                os.path.join("glade", "main_window.tabs.menu_file.ui")))
        # The tabs peer menu
        self.main_builder.add_from_file(
            deluge.common.resource_filename(
                "deluge.ui.gtkui",
                os.path.join("glade", "main_window.tabs.menu_peer.ui")))

        self.window = self.main_builder.get_object("main_window")

        self.window.set_icon(common.get_deluge_icon())

        self.vpaned = self.main_builder.get_object("vpaned")
        self.initial_vpaned_position = self.config["window_pane_position"]

        # Load the window state
        self.load_window_state()

        # Keep track of window's minimization state so that we don't update the
        # UI when it is minimized.
        self.is_minimized = False

        self.window.drag_dest_set(gtk.DEST_DEFAULT_ALL,
                                  [('text/uri-list', 0, 80)],
                                  gtk.gdk.ACTION_COPY)

        # Connect events
        self.window.connect("window-state-event", self.on_window_state_event)
        self.window.connect("configure-event", self.on_window_configure_event)
        self.window.connect("delete-event", self.on_window_delete_event)
        self.window.connect("drag-data-received",
                            self.on_drag_data_received_event)
        self.vpaned.connect("notify::position", self.on_vpaned_position_event)
        self.window.connect("expose-event", self.on_expose_event)

        self.config.register_set_function("show_rate_in_title",
                                          self._on_set_show_rate_in_title,
                                          apply_now=False)

        client.register_event_handler("NewVersionAvailableEvent",
                                      self.on_newversionavailable_event)
        client.register_event_handler("TorrentFinishedEvent",
                                      self.on_torrentfinished_event)
Ejemplo n.º 14
0
    def __init__(self):
        # Get the glade file for the about dialog
        def url_hook(dialog, url):
            deluge.common.open_url_in_browser(url)
        Gtk.about_dialog_set_url_hook(url_hook)
        self.about = Gtk.AboutDialog()
        self.about.set_position(Gtk.WindowPosition.CENTER)
        self.about.set_name("Deluge")
        self.about.set_program_name(_("Deluge"))

        version = deluge.common.get_version()

        self.about.set_copyright(
            _("Copyright %(year_start)s-%(year_end)s Deluge Team") % {"year_start": 2007, "year_end": 2015})
        self.about.set_comments(
            _("A peer-to-peer file sharing program\nutilizing the BitTorrent protocol.")
            + "\n\n" + _("Client:") + " %s\n" % version)
        self.about.set_version(version)
        self.about.set_authors([
            _("Current Developers:"), "Andrew Resch", "Damien Churchill",
            "John Garland", "Calum Lind", "", "libtorrent (libtorrent.org):",
            "Arvid Norberg", "", _("Past Developers or Contributors:"),
            "Zach Tibbitts", "Alon Zakai", "Marcos Mobley", "Alex Dedul",
            "Sadrul Habib Chowdhury", "Ido Abramovich", "Martijn Voncken"
        ])
        self.about.set_artists(["Andrew Wedderburn", "Andrew Resch"])
        self.about.set_translator_credits("\n".join([
            "Aaron Wang Shi", "abbigss", "ABCdatos", "Abcx", "Actam", "Adam",
            "adaminikisi", "adi_oporanu", "Adrian Goll", "afby", "Ahmades",
            "Ahmad Farghal", "Ahmad Gharbeia أحمد غربية", "akira", "Aki Sivula",
            "Alan Pepelko", "Alberto", "Alberto Ferrer", "alcatr4z", "AlckO",
            "Aleksej Korgenkov", "Alessio Treglia", "Alexander Ilyashov",
            "Alexander Matveev", "Alexander Saltykov", "Alexander Taubenkorb",
            "Alexander Telenga", "Alexander Yurtsev", "Alexandre Martani",
            "Alexandre Rosenfeld", "Alexandre Sapata Carbonell",
            "Alexey Osipov", "Alin Claudiu Radut", "allah", "AlSim",
            "Alvaro Carrillanca P.", "A.Matveev", "Andras Hipsag",
            "András Kárász", "Andrea Ratto", "Andreas Johansson", "Andreas Str",
            "André F. Oliveira", "AndreiF", "andrewh", "Angel Guzman Maeso",
            "Aníbal Deboni Neto", "animarval", "Antonio Cono", "antoniojreyes",
            "Anton Shestakov", "Anton Yakutovich", "antou",
            "Arkadiusz Kalinowski", "Artin", "artir", "Astur",
            "Athanasios Lefteris", "Athmane MOKRAOUI (ButterflyOfFire)",
            "Augusta Carla Klug", "Avoledo Marco", "axaard", "AxelRafn",
            "Axezium", "Ayont", "b3rx", "Bae Taegil", "Bajusz Tamás",
            "Balaam's Miracle", "Ballestein", "Bent Ole Fosse", "berto89",
            "bigx", "Bjorn Inge Berg", "blackbird", "Blackeyed", "blackmx",
            "BlueSky", "Blutheo", "bmhm", "bob00work", "boenki",
            "Bogdan Bădic-Spătariu", "bonpu", "Boone", "boss01",
            "Branislav Jovanović", "bronze", "brownie", "Brus46", "bumper",
            "butely", "BXCracer", "c0nfidencal", "Can Kaya",
            "Carlos Alexandro Becker", "cassianoleal", "Cédric.h",
            "César Rubén", "chaoswizard", "Chen Tao", "chicha",
            "Chien Cheng Wei", "Christian Kopac", "Christian Widell",
            "Christoffer Brodd-Reijer", "christooss", "CityAceE", "Clopy",
            "Clusty", "cnu", "Commandant", "Constantinos Koniaris", "Coolmax",
            "cosmix", "Costin Chirvasuta", "CoVaLiDiTy", "cow_2001",
            "Crispin Kirchner", "crom", "Cruster", "Cybolic", "Dan Bishop",
            "Danek", "Dani", "Daniel Demarco", "Daniel Ferreira",
            "Daniel Frank", "Daniel Holm", "Daniel Høyer Iversen",
            "Daniel Marynicz", "Daniel Nylander", "Daniel Patriche",
            "Daniel Schildt", "Daniil Sorokin", "Dante Díaz", "Daria Michalska",
            "DarkenCZ", "Darren", "Daspah", "David Eurenius", "davidhjelm",
            "David Machakhelidze", "Dawid Dziurdzia", "Daya Adianto ", "dcruz",
            "Deady", "Dereck Wonnacott", "Devgru", "Devid Antonio Filoni"
            "DevilDogTG", "di0rz`", "Dialecti Valsamou", "Diego Medeiros",
            "Dkzoffy", "Dmitrij D. Czarkoff", "Dmitriy Geels",
            "Dmitry Olyenyov", "Dominik Kozaczko", "Dominik Lübben", "doomster",
            "Dorota Król", "Doyen Philippe", "Dread Knight", "DreamSonic",
            "duan", "Duong Thanh An", "DvoglavaZver", "dwori", "dylansmrjones",
            "Ebuntor", "Edgar Alejandro Jarquin Flores", "Eetu", "ekerazha",
            "Elias Julkunen", "elparia", "Emberke", "Emiliano Goday Caneda",
            "EndelWar", "eng.essam", "enubuntu", "ercangun", "Erdal Ronahi",
            "ergin üresin", "Eric", "Éric Lassauge", "Erlend Finvåg", "Errdil",
            "ethan shalev", "Evgeni Spasov", "ezekielnin", "Fabian Ordelmans",
            "Fabio Mazanatti", "Fábio Nogueira", "FaCuZ", "Felipe Lerena",
            "Fernando Pereira", "fjetland", "Florian Schäfer", "FoBoS", "Folke",
            "Force", "fosk", "fragarray", "freddeg", "Frédéric Perrin",
            "Fredrik Kilegran", "FreeAtMind", "Fulvio Ciucci", "Gabor Kelemen",
            "Galatsanos Panagiotis", "Gaussian", "gdevitis", "Georg Brzyk",
            "George Dumitrescu", "Georgi Arabadjiev", "Georg Sieber",
            "Gerd Radecke", "Germán Heusdens", "Gianni Vialetto",
            "Gigih Aji Ibrahim", "Giorgio Wicklein", "Giovanni Rapagnani",
            "Giuseppe", "gl", "glen", "granjerox", "Green Fish", "greentea",
            "Greyhound", "G. U.", "Guillaume BENOIT", "Guillaume Pelletier",
            "Gustavo Henrique Klug", "gutocarvalho", "Guybrush88",
            "Hans Rødtang", "HardDisk", "Hargas Gábor",
            "Heitor Thury Barreiros Barbosa", "helios91940", "helix84",
            "Helton Rodrigues", "Hendrik Luup", "Henrique Ferreiro",
            "Henry Goury-Laffont", "Hezy Amiel", "hidro", "hoball", "hokten",
            "Holmsss", "hristo.num", "Hubert Życiński", "Hyo", "Iarwain", "ibe",
            "ibear", "Id2ndR", "Igor Zubarev", "IKON (Ion)", "imen",
            "Ionuț Jula", "Isabelle STEVANT", "István Nyitrai", "Ivan Petrovic",
            "Ivan Prignano", "IvaSerge", "jackmc", "Jacks0nxD", "Jack Shen",
            "Jacky Yeung","Jacques Stadler", "Janek Thomaschewski", "Jan Kaláb",
            "Jan Niklas Hasse", "Jasper Groenewegen", "Javi Rodríguez",
            "Jayasimha (ಜಯಸಿಂಹ)", "jeannich", "Jeff Bailes", "Jesse Zilstorff",
            "Joan Duran", "João Santos", "Joar Bagge", "Joe Anderson",
            "Joel Calado", "Johan Linde", "John Garland", "Jojan", "jollyr0ger",
            "Jonas Bo Grimsgaard", "Jonas Granqvist", "Jonas Slivka",
            "Jonathan Zeppettini", "Jørgen", "Jørgen Tellnes", "josé",
            "José Geraldo Gouvêa", "José Iván León Islas", "José Lou C.",
            "Jose Sun", "Jr.", "Jukka Kauppinen", "Julián Alarcón",
            "julietgolf", "Jusic", "Justzupi", "Kaarel", "Kai Thomsen",
            "Kalman Tarnay", "Kamil Páral", "Kane_F", "*****@*****.**",
            "Kateikyoushii", "kaxhinaz", "Kazuhiro NISHIYAMA", "Kerberos",
            "Keresztes Ákos", "kevintyk", "kiersie", "Kimbo^", "Kim Lübbe",
            "kitzOgen", "Kjetil Rydland", "kluon", "kmikz", "Knedlyk",
            "koleoptero", "Kőrösi Krisztián", "Kouta", "Krakatos",
            "Krešo Kunjas", "kripken", "Kristaps", "Kristian Øllegaard",
            "Kristoffer Egil Bonarjee", "Krzysztof Janowski",
            "Krzysztof Zawada", "Larry Wei Liu", "laughterwym", "Laur Mõtus",
            "lazka", "leandrud", "lê bình", "Le Coz Florent", "Leo", "liorda",
            "LKRaider", "LoLo_SaG", "Long Tran", "Lorenz", "Low Kian Seong",
            "Luca Andrea Rossi", "Luca Ferretti", "Lucky LIX", "Luis Gomes",
            "Luis Reis", "Łukasz Wyszyński", "luojie-dune", "maaark",
            "Maciej Chojnacki", "Maciej Meller", "Mads Peter Rommedahl",
            "Major Kong", "Malaki", "malde", "Malte Lenz", "Mantas Kriaučiūnas",
            "Mara Sorella", "Marcin", "Marcin Falkiewicz", "marcobra",
            "Marco da Silva", "Marco de Moulin", "Marco Rodrigues", "Marcos",
            "Marcos Escalier", "Marcos Mobley", "Marcus Ekstrom",
            "Marek Dębowski", "Mário Buči", "Mario Munda", "Marius Andersen",
            "Marius Hudea", "Marius Mihai", "Mariusz Cielecki",
            "Mark Krapivner", "marko-markovic", "Markus Brummer",
            "Markus Sutter", "Martin", "Martin Dybdal", "Martin Iglesias",
            "Martin Lettner", "Martin Pihl", "Masoud Kalali", "mat02",
            "Matej Urbančič", "Mathias-K", "Mathieu Arès",
            "Mathieu D. (MatToufoutu)", "Mathijs", "Matrik", "Matteo Renzulli",
            "Matteo Settenvini", "Matthew Gadd", "Matthias Benkard",
            "Matthias Mailänder", "Mattias Ohlsson", "Mauro de Carvalho",
            "Max Molchanov", "Me", "MercuryCC", "Mert Bozkurt", "Mert Dirik",
            "MFX", "mhietar", "mibtha", "Michael Budde", "Michael Kaliszka",
            "Michalis Makaronides", "Michał Tokarczyk", "Miguel Pires da Rosa",
            "Mihai Capotă", "Miika Metsälä", "Mikael Fernblad", "Mike Sierra",
            "mikhalek", "Milan Prvulović", "Milo Casagrande", "Mindaugas",
            "Miroslav Matejaš", "misel", "mithras", "Mitja Pagon", "M.Kitchen",
            "Mohamed Magdy", "moonkey", "MrBlonde", "muczy", "Münir Ekinci",
            "Mustafa Temizel", "mvoncken", "Mytonn", "NagyMarton", "neaion",
            "Neil Lin", "Nemo", "Nerijus Arlauskas", "Nicklas Larsson",
            "Nicolaj Wyke", "Nicola Piovesan", "Nicolas Sabatier",
            "Nicolas Velin", "Nightfall", "NiKoB", "Nikolai M. Riabov",
            "Niko_Thien", "niska", "Nithir", "noisemonkey", "nomemohes",
            "nosense", "null", "Nuno Estêvão", "Nuno Santos", "nxxs", "nyo",
            "obo", "Ojan", "Olav Andreas Lindekleiv", "oldbeggar",
            "Olivier FAURAX", "orphe", "osantana", "Osman Tosun", "OssiR",
            "otypoks", "ounn", "Oz123", "Özgür BASKIN", "Pablo Carmona A.",
            "Pablo Ledesma", "Pablo Navarro Castillo", "Paco Molinero",
            "Pål-Eivind Johnsen", "pano", "Paolo Naldini", "Paracelsus",
            "Patryk13_03", "Patryk Skorupa", "PattogoTehen", "Paul Lange",
            "Pavcio", "Paweł Wysocki", "Pedro Brites Moita",
            "Pedro Clemente Pereira Neto", "Pekka \"PEXI\" Niemistö", "Penegal",
            "Penzo", "perdido", "Peter Kotrcka", "Peter Skov",
            "Peter Van den Bosch", "Petter Eklund", "Petter Viklund",
            "phatsphere", "Phenomen", "Philipi", "Philippides Homer", "phoenix",
            "pidi", "Pierre Quillery", "Pierre Rudloff", "Pierre Slamich",
            "Pietrao", "Piotr Strębski", "Piotr Wicijowski", "Pittmann Tamás",
            "Playmolas", "Prescott", "Prescott_SK", "pronull",
            "Przemysław Kulczycki", "Pumy", "pushpika", "PY", "qubicllj",
            "r21vo", "Rafał Barański", "rainofchaos", "Rajbir", "ras0ir", "Rat",
            "rd1381", "Renato", "Rene Hennig", "Rene Pärts", "Ricardo Duarte",
            "Richard", "Robert Hrovat", "Roberth Sjonøy", "Robert Lundmark",
            "Robin Jakobsson", "Robin Kåveland", "Rodrigo Donado",
            "Roel Groeneveld", "rohmaru", "Rolf Christensen", "Rolf Leggewie",
            "Roni Kantis", "Ronmi", "Rostislav Raykov", "royto", "RuiAmaro",
            "Rui Araújo", "Rui Moura", "Rune Svendsen", "Rusna", "Rytis",
            "Sabirov Mikhail", "salseeg", "Sami Koskinen", "Samir van de Sand",
            "Samuel Arroyo Acuña", "Samuel R. C. Vale", "Sanel", "Santi",
            "Santi Martínez Cantelli", "Sardan", "Sargate Kanogan",
            "Sarmad Jari", "Saša Bodiroža", "sat0shi", "Saulius Pranckevičius",
            "Savvas Radevic", "Sebastian Krauß", "Sebastián Porta", "Sedir",
            "Sefa Denizoğlu", "sekolands", "Selim Suerkan", "semsomi",
            "Sergii Golovatiuk", "setarcos", "Sheki", "Shironeko", "Shlomil",
            "silfiriel", "Simone Tolotti", "Simone Vendemia", "sirkubador",
            "Sławomir Więch", "slip", "slyon", "smoke", "Sonja", "spectral",
            "spin_555", "spitf1r3", "Spiziuz", "Spyros Theodoritsis", "SqUe",
            "Squigly", "srtck", "Stefan Horning", "Stefano Maggiolo",
            "Stefano Roberto Soleti", "steinberger", "Stéphane Travostino",
            "Stephan Klein", "Steven De Winter", "Stevie", "Stian24", "stylius",
            "Sukarn Maini", "Sunjae Park", "Susana Pereira", "szymon siglowy",
            "takercena", "TAS", "Taygeto", "temy4", "texxxxxx", "thamood",
            "Thanos Chatziathanassiou", "Tharawut Paripaiboon", "Theodoor",
            "Théophane Anestis", "Thor Marius K. Høgås", "Tiago Silva",
            "Tiago Sousa", "Tikkel", "tim__b", "Tim Bordemann", "Tim Fuchs",
            "Tim Kornhammar", "Timo", "Timo Jyrinki", "Timothy Babych",
            "TitkosRejtozo", "Tom", "Tomas Gustavsson", "Tomas Valentukevičius",
            "Tomasz Dominikowski", "Tomislav Plavčić", "Tom Mannerhagen",
            "Tommy Mikkelsen", "Tom Verdaat", "Tony Manco",
            "Tor Erling H. Opsahl", "Toudi", "tqm_z", "Trapanator", "Tribaal",
            "Triton", "TuniX12", "Tuomo Sipola", "turbojugend_gr", "Turtle.net",
            "twilight", "tymmej", "Ulrik", "Umarzuki Mochlis", "unikob",
            "Vadim Gusev", "Vagi", "Valentin Bora", "Valmantas Palikša",
            "VASKITTU", "Vassilis Skoullis", "vetal17", "vicedo", "viki",
            "villads hamann", "Vincent Garibal", "Vincent Ortalda", "vinchi007",
            "Vinícius de Figueiredo Silva", "Vinzenz Vietzke", "virtoo",
            "virtual_spirit", "Vitor Caike", "Vitor Lamas Gatti",
            "Vladimir Lazic", "Vladimir Sharshov", "Wanderlust", "Wander Nauta",
            "Ward De Ridder", "WebCrusader", "webdr", "Wentao Tang", "wilana",
            "Wilfredo Ernesto Guerrero Campos", "Wim Champagne", "World Sucks",
            "Xabi Ezpeleta", "Xavi de Moner", "XavierToo", "XChesser",
            "Xiaodong Xu", "xyb", "Yaron", "Yasen Pramatarov", "YesPoX",
            "Yuren Ju", "Yves MATHIEU", "zekopeko", "zhuqin", "Zissan",
            "Γιάννης Κατσαμπίρης", "Артём Попов", "Миша", "Шаймарданов Максим",
            "蔡查理"
        ]))
        self.about.set_wrap_license(True)
        self.about.set_license(_(
            "This program is free software; you can redistribute it and/or "
            "modify it under the terms of the GNU General Public License as "
            "published by the Free Software Foundation; either version 3 of "
            "the License, or (at your option) any later version. \n\n"
            "This program "
            "is distributed in the hope that it will be useful, but WITHOUT "
            "ANY WARRANTY; without even the implied warranty of "
            "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "
            "General Public License for more details. \n\n"
            "You should have received "
            "a copy of the GNU General Public License along with this program; "
            "if not, see <http://www.gnu.org/licenses>. \n\n"
            "In addition, as a "
            "special exception, the copyright holders give permission to link "
            "the code of portions of this program with the OpenSSL library. "
            "You must obey the GNU General Public License in all respects for "
            "all of the code used other than OpenSSL. \n\n"
            "If you modify file(s) "
            "with this exception, you may extend this exception to your "
            "version of the file(s), but you are not obligated to do so. If "
            "you do not wish to do so, delete this exception statement from "
            "your version. If you delete this exception statement from all "
            "source files in the program, then also delete it here."
        ))
        self.about.set_website("http://deluge-torrent.org")
        self.about.set_website_label("deluge-torrent.org")

        self.about.set_icon(common.get_deluge_icon())
        self.about.set_logo(GdkPixbuf.Pixbuf.new_from_file(
            deluge.common.get_pixmap("deluge-about.png")
        ))

        if client.connected():
            if not client.is_classicmode():
                self.about.set_comments(
                    self.about.get_comments() + _("Server:") + " %coreversion%\n")

            self.about.set_comments(
                self.about.get_comments() + "\n" + _("libtorrent:")  + " %ltversion%\n")

            def on_lt_version(result):
                c = self.about.get_comments()
                c = c.replace("%ltversion%", result)
                self.about.set_comments(c)

            def on_info(result):
                c = self.about.get_comments()
                c = c.replace("%coreversion%", result)
                self.about.set_comments(c)
                client.core.get_libtorrent_version().addCallback(on_lt_version)

            if not client.is_classicmode():
                client.daemon.info().addCallback(on_info)
            else:
                client.core.get_libtorrent_version().addCallback(on_lt_version)
Ejemplo n.º 15
0
    def __init__(self):
        component.Component.__init__(self, "Preferences")
        self.glade = Gtk.Builder()
        self.glade.add_from_file(
            pkg_resources.resource_filename("deluge.ui.gtkui",
                                            "builder/preferences_dialog.ui"))
        self.pref_dialog = self.glade.get_object("pref_dialog")
        self.pref_dialog.set_transient_for(component.get("MainWindow").window)
        self.pref_dialog.set_icon(common.get_deluge_icon())
        self.treeview = self.glade.get_object("treeview")
        self.notebook = self.glade.get_object("notebook")
        self.gtkui_config = ConfigManager("gtkui.conf")

        self.load_pref_dialog_state()

        self.glade.get_object("image_magnet").set_from_file(
            deluge.common.get_pixmap("magnet.png"))

        # Hide the unused associate magnet button on OSX see: #2420
        if deluge.common.osx_check():
            self.glade.get_object("button_associate_magnet").hide()

        # Setup the liststore for the categories (tab pages)
        self.liststore = Gtk.ListStore(int, str)
        self.treeview.set_model(self.liststore)
        render = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn(_("Categories"), render, text=1)
        self.treeview.append_column(column)
        # Add the default categories
        i = 0
        for category in [
                _("Downloads"),
                _("Network"),
                _("Bandwidth"),
                _("Interface"),
                _("Other"),
                _("Daemon"),
                _("Queue"),
                _("Proxy"),
                _("Cache"),
                _("Plugins")
        ]:
            self.liststore.append([i, category])
            i += 1

        # Setup plugin tab listview
        # The third entry is for holding translated plugin names
        self.plugin_liststore = Gtk.ListStore(str, bool, str)
        self.plugin_liststore.set_sort_column_id(0, Gtk.SortType.ASCENDING)
        self.plugin_listview = self.glade.get_object("plugin_listview")
        self.plugin_listview.set_model(self.plugin_liststore)
        render = Gtk.CellRendererToggle()
        render.connect("toggled", self.on_plugin_toggled)
        render.set_property("activatable", True)
        self.plugin_listview.append_column(
            Gtk.TreeViewColumn(_("Enabled"), render, active=1))
        self.plugin_listview.append_column(
            Gtk.TreeViewColumn(_("Plugin"), Gtk.CellRendererText(), text=2))

        # Connect to the 'changed' event of TreeViewSelection to get selection
        # changes.
        self.treeview.get_selection().connect("changed",
                                              self.on_selection_changed)

        self.plugin_listview.get_selection().connect(
            "changed", self.on_plugin_selection_changed)

        self.glade.connect_signals({
            "on_pref_dialog_delete_event":
            self.on_pref_dialog_delete_event,
            "on_button_ok_clicked":
            self.on_button_ok_clicked,
            "on_button_apply_clicked":
            self.on_button_apply_clicked,
            "on_button_cancel_clicked":
            self.on_button_cancel_clicked,
            "on_toggle":
            self.on_toggle,
            "on_test_port_clicked":
            self.on_test_port_clicked,
            "on_button_plugin_install_clicked":
            self._on_button_plugin_install_clicked,
            "on_button_rescan_plugins_clicked":
            self._on_button_rescan_plugins_clicked,
            "on_button_find_plugins_clicked":
            self._on_button_find_plugins_clicked,
            "on_button_cache_refresh_clicked":
            self._on_button_cache_refresh_clicked,
            "on_combo_proxy_type_changed":
            self._on_combo_proxy_type_changed,
            "on_button_associate_magnet_clicked":
            self._on_button_associate_magnet_clicked,
            "on_pref_dialog_configure_event":
            self.on_pref_dialog_configure_event,
        })

        # These get updated by requests done to the core
        self.all_plugins = []
        self.enabled_plugins = []
Ejemplo n.º 16
0
    def show(self):
        """
        Show the ConnectionManager dialog.
        """
        self.config = self.__load_config()
        # Get the gtk builder file for the connection manager
        self.builder = gtk.Builder()
        # The main dialog
        self.builder.add_from_file(deluge.common.resource_filename(
            "deluge.ui.gtkui", os.path.join("glade", "connection_manager.ui")
        ))
        # The add host dialog
        self.builder.add_from_file(deluge.common.resource_filename(
            "deluge.ui.gtkui", os.path.join("glade", "connection_manager.addhost.ui")
        ))
        # The ask password dialog
        self.builder.add_from_file(deluge.common.resource_filename(
            "deluge.ui.gtkui", os.path.join("glade", "connection_manager.askpassword.ui")
        ))
        self.window = component.get("MainWindow")

        # Setup the ConnectionManager dialog
        self.connection_manager = self.builder.get_object("connection_manager")
        self.connection_manager.set_transient_for(self.window.window)

        self.connection_manager.set_icon(common.get_deluge_icon())

        self.builder.get_object("image1").set_from_pixbuf(common.get_logo(32))

        self.askpassword_dialog = self.builder.get_object("askpassword_dialog")
        self.askpassword_dialog.set_transient_for(self.connection_manager)
        self.askpassword_dialog.set_icon(common.get_deluge_icon())
        self.askpassword_dialog_entry = self.builder.get_object("askpassword_dialog_entry")

        self.hostlist = self.builder.get_object("hostlist")

        # Create status pixbufs
        if not HOSTLIST_PIXBUFS:
            for stock_id in (gtk.STOCK_NO, gtk.STOCK_YES, gtk.STOCK_CONNECT):
                HOSTLIST_PIXBUFS.append(
                    self.connection_manager.render_icon(
                        stock_id, gtk.ICON_SIZE_MENU
                    )
                )

        # Create the host list gtkliststore
        # id-hash, hostname, port, status, username, password, version
        self.liststore = gtk.ListStore(str, str, int, str, str, str, str)

        # Setup host list treeview
        self.hostlist.set_model(self.liststore)
        render = gtk.CellRendererPixbuf()
        column = gtk.TreeViewColumn(_("Status"), render)
        column.set_cell_data_func(render, cell_render_status, 3)
        self.hostlist.append_column(column)
        render = gtk.CellRendererText()
        column = gtk.TreeViewColumn(_("Host"), render, text=HOSTLIST_COL_HOST)
        column.set_cell_data_func(render, cell_render_host, (1, 2, 4))
        column.set_expand(True)
        self.hostlist.append_column(column)
        render = gtk.CellRendererText()
        column = gtk.TreeViewColumn(_("Version"), render, text=HOSTLIST_COL_VERSION)
        self.hostlist.append_column(column)

        # Connect the signals to the handlers
        self.builder.connect_signals(self)
        self.hostlist.get_selection().connect(
            "changed", self.on_hostlist_selection_changed
        )

        # Load any saved host entries
        self.__load_hostlist()
        self.__load_options()
        self.__update_list()

        self.running = True
        # Trigger the on_selection_changed code and select the first host
        # if possible
        self.hostlist.get_selection().unselect_all()
        if len(self.liststore) > 0:
            self.hostlist.get_selection().select_path("0")

        # Run the dialog
        response = self.connection_manager.run()
        self.running = False

        # Save the toggle options
        self.__save_options()
        self.__save_hostlist()

        self.connection_manager.destroy()
        del self.builder
        del self.window
        del self.connection_manager
        del self.liststore
        del self.hostlist
Ejemplo n.º 17
0
    def __init__(self):
        # Get the glade file for the about dialog
        def url_hook(dialog, url):
            deluge.common.open_url_in_browser(url)

        gtk.about_dialog_set_url_hook(url_hook)
        self.about = gtk.AboutDialog()
        self.about.set_position(gtk.WIN_POS_CENTER)
        self.about.set_name("Deluge")
        self.about.set_program_name(_("Deluge"))

        version = deluge.common.get_version()

        self.about.set_copyright(_('Copyright 2007-2011 Deluge Team'))
        self.about.set_comments(
            _("A peer-to-peer file sharing program\nutilizing the BitTorrent protocol."
              ) + "\n\n" + _("Client:") + " %s\n" % version)
        self.about.set_version(version)
        self.about.set_authors([
            _("Current Developers:"), "Andrew Resch", "Damien Churchill",
            "John Garland", "Calum Lind", "", "libtorrent (libtorrent.org):",
            "Arvid Norberg", "",
            _("Past Developers or Contributors:"), "Zach Tibbitts",
            "Alon Zakai", "Marcos Pinto", "Alex Dedul",
            "Sadrul Habib Chowdhury", "Ido Abramovich", "Martijn Voncken"
        ])
        self.about.set_artists(["Andrew Wedderburn", "Andrew Resch"])
        self.about.set_translator_credits("\n".join([
            "Aaron Wang Shi", "abbigss", "ABCdatos", "Abcx", "Actam", "Adam",
            "adaminikisi", "adi_oporanu", "Adrian Goll", "afby", "Ahmades",
            "Ahmad Farghal", "Ahmad Gharbeia أحمد غربية", "akira",
            "Aki Sivula", "Alan Pepelko", "Alberto", "Alberto Ferrer",
            "alcatr4z", "AlckO", "Aleksej Korgenkov", "Alessio Treglia",
            "Alexander Ilyashov", "Alexander Matveev", "Alexander Saltykov",
            "Alexander Taubenkorb", "Alexander Telenga", "Alexander Yurtsev",
            "Alexandre Martani", "Alexandre Rosenfeld",
            "Alexandre Sapata Carbonell", "Alexey Osipov",
            "Alin Claudiu Radut", "allah", "AlSim", "Alvaro Carrillanca P.",
            "A.Matveev", "Andras Hipsag", "András Kárász", "Andrea Ratto",
            "Andreas Johansson", "Andreas Str", "André F. Oliveira", "AndreiF",
            "andrewh", "Angel Guzman Maeso", "Aníbal Deboni Neto", "animarval",
            "Antonio Cono", "antoniojreyes", "Anton Shestakov",
            "Anton Yakutovich", "antou", "Arkadiusz Kalinowski", "Artin",
            "artir", "Astur", "Athanasios Lefteris",
            "Athmane MOKRAOUI (ButterflyOfFire)", "Augusta Carla Klug",
            "Avoledo Marco", "axaard", "AxelRafn", "Axezium", "Ayont", "b3rx",
            "Bae Taegil", "Bajusz Tamás", "Balaam's Miracle", "Ballestein",
            "Bent Ole Fosse", "berto89", "bigx", "Bjorn Inge Berg",
            "blackbird", "Blackeyed", "blackmx", "BlueSky", "Blutheo", "bmhm",
            "bob00work", "boenki", "Bogdan Bădic-Spătariu", "bonpu", "Boone",
            "boss01", "Branislav Jovanović", "bronze", "brownie", "Brus46",
            "bumper", "butely", "BXCracer", "c0nfidencal", "Can Kaya",
            "Carlos Alexandro Becker", "cassianoleal", "Cédric.h",
            "César Rubén", "chaoswizard", "Chen Tao", "chicha",
            "Chien Cheng Wei", "Christian Kopac", "Christian Widell",
            "Christoffer Brodd-Reijer", "christooss", "CityAceE", "Clopy",
            "Clusty", "cnu", "Commandant", "Constantinos Koniaris", "Coolmax",
            "cosmix", "Costin Chirvasuta", "CoVaLiDiTy", "cow_2001",
            "Crispin Kirchner", "crom", "Cruster", "Cybolic", "Dan Bishop",
            "Danek", "Dani", "Daniel Demarco", "Daniel Ferreira",
            "Daniel Frank", "Daniel Holm", "Daniel Høyer Iversen",
            "Daniel Marynicz", "Daniel Nylander", "Daniel Patriche",
            "Daniel Schildt", "Daniil Sorokin", "Dante Díaz",
            "Daria Michalska", "DarkenCZ", "Darren", "Daspah",
            "David Eurenius", "davidhjelm", "David Machakhelidze",
            "Dawid Dziurdzia", "Daya Adianto ", "dcruz", "Deady",
            "Dereck Wonnacott", "Devgru", "Devid Antonio Filoni"
            "DevilDogTG", "di0rz`", "Dialecti Valsamou", "Diego Medeiros",
            "Dkzoffy", "Dmitrij D. Czarkoff", "Dmitriy Geels",
            "Dmitry Olyenyov", "Dominik Kozaczko", "Dominik Lübben",
            "doomster", "Dorota Król", "Doyen Philippe", "Dread Knight",
            "DreamSonic", "duan", "Duong Thanh An", "DvoglavaZver", "dwori",
            "dylansmrjones", "Ebuntor", "Edgar Alejandro Jarquin Flores",
            "Eetu", "ekerazha", "Elias Julkunen", "elparia", "Emberke",
            "Emiliano Goday Caneda", "EndelWar", "eng.essam", "enubuntu",
            "ercangun", "Erdal Ronahi", "ergin üresin", "Eric",
            "Éric Lassauge", "Erlend Finvåg", "Errdil", "ethan shalev",
            "Evgeni Spasov", "ezekielnin", "Fabian Ordelmans",
            "Fabio Mazanatti", "Fábio Nogueira", "FaCuZ", "Felipe Lerena",
            "Fernando Pereira", "fjetland", "Florian Schäfer", "FoBoS",
            "Folke", "Force", "fosk", "fragarray", "freddeg",
            "Frédéric Perrin", "Fredrik Kilegran", "FreeAtMind",
            "Fulvio Ciucci", "Gabor Kelemen", "Galatsanos Panagiotis",
            "Gaussian", "gdevitis", "Georg Brzyk", "George Dumitrescu",
            "Georgi Arabadjiev", "Georg Sieber", "Gerd Radecke",
            "Germán Heusdens", "Gianni Vialetto", "Gigih Aji Ibrahim",
            "Giorgio Wicklein", "Giovanni Rapagnani", "Giuseppe", "gl", "glen",
            "granjerox", "Green Fish", "greentea", "Greyhound", "G. U.",
            "Guillaume BENOIT", "Guillaume Pelletier", "Gustavo Henrique Klug",
            "gutocarvalho", "Guybrush88", "Hans Rødtang", "HardDisk",
            "Hargas Gábor", "Heitor Thury Barreiros Barbosa", "helios91940",
            "helix84", "Helton Rodrigues", "Hendrik Luup", "Henrique Ferreiro",
            "Henry Goury-Laffont", "Hezy Amiel", "hidro", "hoball", "hokten",
            "Holmsss", "hristo.num", "Hubert Życiński", "Hyo", "Iarwain",
            "ibe", "ibear", "Id2ndR", "Igor Zubarev", "IKON (Ion)", "imen",
            "Ionuț Jula", "Isabelle STEVANT", "István Nyitrai",
            "Ivan Petrovic", "Ivan Prignano", "IvaSerge", "jackmc",
            "Jacks0nxD", "Jack Shen", "Jacky Yeung", "Jacques Stadler",
            "Janek Thomaschewski", "Jan Kaláb", "Jan Niklas Hasse",
            "Jasper Groenewegen", "Javi Rodríguez", "Jayasimha (ಜಯಸಿಂಹ)",
            "jeannich", "Jeff Bailes", "Jesse Zilstorff", "Joan Duran",
            "João Santos", "Joar Bagge", "Joe Anderson", "Joel Calado",
            "Johan Linde", "John Garland", "Jojan", "jollyr0ger",
            "Jonas Bo Grimsgaard", "Jonas Granqvist", "Jonas Slivka",
            "Jonathan Zeppettini", "Jørgen", "Jørgen Tellnes", "josé",
            "José Geraldo Gouvêa", "José Iván León Islas", "José Lou C.",
            "Jose Sun", "Jr.", "Jukka Kauppinen", "Julián Alarcón",
            "julietgolf", "Jusic", "Justzupi", "Kaarel", "Kai Thomsen",
            "Kalman Tarnay", "Kamil Páral", "Kane_F", "*****@*****.**",
            "Kateikyoushii", "kaxhinaz", "Kazuhiro NISHIYAMA", "Kerberos",
            "Keresztes Ákos", "kevintyk", "kiersie", "Kimbo^", "Kim Lübbe",
            "kitzOgen", "Kjetil Rydland", "kluon", "kmikz", "Knedlyk",
            "koleoptero", "Kőrösi Krisztián", "Kouta", "Krakatos",
            "Krešo Kunjas", "kripken", "Kristaps", "Kristian Øllegaard",
            "Kristoffer Egil Bonarjee", "Krzysztof Janowski",
            "Krzysztof Zawada", "Larry Wei Liu", "laughterwym", "Laur Mõtus",
            "lazka", "leandrud", "lê bình", "Le Coz Florent", "Leo", "liorda",
            "LKRaider", "LoLo_SaG", "Long Tran", "Lorenz", "Low Kian Seong",
            "Luca Andrea Rossi", "Luca Ferretti", "Lucky LIX", "Luis Gomes",
            "Luis Reis", "Łukasz Wyszyński", "luojie-dune", "maaark",
            "Maciej Chojnacki", "Maciej Meller", "Mads Peter Rommedahl",
            "Major Kong", "Malaki", "malde", "Malte Lenz",
            "Mantas Kriaučiūnas", "Mara Sorella", "Marcin",
            "Marcin Falkiewicz", "marcobra", "Marco da Silva",
            "Marco de Moulin", "Marco Rodrigues", "Marcos", "Marcos Escalier",
            "Marcos Pinto", "Marcus Ekstrom", "Marek Dębowski", "Mário Buči",
            "Mario Munda", "Marius Andersen", "Marius Hudea", "Marius Mihai",
            "Mariusz Cielecki", "Mark Krapivner", "marko-markovic",
            "Markus Brummer", "Markus Sutter", "Martin", "Martin Dybdal",
            "Martin Iglesias", "Martin Lettner", "Martin Pihl",
            "Masoud Kalali", "mat02", "Matej Urbančič", "Mathias-K",
            "Mathieu Arès", "Mathieu D. (MatToufoutu)", "Mathijs", "Matrik",
            "Matteo Renzulli", "Matteo Settenvini", "Matthew Gadd",
            "Matthias Benkard", "Matthias Mailänder", "Mattias Ohlsson",
            "Mauro de Carvalho", "Max Molchanov", "Me", "MercuryCC",
            "Mert Bozkurt", "Mert Dirik", "MFX", "mhietar", "mibtha",
            "Michael Budde", "Michael Kaliszka", "Michalis Makaronides",
            "Michał Tokarczyk", "Miguel Pires da Rosa", "Mihai Capotă",
            "Miika Metsälä", "Mikael Fernblad", "Mike Sierra", "mikhalek",
            "Milan Prvulović", "Milo Casagrande", "Mindaugas",
            "Miroslav Matejaš", "misel", "mithras", "Mitja Pagon", "M.Kitchen",
            "Mohamed Magdy", "moonkey", "MrBlonde", "muczy", "Münir Ekinci",
            "Mustafa Temizel", "mvoncken", "Mytonn", "NagyMarton", "neaion",
            "Neil Lin", "Nemo", "Nerijus Arlauskas", "Nicklas Larsson",
            "Nicolaj Wyke", "Nicola Piovesan", "Nicolas Sabatier",
            "Nicolas Velin", "Nightfall", "NiKoB", "Nikolai M. Riabov",
            "Niko_Thien", "niska", "Nithir", "noisemonkey", "nomemohes",
            "nosense", "null", "Nuno Estêvão", "Nuno Santos", "nxxs", "nyo",
            "obo", "Ojan", "Olav Andreas Lindekleiv", "oldbeggar",
            "Olivier FAURAX", "orphe", "osantana", "Osman Tosun", "OssiR",
            "otypoks", "ounn", "Oz123", "Özgür BASKIN", "Pablo Carmona A.",
            "Pablo Ledesma", "Pablo Navarro Castillo", "Paco Molinero",
            "Pål-Eivind Johnsen", "pano", "Paolo Naldini", "Paracelsus",
            "Patryk13_03", "Patryk Skorupa", "PattogoTehen", "Paul Lange",
            "Pavcio", "Paweł Wysocki", "Pedro Brites Moita",
            "Pedro Clemente Pereira Neto", "Pekka \"PEXI\" Niemistö",
            "Penegal", "Penzo", "perdido", "Peter Kotrcka", "Peter Skov",
            "Peter Van den Bosch", "Petter Eklund", "Petter Viklund",
            "phatsphere", "Phenomen", "Philipi", "Philippides Homer",
            "phoenix", "pidi", "Pierre Quillery", "Pierre Rudloff",
            "Pierre Slamich", "Pietrao", "Piotr Strębski", "Piotr Wicijowski",
            "Pittmann Tamás", "Playmolas", "Prescott", "Prescott_SK",
            "pronull", "Przemysław Kulczycki", "Pumy", "pushpika", "PY",
            "qubicllj", "r21vo", "Rafał Barański", "rainofchaos", "Rajbir",
            "ras0ir", "Rat", "rd1381", "Renato", "Rene Hennig", "Rene Pärts",
            "Ricardo Duarte", "Richard", "Robert Hrovat", "Roberth Sjonøy",
            "Robert Lundmark", "Robin Jakobsson", "Robin Kåveland",
            "Rodrigo Donado", "Roel Groeneveld", "rohmaru", "Rolf Christensen",
            "Rolf Leggewie", "Roni Kantis", "Ronmi", "Rostislav Raykov",
            "royto", "RuiAmaro", "Rui Araújo", "Rui Moura", "Rune Svendsen",
            "Rusna", "Rytis", "Sabirov Mikhail", "salseeg", "Sami Koskinen",
            "Samir van de Sand", "Samuel Arroyo Acuña", "Samuel R. C. Vale",
            "Sanel", "Santi", "Santi Martínez Cantelli", "Sardan",
            "Sargate Kanogan", "Sarmad Jari", "Saša Bodiroža", "sat0shi",
            "Saulius Pranckevičius", "Savvas Radevic", "Sebastian Krauß",
            "Sebastián Porta", "Sedir", "Sefa Denizoğlu", "sekolands",
            "Selim Suerkan", "semsomi", "Sergii Golovatiuk", "setarcos",
            "Sheki", "Shironeko", "Shlomil", "silfiriel", "Simone Tolotti",
            "Simone Vendemia", "sirkubador", "Sławomir Więch", "slip", "slyon",
            "smoke", "Sonja", "spectral", "spin_555", "spitf1r3", "Spiziuz",
            "Spyros Theodoritsis", "SqUe", "Squigly", "srtck",
            "Stefan Horning", "Stefano Maggiolo", "Stefano Roberto Soleti",
            "steinberger", "Stéphane Travostino", "Stephan Klein",
            "Steven De Winter", "Stevie", "Stian24", "stylius", "Sukarn Maini",
            "Sunjae Park", "Susana Pereira", "szymon siglowy", "takercena",
            "TAS", "Taygeto", "temy4", "texxxxxx", "thamood",
            "Thanos Chatziathanassiou", "Tharawut Paripaiboon", "Theodoor",
            "Théophane Anestis", "Thor Marius K. Høgås", "Tiago Silva",
            "Tiago Sousa", "Tikkel", "tim__b", "Tim Bordemann", "Tim Fuchs",
            "Tim Kornhammar", "Timo", "Timo Jyrinki", "Timothy Babych",
            "TitkosRejtozo", "Tom", "Tomas Gustavsson",
            "Tomas Valentukevičius", "Tomasz Dominikowski", "Tomislav Plavčić",
            "Tom Mannerhagen", "Tommy Mikkelsen", "Tom Verdaat", "Tony Manco",
            "Tor Erling H. Opsahl", "Toudi", "tqm_z", "Trapanator", "Tribaal",
            "Triton", "TuniX12", "Tuomo Sipola", "turbojugend_gr",
            "Turtle.net", "twilight", "tymmej", "Ulrik", "Umarzuki Mochlis",
            "unikob", "Vadim Gusev", "Vagi", "Valentin Bora",
            "Valmantas Palikša", "VASKITTU", "Vassilis Skoullis", "vetal17",
            "vicedo", "viki", "villads hamann", "Vincent Garibal",
            "Vincent Ortalda", "vinchi007", "Vinícius de Figueiredo Silva",
            "Vinzenz Vietzke", "virtoo", "virtual_spirit", "Vitor Caike",
            "Vitor Lamas Gatti", "Vladimir Lazic", "Vladimir Sharshov",
            "Wanderlust", "Wander Nauta", "Ward De Ridder", "WebCrusader",
            "webdr", "Wentao Tang", "wilana",
            "Wilfredo Ernesto Guerrero Campos", "Wim Champagne", "World Sucks",
            "Xabi Ezpeleta", "Xavi de Moner", "XavierToo", "XChesser",
            "Xiaodong Xu", "xyb", "Yaron", "Yasen Pramatarov", "YesPoX",
            "Yuren Ju", "Yves MATHIEU", "zekopeko", "zhuqin", "Zissan",
            "Γιάννης Κατσαμπίρης", "Артём Попов", "Миша", "Шаймарданов Максим",
            "蔡查理"
        ]))
        self.about.set_wrap_license(True)
        self.about.set_license(
            _("This program is free software; you can redistribute it and/or "
              "modify it under the terms of the GNU General Public License as "
              "published by the Free Software Foundation; either version 3 of "
              "the License, or (at your option) any later version. \n\n"
              "This program "
              "is distributed in the hope that it will be useful, but WITHOUT "
              "ANY WARRANTY; without even the implied warranty of "
              "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "
              "General Public License for more details. \n\n"
              "You should have received "
              "a copy of the GNU General Public License along with this program; "
              "if not, see <http://www.gnu.org/licenses>. \n\n"
              "In addition, as a "
              "special exception, the copyright holders give permission to link "
              "the code of portions of this program with the OpenSSL library. "
              "You must obey the GNU General Public License in all respects for "
              "all of the code used other than OpenSSL. \n\n"
              "If you modify file(s) "
              "with this exception, you may extend this exception to your "
              "version of the file(s), but you are not obligated to do so. If "
              "you do not wish to do so, delete this exception statement from "
              "your version. If you delete this exception statement from all "
              "source files in the program, then also delete it here."))
        self.about.set_website("http://deluge-torrent.org")
        self.about.set_website_label("deluge-torrent.org")

        self.about.set_icon(common.get_deluge_icon())
        self.about.set_logo(
            gtk.gdk.pixbuf_new_from_file(
                deluge.common.get_pixmap("deluge-about.png")))

        if client.connected():
            if not client.is_classicmode():
                self.about.set_comments(self.about.get_comments() +
                                        _("Server:") + " %coreversion%\n")

            self.about.set_comments(self.about.get_comments() + "\n" +
                                    _("libtorrent:") + " %ltversion%\n")

            def on_lt_version(result):
                c = self.about.get_comments()
                c = c.replace("%ltversion%", result)
                self.about.set_comments(c)

            def on_info(result):
                c = self.about.get_comments()
                c = c.replace("%coreversion%", result)
                self.about.set_comments(c)
                client.core.get_libtorrent_version().addCallback(on_lt_version)

            if not client.is_classicmode():
                client.daemon.info().addCallback(on_info)
            else:
                client.core.get_libtorrent_version().addCallback(on_lt_version)
Ejemplo n.º 18
0
    def __init__(self):
        component.Component.__init__(self, "Preferences")
        self.glade = gtk.glade.XML(pkg_resources.resource_filename("deluge.ui.gtkui", "glade/preferences_dialog.glade"))
        self.pref_dialog = self.glade.get_widget("pref_dialog")
        self.pref_dialog.set_transient_for(component.get("MainWindow").window)
        self.pref_dialog.set_icon(common.get_deluge_icon())
        self.treeview = self.glade.get_widget("treeview")
        self.notebook = self.glade.get_widget("notebook")
        self.gtkui_config = ConfigManager("gtkui.conf")

        self.load_pref_dialog_state()

        self.glade.get_widget("image_magnet").set_from_file(deluge.common.get_pixmap("magnet.png"))

        # Setup the liststore for the categories (tab pages)
        self.liststore = gtk.ListStore(int, str)
        self.treeview.set_model(self.liststore)
        render = gtk.CellRendererText()
        column = gtk.TreeViewColumn(_("Categories"), render, text=1)
        self.treeview.append_column(column)
        # Add the default categories
        i = 0
        for category in [
            _("Downloads"),
            _("Network"),
            _("Bandwidth"),
            _("Interface"),
            _("Other"),
            _("Daemon"),
            _("Queue"),
            _("Proxy"),
            _("Cache"),
            _("Plugins"),
        ]:
            self.liststore.append([i, category])
            i += 1

        # Setup plugin tab listview
        self.plugin_liststore = gtk.ListStore(str, bool)
        self.plugin_liststore.set_sort_column_id(0, gtk.SORT_ASCENDING)
        self.plugin_listview = self.glade.get_widget("plugin_listview")
        self.plugin_listview.set_model(self.plugin_liststore)
        render = gtk.CellRendererToggle()
        render.connect("toggled", self.on_plugin_toggled)
        render.set_property("activatable", True)
        self.plugin_listview.append_column(gtk.TreeViewColumn(_("Enabled"), render, active=1))
        self.plugin_listview.append_column(gtk.TreeViewColumn(_("Plugin"), gtk.CellRendererText(), text=0))

        # Connect to the 'changed' event of TreeViewSelection to get selection
        # changes.
        self.treeview.get_selection().connect("changed", self.on_selection_changed)

        self.plugin_listview.get_selection().connect("changed", self.on_plugin_selection_changed)

        self.glade.signal_autoconnect(
            {
                "on_pref_dialog_delete_event": self.on_pref_dialog_delete_event,
                "on_button_ok_clicked": self.on_button_ok_clicked,
                "on_button_apply_clicked": self.on_button_apply_clicked,
                "on_button_cancel_clicked": self.on_button_cancel_clicked,
                "on_toggle": self.on_toggle,
                "on_test_port_clicked": self.on_test_port_clicked,
                "on_button_plugin_install_clicked": self._on_button_plugin_install_clicked,
                "on_button_rescan_plugins_clicked": self._on_button_rescan_plugins_clicked,
                "on_button_find_plugins_clicked": self._on_button_find_plugins_clicked,
                "on_button_cache_refresh_clicked": self._on_button_cache_refresh_clicked,
                "on_combo_proxy_type_changed": self._on_combo_proxy_type_changed,
                "on_button_associate_magnet_clicked": self._on_button_associate_magnet_clicked,
                "on_pref_dialog_configure_event": self.on_pref_dialog_configure_event,
            }
        )

        # These get updated by requests done to the core
        self.all_plugins = []
        self.enabled_plugins = []