misc work, large amount of work still to be done

This commit is contained in:
Zach Tibbitts 2006-12-21 07:28:55 +00:00
parent 919b192dd4
commit 520a819ae4
3 changed files with 812 additions and 850 deletions

View File

@ -54,6 +54,7 @@ class DelugeGTK:
## File Menu
"new_torrent": self.new_torrent,
"add_torrent": self.add_torrent,
## Edit Menu
"pref_clicked": self.prf.show_pref,
"plugins_clicked": self.prf.show_plugins,
## Torrent Menu
@ -66,8 +67,8 @@ class DelugeGTK:
## 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.store = gtk.ListStore(str)
self.torrent_view.set_model(self.store)
## Still a lot of work to be done here,
@ -81,11 +82,11 @@ class DelugeGTK:
## Deluge's code (up to 0.4) got way out of
## hand.
self.name_column = dgtk.TextColumn("Name")
self.name_column = dgtk.TextColumn("Name", 0)
self.torrent_view.append_column(self.name_column)
self.progress_column = dgtk.ProgressColumn("Progress")
self.progress_column = dgtk.ProgressColumn("Progress", 1)
self.torrent_view.append_column(self.progress_column)
self.check_column = dgtk.ToggleColumn("Enabled")
self.check_column = dgtk.ToggleColumn("Enabled", 2)
self.torrent_view.append_column(self.check_column)

37
dgtk.py
View File

@ -80,14 +80,18 @@ class PreferencesDialog:
self.notebook.set_current_page(2)
self.prf.run()
self.prf.hide_all()
## Columns still need work, but should be easy now that I've worked out
## liststores and treeviews.
## Most likely will get rid of Objects for columns, and instead revert to
## a more organized form of the old add_column method, which will properly
## create and add the column and in addition, return that column to the
## calling function.
class TextColumn(gtk.TreeViewColumn):
def __init__(self, title):
def __init__(self, title, cid):
gtk.TreeViewColumn.__init__(self, title, gtk.CellRendererText())
def set_value(self, string):
pass
def show(self):
self.set_visible(True)
@ -95,12 +99,14 @@ class TextColumn(gtk.TreeViewColumn):
self.set_visible(False)
class ToggleColumn(gtk.TreeViewColumn):
def __init__(self, title):
gtk.TreeViewColumn.__init__(self, title, gtk.CellRendererToggle())
def set_value(self, value):
pass
def __init__(self, title, cid):
self.renderer = gtk.CellRendererToggle()
gtk.TreeViewColumn.__init__(self, title, self.renderer, value=cid)
self.set_resizable(True)
self.set_sort_column_id(cid)
self.set_expand(False)
#renderer.connect("toggled", toggledSignal, cid)
def show(self):
self.set_visible(True)
@ -108,11 +114,12 @@ class ToggleColumn(gtk.TreeViewColumn):
self.set_visible(False)
class ProgressColumn(gtk.TreeViewColumn):
def __init__(self, title):
gtk.TreeViewColumn.__init__(self, title, gtk.CellRendererProgress())
def set_value(self, progress):
pass
def __init__(self, title, cid):
self.renderer = gtk.CellRendererProgress()
gtk.TreeViewColumn.__init__(self, title, self.renderer, value=cid)
self.set_resizable(True)
self.set_sort_column_id(cid)
self.set_expand(True)
def show(self):
self.set_visible(True)

File diff suppressed because it is too large Load Diff