From 398b40dec93e457f04b4099bfa62782157c0de3c Mon Sep 17 00:00:00 2001 From: Zach Tibbitts Date: Fri, 8 Dec 2006 18:10:47 +0000 Subject: [PATCH] preliminary columns work, tray icon, dgtk module --- delugegtk.py | 37 +- dgtk.py | 78 +++ glade/delugegtk.glade | 1336 ++++++++++++++++++++--------------------- glade/dgtkpref.glade | 577 ++++++++++++++++++ 4 files changed, 1356 insertions(+), 672 deletions(-) create mode 100644 dgtk.py create mode 100644 glade/dgtkpref.glade diff --git a/delugegtk.py b/delugegtk.py index 712acc4bb..ce5596aa7 100755 --- a/delugegtk.py +++ b/delugegtk.py @@ -1,10 +1,28 @@ #!/usr/bin/env python2.4 # -# Deluge common class -# For functions and variables that -# need to be accessed globally. +# delugegtk.py +# +# Copyright (C) Zach Tibbitts 2006 +# +# 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. +# +# delugegtk.py 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 main.py. If not, write to: +# The Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor +# Boston, MA 02110-1301, USA. -import deluge, dcommon +import deluge, dcommon, dgtk import sys, os, gettext import pygtk @@ -35,6 +53,9 @@ class DelugeGTK: } self.wtree.signal_autoconnect(actions) + ## Create the system tray icon + self.tray = dgtk.TrayIcon(self) + ## Create the about dialog gtk.about_dialog_set_url_hook(dcommon.open_url_in_browser) self.abt = gtk.AboutDialog() @@ -48,6 +69,14 @@ class DelugeGTK: self.prf = self.wtree.get_widget("pref_dialog") self.prf.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + ## Create the torrent listview + self.torrent_view = self.wtree.get_widget("torrent_view") + self.torrent_list = gtk.ListStore(str) + self.torrent_view.set_model(self.torrent_list) + + self.name_column = dgtk.TextColumn("Name") + self.torrent_view.append_column(self.name_column) + def new_torrent(self, obj): diff --git a/dgtk.py b/dgtk.py new file mode 100644 index 000000000..4ea138b4e --- /dev/null +++ b/dgtk.py @@ -0,0 +1,78 @@ +# dgtk.py +# +# Copyright (C) Zach Tibbitts 2006 +# +# 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. +# +# dgtk.py 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 main.py. If not, write to: +# The Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor +# Boston, MA 02110-1301, USA. + +import dcommon +import pygtk +pygtk.require('2.0') +import gtk +import gtk.glade + + +## Right now this only supports PyGTK's native +## tray library. I will add egg support into +## this class at a later time. +class TrayIcon(gtk.StatusIcon): + def __init__(self, parent): + gtk.StatusIcon.__init__(self) + self.parent = parent + #self.gladefile = dcommon.get_glade("dgtkpopups.glade") + self.set_from_file(dcommon.get_pixmap("deluge32.png")) + self.set_tooltip("Deluge Bittorrent Client") + + +class AboutDialog(gtk.AboutDialog): + def __init__(self): + pass + +class DelugeColumn(gtk.TreeViewColumn): + def __init__(self, title=None, renderer=None): + gtk.TreeViewColumn.__init__(self, title, renderer) + + def set_value(self, arg): + pass + + def show(self): + self.set_visible(True) + + def hide(self): + self.set_visible(False) + +class TextColumn(DelugeColumn): + def __init__(self, title=None): + DelugeColumn.__init__(self, title, gtk.CellRendererText()) + + def set_value(self, string): + pass + +class ToggleColumn(DelugeColumn): + def __init__(self, title=None): + DelugeColumn.__init__(self, title, gtk.CellRendererToggle()) + + def set_value(self, value): + pass + +class ProgressColumn(DelugeColumn): + def __init__(self, title=None): + DelugeColumn.__init__(self, title, gtk.CellRendererProgress()) + + def set_value(self, progress): + pass \ No newline at end of file diff --git a/glade/delugegtk.glade b/glade/delugegtk.glade index ad555ab58..16fdbcf05 100644 --- a/glade/delugegtk.glade +++ b/glade/delugegtk.glade @@ -16,506 +16,110 @@ 4 3 - + True + GTK_TOOLBAR_BOTH_HORIZ - 3 - 3 - 4 - + 1 + 2 + 1 + 2 + GTK_FILL - - True - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - True - True - False - - - - - - False - - - - - True - True - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - - - True - 10 - 9 - 4 - - - - - - - - - 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 - - - 3 - 4 - - - - - True - 0 - <b>Downloaded this session:</b> - True - - - 4 - 5 - - - - - True - 0 - - - 1 - 2 - 1 - 2 - - - - - True - 0 - - - 1 - 2 - 2 - 3 - - - - - True - 0 - - - 1 - 2 - 3 - 4 - - - - - True - 0 - - - 1 - 2 - 4 - 5 - - - - - True - 0 - <b>Tracker:</b> - True - - - 5 - 6 - - - - - True - 0 - <b>Tracker Response:</b> - True - - - 6 - 7 - - - - - True - 0 - <b>Tracker Status:</b> - True - - - 7 - 8 - - - - - True - 0 - - - 1 - 2 - 7 - 8 - - - - - True - 0 - <b>Next Announce:</b> - True - - - 2 - 3 - 7 - 8 - - - - - True - 0 - - - 3 - 4 - 7 - 8 - - - - - 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 - 3 - 4 - - - - - True - 0 - <b>Uploaded This Session:</b> - True - - - 2 - 3 - 4 - 5 - - - - - True - 0 - - - 3 - 4 - 3 - 4 - - - - - True - 0 - - - 3 - 4 - 4 - 5 - - - - - True - 0 - - - 1 - 4 - 5 - 6 - - - - - True - 0 - - - 1 - 4 - 6 - 7 - - - - - True - 0 - <b>Name:</b> - True - - - - - True - 0 - <b>Use compact storage allocation:</b> - True - - - 8 - 9 - - - - - True - 0 - - - 1 - 2 - 8 - 9 - - - - - - - - - False - - - - - True - Information - - - tab - False - False - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - - - - - 1 - False - - - - - True - Files - - - tab - 1 - False - False - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - - - True - True - - - - - 2 - False - - - - - True - Peers - - - tab - 2 - False - False - - - - - False - - - - - 3 - 2 - 3 - - - - + True GTK_TOOLBAR_BOTH_HORIZ False + + + True + Add Torrent + True + gtk-add + Add Torrent + + + + + + True + Remove Torrent + True + gtk-remove + Remove Torrent + + + + + + True + + + + + True + Update Tracker + True + gtk-refresh + Update Tracker + + + + + + True + Clear Finished + True + gtk-clear + Clear Finished Torrents + + + + + + True + + + + + True + Force Pause/Resume Torrent + True + gtk-media-pause + Force Pause/Resume Torrent + + + + + + True + + + + + True + Move Up + True + gtk-go-up + Queue Torrent Up + + + + + + True + Move Down + True + gtk-go-down + Queue Torrent Down + + + - 2 - 3 1 2 @@ -765,97 +369,14 @@ - + True GTK_TOOLBAR_BOTH_HORIZ False - - - True - Add Torrent - True - gtk-add - Add Torrent - - - - - - True - Remove Torrent - True - gtk-remove - Remove Torrent - - - - - - True - - - - - True - Update Tracker - True - gtk-refresh - Update Tracker - - - - - - True - Clear Finished - True - gtk-clear - Clear Finished Torrents - - - - - - True - - - - - True - Force Pause/Resume Torrent - True - gtk-media-pause - Force Pause/Resume Torrent - - - - - - True - - - - - True - Move Up - True - gtk-go-up - Queue Torrent Up - - - - - - True - Move Down - True - gtk-go-down - Queue Torrent Down - - - + 2 + 3 1 2 @@ -863,16 +384,495 @@ - + True - GTK_TOOLBAR_BOTH_HORIZ + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + True + False + + + + + + False + + + + + True + True + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + + + True + 10 + 9 + 4 + + + + + + + + + True + 0 + + + 1 + 2 + 8 + 9 + + + + + True + 0 + <b>Use compact storage allocation:</b> + True + + + 8 + 9 + + + + + True + 0 + <b>Name:</b> + True + + + + + True + 0 + + + 1 + 4 + 6 + 7 + + + + + True + 0 + + + 1 + 4 + 5 + 6 + + + + + True + 0 + + + 3 + 4 + 4 + 5 + + + + + True + 0 + + + 3 + 4 + 3 + 4 + + + + + True + 0 + <b>Uploaded This Session:</b> + True + + + 2 + 3 + 4 + 5 + + + + + True + 0 + <b>Share Ratio:</b> + True + + + 2 + 3 + 3 + 4 + + + + + 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 + 7 + 8 + + + + + True + 0 + <b>Next Announce:</b> + True + + + 2 + 3 + 7 + 8 + + + + + True + 0 + + + 1 + 2 + 7 + 8 + + + + + True + 0 + <b>Tracker Status:</b> + True + + + 7 + 8 + + + + + True + 0 + <b>Tracker Response:</b> + True + + + 6 + 7 + + + + + True + 0 + <b>Tracker:</b> + True + + + 5 + 6 + + + + + True + 0 + + + 1 + 2 + 4 + 5 + + + + + True + 0 + + + 1 + 2 + 3 + 4 + + + + + True + 0 + + + 1 + 2 + 2 + 3 + + + + + True + 0 + + + 1 + 2 + 1 + 2 + + + + + True + 0 + <b>Downloaded this session:</b> + True + + + 4 + 5 + + + + + True + 0 + <b>Percentage Done:</b> + True + + + 3 + 4 + + + + + True + 0 + <b>Total Downloaded:</b> + True + + + 2 + 3 + + + + + True + 0 + <b>Total Size:</b> + True + + + 1 + 2 + + + + + True + 0 + True + + + 1 + 4 + + + + + + + + + False + + + + + True + Information + + + tab + False + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + + + + + 1 + False + + + + + True + Files + + + tab + 1 + False + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + + + + + 2 + False + + + + + True + Peers + + + tab + 2 + False + False + + + + + False + + - 1 - 2 - 1 - 2 - GTK_FILL + 3 + 2 + 3 + + + + + True + + + 3 + 3 + 4 + @@ -958,15 +958,13 @@ 2 2 - - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + True + Ask me where to save each download + True - 1 2 - 1 - 2 @@ -982,13 +980,15 @@ - + + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER True - Ask me where to save each download - True + 1 2 + 1 + 2 @@ -1017,6 +1017,14 @@ True 1 2 + + + True + Stop seeding torrents when +their share ratio reaches: + True + + True @@ -1031,14 +1039,6 @@ 2 - - - True - Stop seeding torrents when -their share ratio reaches: - True - - @@ -1131,51 +1131,13 @@ their share ratio reaches: - + True - Try from: - - - - - True - to: - - - 2 - 3 - - - - - True - True - 0 0 100 1 10 10 - - - 1 - 2 - - - - - True - True - 0 0 100 1 10 10 + Test Port 3 4 - - - - - True - Active port: - - - 1 - 2 1 2 @@ -1193,17 +1155,55 @@ their share ratio reaches: - + True - Test Port + Active port: + + + 1 + 2 + 1 + 2 + + + + + True + True + 0 0 100 1 10 10 3 4 - 1 - 2 + + + True + True + 0 0 100 1 10 10 + + + 1 + 2 + + + + + True + to: + + + 2 + 3 + + + + + True + Try from: + + @@ -1241,7 +1241,7 @@ their share ratio reaches: - + True True 0 0 100 1 10 10 @@ -1249,21 +1249,6 @@ their share ratio reaches: 1 2 - 3 - 4 - - - - - True - True - 0 0 100 1 10 10 - - - 1 - 2 - 2 - 3 @@ -1280,7 +1265,7 @@ their share ratio reaches: - + True True 0 0 100 1 10 10 @@ -1288,6 +1273,21 @@ their share ratio reaches: 1 2 + 2 + 3 + + + + + True + True + 0 0 100 1 10 10 + + + 1 + 2 + 3 + 4 @@ -1338,11 +1338,16 @@ their share ratio reaches: 2 2 - + True + False + GTK_WRAP_WORD - 2 + 1 + 2 + 10 + 10 @@ -1384,16 +1389,11 @@ their share ratio reaches: - + True - False - GTK_WRAP_WORD - 1 - 2 - 10 - 10 + 2 diff --git a/glade/dgtkpref.glade b/glade/dgtkpref.glade new file mode 100644 index 000000000..1549ff792 --- /dev/null +++ b/glade/dgtkpref.glade @@ -0,0 +1,577 @@ + + + + + + 480 + 5 + Preferences Dialog + False + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK + 2 + + + True + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + + + True + GTK_RESIZE_IMMEDIATE + + + True + + + True + 3 + 2 + + + + + + + + + + + + + + + True + Minimize to tray on close + True + + + 2 + + + + + + + True + Options + + + label_item + + + + + False + + + + + True + + + True + 2 + 2 + + + True + Ask me where to save each download + True + + + 2 + + + + + True + Save all downloads to: + True + radio_ask_save + + + 1 + 2 + + + + + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + True + + + 1 + 2 + 1 + 2 + + + + + + + True + Save Location + + + label_item + + + + + False + 1 + + + + + True + True + + + True + 1 + 2 + + + True + Stop seeding torrents when +their share ratio reaches: + True + + + + + True + True + 0.10000000000000001 0 10 0.10000000000000001 10 10 + 0.10000000149011612 + 2 + True + + + 1 + 2 + + + + + + + True + Seeding + + + label_item + + + + + False + 2 + + + + + True + True + + + True + Use compact storage allocation + True + + + + + True + Storage + + + label_item + + + + + False + 3 + + + + + + + + + + + + + + + False + + + + + True + General + + + tab + False + False + + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + + + True + + + True + + + True + 2 + 4 + + + + + + True + Test Port + + + 3 + 4 + 1 + 2 + + + + + True + label + + + 2 + 3 + 1 + 2 + + + + + True + Active port: + + + 1 + 2 + 1 + 2 + + + + + True + True + 0 0 100 1 10 10 + + + 3 + 4 + + + + + True + True + 0 0 100 1 10 10 + + + 1 + 2 + + + + + True + to: + + + 2 + 3 + + + + + True + Try from: + + + + + + + True + TCP Port + + + label_item + + + + + False + + + + + True + + + True + 4 + 2 + + + + + + + + + + + + + + + True + True + 0 0 100 1 10 10 + + + 1 + 2 + + + + + True + True + 0 0 100 1 10 10 + + + 1 + 2 + 1 + 2 + + + + + True + True + 0 0 100 1 10 10 + + + 1 + 2 + 2 + 3 + + + + + True + True + 0 0 100 1 10 10 + + + 1 + 2 + 3 + 4 + + + + + + + True + Bandwidth + + + label_item + + + + + False + 1 + + + + + + + + + + + + 1 + False + + + + + True + Network + + + tab + 1 + False + False + + + + + True + 2 + 2 + + + True + False + GTK_WRAP_WORD + + + 1 + 2 + 10 + 10 + + + + + True + GTK_BUTTONBOX_SPREAD + + + True + button + + + + + True + button + + + 1 + + + + + True + button + + + 2 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + + + 2 + + + + + 2 + False + + + + + True + Plugins + + + tab + 2 + 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-cancel + True + + + + + True + gtk-ok + True + + + 1 + + + + + False + GTK_PACK_END + + + + + +