[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/gnuef doc/just samples/contact.gfd samples...
From: |
James Thompson |
Subject: |
gnue/gnuef doc/just samples/contact.gfd samples... |
Date: |
Tue, 03 Oct 2000 22:05:00 -0700 |
CVSROOT: /cvs
Module name: gnue
Changes by: James Thompson <address@hidden> 00/10/03 22:04:59
Modified files:
gnuef/doc : just
gnuef/samples : contact.gfd sc_po_entry.gfd
gnuef/src : DSpostgresql.py GFClient.py GFEvent.py
GFForm.py GFObjects.py GFParser.py GFTrigger.py
UIbase.py
Added files:
gnuef/src : GFOptions.py
Removed files:
gnuef/src : GFView.py
Log message:
More database stuff
Modied sc_po_entry.gfd to do triggers and database stuff
Global debug level support
Cleaned up some crap (old code and files not needed anymore)
CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/doc/just.diff?r1=1.1&r2=1.2
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/contact.gfd.diff?r1=1.5&r2=1.6
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/sc_po_entry.gfd.diff?r1=1.1&r2=1.2
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFOptions.py.diff?r1=NONE&r2=1.1
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/DSpostgresql.py.diff?r1=1.1&r2=1.2
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFClient.py.diff?r1=1.11&r2=1.12
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFEvent.py.diff?r1=1.3&r2=1.4
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFForm.py.diff?r1=1.11&r2=1.12
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFObjects.py.diff?r1=1.7&r2=1.8
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFParser.py.diff?r1=1.3&r2=1.4
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFTrigger.py.diff?r1=1.2&r2=1.3
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/UIbase.py.diff?r1=1.3&r2=1.4
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFView.py.diff?r1=1.2&r2=NONE
Patches:
Index: gnue/gnuef/doc/just
diff -u gnue/gnuef/doc/just:1.1 gnue/gnuef/doc/just:1.2
--- gnue/gnuef/doc/just:1.1 Wed Jul 5 19:44:09 2000
+++ gnue/gnuef/doc/just Tue Oct 3 22:04:58 2000
@@ -9,3 +9,71 @@
GFBock
GFField
+<Derek> TDatabase
+<Derek> TProvider
+<Derek> TDataSet
+<Derek> TDatasource
+<Derek> something like that
+<Derek> TDataSet can have a TClientDataSet
+<Derek> and a TRemoteProvider
+<Derek> so in a Distributed World it can be
+<Derek> TDatabase
+<Derek> TRemoteProvider
+<Derek> TRemoteDataSet
+<Derek> TClientDataSet
+<Derek> TDatasource
+<Derek> where TClientDataSet and TDataSource live on the client
+<Derek> and all other live on the middleware
+<Derek> in two tier world
+<Derek> provider/dataset/datasource all on client
+<Derek> in distributed world
+<Derek> provider/dataset on middleware dataset on client
+<Derek> er datasource
+<Derek> or clientdataset
+* andrewm is just fuzzy on the purpose of all these objects :)
+<Derek> http://community.borland.com/article/0,1410,22571,00.html#Introduction
+<Derek> is an article from one of the studs of MIDAS
+<Derek> dan miser
+* andrewm goes and reads :)
+<Derek> josh dahlby is other midas stud
+<Derek> or was
+<Derek> met these guys at a conference before they know their stuff
+<Derek> Charlie Calvert knows his way around too
+<Derek> history
+<Derek> borland did client server
+<Derek> then came up with this little beauty called
+<Derek> guess
+<Derek> CACHED UPDATES. :)
+<Derek> which is what you guys are talking about now. :)
+<Derek> they evolved this into a real DISTRIBUTED architecture for middleware
instead of just a cool way to cache database updates. :)
+<jamest> ok this is way overkill for what I need for tonights work
+<Derek> http://www.distribucon.com/dl210.html
+<Derek> is another good article
+<Derek> jamest: oh yes
+<jamest> and really belongs in the objestserver discussions
+<Derek> probably version 3.0 :)
+<jamest> as that is where it would be implemented
+<jamest> is that fair to say Derek
+<Derek> um kind of
+<Derek> it would have to be done at both places
+<jamest> on both the client and server yes
+<Derek> ideally the client has two portions
+<jamest> but via the client API of objectserver
+<Derek> a dataset/datasource portion
+<Derek> the datasource is the same REGARDLESS of the ass end
+<Derek> and its what drives all the widgets etc
+<Derek> which is what i was tryign to explain last night
+<Derek> that way if you wanted to gut a two tier
+<Derek> to make three tier
+<andrewm> it looks to me like you basically have a database running as an
actual database, and another on the object server, and even one on the client -
the far end being definitive, but the intermediate stages working as a full
database rather than having all connections going to the end database
+<Derek> you could just replace the dataset
+<andrewm> does that make sense? if so, am I right? :)
+<Derek> and point the datasource to the new dataset and everything else
functions as before
+<jamest> andrewm: i think the client side is lighter
+<jamest> andrewm: more like what I recall of notes
+<jamest> notes = lotus notes
+<Derek> yes client is almost non existent. :)
+<Derek> super lightweight
+* andrewm hasn't used notes
+* jamest hasn't in about 6 or 7 years
+<Derek> here is what i would like to see
Index: gnue/gnuef/samples/contact.gfd
diff -u gnue/gnuef/samples/contact.gfd:1.5 gnue/gnuef/samples/contact.gfd:1.6
--- gnue/gnuef/samples/contact.gfd:1.5 Tue Sep 26 15:26:38 2000
+++ gnue/gnuef/samples/contact.gfd Tue Oct 3 22:04:58 2000
@@ -8,6 +8,12 @@
<width>500</width>
</options>
+
+ <database name="gnue_data" provider="postgres" db_name="gnue"/>
+ <dataset name="qrySomeQuery" databaseName="gnue_data"
+ query="select * from country;"/>
+ <datasource name="dtsrcCoolBeans" DataSet="qrySomeQuery"/>
+
<page>
<block dbName="test" tableName="country">
<label text="General" x="5" y="1"/>
Index: gnue/gnuef/samples/sc_po_entry.gfd
diff -u gnue/gnuef/samples/sc_po_entry.gfd:1.1
gnue/gnuef/samples/sc_po_entry.gfd:1.2
--- gnue/gnuef/samples/sc_po_entry.gfd:1.1 Tue Oct 3 07:38:44 2000
+++ gnue/gnuef/samples/sc_po_entry.gfd Tue Oct 3 22:04:58 2000
@@ -1,23 +1,35 @@
<?xml version="1.0" ?>
-<form height="480" width="540" title="GNUe Supply Chain : Purchase Order
Entry">
+<form>
-<options>
- <name>GNUe Supply Chain : Purchase Order Entry</name>
- <version>0.0.1</version>
- <height>480</height>
- <width>540</width>
-</options>
+ <options>
+ <title>GNUe Supply Chain : Purchase Order Entry</title>
+ <version>0.0.1</version>
+ <height>480</height>
+ <width>540</width>
+ </options>
+ <database name="gnue" provider="postgresql" dbname="gnue" host="gnue"/>
+ <datasource name="po_data" database="gnue" table="po" cache="5">
+ <datasource name="ship_to_data" database="gnue" table="ship_to" cache="5">
+ <datasource name="bill_to_data" database="gnue" table="bill_to" cache="5">
+
<page>
- <block>
+ <block name="po" datasource="po">
<label text="PO Number" x="5" y="5"/>
- <entry value="2343243" x="5" y="15" width="100" height="20"/>
+ <entry value="2343243" x="5" y="15" width="100" height="20">
+ <trigger type ="Pre-FocusOut">
+#
+#User name trigger
+#
+print "PO has been updated to %s" % self.value
+</trigger>
+ </entry>
<label text="Tax Exempt #" x="125" y="5"/>
<entry value="89-980980" x="125" y="15" width="100" height="20"/>
</block>
- <block>
+ <block name="ship_to" datasource="ship_to_data">
<label text="Ship To" x="5" y="30"/>
<entry value="GNU Coding Factory" x="5" y="40" width="245" height="20"/>
<label text="Contact" x="5" y="55"/>
@@ -33,7 +45,7 @@
<entry value="54034-3454" x="77" y="130" width="80" height="20"/>
</block>
- <block>
+ <block name="bill_to" datasource="bill_to_data">
<label text="Bill To" x="125" y="30"/>
<entry value="Sun MicroSystems" x="125" y="40" width="245" height="20"/>
<label text="Contact" x="125" y="55"/>
Index: gnue/gnuef/src/DSpostgresql.py
diff -u gnue/gnuef/src/DSpostgresql.py:1.1 gnue/gnuef/src/DSpostgresql.py:1.2
--- gnue/gnuef/src/DSpostgresql.py:1.1 Tue Oct 3 18:19:53 2000
+++ gnue/gnuef/src/DSpostgresql.py Tue Oct 3 22:04:58 2000
@@ -12,110 +12,44 @@
# Copyright (c) 2000 James Thompson
#
-class DSdataLink:
- def __init__(self, name, table):
- self.databaseName = name
- self.tableName = table
+import GFOptions
+import _pg
+
+class DSLink:
+ def __init__(self):
+ if GFOptions.DEBUG:
+ print "Postgresql database driver initializing"
+ pass;
+
+ self.connection = None
- def connect(self):
- # find the object server base object
- CORBA.load_idl( "../../objectserver/idl/gedi.idl" )
- orb = CORBA.ORB_init( () , CORBA.ORB_ID )
- ior = open("/tmp/databasefactory.ior").readline()
- self.factory = orb.string_to_object(ior)
-
- try:
- self.database = self.factory.newDatabase( self.databaseName );
- except GEDI.UnknownDatabase,ex:
- print "Failed to connect to database. Exiting."
- print ex.detail
- sys.exit(0)
+ def connect(self, host, dbname, user, passwd):
+ if GFOptions.DEBUG:
+ print "connecting"
- self.database.connect()
+ self.connection = _pg.connect(dbname, host, -1, None, None, user, passwd)
def disconnect(self):
- self.database.disconnect();
- self.database.release();
-
+ self.connection.close()
- def execQuery(self):
- self.resultSet = self.database.loadAll( self.tableName );
- self.currentObject = self.resultSet
+ def commit(self):
+ self.connection.commit()
+
+ def rollback(self):
+ self.connection.rollback()
+
+ def query(self):
+ pass;
def nextObject(self):
- self.currentObject.next()
+ pass;
def prevObject(self):
- self.currentObject.previous()
+ pass;
def newObject(self):
- self.currentObject = self.database.newObject(self.tableName)
+ pass;
-## def commit(self):
-## def rollback(self):
-## def defQuery(self):
-
-#
-------------------------------------------------------------------------------------------------------
-
-### this really should handle exceptions
-##def show_customers():
-## c = database.loadAll( "customer" );
-## while c != None:
-## print "customer: " , c.getField("id") , ":" , c.getField("name") , ":"
, c.getField("country")
-## i = c.getReference( "invoices" )
-## while i != None:
-## print " invoice: " , i.getField("contents")
-## i = i.next()
-## c = c.next();
-## print ""
-### this really should handle more exceptions
-##def show_invoices():
-## try:
-## i = database.loadAll( "invoice" );
-## while i != None:
-## print "invoice: " , i.getField("contents")
-## c = i.getReference( "customer" )
-## if c != None:
-## print " customer: " , c.getField("name")
-## i = i.next();
-## print ""
-## except GEDI.ServerError,ex: print ex.detail
-
-### this really should handle exceptions
-##def add_country():
-## c = database.newObject("country")
-## c.setField( "id" , raw_input("entry country ID : ") )
-## c.setField( "name" , raw_input("entry country name: ") )
-## c.flush()
-
-### this really should handle exceptions
-##def add_customer():
-## c = database.newObject("customer")
-## c.setField( "id" , raw_input("customer ID : ") )
-## c.setField( "name" , raw_input("customer name : ") )
-## c.setField( "countrycode" , raw_input("customer country code: ") )
-## c.flush()
-
-### this really should handle exceptions
-##def add_invoice():
-## i = database.newObject("invoice")
-## i.setField( "customerid" , raw_input("customer id : ") )
-## i.setField( "id" , raw_input("invoice id : ") )
-## i.setField( "contents" , raw_input("invoice contents: ") )
-## i.flush()
-
-### this really should handle exceptions
-##def del_customer():
-## id = raw_input("enter customer ID: ")
-## c = database.loadObject("customer","id",id)
-## if c == None:
-## print "Customer not found"
-## else:
-## c.delete()
-## c.flush()
-## print "deleted"
-
-
-
+# def defQuery(self):
Index: gnue/gnuef/src/GFClient.py
diff -u gnue/gnuef/src/GFClient.py:1.11 gnue/gnuef/src/GFClient.py:1.12
--- gnue/gnuef/src/GFClient.py:1.11 Tue Oct 3 18:19:53 2000
+++ gnue/gnuef/src/GFClient.py Tue Oct 3 22:04:58 2000
@@ -14,10 +14,11 @@
import sys
import urllib
import os
+import GFOptions
from GFGetOpt import *
from GFForm import *
from GFController import *
-
+
class GFClient:
def __init__(self):
self.version="0.0.2"
@@ -31,11 +32,16 @@
CmdOpt = GFGetOpt()
CmdOpt.parseOptions(sys.argv)
ui_type = CmdOpt.getOption('user_interface')#user interface
- debug = CmdOpt.getOption('debug_level')#debugging
+ GFOptions.DEBUG = CmdOpt.getOption('debug_level')#debugging
help = CmdOpt.getOption('help')#display man page
version = CmdOpt.getOption('version')#display version information
+
+ if GFOptions.DEBUG:
+ print "Debug level =",GFOptions.DEBUG
+
+ #assign form file from 1st free argument
try:
- self.formfile = CmdOpt.getArgument(0) #assign form file from 1st free
argument
+ self.formfile = CmdOpt.getArgument(0)
except:
if help :
# help -> this should really read a man page
@@ -54,9 +60,6 @@
print "No Forms Definition File Specified. Use GFClient -h for more
information."
sys.exit()
- # debugging supports need to be added
- if debug == 1 :
- print "Silly rabbit, Debuging is for kids!"
# user interface type defaulting to gui currently
if ui_type == 'gui' :
self.ui = 'WXPYTHON'
Index: gnue/gnuef/src/GFEvent.py
diff -u gnue/gnuef/src/GFEvent.py:1.3 gnue/gnuef/src/GFEvent.py:1.4
--- gnue/gnuef/src/GFEvent.py:1.3 Sun Aug 27 20:06:37 2000
+++ gnue/gnuef/src/GFEvent.py Tue Oct 3 22:04:58 2000
@@ -10,6 +10,8 @@
# Copyright (c) 2000 James Thompson
#
+import GFOptions
+
#
# Basic event passed between items
#
@@ -61,7 +63,9 @@
# print "Received ", event.getEvent()
self.incommingEvent[event.getEvent()] (event)
except KeyError:
- print "Unknown Event: %s " % (event.getEvent())
+ if GFOptions.DEBUG > 99:
+ print "Unknown Event: %s " % (event.getEvent())
+
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.11 gnue/gnuef/src/GFForm.py:1.12
--- gnue/gnuef/src/GFForm.py:1.11 Tue Oct 3 18:19:53 2000
+++ gnue/gnuef/src/GFForm.py Tue Oct 3 22:04:58 2000
@@ -12,6 +12,9 @@
#
import sys
+import os # This only exists for the complete crap hack for passwd info
+ # in initDatabases
+
from GFObjects import *
from GFEvent import *
from GFParser import *
@@ -49,6 +52,8 @@
}
+ self.databaseDictionary = {}
+
# Insert/Overwrite mode
self.insertMode = 1
@@ -79,6 +84,12 @@
# build the block list
self.walk(self.initBlocks)
self.walk(self.initEntries)
+
+ # Connect to the defined databases
+ self.walk(self.initDatabases)
+ if GFOptions.DEBUG > 50:
+ print self.databaseDictionary
+
#
# begin routines made for walking
@@ -105,17 +116,22 @@
if object.getObjectType() == 'GFEntry':
object.valueArray[0] = object.value
- def resetValue(self, object):
- if object.getObjectType() == 'GFEntry':
- object.value = object.valueArray[object.root.currentRecord]
- self.dispatchEvent(GFEvent('updateENTRY',object));
+ def initDatabases(self, object):
+ if object.getObjectType() =='GFDatabase':
+ self.databaseDictionary[object.name]=object
- def appendRecord(self, object):
- if object.getObjectType() == 'GFEntry':
- object.valueArray.append("")
-
-
-
+ # begin complete crap hack
+ print "Logging into database %s on host %s" %(object.dbname, object.host)
+ print ("Enter Username:")
+ user = raw_input()
+
+ print ("Enter Password: ")
+ os.system("stty -echo")
+ passwd = raw_input()
+ os.system("stty echo")
+ # end complete crap hack
+
+ object.initialize(user,passwd)
#
# end of routines made for walking
#
Index: gnue/gnuef/src/GFObjects.py
diff -u gnue/gnuef/src/GFObjects.py:1.7 gnue/gnuef/src/GFObjects.py:1.8
--- gnue/gnuef/src/GFObjects.py:1.7 Tue Oct 3 18:19:53 2000
+++ gnue/gnuef/src/GFObjects.py Tue Oct 3 22:04:58 2000
@@ -14,9 +14,8 @@
import DSobjectServer
from GFTrigger import *
from GFEvent import *
+import GFOptions
-DEBUG = 0
-
#
# Class GFObj
#
@@ -78,17 +77,17 @@
def __init__(self, parent=None, value=None):
self.value = value
self.type = "GFValue"
- if DEBUG:
+ if GFOptions.DEBUG:
print "Value = ", self.value
GFObj.__init__(self, parent)
def setValue(self, value):
- if DEBUG:
+ if GFOptions.DEBUG:
print "Value = ", self.value
self.value = value
def getValue(self):
- if DEBUG:
+ if GFOptions.DEBUG:
print "Value = ", self.value
return self.value
@@ -150,19 +149,26 @@
GFObj.__init__(self, parent)
self.type = "GFDataSource"
#
-#GFDatabase
+#GFDataSet
#
class GFDataSet(GFObj):
def __init__(self, parent=None):
GFObj.__init__(self, parent)
self.type = "GFDataSet"
+
#
-#GFDataSource
+#GFDatabase
#
class GFDatabase(GFObj):
def __init__(self, parent=None):
GFObj.__init__(self, parent)
self.type = "GFDatabase"
+
+ def initialize(self,user,passwd):
+ if self.provider == "postgresql":
+ import DSpostgresql
+ self.link = DSpostgresql.DSLink()
+ self.link.connect(self.host,self.dbname,user,passwd)
#
#
# More complex objects below
@@ -238,7 +244,7 @@
# recordSwitched
#
def recordSwitched(self, event):
- if DEBUG:
+ if GFOptions.DEBUG:
print event.data, " just switched records"
self.dispatchEvent(GFEvent('recordSWITCHED',event.data))
@@ -302,7 +308,7 @@
# Moves the proper record into editing position
#
def switchRecord(self, event):
- if DEBUG:
+ if GFOptions.DEBUG:
print "Switching to record ",event.data
self.value = self.valueArray[event.data]
self.dispatchEvent(GFEvent('recordSWITCHED',self));
Index: gnue/gnuef/src/GFParser.py
diff -u gnue/gnuef/src/GFParser.py:1.3 gnue/gnuef/src/GFParser.py:1.4
--- gnue/gnuef/src/GFParser.py:1.3 Tue Oct 3 18:19:53 2000
+++ gnue/gnuef/src/GFParser.py Tue Oct 3 22:04:58 2000
@@ -19,9 +19,8 @@
from GFObjects import *
import string
import sys
+import GFOptions
-DEBUG = 0
-
#
#Remove redundant whitespace from a string ( from xml-howto )
#
@@ -63,7 +62,7 @@
self.widgetParent = wParent
self.contents = ''
self.attrs = attrs
- if DEBUG:
+ if GFOptions.DEBUG:
print "<%s>" % name
def startTag(self, name, attrs):
return None
@@ -72,7 +71,7 @@
def endTag(self, name, child):
pass
def __del__(self):
- if DEBUG:
+ if GFOptions.DEBUG:
print "<%s/>" % self.name
#
# Class representing an element which can contain <option> and <options>
Index: gnue/gnuef/src/GFTrigger.py
diff -u gnue/gnuef/src/GFTrigger.py:1.2 gnue/gnuef/src/GFTrigger.py:1.3
--- gnue/gnuef/src/GFTrigger.py:1.2 Tue Oct 3 18:19:53 2000
+++ gnue/gnuef/src/GFTrigger.py Tue Oct 3 22:04:58 2000
@@ -11,6 +11,7 @@
# Copyright (c) 2000 James Thompson
#
+import GFOptions
from GFObjects import *
class GFTriggerAware:
@@ -34,7 +35,8 @@
for function in self.trigger[key]:
function(self)
else:
- print "No triggers to fire"
+ if GFOptions.DEBUG > 99:
+ print "No triggers to fire"
else:
print "Invalid trigger ",key
Index: gnue/gnuef/src/UIbase.py
diff -u gnue/gnuef/src/UIbase.py:1.3 gnue/gnuef/src/UIbase.py:1.4
--- gnue/gnuef/src/UIbase.py:1.3 Tue Oct 3 18:19:53 2000
+++ gnue/gnuef/src/UIbase.py Tue Oct 3 22:04:58 2000
@@ -14,7 +14,6 @@
from GFForm import *
from GFEvent import *
-
#
# GFUserInterfaceBase
#
@@ -50,8 +49,8 @@
'GFPage': self.pageHandler,
'GFLabel': self.stdHandler,
'GFEntry': self.stdHandler,
- 'GFForm': self.formHandler,
- 'GFDataSource': self.notVisible
+ 'GFForm': self.formHandler
+# 'GFDataSource': self.notVisible
}
#
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/gnuef doc/just samples/contact.gfd samples...,
James Thompson <=