--- a/blogic/categories.py Wed Jan 03 18:06:01 2007 -0300
+++ b/blogic/categories.py Wed Jan 03 21:44:53 2007 -0300
@@ -37,11 +37,13 @@
class CategoryView(gtk.TreeView):
"A custom implementation of gtk.TreeView for handle categories."
- def __init__(self, data):
+ def __init__(self, categories):
"""Initialize a gtk.TreeView creating a gtk.ListStore using
the list given.
- data is expected to be a list of tuples of (str, bool, bool, str):
+ categories is expected to be a list of tuples such as
+ (str, bool, bool, str). For instance:
+
[ (id, is_primary, is_secondary, category),
(id, is_primary, is_secondary, category),
...
@@ -55,7 +57,7 @@
gtk.TreeView.__init__(self)
self.primary_path = None
- self.set_model(self._create_model(data))
+ self.set_model(self._create_model(categories))
self._add_columns()
def _create_model(self, data):
@@ -69,7 +71,7 @@
COLUMN_SECONDARY, item[COLUMN_SECONDARY],
COLUMN_NAME, item[COLUMN_NAME])
- if more_than_one_primary:
+ if more_than_one_primary and item[COLUMN_PRIMARY]:
store.set(iter, COLUMN_PRIMARY, False)
store.set(iter, COLUMN_SECONDARY, True)
@@ -156,7 +158,7 @@
"""Implements a dialog to choose categories using the widget
CategoryView.
"""
- def __init__(self, data, title='Choose categories', parent=None,
+ def __init__(self, categories, title='Choose categories', parent=None,
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OK, gtk.RESPONSE_OK)):
@@ -164,7 +166,9 @@
extra parameter (data) wich is used to fill the model
of the widget CategoryView.
- data is expected to be a list of tuples of (str, bool, bool, str):
+ categories is expected to be a list of tuples such as
+ (str, bool, bool, str). For instance:
+
[ (id, is_primary, is_secondary, category),
(id, is_primary, is_secondary, category),
...
@@ -181,7 +185,7 @@
scroll.set_shadow_type(gtk.SHADOW_ETCHED_IN)
scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
- self.treeview = CategoryView(data)
+ self.treeview = CategoryView(categories)
self.treeview.set_rules_hint(True)
scroll.add(self.treeview)
@@ -202,7 +206,7 @@
(3, True, False, 'Urgent')
]
- dialog = CategoryDialog(data=test_data)
+ dialog = CategoryDialog(categories=test_data)
dialog.set_default_size(300,250)
dialog.show_all()
result = dialog.run()