[POS-commit] r71 - in Kiwi2: . Kiwi2 examples/HeyPlanet
Lorenzo Gil Sanchez
lgs at async.com.br
Sat Mar 5 18:22:10 BRT 2005
Author: lgs
Date: 2005-03-05 18:22:10 -0300 (Sat, 05 Mar 2005)
New Revision: 71
Modified:
Kiwi2/ChangeLog
Kiwi2/Kiwi2/Views.py
Kiwi2/examples/HeyPlanet/heyglade3.py
Log:
* Kiwi2/Views.py (GazpachoWidgetTree.__init__): move the gladename
and gladefile class attributes to GladeSlaveView and GladeView. Fix
#1843
(GladeSlaveView, GladeView):
* examples/HeyPlanet/heyglade3.py (MyView.gladefile): provide an
example of setting the gladefile as a class attribute
Modified: Kiwi2/ChangeLog
===================================================================
--- Kiwi2/ChangeLog 2005-03-05 21:01:17 UTC (rev 70)
+++ Kiwi2/ChangeLog 2005-03-05 21:22:10 UTC (rev 71)
@@ -1,5 +1,13 @@
2005-03-05 Lorenzo Gil Sanchez <lgs at sicem.biz>
+ * Kiwi2/Views.py (GazpachoWidgetTree.__init__): move the gladename
+ and gladefile class attributes to GladeSlaveView and GladeView. Fix
+ #1843
+ (GladeSlaveView, GladeView):
+
+ * examples/HeyPlanet/heyglade3.py (MyView.gladefile): provide an
+ example of setting the gladefile as a class attribute
+
* Kiwi2/Delegates.py: add a keyactions argument to all the Delegates
so we can use it for the Controller
Modified: Kiwi2/Kiwi2/Views.py
===================================================================
--- Kiwi2/Kiwi2/Views.py 2005-03-05 21:01:17 UTC (rev 70)
+++ Kiwi2/Kiwi2/Views.py 2005-03-05 21:22:10 UTC (rev 71)
@@ -934,13 +934,10 @@
from gazpacho.loader import widgettree
class GazpachoWidgetTree:
- gladefile = None
- gladename = None
tree = None
- def __init__(self, view, gladefile, widgets):
+ def __init__(self, view, gladefile, widgets, gladename=None):
self.view = view
- gladefile = gladefile or self.gladefile
widgets = (widgets or self.view.widgets or [])[:]
if not gladefile:
@@ -955,8 +952,8 @@
gladefile = find_in_gladepath(filename + ".glade")
self.tree = widgettree.WidgetTree(gladefile)
- if self.gladename is None:
- self.gladename = filename
+ self.gladename = gladename or filename
+
# Attach widgets in the widgetlist to the view specified, so
# widgets = [label1, button1] -> view.label1, view.button1
@@ -1092,6 +1089,8 @@
will be assigned to the placeholder's original contents.
"""
container_name = None
+ gladefile = None
+ gladename = None
def __init__(self, gladefile=None, container_name=None, widgets=None):
"""
Creates a new GladeSlaveView.
@@ -1117,7 +1116,10 @@
_warn("GladeSlaveView does not use the `toplevel' attribute; "
"instead, provide a container_name")
- self.gazpacho = GazpachoWidgetTree(self, gladefile, widgets)
+ gladefile = gladefile or self.gladefile
+
+ self.gazpacho = GazpachoWidgetTree(self, gladefile, widgets,
+ self.gladename)
container_name = container_name or self.container_name \
or self.gazpacho.gladename
@@ -1148,6 +1150,8 @@
Internally it has a instance of GazpachoWidgetTree to do the
the work related to the glade file
"""
+ gladefile = None
+ gladename = None
def __init__(self, gladefile=None, toplevel_name=None,
delete_handler=None, widgets=None):
@@ -1171,8 +1175,10 @@
from the glade file and attach to the view as instance
variables
"""
+ gladefile = gladefile or self.gladefile
- self.gazpacho = GazpachoWidgetTree(self, gladefile, widgets)
+ self.gazpacho = GazpachoWidgetTree(self, gladefile, widgets,
+ self.gladename)
name = toplevel_name or self.gazpacho.gladename
self.win = self.gazpacho.tree.get_widget(name)
Modified: Kiwi2/examples/HeyPlanet/heyglade3.py
===================================================================
--- Kiwi2/examples/HeyPlanet/heyglade3.py 2005-03-05 21:01:17 UTC (rev 70)
+++ Kiwi2/examples/HeyPlanet/heyglade3.py 2005-03-05 21:22:10 UTC (rev 71)
@@ -4,9 +4,9 @@
class MyView(Views.GladeView):
widgets = ["the_label"] # widgets list
+ gladefile = "hey"
def __init__(self):
Views.GladeView.__init__(self,
- gladefile="hey",
delete_handler=quit_if_last)
text = self.the_label.get_text() # attached by constructor
self.the_label.set_markup('<b>%s</b>' % text)
@@ -15,4 +15,4 @@
app = MyView()
app.show()
-gtk.main()
\ No newline at end of file
+gtk.main()
More information about the POS-commit
mailing list