basic work, gui runs

This commit is contained in:
Zach Tibbitts 2006-11-28 22:28:37 +00:00
parent 64bf082308
commit d6dd893c71
4 changed files with 689 additions and 592 deletions

25
dcommon.py Normal file
View File

@ -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"

13
deluge.py Normal file
View File

@ -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

59
delugegtk.py Executable file
View File

@ -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()

File diff suppressed because it is too large Load Diff