[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/gnuef TODO samples/inventory/README sample...
From: |
James Thompson |
Subject: |
gnue/gnuef TODO samples/inventory/README sample... |
Date: |
Sun, 14 Jan 2001 15:32:38 -0800 |
CVSROOT: /cvs
Module name: gnue
Changes by: James Thompson <address@hidden> 01/01/14 15:32:38
Modified files:
gnuef : TODO
gnuef/samples/inventory: README
gnuef/samples/inventory/forms: company.gfd
gnuef/samples/trigger: trigger.gfd
gnuef/samples/zipcode: states.gfd
gnuef/src : GFForm.py GFObjects.py GFParser.py GFTrigger.py
Added files:
gnuef/samples/location: README
Log message:
Added access to datasources to triggers
Added a sample of using that to query values from a db
Clean up and a few more comments
fixed rollback causing UI corruption
fixed mouse and shift-tab to hidden or readonly fields
CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/TODO.diff?r1=1.38&r2=1.39
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/inventory/README.diff?r1=1.1&r2=1.2
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/inventory/forms/company.gfd.diff?r1=1.1&r2=1.2
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/location/README.diff?r1=NONE&r2=1.1
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/trigger/trigger.gfd.diff?r1=1.5&r2=1.6
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/zipcode/states.gfd.diff?r1=1.8&r2=1.9
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFForm.py.diff?r1=1.60&r2=1.61
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFObjects.py.diff?r1=1.53&r2=1.54
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFParser.py.diff?r1=1.11&r2=1.12
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFTrigger.py.diff?r1=1.9&r2=1.10
Patches:
Index: gnue/gnuef/TODO
diff -u gnue/gnuef/TODO:1.38 gnue/gnuef/TODO:1.39
--- gnue/gnuef/TODO:1.38 Sun Jan 14 10:48:21 2001
+++ gnue/gnuef/TODO Sun Jan 14 15:32:37 2001
@@ -2,7 +2,6 @@
name in []
I've broken msgboxs in triggers
-UI Corruption on rollback if not in first record
**MUST HAVES for 0.1.0
** windows support (ODBC?) [jade]
Index: gnue/gnuef/samples/inventory/README
diff -u gnue/gnuef/samples/inventory/README:1.1
gnue/gnuef/samples/inventory/README:1.2
--- gnue/gnuef/samples/inventory/README:1.1 Sun Jan 14 12:00:13 2001
+++ gnue/gnuef/samples/inventory/README Sun Jan 14 15:32:37 2001
@@ -13,4 +13,7 @@
add_*.sql - adding of groups
remove_*.sql - removing of groups
-When first installing simply create database of your choice and go into psql
and do an \i create_all_tables.sql . This will create all tables and groups
and do the insert of defaults for you.
\ No newline at end of file
+When first installing simply create database of your choice and go into psql
and do an \i create_all_tables.sql . This will create all tables and groups
and do the insert of defaults for you.
+
+Also, the company screen expects that the zipcode database from
+samples/location is installed
Index: gnue/gnuef/samples/inventory/forms/company.gfd
diff -u gnue/gnuef/samples/inventory/forms/company.gfd:1.1
gnue/gnuef/samples/inventory/forms/company.gfd:1.2
--- gnue/gnuef/samples/inventory/forms/company.gfd:1.1 Sun Jan 14 14:00:33 2001
+++ gnue/gnuef/samples/inventory/forms/company.gfd Sun Jan 14 15:32:37 2001
@@ -9,8 +9,9 @@
<width>42</width>
</options>
- <database name="dtbsgnue" provider="postgresql" dbname="gnue"
host="localhost"/>
+ <database name="dtbsgnue" provider="postgresql" dbname="gnue" host="gnue"/>
<datasource name="dtsrccompany" database="dtbsgnue" table="company"
cache="5"/>
+ <datasource name="ziplookup" database="dtbsgnue" table="zipcode"/>
<page>
<block name="blckcompany" datasource="dtsrccompany">
@@ -35,14 +36,14 @@
</entry>
<label text="City" x="1" y="6"/>
- <entry name="ntrycity" field="city" x="1" y="7" width="25"
max_length="40" uppercase="">
+ <entry name="ntrycity" field="city" x="1" y="7" width="25"
max_length="40" uppercase="" readonly="">
<options>
<tip>Please enter the value for city.</tip>
</options>
</entry>
<label text="ST" x="27" y="6"/>
- <entry name="ntrystate" field="state" x="27" y="7" width="3"
max_length="2" uppercase="">
+ <entry name="ntrystate" field="state" x="27" y="7" width="3"
max_length="2" uppercase="" readonly="">
<options>
<tip>Please enter the value for state.</tip>
</options>
@@ -53,6 +54,15 @@
<options>
<tip>Please enter the value for zip code.</tip>
</options>
+ <trigger type ="Pre-FocusOut">
+ziplookup.clear()
+ziplookup.setField(0,"zipcode",self.value,TRUE)
+ziplookup.query()
+state = ziplookup.getField(0,"state")
+city = ziplookup.getField(0,"city")
+blckcompany.fields.ntrycity = city
+blckcompany.fields.ntrystate = state
+ </trigger>
</entry>
<label text="Phone Number" x="1" y="8"/>
Index: gnue/gnuef/samples/trigger/trigger.gfd
diff -u gnue/gnuef/samples/trigger/trigger.gfd:1.5
gnue/gnuef/samples/trigger/trigger.gfd:1.6
--- gnue/gnuef/samples/trigger/trigger.gfd:1.5 Thu Jan 11 22:08:48 2001
+++ gnue/gnuef/samples/trigger/trigger.gfd Sun Jan 14 15:32:37 2001
@@ -29,18 +29,19 @@
<tip>Type Field One's Replacement</tip>
</options>
<trigger type ="Pre-FocusOut">
+block1.fields.one = self.value
#
#User name trigger
#
-import sys
-
-if (block1.fields.one == "") or (block1.fields.two == ""):
- messageValue = "Both Fields One and Two Must Have Data!"
-else:
- messageValue = "Contragulations. You get your own error.\n" +
block2.fields.alter
-
-message = GFMsgBox(self, messageValue)
-message.show()
+#import sys
+#
+#if (block1.fields.one == "") or (block1.fields.two == ""):
+# messageValue = "Both Fields One and Two Must Have Data!"
+#else:
+# messageValue = "Contragulations. You get your own error.\n" +
block2.fields.alter
+#
+#message = GFMsgBox(self, messageValue)
+#message.show()
</trigger>
</entry>
</block>
Index: gnue/gnuef/samples/zipcode/states.gfd
diff -u gnue/gnuef/samples/zipcode/states.gfd:1.8
gnue/gnuef/samples/zipcode/states.gfd:1.9
--- gnue/gnuef/samples/zipcode/states.gfd:1.8 Sat Jan 13 15:24:30 2001
+++ gnue/gnuef/samples/zipcode/states.gfd Sun Jan 14 15:32:37 2001
@@ -9,11 +9,11 @@
</options>
<database name="gnue" provider="postgresql" dbname="gnue" host="gnue"/>
- <datasource name="state" database="gnue" table="state" cache="5"
order_by="state"/>
- <datasource name="cities" database="gnue" table="zipcode" cache="5"
order_by="city"/>
+ <datasource name="dsstate" database="gnue" table="state" cache="5"
order_by="state"/>
+ <datasource name="dscities" database="gnue" table="zipcode" cache="5"
order_by="city"/>
<page>
- <block name="state" datasource="state">
+ <block name="state" datasource="dsstate">
<label text="Code" x="2" y="1"/>
<entry name="state" field="state" x="2" y="2" width="4" height="1"
visibleCount="5"/>
<label text="Description" x="7" y="1"/>
@@ -22,7 +22,7 @@
<!-- Block of cities -->
- <block name="cities" datasource="cities" master="state.state"
detail="state_code">
+ <block name="cities" datasource="dscities" master="state.state"
detail="state_code">
<label text="City" x="2" y="9"/>
<entry name="city" field="city" x="2" y="10" width="20" visibleCount="5"
/>
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.60 gnue/gnuef/src/GFForm.py:1.61
--- gnue/gnuef/src/GFForm.py:1.60 Sun Jan 14 10:48:21 2001
+++ gnue/gnuef/src/GFForm.py Sun Jan 14 15:32:38 2001
@@ -113,10 +113,17 @@
#detailed than this including widgets etc. Also attaches
#named triggers to thier placeholders
self.triggerns={}
+ self.triggerns['TRUE'] = 1
+ self.triggerns['FALSE'] = 0
+
for block in self.blockList:
try:
self.triggerns[block.name] = GFTriggerHelper( block )
except AttributeError: pass
+
+ for key in self.datasourceDictionary.keys():
+ self.triggerns[key] = self.datasourceDictionary[key]
+
self.triggerns['GFMsgBox'] = GFMsgBox
self.walk(self.initTriggers)
@@ -245,6 +252,8 @@
masterBlock,masterField = string.split(block.master,'.')
if masterBlock == self.currentBlock.name:
if not block.isSaved():
+# self.parent.dispatchEvent( GFEvent( 'msgBoxUI',
GFOptions._msgDETAILNOTSAVED) )
+
message = GFMsgBox(self, GFOptions._msgDETAILNOTSAVED )
message.show()
return
@@ -261,6 +270,8 @@
masterBlock,masterField = string.split(block.master,'.')
if masterBlock == self.currentBlock.name:
if not block.isSaved():
+# self.parent.dispatchEvent( GFEvent( 'msgBoxUI',
GFOptions._msgNOTSAVED) )
+
message = GFMsgBox(self, GFOptions._msgNOTSAVED)
message.show()
return
@@ -288,6 +299,8 @@
def executeExit(self, event):
for block in self.blockList:
if not block.isSaved():
+ #self.parent.dispatchEvent( GFEvent( 'msgBoxUI',
GFOptions._msgDETAILNOTSAVED) )
+
message = GFMsgBox(self, GFOptions._msgNOTSAVED)
message.show()
return
@@ -297,11 +310,13 @@
def requestQuery(self, event):
if hasattr(self.currentBlock,"master"):
- message = GFMsgBox(self, "Query from detail blocks currently not
supported")
- message.show()
+ self.parent.dispatchEvent( GFEvent( 'msgBoxUI', "Query from detail
blocks currently not supported"))
+ #message = GFMsgBox(self, "Query from detail blocks currently not
supported")
+ #message.show()
return
for block in self.blockList:
if not block.isSaved():
+# self.parent.dispatchEvent( GFEvent( 'msgBoxUI',
GFOptions._msgNOTSAVED) )
message = GFMsgBox(self, GFOptions._msgNOTSAVED)
message.show()
return
@@ -393,12 +408,13 @@
nextEntry = None
if not self.currentEntry.verifyValue(): return
for object in self.currentEntry.parent.children:
- if object.getObjectType()=='GFEntry': nextEntry = object
+ if object.getObjectType()=='GFEntry' and not hasattr(object,'hidden')
and not hasattr(object,'readonly'):
+ nextEntry = object
keepNext = 0
for object in self.currentEntry.parent.children:
# Put the first field as the next to rollover
- if object.getObjectType()=='GFEntry':
+ if object.getObjectType()=='GFEntry' and not hasattr(object,'hidden')
and not hasattr(object,'readonly'):
if object == self.currentEntry:
break
@@ -422,6 +438,9 @@
# an event sourse
#
def changeFocus(self, event):
+ if event.data.getObjectType()=='GFEntry' and (hasattr(event.data,'hidden')
or hasattr(event.data,'readonly')):
+ return
+
self.currentEntry.processTrigger('Pre-FocusOut')
self.currentEntry.processTrigger('Post-FocusOut')
event.data.processTrigger('Pre-FocusIn')
Index: gnue/gnuef/src/GFObjects.py
diff -u gnue/gnuef/src/GFObjects.py:1.53 gnue/gnuef/src/GFObjects.py:1.54
--- gnue/gnuef/src/GFObjects.py:1.53 Sun Jan 14 10:48:21 2001
+++ gnue/gnuef/src/GFObjects.py Sun Jan 14 15:32:38 2001
@@ -228,8 +228,8 @@
self.dataSourceLink.clear()
self.switchRecord(0)
- #self.dispatchEvent(GFEvent('requestPREVRECORD',None))
- #self.dispatchEvent(GFEvent('requestNEXTRECORD',None))
+ self.dispatchEvent(GFEvent('requestPREVRECORD',None))
+ self.dispatchEvent(GFEvent('requestNEXTRECORD',None))
#
# processQuery
@@ -654,8 +654,6 @@
def show(self):
self.parent.dispatchEvent( GFEvent( 'msgBoxUI', self) )
-
-
Index: gnue/gnuef/src/GFParser.py
diff -u gnue/gnuef/src/GFParser.py:1.11 gnue/gnuef/src/GFParser.py:1.12
--- gnue/gnuef/src/GFParser.py:1.11 Mon Dec 18 11:59:28 2000
+++ gnue/gnuef/src/GFParser.py Sun Jan 14 15:32:38 2001
@@ -51,6 +51,7 @@
def __init__(self, name, attrs, wParent = None):
self.name = name
self.widgetParent = wParent
+
self.contents = ''
self.attrs = attrs
GFDebug.printMesg(10, "<%s>" % name)
@@ -111,6 +112,7 @@
def getOptions(self):
return self.options
+
#
#Class representing an <option> element
#
@@ -188,8 +190,11 @@
setattr( self.widget, attr, self.attrs[attr] )
#
-#Class to work through XML tree
+# xmlHandler
#
+# This class is called by the XML parser to
+# process the xml file. IOW it's the starting point
+#
class xmlHandler(saxlib.HandlerBase):
def __init__(self, stack):
self.widgetStack = stack
@@ -219,9 +224,7 @@
if self.xmlStack[0] != None:
self.xmlStack[0].endTag(name, child)
child.destroy()
-#
-#
-#
+
Index: gnue/gnuef/src/GFTrigger.py
diff -u gnue/gnuef/src/GFTrigger.py:1.9 gnue/gnuef/src/GFTrigger.py:1.10
--- gnue/gnuef/src/GFTrigger.py:1.9 Thu Jan 11 22:08:48 2001
+++ gnue/gnuef/src/GFTrigger.py Sun Jan 14 15:32:38 2001
@@ -17,10 +17,12 @@
from GFEvent import *
import string
+
+#
+# GFTriggerAware
#
-#!Hack warning! have moved GFTriggerAware into GFObjects.py
-#until to prevent circular dependencies until a better solution
-#can be found.
+# Objects that inherit this class will be
+# capable of processing triggers
#
class GFTriggerAware:
def __init__(self):
@@ -29,15 +31,21 @@
self.validTriggers = [ 'Pre-FocusOut',
'Post-FocusOut',
'Pre-FocusIn',
- 'Post-FocusIn']
-
+ 'Post-FocusIn',
+ 'Pre-Commit',
+ 'Post-Commit',
+ 'Pre-Change',
+ 'Post-Change']
-
+ # addTrigger
+ # Associates a trigger with the object
def addTrigger(self, key, function):
if not self.trigger.has_key(key):
self.trigger[key] = []
self.trigger[key].append(function)
+ # processTrigger
+ # "fires" the trigger
def processTrigger(self, key):
if self.validTriggers.count(key):
if self.trigger.has_key(key):
@@ -47,16 +55,16 @@
GFDebug.printMesg(10, "No triggers to fire")
else:
print "Invalid trigger ",key
-
+
+#
+# GFTrigger
#
# Class used to implement triggers
#
-##class GFTrigger(GFObj):
class GFTrigger(GFEventAware):
def __init__(self, parent=None, tr_type=None, id=None, src=None):
GFEventAware.__init__(self)
-## GFObj.__init__(self, parent)
self.parent = parent
self.children = []
self.attributes = {}
@@ -114,7 +122,6 @@
def dummyFunction(self, myself):
print "Trigger not implemented"
-
#
# These may not all be needed but were copied from the GFObj object
# so that GFTrigger wouldn't have to inherit from it. This removed the
circular
@@ -138,8 +145,6 @@
parentObject = parentObject.parent
return parentObject
-
-
#
# Helper class for building the namespace for python triggers. All access
@@ -149,7 +154,8 @@
#
class GFTriggerHelper:
def __init__(self,object, helper=None):
- baseClassDict = { 'GFBlock': GFTriggerBlock }
+ baseClassDict = { 'GFBlock': GFTriggerBlock,
+ 'GFDataSource': GFTriggerDatasource}
if helper == None:
self.__dict__['helper'] = baseClassDict[ object.type ](object)
else:
@@ -187,6 +193,12 @@
def setattributes( self, name, value ):
raise AttributeError
+
+class GFTriggerDatasource(GFTriggerHelperBase ):
+ def __init__(self, object):
+ GFTriggerHelperBase.__init__(self, object)
+
+
class GFTriggerFields( GFTriggerHelperBase ):
def getattribute( self, name ):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/gnuef TODO samples/inventory/README sample...,
James Thompson <=