[POS-commit] Kiwi/tests/Proxies NoModel.py,NONE,1.1 None.py,1.1,1.2
kiko at async.com.br
kiko at async.com.br
Thu May 22 19:13:05 BRST 2003
Update of /cvs/Kiwi/tests/Proxies
In directory anthem:/tmp/cvs-serv14248/tests/Proxies
Modified Files:
None.py
Added Files:
NoModel.py
Log Message:
Implement a change requested by Bruno Trevisan in bug 656: allow a null
model to be passed into Proxy. We just postpone attaching signals to
widgets and do it when new_model() is called. This is specially useful
for forms which need to use a selector to identify which object should
be displayed.
Added a test for the new functionality and updated docs on an old test
that has a bad name.
--- NEW FILE: NoModel.py ---
#!/usr/bin/env python
#
# Tests creating a Proxy with no initial model, and then adding one later
#
import sys, pprint
sys.path.insert(0, "../..")
DEBUG = 0
if len(sys.argv) > 1:
DEBUG = 1
from Kiwi.initgtk import gtk
from Kiwi.Proxies import Proxy
from Kiwi.FrameWork import Model
class Foo(Model):
pass
class XProxy(Proxy):
widgets = [":A"]
def __init__(self, model=None, flag=0):
self._build()
self.set_numeric("A")
Proxy.__init__(self, model, delete_handler=gtk.mainquit)
self.A.grab_focus()
def _build(self):
self.win = gtk.GtkWindow()
self.A = gtk.GtkEntry()
self.win.add(self.A)
c = XProxy()
f = Foo()
c.new_model(f)
assert f.A == 0, f.A # XXX: Is this really expected?
f = Foo()
f.A = 10
c.new_model(f)
assert f.A == 10, f.A
t = c.A.get_text()
assert t == "10", t
print "NoModel ok"
if DEBUG:
c.show_all()
gtk.mainloop()
pprint.pprint(f.__dict__)
Index: None.py
===================================================================
RCS file: /cvs/Kiwi/tests/Proxies/None.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- None.py 5 May 2003 11:57:08 -0000 1.1
+++ None.py 22 May 2003 22:13:03 -0000 1.2
@@ -1,4 +1,10 @@
#!/usr/bin/env python
+
+#
+# Tests creating a Proxy against a widget that is not supported by Glade
+# (a Frame).
+#
+
import sys, pprint
sys.path.insert(0, "../..")
@@ -6,8 +12,6 @@
if len(sys.argv) > 1:
DEBUG = 1
-from mx import DateTime
-
from Kiwi.initgtk import gtk
from Kiwi.Proxies import Proxy
from Kiwi.FrameWork import Model
@@ -30,5 +34,5 @@
try:
c = NoProxy(f)
raise AssertionError
-except TypeError:
+except TypeError:
print "None ok"
More information about the POS-commit
mailing list