removed references to deluge class

This commit is contained in:
Zach Tibbitts 2006-12-08 19:02:22 +00:00
parent 9005d0e57b
commit c4e03ec27e
2 changed files with 48 additions and 28 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2.4 #!/usr/bin/env python2.5
# #
# delugegtk.py # delugegtk.py
# #
@ -22,7 +22,7 @@
# 51 Franklin Street, Fifth Floor # 51 Franklin Street, Fifth Floor
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
import deluge, dcommon, dgtk import dcommon, dgtk
import sys, os, gettext import sys, os, gettext
import pygtk import pygtk
@ -40,6 +40,17 @@ class DelugeGTK:
self.window.connect("destroy", gtk.main_quit) self.window.connect("destroy", gtk.main_quit)
self.window.set_title(dcommon.PROGRAM_NAME + " " + dcommon.PROGRAM_VERSION) self.window.set_title(dcommon.PROGRAM_NAME + " " + dcommon.PROGRAM_VERSION)
self.window.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) 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()
## Create the preferences dialog
self.prf = self.wtree.get_widget("pref_dialog")
self.prf.set_icon_from_file(dcommon.get_pixmap("deluge32.png"))
actions = { actions = {
## File Menu ## File Menu
"new_torrent": self.new_torrent, "new_torrent": self.new_torrent,
@ -49,31 +60,28 @@ class DelugeGTK:
## Torrent Menu ## Torrent Menu
"show_info": self.show_info_pane, "show_info": self.show_info_pane,
## Help Menu ## Help Menu
"show_about_dialog": self.show_about_dialog, "show_about_dialog": self.abt.show,
} }
self.wtree.signal_autoconnect(actions) 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()
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")))
## Create the preferences dialog
self.prf = self.wtree.get_widget("pref_dialog")
self.prf.set_icon_from_file(dcommon.get_pixmap("deluge32.png"))
## Create the torrent listview ## Create the torrent listview
self.torrent_view = self.wtree.get_widget("torrent_view") self.torrent_view = self.wtree.get_widget("torrent_view")
self.torrent_list = gtk.ListStore(str) self.torrent_list = gtk.ListStore(str)
self.torrent_view.set_model(self.torrent_list) self.torrent_view.set_model(self.torrent_list)
## Still a lot of work to be done here,
## this column is here as an example of how
## to create and add columns. Perhaps I
## should create some sort of ColumnsManager
## object in dgtk to keep the code cleaner
## and also confine column code to one place.
## I'm worrying about columns way too much
## because that was one of the main places
## Deluge's code (up to 0.4) got way out of
## hand.
self.name_column = dgtk.TextColumn("Name") self.name_column = dgtk.TextColumn("Name")
self.torrent_view.append_column(self.name_column) self.torrent_view.append_column(self.name_column)
@ -106,9 +114,7 @@ class DelugeGTK:
def show_about_dialog(self, obj): def show_about_dialog(self, obj):
self.abt.show_all() self.abt.show()
self.abt.run()
self.abt.hide_all()

28
dgtk.py
View File

@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
import dcommon import dcommon
import gettext
import pygtk import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
@ -30,18 +31,31 @@ import gtk.glade
## Right now this only supports PyGTK's native ## Right now this only supports PyGTK's native
## tray library. I will add egg support into ## tray library. I will add egg support into
## this class at a later time. ## this class at a later time.
class TrayIcon(gtk.StatusIcon): class TrayIcon:
def __init__(self, parent): def __init__(self, parent):
gtk.StatusIcon.__init__(self)
self.parent = parent self.parent = parent
#self.gladefile = dcommon.get_glade("dgtkpopups.glade") self.tray = gtk.StatusIcon()
self.set_from_file(dcommon.get_pixmap("deluge32.png")) ## uncomment later
self.set_tooltip("Deluge Bittorrent Client") ##self.gladefile = dcommon.get_glade("dgtkpopups.glade")
self.tray.set_from_file(dcommon.get_pixmap("deluge32.png"))
self.tray.set_tooltip("Deluge Bittorrent Client")
class AboutDialog(gtk.AboutDialog): class AboutDialog:
def __init__(self): def __init__(self):
pass 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 show(self, arg=None):
self.abt.show_all()
self.abt.run()
self.abt.hide_all()
class DelugeColumn(gtk.TreeViewColumn): class DelugeColumn(gtk.TreeViewColumn):
def __init__(self, title=None, renderer=None): def __init__(self, title=None, renderer=None):