[POS-commit] r100 - in Kiwi2: . Kiwi2 Kiwi2/Widgets

Lorenzo Gil Sanchez lgs at async.com.br
Thu Mar 10 14:42:17 BRT 2005


Author: lgs
Date: 2005-03-10 14:42:16 -0300 (Thu, 10 Mar 2005)
New Revision: 100

Modified:
   Kiwi2/ChangeLog
   Kiwi2/Kiwi2/Views.py
   Kiwi2/Kiwi2/Widgets/List.py
Log:
	* Kiwi2/Widgets/List.py (List): 
	* Kiwi2/Views.py (SlaveView): use Johan gsignal and gproperty functions
	to make	the code more readable

	* Kiwi2/Widgets/List.py: remove some print debugging stuff

Modified: Kiwi2/ChangeLog
===================================================================
--- Kiwi2/ChangeLog	2005-03-10 17:08:51 UTC (rev 99)
+++ Kiwi2/ChangeLog	2005-03-10 17:42:16 UTC (rev 100)
@@ -1,5 +1,11 @@
 2005-03-10  Lorenzo Gil Sanchez  <lgs at sicem.biz>
 
+	* Kiwi2/Widgets/List.py (List): 
+	* Kiwi2/Views.py (SlaveView): use Johan gsignal and gproperty functions
+	to make	the code more readable
+
+	* Kiwi2/Widgets/List.py: remove some print debugging stuff
+
 	* Kiwi2/Views.py (find_in_gladepath): fixed a typo
 
 	* examples/* adapt examples to work with the new changes

Modified: Kiwi2/Kiwi2/Views.py
===================================================================
--- Kiwi2/Kiwi2/Views.py	2005-03-10 17:08:51 UTC (rev 99)
+++ Kiwi2/Kiwi2/Views.py	2005-03-10 17:42:16 UTC (rev 100)
@@ -30,6 +30,7 @@
 import os, string, re, sys
 
 from Kiwi2 import _warn, get_gladepath
+from Kiwi2.utils import gsignal
 from Kiwi2.initgtk import _non_interactive, gtk, gobject, quit_if_last
 from Kiwi2.Proxies import Proxy
 
@@ -189,10 +190,8 @@
     gladefile = None
     gladename = None
 
-    __gsignals__ = {
-        # This signal is emited when the view wants to return a result value
-        'result' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (object,))
-        }
+    # This signal is emited when the view wants to return a result value
+    gsignal("result", object)
     
     def __init__(self, toplevel=None, widgets=None, gladefile=None,
                  gladename=None, toplevel_name=None):

Modified: Kiwi2/Kiwi2/Widgets/List.py
===================================================================
--- Kiwi2/Kiwi2/Widgets/List.py	2005-03-10 17:08:51 UTC (rev 99)
+++ Kiwi2/Kiwi2/Widgets/List.py	2005-03-10 17:42:16 UTC (rev 100)
@@ -26,6 +26,7 @@
 from Kiwi2 import ValueUnset
 from Kiwi2.Widgets import str2bool
 from Kiwi2.initgtk import gtk, gobject
+from Kiwi2.utils import gsignal, gproperty
 
 # Minimum number of rows where we show busy cursor when sorting numeric columns
 MANY_ROWS = 1000
@@ -225,32 +226,25 @@
     """An enhanced version of GtkTreeView, which provides pythonic wrappers
     for accessing rows, and optional facilities for column sorting (with
     types) and column selection."""
-    __gsignals__ = {
-        'selection-change' : (gobject.SIGNAL_RUN_LAST, None, ()),
-        'double-click' : (gobject.SIGNAL_RUN_LAST, None, (object,)),
-        }
+    gsignal('selection-change')
+    gsignal('double-click', object)
 
-    __gproperties__ = {
-        # this property is used to serialize the columns of a List. The format
-        # is a big string with '^' as the column separator and '|' as the field
-        # separator
-        # Each column has the following fields:
-        #  - attribute: name of the model attribute this column shows
-        #  - title: the title that shows in the column header. Default to ''
-        #  - data_type: one of 'str', 'int', 'float', 'date'. Default to str
-        #  - visible: if this column is visible or not. Default to True
-        #  - justify: one of 'left', 'center', 'right'. Default to 'left'
-        #  - tooltip: the tooltip on the column header. Deafult to ''
-        #  - format: string format for numeric types. Deafult to ''
-        #  - width: the number of pixels for the widget. Default to 0, which
-        #    means autosize
-        #  - sorted: if the data is sorted by this column. Default to False
-        #  - order: one of 'ascending', 'descending' or ''. Default to ''
-        'column-definitions' : (str, 'ColumnDefinitions',
-                                'A string with the columns definitions',
-                                '',
-                                gobject.PARAM_READWRITE),
-        }
+    # this property is used to serialize the columns of a List. The format
+    # is a big string with '^' as the column separator and '|' as the field
+    # separator
+    # Each column has the following fields:
+    #  - attribute: name of the model attribute this column shows
+    #  - title: the title that shows in the column header. Default to ''
+    #  - data_type: one of 'str', 'int', 'float', 'date'. Default to str
+    #  - visible: if this column is visible or not. Default to True
+    #  - justify: one of 'left', 'center', 'right'. Default to 'left'
+    #  - tooltip: the tooltip on the column header. Deafult to ''
+    #  - format: string format for numeric types. Deafult to ''
+    #  - width: the number of pixels for the widget. Default to 0, which
+    #    means autosize
+    #  - sorted: if the data is sorted by this column. Default to False
+    #  - order: one of 'ascending', 'descending' or ''. Default to ''
+    gproperty('column-definitions', str, nick="ColumnDefinitions")
     
     def __init__(self, column_definitions=[],
                  instance_list=None,
@@ -269,10 +263,6 @@
         self.treeview.show()
         self.add(self.treeview)
 
-        print 'INIT:'
-        print 'treeview:', self.treeview
-        print 'selection:', self.treeview.get_selection()
-
         self.treeview.set_rules_hint(True)
 
         # these tooltips are used for the columns
@@ -797,9 +787,6 @@
         self.treeview.get_column(column_index).set_visible(visibility)
 
     def get_selection_mode(self):
-        print 'GET SELECTION MODE:'
-        print 'treeview:', self.treeview
-        print 'selection:', self.treeview.get_selection()
         return self.treeview.get_selection().get_mode()
     
     def set_selection_mode(self, mode):



More information about the POS-commit mailing list