[POS-commit] r98 - in Kiwi2/examples: . NewsForm

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


Author: lgs
Date: 2005-03-10 14:07:45 -0300 (Thu, 10 Mar 2005)
New Revision: 98

Added:
   Kiwi2/examples/NewsForm/
   Kiwi2/examples/NewsForm/newsform.glade
   Kiwi2/examples/NewsForm/newsform.py
Log:
	* examples/* adapt examples to work with the new changes
	
	* Kiwi2/Controllers.py: don't use string module and ListType and
	TupleType.

	* Kiwi2/utils.py: put here some useful functions that are needed from 
	several different places.

	* Kiwi2/Widgets/List.py: 
	* Kiwi2/Widgets/Entry.py: 
	* Kiwi2/Widgets/Label.py: 
	* Kiwi2/Widgets/__init__.py: 
	* Kiwi2/Widgets/WidgetProxy.py: new module to keep the KiwiWidgets.
	These widgets inherit from a gtk widget and from WidgetProxyMixin,
	which provides the functionality to work together with the Proxy
	Kiwi Framework class.

	* Kiwi2/__init__.py: move some utility functions to utils.py and
	better API of gladepath

	* Kiwi2/Delegates.py: remove GladeDelegate and GladeSlaveDelegate and
	put more arguments to Delegate and SlaveDelegate so we keep the
	same functionality.

	* Kiwi2/Views.py: remove GladeView and GladeSlaveView. Rename 
	AbstractView to SlaveView so now we just have SlaveView and BaseView
	and they now how to handle glade files if the user gives them the
	apropiate constructor argument.
	Also, add add_proxy method to the views and make them work with
	proxies by composition.

	* Kiwi2/Proxies.py: change the VirtualProxy class to be the only Proxy
	class and work by composition of the View classes

Added: Kiwi2/examples/NewsForm/newsform.glade
===================================================================
--- Kiwi2/examples/NewsForm/newsform.glade	2005-03-10 17:07:25 UTC (rev 97)
+++ Kiwi2/examples/NewsForm/newsform.glade	2005-03-10 17:07:45 UTC (rev 98)
@@ -0,0 +1,102 @@
+<?xml version="1.0" ?>
+<glade-interface>
+    <requires lib="Kiwi2.Widgets"/>
+    <widget class="GtkWindow" id="newsform">
+        <property name="role"></property>
+        <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property>
+        <property name="title" context="True" translatable="True">News Editor</property>
+        <child>
+            <widget class="GtkTable" id="table1">
+                <property name="row_spacing">6</property>
+                <property name="column_spacing">6</property>
+                <property name="border_width">6</property>
+                <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property>
+                <property name="n_rows">3</property>
+                <property name="n_columns">2</property>
+                <property name="visible">True</property>
+                <child>
+                    <widget class="Kiwi2+Widgets+Entry+Entry" id="url">
+                        <property name="model_attribute">url</property>
+                        <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property>
+                        <property name="can_focus">True</property>
+                        <property name="data_type">str</property>
+                        <property name="visible">True</property>
+                    </widget>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="top_attach">2</property>
+                        <property name="right_attach">2</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="Kiwi2+Widgets+Entry+Entry" id="author">
+                        <property name="model_attribute">author</property>
+                        <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property>
+                        <property name="can_focus">True</property>
+                        <property name="data_type">str</property>
+                        <property name="visible">True</property>
+                    </widget>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="right_attach">2</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="Kiwi2+Widgets+Entry+Entry" id="title">
+                        <property name="model_attribute">title</property>
+                        <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property>
+                        <property name="can_focus">True</property>
+                        <property name="data_type">str</property>
+                        <property name="visible">True</property>
+                    </widget>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="GtkLabel" id="label1">
+                        <property name="pattern" context="True" translatable="True"></property>
+                        <property name="label" context="True" translatable="True">_Title:</property>
+                        <property name="use_underline">True</property>
+                        <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property>
+                        <property name="xalign">1.0</property>
+                        <property name="visible">True</property>
+                    </widget>
+                    <packing/>
+                </child>
+                <child>
+                    <widget class="GtkLabel" id="label2">
+                        <property name="pattern" context="True" translatable="True"></property>
+                        <property name="label" context="True" translatable="True">_Author:</property>
+                        <property name="use_underline">True</property>
+                        <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property>
+                        <property name="xalign">1.0</property>
+                        <property name="visible">True</property>
+                    </widget>
+                    <packing>
+                        <property name="bottom_attach">2</property>
+                        <property name="top_attach">1</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="GtkLabel" id="label3">
+                        <property name="pattern" context="True" translatable="True"></property>
+                        <property name="label" context="True" translatable="True">_URL:</property>
+                        <property name="use_underline">True</property>
+                        <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property>
+                        <property name="xalign">1.0</property>
+                        <property name="visible">True</property>
+                    </widget>
+                    <packing>
+                        <property name="bottom_attach">3</property>
+                        <property name="top_attach">2</property>
+                    </packing>
+                </child>
+            </widget>
+        </child>
+    </widget>
+</glade-interface>

Added: Kiwi2/examples/NewsForm/newsform.py
===================================================================
--- Kiwi2/examples/NewsForm/newsform.py	2005-03-10 17:07:25 UTC (rev 97)
+++ Kiwi2/examples/NewsForm/newsform.py	2005-03-10 17:07:45 UTC (rev 98)
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+from Kiwi2 import Views
+from Kiwi2.initgtk import gtk, quit_if_last
+
+# Empty model; GladeProxy will use it to hold the attributes
+class NewsItem:
+    """An instance representing an item of news. 
+       Attributes: title, author, url"""
+    pass
+
+item = NewsItem()
+my_widgets = ["title", "author", "url"]
+view = Views.BaseView(gladefile="newsform", widgets=my_widgets,
+                      delete_handler=quit_if_last)
+view.add_proxy(item, my_widgets)
+view.focus_topmost()
+view.show()
+gtk.main() # runs till window is closed as per delete_handler
+
+print 'Item: "%s" (%s) %s' % (item.title, item.author, item.url)


Property changes on: Kiwi2/examples/NewsForm/newsform.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the POS-commit mailing list