[POS-commit] CVS: Kiwi/Kiwi Basic.py,1.17,1.18 Delegates.py,1.87,1.88 Menu.py,1.26,1.27 Proxies.py,1.42,1.43 UI.py,1.12,1.13 Views.py,1.75,1.76 __init__.py,1.35,1.36

Christian Reis kiko at async.com.br
Mon Feb 3 18:28:34 BRDT 2003


Update of /cvs/Kiwi/Kiwi
In directory anthem:/tmp/cvs-serv31370/Kiwi

Modified Files:
	Basic.py Delegates.py Menu.py Proxies.py UI.py Views.py 
	__init__.py 
Log Message:
Change order of imports, clean up exceptions (part of bug 189) and
remove backwards compatibility cruft.


Index: Basic.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/Basic.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Basic.py	10 Dec 2002 21:35:07 -0000	1.17
+++ Basic.py	3 Feb 2003 19:28:32 -0000	1.18
@@ -49,7 +49,7 @@
         # changed to tuples with backwards compat. 
         self.clear_list()
         if type(data) is not type( {} ):
-            raise "Requires a dictionary as parameter."
+            raise TypeError, "Requires a dictionary as parameter."
         for l in data.keys():
             self.append_item(l,data[l])
         self.entry.set_text("")

Index: Delegates.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/Delegates.py,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- Delegates.py	3 Feb 2003 19:09:22 -0000	1.87
+++ Delegates.py	3 Feb 2003 19:28:32 -0000	1.88
@@ -24,12 +24,14 @@
 
 """Defines the Delegate classes that are included in the Kiwi Framework."""
 
-import gtk, os, string, sys
-from List import CList, SortedCList
+import os, string, sys
+
 from Views import SlaveView, GladeView, BaseView, gladepath, find_in_gladepath
+from List import CList, SortedCList
 from FrameWork import BaseController
 from types import IntType, FloatType, ListType, DictType, TupleType, \
                   StringType, NoneType
+import gtk
 from gtk import TRUE, FALSE
 
 def _warn(msg):

Index: Menu.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/Menu.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- Menu.py	24 Jan 2003 20:13:35 -0000	1.26
+++ Menu.py	3 Feb 2003 19:28:32 -0000	1.27
@@ -238,7 +238,7 @@
         for c in children:
             if c.get_data("_kiwi_data") == data:
                 return children.index(c)
-        raise "Data %s not in OptionMenu" % data
+        raise KeyError, "Data %s not in OptionMenu" % data
 
     def select_by_data(self, data, activate=1):
         """Selects the optionmenu's item which has the data specified"""

Index: Proxies.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/Proxies.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- Proxies.py	30 Jan 2003 21:00:14 -0000	1.42
+++ Proxies.py	3 Feb 2003 19:28:32 -0000	1.43
@@ -29,8 +29,7 @@
 model.
 """
 
-import string, gtk, sys, copy
-from gtk import TRUE, FALSE
+import string, sys, copy
 from types import *
 
 from Views import SlaveView, GladeView, BaseView
@@ -39,6 +38,9 @@
 from List import SortedCList
 from Menu import OptionMenu
 from UI import get_all_methods
+
+import gtk
+from gtk import TRUE, FALSE
 
 PROXY_WARNINGS = 1
 ATTR_WARNINGS = 0

Index: UI.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/UI.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- UI.py	2 Jan 2003 18:04:30 -0000	1.12
+++ UI.py	3 Feb 2003 19:28:32 -0000	1.13
@@ -61,12 +61,12 @@
     for k in components.keys():
         w  = tree.get_widget(k)
         if not w:
-            raise "Widget to be replaced not found"
+            raise AttributeError, "Widget to be replaced not found"
         p = w['parent']
         if not p:
-            raise "Widget to be replaced not inside container"
+            raise AttributeError, "Widget to be replaced not inside container"
         if not isinstance(p, gtk.GtkEventBox):
-            raise "Widget to be replaced must be wrapped in EventBox"
+            raise AttributeError, "Widget to be replaced must be wrapped in EventBox"
         p.remove(w)
         s = components[k]
         if s['parent']:
@@ -99,7 +99,8 @@
             dict = compiler(ctl, methods, par)
             tree.signal_autoconnect(dict)
         else:
-            raise "H0rked Basewindow"
+            # XXX: yuck
+            raise AssertionError, "H0rked Basewindow"
 
 # Compiles methods, taking care to attach the prefix to the handler name
 # for glade's delight.

Index: Views.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/Views.py,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- Views.py	31 Jan 2003 03:03:48 -0000	1.75
+++ Views.py	3 Feb 2003 19:28:32 -0000	1.76
@@ -28,14 +28,16 @@
 are the base of Delegates and Proxies.
 """
 
-import gtk, libglade, UI, os, string, re, sys
+import os, string, re, sys
+from Kiwi import _non_interactive
 from Basic import Label, Combo, Statusbar, Entry
 from List import CList, SortedCList
 from Menu import OptionMenu
 from FrameWork import BaseController
 from types import IntType, FloatType, ListType, DictType, TupleType, StringType
+
+import gtk, libglade, UI
 from gtk import TRUE, FALSE
-from Kiwi import _non_interactive
 
 _widget_map = {
     gtk.GtkLabel : Label,
@@ -515,7 +517,8 @@
 eventbox) is still supported for compatibility reasons but will print a
 warning."""
         if not isinstance(slave, SlaveView):
-            raise "slave specified must be a View, found %s" % type(slave)
+            raise TypeError, "slave specified must be a View, found %s" \
+                  % type(slave)
         shell = slave.get_toplevel()
 
         if isinstance(shell, gtk.GtkWindow): # View with toplevel Window
@@ -526,7 +529,8 @@
 
         placeholder  = self.tree.get_widget(name)
         if not placeholder:
-            raise AttributeError,"slave container widget `%s' not found" % name
+            raise AttributeError, \
+                  "slave container widget `%s' not found" % name
         parent = placeholder['parent']           
 
         if isinstance(placeholder, gtk.GtkEventBox):

Index: __init__.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/__init__.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- __init__.py	31 Jan 2003 02:37:57 -0000	1.35
+++ __init__.py	3 Feb 2003 19:28:32 -0000	1.36
@@ -177,24 +177,6 @@
 def _warn(msg):
     sys.stderr.write("Kiwi warning: "+msg+"\n")
 
-class BaseController(FrameWork.BaseController):
-    """Backwards-compatibility wrapper kept here; use
-Framework.BaseController instead."""
-    def __init__(self, *args):
-        _warn("""
-Kiwi.BaseController has been moved to FrameWork.BaseController; update
-your code, this will become an error in 0.5.1""")
-        apply(FrameWork.BaseController.__init__, (self,) + args)
-
-class GladeView(Views.GladeView):
-    """Backwards-compatibility wrapper kept here; use Views.GladeView
-instead."""
-    def __init__(self, *args):
-        _warn("""
-Kiwi.BaseController has been moved to FrameWork.BaseController; update
-your code, this will become an error in 0.5.1""")
-        apply(Views.GladeView.__init__, (self,) + args)
-
 def get_pixmap(win, pixmap):
     pixmap = Views.find_in_gladepath(pixmap)
     return gtk.GtkPixmap(win, pixmap).get()



More information about the POS-commit mailing list