[POS-commit] CVS: Kiwi/tests test_CListDelegate.py,1.29,1.30

Christian Reis kiko at async.com.br
Fri Feb 7 12:12:53 BRDT 2003


Update of /cvs/Kiwi/tests
In directory anthem:/tmp/cvs-serv21733/tests

Modified Files:
	test_CListDelegate.py 
Log Message:
Support CList sorting by datetime. I also fixed a bunch of small issues
when using None values as parts of a list, and initialized pixmap_rspecs
correctly. Note to users: Pay attention to Kiwi warnings, they are
important!


Index: test_CListDelegate.py
===================================================================
RCS file: /cvs/Kiwi/tests/test_CListDelegate.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- test_CListDelegate.py	5 Feb 2003 18:06:04 -0000	1.29
+++ test_CListDelegate.py	7 Feb 2003 13:12:50 -0000	1.30
@@ -2,6 +2,7 @@
 import sys
 sys.path.insert(0,"..")
 from types import StringType
+from mx import DateTime
 
 from Kiwi.Delegates import CListDelegate, Column
 from Kiwi.FrameWork import Model
@@ -43,7 +44,7 @@
     print cp.get_selected()
 
 class Person(Model):
-    def __init__(self, name, address, age, sex, salary, cool, true):
+    def __init__(self, name, address, age, sex, salary, cool, true, date):
         Model.__init__(self)
         self.name = name
         self.address = address
@@ -52,6 +53,7 @@
         self.salary = salary
         self.cool = cool
         self.true = true
+        self.date = date
 
 # This text explains one pretty interesting `feature' here. Normally, when
 # a value of None is inserted as an instance value, the column will show
@@ -78,25 +80,30 @@
 # Build list of instances
 pl = []
 p = Person("Christian Robottom Reis", "SHIS QL 20 Conj. 4 Casa 18 Lago Sul",
-           23, None, 443242.33, 1, TRUE)
+           23, None, 443242.33, 1, TRUE, DateTime.now())
 pl.append(p)
 p = Person("Johan Dahlin", "R. Thomaz Antonio Gonzaga 75 Ap. 22",
-           2, "M", 223.33, 2, FALSE)
+           2, "M", 223.33, 2, FALSE, DateTime.DateFrom("16 February 1976"))
 pl.append(p)
 # Pedro here is an example: we insert None as his value for "cool", but
 # it is read out as being 3 because of the pixhash. This prints out a
 # warning.
-p = Person("Pedro Bó", None, 21, "X", 666.66, None, None)
+p = Person("Pedro Bó", None, 21, "X", 666.66, 2, None,
+            DateTime.DateFrom("3 May 1977"))
 pl.append(p)
-p = Person("Xico Sergio", None, 99, "X", None, 0, None)
+p = Person("Xico Sergio", None, 99, "X", 1, 0, None,
+           DateTime.DateFrom("4 March 1949"))
 pl.append(p)
 # Manuela is an authentic user of the empty "cool": she supplies the
 # value 3.
 p = Person("Manuela Tiça", "R. dos Carvalhos, 532, Santa Rita do Passa Quatro",
-           84, "M", 11.33, 3, TRUE)
+           84, "M", None, 3, TRUE, DateTime.DateFrom("6 September 1953"))
+pl.append(p)
+p = Person("Maria Juana", "Foo me Foo", None, "X", None, 1, TRUE,
+            None)
 pl.append(p)
 p = Person("Manuela Tiça", "R. dos Carvalhos, 532, Santa Rita do Passa Quatro",
-           92, "M", 11.03, 6, FALSE)
+           92, "M", 11.03, 6, FALSE, DateTime.DateFrom("7 September"))
 del p.name
 pl.append(p)
 
@@ -104,14 +111,15 @@
                    Column("address", tooltip="foobar"),
                    Column("age", format="%03d"),
                    Column("sex"),
-                   Column("salary")]
+                   Column("salary"),
+                   Column("date")]
 
 columns = [ Column(attribute='name', title='Name', visible=0, justify=0, 
                         format=None, width=132, sorted=0, order=-1), 
             Column(attribute='address', title='Address', visible=1, justify=0, 
-                        format=None, width=288, sorted=1, order=0, tooltip="foobar"), 
+                        format=None, width=188, sorted=1, order=0, tooltip="foobar"), 
             Column(attribute='age', title='Age', visible=1, justify=1, 
-                        format='%03d', width=38, sorted=0, order=-1), 
+                        width=38, sorted=0, order=-1), 
             Column(attribute='sex', title='Sex', visible=1, justify=0, 
                         format=None, width=27, sorted=0, order=-1), 
             Column(attribute='salary', title='Salary', visible=1, justify=1, 
@@ -119,7 +127,8 @@
             Column("cool", tooltip="noogie", title_pixmap="foo.xpm", 
                     title="Foo XPM", pixmap_spec=pixhash),
             Column("true", title_pixmap="bar.xpm", 
-                    title="Bar XPM", pixmap_spec=pixhash2)
+                    title="Bar XPM", pixmap_spec=pixhash2),
+            Column("date", title="DATE MOO")
            ]
 
 try:
@@ -137,7 +146,7 @@
 columns_simple[3].type = StringType
 columns[3].type = StringType
 
-cp_fake = CListDelegate(columns_simple, pl[:-1])
+cp_fake = CListDelegate(columns_simple, pl[:-2])
 
 cp = CListDelegate(columns, pl[:-1])
 cp = CListDelegate(columns, handler=select_row, mode=gtk.SELECTION_EXTENDED)



More information about the POS-commit mailing list