diff --git a/glade/delugegtk.glade b/glade/delugegtk.glade index 305b8619b..0c45cf43b 100644 --- a/glade/delugegtk.glade +++ b/glade/delugegtk.glade @@ -16,152 +16,623 @@ 4 3 - + True - GTK_TOOLBAR_BOTH_HORIZ - False + 190 + True - + True - Add Torrent - Add Torrent - True - gtk-add - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + True + True + False + + + - False + False + False - + True - Remove Torrent - Remove Torrent - True - gtk-remove - + True + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + + + True + 10 + 12 + 4 + + + + + + + + + + + + + + + True + + + 3 + 4 + 10 + 11 + + + + + True + 0 + <b>Estimated Time Remaining:</b> + True + + + 2 + 3 + 10 + 11 + + + + + True + 0 + + + 3 + 4 + 4 + 5 + + + + + True + 0 + + + 1 + 2 + 4 + 5 + + + + + True + 0 + <b>Peers:</b> + True + + + 2 + 3 + 4 + 5 + + + + + True + 0 + <b>Seeders:</b> + True + + + 4 + 5 + + + + + True + 0 + True + + + 1 + 4 + + + + + True + 0 + <b>Total Size:</b> + True + + + 1 + 2 + + + + + True + 0 + <b>Total Downloaded:</b> + True + + + 2 + 3 + + + + + True + 0 + <b>Percentage Done:</b> + True + + + 5 + 6 + + + + + True + 0 + <b>Downloaded this session:</b> + True + + + 6 + 7 + + + + + True + 0 + + + 1 + 2 + 1 + 2 + + + + + True + 0 + + + 1 + 2 + 2 + 3 + + + + + True + 0 + + + 1 + 2 + 5 + 6 + + + + + True + 0 + + + 1 + 2 + 6 + 7 + + + + + True + 0 + <b>Tracker:</b> + True + + + 7 + 8 + + + + + True + 0 + <b>Tracker Response:</b> + True + + + 8 + 9 + + + + + True + 0 + <b>Tracker Status:</b> + True + + + 9 + 10 + + + + + True + 0 + + + 1 + 2 + 9 + 10 + + + + + True + 0 + <b>Next Announce:</b> + True + + + 2 + 3 + 9 + 10 + + + + + True + 0 + + + 3 + 4 + 9 + 10 + + + + + True + 0 + <b>Pieces:</b> + True + + + 2 + 3 + 1 + 2 + + + + + True + 0 + <b>Total Uploaded:</b> + True + + + 2 + 3 + 2 + 3 + + + + + True + 0 + + + 3 + 4 + 1 + 2 + + + + + True + 0 + + + 3 + 4 + 2 + 3 + + + + + True + 0 + <b>Share Ratio:</b> + True + + + 2 + 3 + 5 + 6 + + + + + True + 0 + <b>Uploaded This Session:</b> + True + + + 2 + 3 + 6 + 7 + + + + + True + 0 + + + 3 + 4 + 5 + 6 + + + + + True + 0 + + + 3 + 4 + 6 + 7 + + + + + True + 0 + + + 1 + 4 + 7 + 8 + + + + + True + 0 + + + 1 + 4 + 8 + 9 + + + + + True + 0 + <b>Name:</b> + True + + + + + True + 0 + <b>Use compact storage allocation:</b> + True + + + 10 + 11 + + + + + True + 0 + + + 1 + 2 + 10 + 11 + + + + + True + 0 + <b>Download Rate:</b> + True + + + 3 + 4 + + + + + True + 0 + + + 1 + 2 + 3 + 4 + + + + + True + 0 + <b>Upload Rate:</b> + True + + + 2 + 3 + 3 + 4 + + + + + True + 0 + + + 3 + 4 + 3 + 4 + + + + + + + + + False + + + + + True + Details + + + tab + False + False + + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + + + + + 1 + False + + + + + True + Peers + + + tab + 1 + False + False + + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + + + + + 2 + False + + + + + True + Files + + + tab + 2 + False + False + + - - False - - - - - True - - - False - False - - - - - True - Recheck Download - Recheck - gtk-yes - - - - False - - - - - True - Update Tracker - Update Tracker - True - gtk-refresh - - - - False - - - - - True - Clear Finished Torrents - Clear Finished - True - gtk-clear - - - - False - - - - - True - - - False - False - - - - - True - Queue Torrent Up - Move Up - True - gtk-go-up - - - - False - - - - - True - Queue Torrent Down - Move Down - True - gtk-go-down - - - - False - - 1 - 2 - - GTK_FILL - - - - - True - GTK_TOOLBAR_BOTH_HORIZ - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - GTK_TOOLBAR_BOTH_HORIZ - False - - - 2 3 - 1 - 2 - - GTK_FILL + 2 + 3 + + + + + True + + + 3 + 3 + 4 + @@ -254,9 +725,9 @@ True + True Show Details Pane True - True @@ -271,72 +742,72 @@ True + True Size True - True True + True Status True - True True + True Seeders True - True True + True Peers True - True True + True Download True - True True + True Upload True - True True + True Time Remaining True - True True + True Share Ratio True - True @@ -375,623 +846,104 @@ - + True + GTK_TOOLBAR_BOTH_HORIZ + False + 2 3 - 3 - 4 - + 1 + 2 + + GTK_FILL - + True - 190 - True + GTK_TOOLBAR_BOTH_HORIZ + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + GTK_TOOLBAR_BOTH_HORIZ + False - + True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - True - True - True - False - - - + Add Torrent + True + gtk-add + Add Torrent + - - False - False - - + True - True - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - - - True - 10 - 12 - 4 - - - - - - - - - - - - - - - True - 0 - - - 3 - 4 - 3 - 4 - - - - - True - 0 - <b>Upload Rate:</b> - True - - - 2 - 3 - 3 - 4 - - - - - True - 0 - - - 1 - 2 - 3 - 4 - - - - - True - 0 - <b>Download Rate:</b> - True - - - 3 - 4 - - - - - True - 0 - - - 1 - 2 - 10 - 11 - - - - - True - 0 - <b>Use compact storage allocation:</b> - True - - - 10 - 11 - - - - - True - 0 - <b>Name:</b> - True - - - - - True - 0 - - - 1 - 4 - 8 - 9 - - - - - True - 0 - - - 1 - 4 - 7 - 8 - - - - - True - 0 - - - 3 - 4 - 6 - 7 - - - - - True - 0 - - - 3 - 4 - 5 - 6 - - - - - True - 0 - <b>Uploaded This Session:</b> - True - - - 2 - 3 - 6 - 7 - - - - - True - 0 - <b>Share Ratio:</b> - True - - - 2 - 3 - 5 - 6 - - - - - True - 0 - - - 3 - 4 - 2 - 3 - - - - - True - 0 - - - 3 - 4 - 1 - 2 - - - - - True - 0 - <b>Total Uploaded:</b> - True - - - 2 - 3 - 2 - 3 - - - - - True - 0 - <b>Pieces:</b> - True - - - 2 - 3 - 1 - 2 - - - - - True - 0 - - - 3 - 4 - 9 - 10 - - - - - True - 0 - <b>Next Announce:</b> - True - - - 2 - 3 - 9 - 10 - - - - - True - 0 - - - 1 - 2 - 9 - 10 - - - - - True - 0 - <b>Tracker Status:</b> - True - - - 9 - 10 - - - - - True - 0 - <b>Tracker Response:</b> - True - - - 8 - 9 - - - - - True - 0 - <b>Tracker:</b> - True - - - 7 - 8 - - - - - True - 0 - - - 1 - 2 - 6 - 7 - - - - - True - 0 - - - 1 - 2 - 5 - 6 - - - - - True - 0 - - - 1 - 2 - 2 - 3 - - - - - True - 0 - - - 1 - 2 - 1 - 2 - - - - - True - 0 - <b>Downloaded this session:</b> - True - - - 6 - 7 - - - - - True - 0 - <b>Percentage Done:</b> - True - - - 5 - 6 - - - - - True - 0 - <b>Total Downloaded:</b> - True - - - 2 - 3 - - - - - True - 0 - <b>Total Size:</b> - True - - - 1 - 2 - - - - - True - 0 - True - - - 1 - 4 - - - - - True - 0 - <b>Seeders:</b> - True - - - 4 - 5 - - - - - True - 0 - <b>Peers:</b> - True - - - 2 - 3 - 4 - 5 - - - - - True - 0 - - - 1 - 2 - 4 - 5 - - - - - True - 0 - - - 3 - 4 - 4 - 5 - - - - - True - 0 - <b>Estimated Time Remaining:</b> - True - - - 2 - 3 - 10 - 11 - - - - - True - - - 3 - 4 - 10 - 11 - - - - - - - - - False - - - - - True - Details - - - tab - False - False - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - - - - - 1 - False - - - - - True - Peers - - - tab - 1 - False - False - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - True - - - - - 2 - False - - - - - True - Files - - - tab - 2 - False - False - - + Remove Torrent + True + gtk-remove + Remove Torrent + + + + + + True + Clear Finished + True + gtk-clear + Clear Finished Torrents + + + + + + True + Update Tracker + True + gtk-refresh + Update Tracker + + + + + + True + Move Up + True + gtk-go-up + Queue Torrent Up + + + + + + True + Move Down + True + gtk-go-down + Queue Torrent Down + - 3 - 2 - 3 + 1 + 2 + + GTK_FILL diff --git a/src/delugegtk.py b/src/delugegtk.py index 9b028e52b..8993893d8 100755 --- a/src/delugegtk.py +++ b/src/delugegtk.py @@ -52,25 +52,32 @@ class DelugeGTK(dbus.service.Object): self.manager = deluge.Manager("DE", "0490", "Deluge 0.4.9", xdg.BaseDirectory.save_config_path("deluge-svn")) #Set up the interface: - self.gladefile = dcommon.get_glade_file("delugegtk.glade") - self.wtree = gtk.glade.XML(self.gladefile) + self.wtree = gtk.glade.XML(dcommon.get_glade_file("delugegtk.glade")) self.window = self.wtree.get_widget("main_window") self.window.hide() self.toolbar = self.wtree.get_widget("tb_middle") if(self.window): self.window.connect("destroy", self.quit) - self.window.set_title(dcommon.PROGRAM_NAME + " " + dcommon.PROGRAM_VERSION) + self.window.set_title('%s %s'%(dcommon.PROGRAM_NAME, dcommon.PROGRAM_VERSION)) self.window.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) ## Create the system tray icon self.tray = dgtk.TrayIcon(self) - ## Create the about dialog - self.abt = dgtk.AboutDialog() + ## Construct the Interface + self.build_about_dialog() + self.build_pref_dialog() + self.build_plugin_dialog() + self.build_torrent_table() + self.build_summary_tab() + self.build_file_tab() + self.build_peer_tab() - ## Create the preferences dialog - self.prf = dgtk.PreferencesDialog() + self.connect_signals() + self.apply_prefs() + + def connect_signals(self): self.wtree.signal_autoconnect({ ## File Menu "new_torrent": self.new_torrent_clicked, @@ -78,8 +85,8 @@ class DelugeGTK(dbus.service.Object): "remove_torrent" : self.remove_torrent_clicked, "menu_quit": self.quit, ## Edit Menu - "pref_clicked": self.show_pref, - "plugins_clicked": self.show_plugins, + "pref_clicked": self.show_pref_dialog, + "plugins_clicked": self.show_plugin_dialog, ## View Menu "infopane_toggle": self.infopane_toggle, "size_toggle": self.size_toggle, @@ -91,9 +98,8 @@ class DelugeGTK(dbus.service.Object): "eta_toggle": self.eta_toggle, "share_toggle": self.share_toggle, ## Help Menu - "show_about_dialog": self.abt.show, + "show_about_dialog": self.show_about_dialog, ## Toolbar - "recheck_files": self.recheck_files, "update_tracker": self.update_tracker, "clear_finished": self.clear_finished, "queue_up": self.q_torrent_up, @@ -101,7 +107,29 @@ class DelugeGTK(dbus.service.Object): ## Other events "torrentrow_click": self.torrentview_clicked, }) - + + def build_about_dialog(self): + gtk.about_dialog_set_url_hook(dcommon.open_url_in_browser) + self.abt = gtk.AboutDialog() + self.abt.set_name(dcommon.PROGRAM_NAME) + self.abt.set_version(dcommon.PROGRAM_VERSION) + self.abt.set_authors(["Zach Tibbits", "A. Zakai"]) + self.abt.set_artists(["Andrew Wedderburn"]) + self.abt.set_website("http://deluge-torrent.org") + self.abt.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + #self.abt.set_logo(gtk.gdk.pixbuf_new_from_file( + # dcommon.get_pixmap("deluge256.png"))) + + def build_pref_dialog(self): + self.prf_glade = gtk.glade.XML(dcommon.get_glade_file("dgtkpref.glade")) + self.prf = self.prf_glade.get_widget("pref_dialog") + self.prf.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + self.prf_glade.signal_autoconnect({"tray_toggle": self.tray_toggle,}) + + def build_plugin_dialog(self): + pass + + def build_torrent_table(self): ## Create the torrent listview self.view = self.wtree.get_widget("torrent_view") # UID, Q#, Name, Size, Progress, Message, Seeders, Peers, DL, UL, ETA, Share @@ -111,8 +139,8 @@ class DelugeGTK(dbus.service.Object): ## Initializes the columns for the torrent_view -# Just found out there are built-in pygtk methods with similar functionality -# to these, perhaps I should look into using those. + #Just found out there are built-in pygtk methods with similar functionality + #to these, perhaps I should look into using those. self.queue_column = dgtk.add_text_column(self.view, "#", 1) self.name_column = dgtk.add_text_column(self.view, "Name", 2) self.size_column = dgtk.add_text_column(self.view, "Size", 3) @@ -125,29 +153,9 @@ class DelugeGTK(dbus.service.Object): self.share_column = dgtk.add_text_column(self.view, "Share Ratio", 11) self.status_column.set_expand(True) - - self.file_view = self.wtree.get_widget("file_view") - self.file_store = gtk.ListStore(str, bool) - self.file_view.set_model(self.file_store) - - self.filename_column = dgtk.add_text_column(self.file_view, "Filename", 0) - self.filetoggle_column = dgtk.add_toggle_column(self.file_view, "DL?", 0) - self.filename_column.set_expand(True) - - ## Should probably use rules-hint for other treevies as well - - self.peer_view = self.wtree.get_widget("peer_view") - self.peer_store = gtk.ListStore(str, str, str, str, str) - self.peer_view.set_model(self.peer_store) - - self.peer_ip_column = dgtk.add_text_column(self.peer_view, "IP Address", 0) - self.peer_client_column = dgtk.add_text_column(self.peer_view, "Client", 1) - ## Note: change this column to use a progress column before 0.5 is released - self.peer_complete_column = dgtk.add_text_column(self.peer_view, "Percent Complete", 2) - self.peer_download_column = dgtk.add_text_column(self.peer_view, "Download Rate", 3) - self.peer_upload_column = dgtk.add_text_column(self.peer_view, "Upload Rate", 4) - + + def build_summary_tab(self): #Torrent Summary tab # Look into glade's widget prefix function self.text_summary_title = self.wtree.get_widget("summary_title") @@ -169,10 +177,56 @@ class DelugeGTK(dbus.service.Object): self.text_summary_next_announce = self.wtree.get_widget("summary_next_announce") self.text_summary_compact_allocation = self.wtree.get_widget("summary_compact_allocation") self.text_summary_eta = self.wtree.get_widget("summary_eta") + + def build_peer_tab(self): + self.peer_view = self.wtree.get_widget("peer_view") + self.peer_store = gtk.ListStore(str, str, str, str, str) + self.peer_view.set_model(self.peer_store) - ## Interface created + self.peer_ip_column = dgtk.add_text_column(self.peer_view, "IP Address", 0) + self.peer_client_column = dgtk.add_text_column(self.peer_view, "Client", 1) + ## Note: (maybe) change this column to use a progress column before 0.5 is released + self.peer_complete_column = dgtk.add_text_column(self.peer_view, "Percent Complete", 2) + self.peer_download_column = dgtk.add_text_column(self.peer_view, "Download Rate", 3) + self.peer_upload_column = dgtk.add_text_column(self.peer_view, "Upload Rate", 4) + + + def build_file_tab(self): + self.file_view = self.wtree.get_widget("file_view") + self.file_store = gtk.ListStore(str, bool) + self.file_view.set_model(self.file_store) + + self.filename_column = dgtk.add_text_column(self.file_view, "Filename", 0) + self.filetoggle_column = dgtk.add_toggle_column(self.file_view, "DL?", 0) + + self.filename_column.set_expand(True) + + + + + + def show_about_dialog(self, arg=None): + self.abt.show_all() + self.abt.run() + self.abt.hide_all() + + def show_pref_dialog(self, arg=None): + self.prf.show_all() + self.prf.run() + self.prf.hide_all() self.apply_prefs() + def show_plugin_dialog(self, arg=None): + pass + + def tray_toggle(self, obj): + if obj.get_active(): + self.wtree.get_widget("chk_min_on_close").set_sensitive(True) + else: + self.wtree.get_widget("chk_min_on_close").set_sensitive(False) + + + ## external_add_torrent should only be called from outside the class @dbus.service.method('org.deluge_torrent.DelugeInterface') def external_add_torrent(self, torrent_file): @@ -328,9 +382,6 @@ class DelugeGTK(dbus.service.Object): torrent = self.get_selected_torrent() if torrent is not None: self.manager.remove_torrent(torrent, False) - - def recheck_files(self, obj=None): - pass def update_tracker(self, obj=None): torrent = self.get_selected_torrent() diff --git a/src/dgtk.py b/src/dgtk.py index 370e00083..044669954 100644 --- a/src/dgtk.py +++ b/src/dgtk.py @@ -44,72 +44,6 @@ class TrayIcon: def popup(self): pass - - -class AboutDialog: - def __init__(self): - gtk.about_dialog_set_url_hook(dcommon.open_url_in_browser) - self.abt = gtk.AboutDialog() - self.abt.set_name(dcommon.PROGRAM_NAME) - self.abt.set_version(dcommon.PROGRAM_VERSION) - self.abt.set_authors(["Zach Tibbits", "A. Zakai"]) - self.abt.set_artists(["Andrew Wedderburn"]) - self.abt.set_website("http://deluge-torrent.org") - self.abt.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) - self.abt.set_logo(gtk.gdk.pixbuf_new_from_file( - dcommon.get_pixmap("deluge256.png"))) - - def show(self, arg=None): - self.abt.show_all() - self.abt.run() - self.abt.hide_all() - - -## TODO: Merge this class (and possibly others) into the main interface class -class PreferencesDialog: - def __init__(self): - self.gladefile = dcommon.get_glade_file("dgtkpref.glade") - self.wtree = gtk.glade.XML(self.gladefile) - self.dlg = self.wtree.get_widget("pref_dialog") - self.notebook = self.wtree.get_widget("pref_notebook") - self.dlg.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) - - #self.plugin_view = self.wtree.get_widget("plugin_view") - #self.plugin_store = gtk.ListStore(str, 'gboolean') - #self.plugin_view.set_model(self.plugin_store) - #self.plugin_name_column = add_text_column(self.plugin_view, "Plugin", 0) - #self.plugin_name_column.set_expand(True) - #self.plugin_toggle_column = add_toggle_column(self.plugin_view, "Enable", 1) - - self.wtree.signal_autoconnect({"tray_toggle": self.tray_toggle, - }) - - def tray_toggle(self, obj): - if obj.get_active(): - self.wtree.get_widget("chk_min_on_close").set_sensitive(True) - else: - self.wtree.get_widget("chk_min_on_close").set_sensitive(False) - - def set_pref(self, pref_file): - pass - - def get_pref(self, pref_file): - pass - - def show_dlg(self, conf=None, page=0): - self.dlg.show_all() - self.notebook.set_current_page(page) - # Set existing options - self.set_pref(conf) - - self.dlg.run() - self.dlg.hide_all() - -class PluginsDialog: - def __init__(self): - pass - - ## A simple file open dialog. I'm going to improve it later, ## this is a quick implementation for testing. def show_file_open_dialog():