From d6dd893c7143eeeffa7668f63563f19727982e53 Mon Sep 17 00:00:00 2001 From: Zach Tibbitts Date: Tue, 28 Nov 2006 22:28:37 +0000 Subject: [PATCH] basic work, gui runs --- dcommon.py | 25 + deluge.py | 13 + delugegtk.py | 59 ++ glade/delugegtk.glade | 1184 ++++++++++++++++++++--------------------- 4 files changed, 689 insertions(+), 592 deletions(-) create mode 100644 dcommon.py create mode 100644 deluge.py create mode 100755 delugegtk.py diff --git a/dcommon.py b/dcommon.py new file mode 100644 index 000000000..6c479fec1 --- /dev/null +++ b/dcommon.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python2.4 +# +# Deluge common class +# For functions and variables that +# need to be accessed globally. + +import sys, os, webbrowser + +PROGRAM_NAME = "Deluge Torrent" +PROGRAM_VERSION = "0.5" +DELUGE_DIR = os.path.abspath(os.path.dirname(sys.argv[0])) +GLADE_DIR = DELUGE_DIR + "/glade" +PIXMAP_DIR = DELUGE_DIR + "/pixmaps" + +def get_glade_file(fname): + return GLADE_DIR + "/" + fname + +def get_pixmap(fname): + return PIXMAP_DIR + "/" + fname + +def open_url_in_browser(dialog, link): + try: + webbrowser.open(link) + except webbrowser.Error: + print "Error: no webbrowser found" \ No newline at end of file diff --git a/deluge.py b/deluge.py new file mode 100644 index 000000000..c718d357c --- /dev/null +++ b/deluge.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python2.4 +# +# Deluge backend +# A daemonized backend for +# Deluge in order to allow +# for multiple frontends + + + + +class Deluge: + def __init__(self): + pass \ No newline at end of file diff --git a/delugegtk.py b/delugegtk.py new file mode 100755 index 000000000..189704d6c --- /dev/null +++ b/delugegtk.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python2.4 +# +# Deluge common class +# For functions and variables that +# need to be accessed globally. + +import deluge, dcommon + +import sys, os, gettext +import pygtk +pygtk.require('2.0') +import gtk +import gtk.glade + + +class DelugeGTK: + def __init__(self): + self.gladefile = dcommon.get_glade_file("delugegtk.glade") + self.wtree = gtk.glade.XML(self.gladefile) + self.window = self.wtree.get_widget("main_window") + if(self.window): + self.window.connect("destroy", gtk.main_quit) + self.window.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + actions = { + ## File Menu + "new_torrent": self.new_torrent, + "add_torrent": self.add_torrent, + ## Help Menu + "show_about_dialog": self.show_about_dialog, + } + self.wtree.signal_autoconnect(actions) + + ## Create the about dialog + 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_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 new_torrent(self, obj): + pass + + def add_torrent(self, obj): + pass + + def show_about_dialog(self, obj): + self.abt.show_all() + self.abt.run() + self.abt.hide_all() + + +if __name__ == "__main__": + dgtk = DelugeGTK() + gtk.main() \ No newline at end of file diff --git a/glade/delugegtk.glade b/glade/delugegtk.glade index ca84cbfb9..ce09bf270 100644 --- a/glade/delugegtk.glade +++ b/glade/delugegtk.glade @@ -14,506 +14,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 @@ -531,28 +135,28 @@ - + True - Add a Torrent from File... + Create a Torrent True - + - - True - gtk-add + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK + gtk-new 1 - + True - Add a Torrent from URL... + Add a Torrent... True - + - + True gtk-add 1 @@ -762,97 +366,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 @@ -860,16 +381,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 +