diff options
author | Mike Fulbright <msf@redhat.com> | 2002-01-29 22:01:38 +0000 |
---|---|---|
committer | Mike Fulbright <msf@redhat.com> | 2002-01-29 22:01:38 +0000 |
commit | 6c3a88b317773f3f29a92e10b154d85c033e8a7a (patch) | |
tree | fe3914a40e9c806f4def6c00ba45d2e724626d8c /iw/checklist.py | |
parent | c1cb81f614c895d43a2b5c788538ef53e5d13a12 (diff) | |
download | anaconda-6c3a88b317773f3f29a92e10b154d85c033e8a7a.tar.gz anaconda-6c3a88b317773f3f29a92e10b154d85c033e8a7a.tar.xz anaconda-6c3a88b317773f3f29a92e10b154d85c033e8a7a.zip |
move parition_gui to use checklist (dropping clist) and tweaked checklist to be more sane (but needs a better fix than I made)
Diffstat (limited to 'iw/checklist.py')
-rw-r--r-- | iw/checklist.py | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/iw/checklist.py b/iw/checklist.py index 897a67499..3c400dca3 100644 --- a/iw/checklist.py +++ b/iw/checklist.py @@ -22,12 +22,33 @@ class CheckList (gtk.TreeView): """A class (derived from gtk.TreeView) that provides a list of checkbox / text string pairs""" + # override this to make your own columns if necessary + def create_columns(self, columns): + # add the string columns to the tree view widget + for i in range(1, columns + 1): + renderer = gtk.CellRendererText() + column = gtk.TreeViewColumn('Text', renderer, text=i) + column.set_clickable(gtk.FALSE) + self.append_column(column) + # XXX need to handle the multicolumn case better still.... - def __init__ (self, columns = 1): - self.store = gtk.TreeStore(gobject.TYPE_BOOLEAN, - gobject.TYPE_STRING, gobject.TYPE_STRING) + def __init__ (self, columns = 1, custom_store=None): + + if not custom_store: + self.store = gtk.TreeStore(gobject.TYPE_BOOLEAN, + gobject.TYPE_STRING, + gobject.TYPE_STRING) + else: + self.store = custom_store + gtk.TreeView.__init__ (self, self.store) + # XXX we only handle two text columns right now + if custom_store == None and columns > 2: + raise RuntimeError, "CheckList supports a maximum of 2 columns" + + self.columns = columns + self.checkboxrenderer = gtk.CellRendererToggle() column = gtk.TreeViewColumn('', self.checkboxrenderer, active=0) column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) @@ -36,17 +57,7 @@ class CheckList (gtk.TreeView): self.checkboxrenderer.connect ("toggled", self.toggled_item) self.append_column(column) - # XXX we only handle two text columns right now - if columns > 2: - raise RuntimeError, "CheckList supports a maximum of 2 columns" - self.columns = columns - - # add the string columns to the tree view widget - for i in range(1, columns + 1): - renderer = gtk.CellRendererText() - column = gtk.TreeViewColumn('Text', renderer, text=i) - column.set_clickable(gtk.FALSE) - self.append_column(column) + self.create_columns(columns) self.set_rules_hint(gtk.FALSE) self.set_headers_visible(gtk.FALSE) |