From a8c796ba59c2dde5f4f548283b3941db0ab82ea6 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 12 Nov 2007 02:27:03 +0000 Subject: [PATCH] Inital import of EditTrackersDialog. --- deluge/ui/gtkui/connectionmanager.py | 2 + deluge/ui/gtkui/edittrackersdialog.py | 78 +++++++ deluge/ui/gtkui/glade/edit_trackers.glade | 238 +++++++++++++++------- deluge/ui/gtkui/glade/plugin_dialog.glade | 114 ----------- deluge/ui/gtkui/menubar.py | 3 + 5 files changed, 249 insertions(+), 186 deletions(-) create mode 100644 deluge/ui/gtkui/edittrackersdialog.py delete mode 100644 deluge/ui/gtkui/glade/plugin_dialog.glade diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py index 780e05bf8..17ca1a1e3 100644 --- a/deluge/ui/gtkui/connectionmanager.py +++ b/deluge/ui/gtkui/connectionmanager.py @@ -69,6 +69,8 @@ class ConnectionManager(component.Component): self.config = ConfigManager("hostlist.conf", DEFAULT_CONFIG) self.gtkui_config = ConfigManager("gtkui.conf") self.connection_manager = self.glade.get_widget("connection_manager") + # Make the Connection Manager window a transient for the main window. + self.connection_manager.set_transient_for(self.window.window) self.hostlist = self.glade.get_widget("hostlist") self.connection_manager.set_icon(deluge.common.get_logo(32)) diff --git a/deluge/ui/gtkui/edittrackersdialog.py b/deluge/ui/gtkui/edittrackersdialog.py new file mode 100644 index 000000000..b25f73049 --- /dev/null +++ b/deluge/ui/gtkui/edittrackersdialog.py @@ -0,0 +1,78 @@ +# +# edittrackersdialog.py +# +# Copyright (C) 2007 Andrew Resch ('andar') +# +# Deluge is free software. +# +# You may redistribute it and/or modify it under the terms of the +# GNU General Public License, as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# deluge 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. +# +# You should have received a copy of the GNU General Public License +# along with deluge. If not, write to: +# The Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor +# Boston, MA 02110-1301, USA. +# +# 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. 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. + +import gtk, gtk.glade +import pkg_resources + +import deluge.common +import deluge.ui.client as client +import deluge.ui.component as component +from deluge.log import LOG as log + +class EditTrackersDialog: + def __init__(self, torrent_id, parent=None): + 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.dialog.set_icon(deluge.common.get_logo(32)) + + 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_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 + }) + + def run(self): + self.dialog.show() + + def on_button_up_clicked(self, widget): + log.debug("on_button_up_clicked") + def on_button_add_clicked(self, widget): + log.debug("on_button_add_clicked") + def on_button_remove_clicked(self, widget): + log.debug("on_button_remove_clicked") + def on_button_down_clicked(self, widget): + log.debug("on_button_down_clicked") + def on_button_ok_clicked(self, widget): + log.debug("on_button_ok_clicked") + def on_button_cancel_clicked(self, widget): + log.debug("on_button_cancel_clicked") diff --git a/deluge/ui/gtkui/glade/edit_trackers.glade b/deluge/ui/gtkui/glade/edit_trackers.glade index 32053dcd5..800c30e5a 100644 --- a/deluge/ui/gtkui/glade/edit_trackers.glade +++ b/deluge/ui/gtkui/glade/edit_trackers.glade @@ -1,73 +1,163 @@ - + - - 300 - 200 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 Edit Trackers - - + GTK_WIN_POS_CENTER_ON_PARENT + 400 + True + GDK_WINDOW_TYPE_HINT_DIALOG + False + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 - - 36 + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Tracker Editing - - - False - False - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC + 5 - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - GTK_SHADOW_NONE - 1 + 10 - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-edit + + + False + False + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.05000000074505806 + 10 + <big><b>Edit Trackers</b></big> + True + + + False + False + 1 + + + False + False + - + True - True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-cancel - True - 0 - + 5 + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_RESIZE_QUEUE + GTK_SHADOW_NONE + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 1 + GTK_BUTTONBOX_END + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-go-up + True + 0 + + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-add + True + 0 + + + + 1 + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-remove + True + 0 + + + + 2 + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-go-down + True + 0 + + + + 3 + + + + + False + False + 1 + + False @@ -75,8 +165,30 @@ 1 + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_BUTTONBOX_END - + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-cancel + True + 0 + + + + + True True True @@ -84,34 +196,16 @@ gtk-ok True 0 - + - False - False - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - GTK_SHADOW_NONE - 1 - - - - - - 3 + 1 False - False - 2 + GTK_PACK_END diff --git a/deluge/ui/gtkui/glade/plugin_dialog.glade b/deluge/ui/gtkui/glade/plugin_dialog.glade deleted file mode 100644 index 68fa97357..000000000 --- a/deluge/ui/gtkui/glade/plugin_dialog.glade +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - 480 - 5 - Plugin Manager - 583 - 431 - True - GDK_WINDOW_TYPE_HINT_DIALOG - True - True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK - 2 - - - True - False - - - True - True - - - True - - - - - True - - - True - False - GTK_WRAP_WORD - False - - - 10 - - - - - True - GTK_BUTTONBOX_SPREAD - - - True - False - gtk-preferences - True - - - - - - False - 1 - - - - - 10 - 1 - - - - - False - - - - - True - Plugins - - - tab - False - False - - - - - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK - GTK_BUTTONBOX_END - - - True - gtk-close - True - - - - - False - GTK_PACK_END - - - - - - diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index aa1ede056..079d7d762 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -183,6 +183,9 @@ class MenuBar(component.Component): def on_menuitem_edittrackers_activate(self, data=None): log.debug("on_menuitem_edittrackers_activate") + from edittrackersdialog import EditTrackersDialog + dialog = EditTrackersDialog(None, component.get("MainWindow").window) + dialog.run() def on_menuitem_remove_activate(self, data=None): log.debug("on_menuitem_remove_activate")