commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/gnuef TODO samples/zipcode/states.gfd samp...


From: James Thompson
Subject: gnue/gnuef TODO samples/zipcode/states.gfd samp...
Date: Mon, 19 Feb 2001 18:47:24 -0800

CVSROOT:        /cvs
Module name:    gnue
Changes by:     James Thompson <address@hidden> 01/02/19 18:47:24

Modified files:
        gnuef          : TODO 
        gnuef/samples/zipcode: states.gfd zipcode.gfd 
        gnuef/src      : GFForm.py GFObjects.py GFParser.py UIbase.py 
                         UIwxpython.py 
Added files:
        gnuef/samples/button/forms: form.gfd 

Log message:
        <button> support
        misc internal changes that I don't recall :(
        cleaned up TODO a bit

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/TODO.diff?r1=1.45&r2=1.46
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/button/forms/form.gfd.diff?r1=NONE&r2=1.1
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/zipcode/states.gfd.diff?r1=1.11&r2=1.12
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/zipcode/zipcode.gfd.diff?r1=1.8&r2=1.9
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFForm.py.diff?r1=1.69&r2=1.70
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFObjects.py.diff?r1=1.63&r2=1.64
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFParser.py.diff?r1=1.13&r2=1.14
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/UIbase.py.diff?r1=1.17&r2=1.18
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/UIwxpython.py.diff?r1=1.68&r2=1.69

Patches:
Index: gnue/gnuef/TODO
diff -u gnue/gnuef/TODO:1.45 gnue/gnuef/TODO:1.46
--- gnue/gnuef/TODO:1.45        Thu Feb 15 20:34:11 2001
+++ gnue/gnuef/TODO     Mon Feb 19 18:47:23 2001
@@ -9,7 +9,7 @@
     triggers should not fire during query entry
 
   Internal Enhancements
-    Speed, speed, speed (it's pretty bad now w/ complex forms)
+    Speed, speed, speed 
 
     clean up code  [everyone working on the code]
       provide better seperation of Objects in the Data system
@@ -39,7 +39,7 @@
   
     user extensible menus
 
-    Look into adding checkbox, button and memo box widgets.
+    Look into adding checkbox [ra3vat]
 
     menus should disable options not available via events 
 
@@ -49,7 +49,6 @@
       that can be put in UIbase.  Maybe adjust UIpython to use NC*style
       ojbects so that most of the core functionality can be moved to UIbase
 
-    Pop up search boxes
 
     Dropdown Issues:
       wxpython dropdowns don't allow you to go to next|prev record via up and 
down arrows
@@ -72,7 +71,7 @@
 
     Add layout manager support
 
-    lookup dialogs
+    Pop up search boxes (lookup dialogs)
 
   Long term:
 
@@ -89,4 +88,3 @@
     Look into inlcude support (entities could do this too)
 
     Make other datasources accessible from forms easily
-
Index: gnue/gnuef/samples/zipcode/states.gfd
diff -u gnue/gnuef/samples/zipcode/states.gfd:1.11 
gnue/gnuef/samples/zipcode/states.gfd:1.12
--- gnue/gnuef/samples/zipcode/states.gfd:1.11  Thu Feb 15 20:34:11 2001
+++ gnue/gnuef/samples/zipcode/states.gfd       Mon Feb 19 18:47:24 2001
@@ -30,7 +30,7 @@
       <entry name="state" field="state_code" x="23" y="10" width="3" 
visibleCount="5" />
 
       <label text="Zip" x="27" y="9"/>
-      <entry name="zip" field="zipcode" x="27" y="10" width="10" 
visibleCount="5" />
+      <entry name="zip" field="zip" x="27" y="10" width="10" visibleCount="5" 
/>
 
       <box x="1" y="8" width="37" height="8" label="State Cities"/>
 
Index: gnue/gnuef/samples/zipcode/zipcode.gfd
diff -u gnue/gnuef/samples/zipcode/zipcode.gfd:1.8 
gnue/gnuef/samples/zipcode/zipcode.gfd:1.9
--- gnue/gnuef/samples/zipcode/zipcode.gfd:1.8  Thu Feb 15 20:34:11 2001
+++ gnue/gnuef/samples/zipcode/zipcode.gfd      Mon Feb 19 18:47:24 2001
@@ -31,7 +31,7 @@
       </entry>
 
       <label text="Zip" x="33" y="1"/>
-      <entry name="zip" field="zip" x="33" y="2" width="5" visibleCount="15" 
numeric="" max_length="5" readonly="">
+      <entry name="zip" field="zip" x="33" y="2" width="5" visibleCount="15" 
numeric="" max_length="5" >
        <options>
          <tip>US Postal Zip Code</tip>
        </options>
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.69 gnue/gnuef/src/GFForm.py:1.70
--- gnue/gnuef/src/GFForm.py:1.69       Thu Feb 15 20:34:11 2001
+++ gnue/gnuef/src/GFForm.py    Mon Feb 19 18:47:24 2001
@@ -12,14 +12,14 @@
 #
 
 import sys
-import os   # This only exists for the complete crap hack for passwd info
-            # in initDatabases
+import os
 import string
+import GFDebug
 import GFOptions            
+
 from GFObjects import *
 from GFEvent import *
 from GFParser import *
-import GFDebug
 from GFError import DBError
 
 class GFForm(GFObj, GFEventAware):
@@ -56,6 +56,7 @@
                            'requestROLLBACK'   : self.executeRollback,
                            'requestEXIT'       : self.executeExit,
                            'requestABOUT'      : self.executeAbout,
+                           'fireTRIGGER'       : self.fireTrigger,
                            }
 
     self.databaseDictionary = {}
@@ -78,20 +79,16 @@
     self.borderPercentage = 10
     self.textPercentage   = 7.5
 
-  def run(self, URL):
-    
+  def run(self, URL):    
     # Create a parser
     parser = saxexts.make_parser()
     
     # Create the handler
     dh = xmlHandler(self.currentObject)
+    
     # Tell the parser to use our handler
     parser.setDocumentHandler(dh)
-    
-    # Parse the input
     parser.parseFile(URL)
-    
-    # Close the parser
     parser.close()
     
     # set the initial focus
@@ -179,7 +176,6 @@
           message = GFMsgBox(self,"Database initialization error:\n%s\n%s " % 
(sys.exc_info()[0], sys.exc_info()[1]))
           message.show()
                                   
-
         except:
           if sys.platform != 'win32':
             os.system("stty sane")
@@ -259,8 +255,6 @@
         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
@@ -277,8 +271,6 @@
         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
@@ -291,6 +283,7 @@
   def newRecord(self, event):
     if not hasattr(self,'readonly'):
       self.currentBlock.newRecord()
+      self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
       self.updateRecordStatus()
       self.updateRecordCounter()
     else:
@@ -363,6 +356,8 @@
         self.databaseDictionary[key].rollback()
       message = GFMsgBox(self,"Database commit error:\n%s\n%s " % 
(sys.exc_info()[0], sys.exc_info()[1]))
       message.show()
+    except:
+      print "Argh: \n%s\n%s " % (sys.exc_info()[0], sys.exc_info()[1]) 
 
   def executeAbout(self,event):
      version = GFOptions.VERSION
@@ -376,6 +371,7 @@
   def executeRollback(self,event):
     for block in self.blockList:
       block.processRollback();
+    self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
     self.updateRecordStatus()
     self.updateRecordCounter()
     
@@ -608,7 +604,6 @@
           else: return
 
         if hasattr(self.currentEntry,'foreign_key_description') and 
hasattr(self.currentEntry,'style') and (self.currentEntry.style=='dropdown'):
-#          value= 
self.currentEntry.findClosestValue(currentvalue[:self.currentEntry.cursorPosition]+event.data)
           value= self.currentEntry.findClosestValue(event.data)
           if not value: return
           self.currentEntry.setValue(value)
@@ -668,9 +663,12 @@
     else:
       self.dispatchEvent(GFEvent('formALERT','Field is readonly'))
 
-
 
-
+  #
+  # fireTrigger
+  #
+  def fireTrigger(self, event):
+    self.triggerDictionary[event.data](self)
 
 
 
Index: gnue/gnuef/src/GFObjects.py
diff -u gnue/gnuef/src/GFObjects.py:1.63 gnue/gnuef/src/GFObjects.py:1.64
--- gnue/gnuef/src/GFObjects.py:1.63    Fri Feb 16 16:42:26 2001
+++ gnue/gnuef/src/GFObjects.py Mon Feb 19 18:47:24 2001
@@ -10,7 +10,6 @@
 # HISTORY:
 # Copyright (c) 2000 Free Software Foundation
 #
-
 from GFEvent import *
 from GFTrigger import *
 from DBfactory import DBfactory
@@ -36,7 +35,19 @@
     self.attributes = {}
     if parent :
       parent.addChild(self)
-      
+
+  #
+  # initialize
+  #
+  # This will be the base of the new initialization system for gnuef
+  # each childs initialization function must call GFObj.initialize()
+  # 
+
+  def initialize(self):
+    if self.children:
+      for child in self.children:
+        child.inititialize(function)
+                
   def getObjectType(self):
     return self.type
   
@@ -76,6 +87,20 @@
     return self.value
 
 #
+#GFLabel
+#
+class GFLabel(GFValue):
+  def __init__(self, parent=None, value=None):
+    GFValue.__init__(self, parent, value)
+    self.type = "GFLabel"
+    self.alignment = "left"
+    self.height = GFOptions.widgetHeight
+
+  def setValue(self, value):
+    if not self.value:
+      GFValue.setValue(self,value)
+
+#
 # GFPage
 #
 class GFPage(GFObj):
@@ -101,18 +126,13 @@
     self.label = ""
 
 #
-#GFLabel
+# GFButton
 #
-class GFLabel(GFValue):
-  def __init__(self, parent=None, value=None):
-    GFValue.__init__(self, parent, value)
-    self.type = "GFLabel"
-    self.alignment = "left"
-    self.height = GFOptions.widgetHeight
-
-  def setValue(self, value):
-    if not self.value:
-      GFValue.setValue(self,value)
+class GFButton(GFObj):
+  def __init__(self, parent=None):
+    GFObj.__init__(self, parent)
+    self.type = "GFButton"
+    self.label = ""
 
 ############################################################
 # GFBlock
@@ -132,15 +152,9 @@
     self.currentRecord = 0
     self.recordCount = 0
 
-    # Event processing
-    self.incommingEvent = {                           
-                           }
-    
-    # register the form to recieve events from the block
-    self.registerEventListener(self.form.processEvent)
-
   def initialize(self):
     self.walk(self.buildEntryList)
+
     if hasattr(self,'datasource'):
       self.dataSourceLink = self.form.datasourceDictionary[self.datasource]
     else:
@@ -151,17 +165,23 @@
   def buildEntryList(self, object):
     if object.getObjectType() == 'GFEntry':
        self.entryList.append(object)
-  
+
+
   def isSaved(self):
     return self.dataSourceLink.isSaved()
   
   #
   # deleteRecord
   #
+  # Doesn't really delete the record but marks it for
+  # deletion during next commit
+  #
   def deleteRecord(self):
     self.dataSourceLink.markForRemoval(self.currentRecord)
 
   #
+  # newRecord
+  #
   # Adds a record to the current records in memory
   #
   def newRecord(self):
@@ -174,12 +194,9 @@
       if len(fieldValue) > 0:
         
self.dataSourceLink.setField(self.recordCount,self.detail,fieldValue,TRUE)
       
-    oldRecord = self.currentRecord
-    self.currentRecord = 0
+    self.currentRecord = self.recordCount
     self.switchRecord(self.currentRecord)
     
-    self.dispatchEvent(GFEvent('requestPREVRECORD',None))
-
   #
   # Moves the proper record into editing position
   #
@@ -216,16 +233,10 @@
       if len(fieldValue) > 0:
         for count in range(self.recordCount+1):
           self.dataSourceLink.setField(count,self.detail,fieldValue, TRUE)
-    
-    self.dataSourceLink.commit()
 
+    #self.currentRecord = 0
+    self.dataSourceLink.commit()
     self.recordCount = self.dataSourceLink.getLastRecordNumber()
-
-    # Switch to first record
-    # self.currentRecord = 0
-    # self.switchRecord(0)
-    # self.dispatchEvent(GFEvent('requestPREVRECORD',None))
-    # self.dispatchEvent(GFEvent('requestNEXTRECORD',None))
     self.mode='normal'
 
   #
@@ -237,11 +248,11 @@
     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
+  # initQuery and processQuery
   #
   def initQuery(self):
     if self.mode != 'query':
@@ -252,7 +263,7 @@
     self.processRollback() 
     
   def processQuery(self):
-    # Implement sloppyFocus system 
+    # Implement sloppyQuery system 
     if self.mode == 'query':
       for entry in self.entryList:
         if hasattr(entry,'sloppyQuery'):
@@ -311,7 +322,6 @@
     self.height = GFOptions.widgetHeight
     self.block = self.findParentOfType('GFBlock')
 
-
   def initialize(self):
     if not hasattr(self,'field'):
       GFDebug.printMesg(1,"%s" % self.getObjectType())
@@ -387,7 +397,7 @@
     return values
 
 ############################################################
-#GFDataSource
+# GFDataSource
 #
 # In memory store of data manipulated by forms
 # sometimes attached to a database, sometimes not
@@ -492,11 +502,11 @@
       else:
         self.clear()
         
-  def beginTransaction(self):
-    self.dataConnection.beginTransaction()
+##  def beginTransaction(self):
+##    self.dataConnection.beginTransaction()
 
-  def rollback(self):  
-    self.dataConnection.rollback()
+##  def rollback(self):  
+##    self.dataConnection.rollback()
       
   def commit(self):
     if hasattr(self,'database'):
@@ -533,9 +543,6 @@
 
             for newkey in result.keys():
               self.resultSet[count][newkey] = result[newkey]
-#              print newkey, self.resultSet[count][newkey]
-              
-      #self.dataConnection.commit()
 
       # Clean up record list
       count = 0
@@ -650,34 +657,6 @@
   def getFieldList(self,table):
     self.uniqueKey = self.link.getUniqueKey(table)
     return self.link.getFieldList(table)    
-
-############################################################
-# GFFields
-#
-# I'm commenting this out as I don't recall what it's for
-# jamest
-#
-##class GFFields:
-##  def __init__(self,block):
-##    self.block = block
-   
-##  def __getattr__(self,name):
-##    for item in self.block.entryList:
-##      if item.name == name:
-##        return item.value
-##    return None
-
-##  def __setattr__(self,name,value):
-##    try:
-##      for item in self.__dict__['block'].__dict__['entryList']:
-##        if item.name == name:
-##         item.cursorPosition = len(value)
-##         item.setValue(value)
-##         return
-       
-##    except KeyError:
-##      self.__dict__[name] = value
-##    return
 
 ############################################################
 # GFMsgBox
Index: gnue/gnuef/src/GFParser.py
diff -u gnue/gnuef/src/GFParser.py:1.13 gnue/gnuef/src/GFParser.py:1.14
--- gnue/gnuef/src/GFParser.py:1.13     Fri Feb  9 14:06:48 2001
+++ gnue/gnuef/src/GFParser.py  Mon Feb 19 18:47:24 2001
@@ -164,6 +164,7 @@
               'entry' : GFEntry,
               'box'   : GFBox,
               'scrollbar' : GFScrollBar,
+              'button' : GFButton,
               'datasource': GFDataSource,
               'database':   GFDatabase
               }
Index: gnue/gnuef/src/UIbase.py
diff -u gnue/gnuef/src/UIbase.py:1.17 gnue/gnuef/src/UIbase.py:1.18
--- gnue/gnuef/src/UIbase.py:1.17       Fri Feb  9 14:06:48 2001
+++ gnue/gnuef/src/UIbase.py    Mon Feb 19 18:47:24 2001
@@ -55,8 +55,9 @@
     self.widgetConstructorFunction = {   # A dictionary of functions used by 
buildUI
       'GFPage': self.pageHandler,        # to build the widgets.  Can override 
in 
       'GFLabel': self.stdHandler,        # UI specific module if necessary
-      'GFBox': self.stdHandler,          # UI specific module if necessary
-      'GFScrollBar': self.stdHandler,          # UI specific module if 
necessary
+      'GFBox': self.stdHandler,          
+      'GFScrollBar': self.stdHandler,    
+      'GFButton': self.buttonHandler,
       'GFEntry': self.entryHandler,
       'GFForm': self.formHandler
       }
Index: gnue/gnuef/src/UIwxpython.py
diff -u gnue/gnuef/src/UIwxpython.py:1.68 gnue/gnuef/src/UIwxpython.py:1.69
--- gnue/gnuef/src/UIwxpython.py:1.68   Mon Feb 19 09:31:08 2001
+++ gnue/gnuef/src/UIwxpython.py        Mon Feb 19 18:47:24 2001
@@ -64,11 +64,8 @@
                               """wxScrollBar(container,-1,
                               
wxPoint(int(object.x)*int(self.widgetWidth),(int(object.y)+spacer)*int(self.widgetHeight)),
                               
wxSize(int(object.width)*int(self.widgetWidth),int(object.height)*int(self.widgetHeight)),
-                              wxSB_VERTICAL
-                              )"""
-                              
+                              wxSB_VERTICAL)"""
                               }
-#                                
wxSize(int(object.width)*int(self.widgetWidth),int(object.height)*int(self.widgetHeight)))"""
     
     self.keyEvents = {WXK_PRIOR:  GFEvent('requestPREVBLOCK'),
                       WXK_NEXT:   GFEvent('requestNEXTBLOCK'),
@@ -406,7 +403,17 @@
             eventdata = [key, event.GetString()]
             action = GFEvent('requestREPLACEVALUE',eventdata)
 
+    #
+    # Button Events
+    #
+    elif event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED:
+      eo = event.GetEventObject()
+      object = wxPyTypeCast(eo, 'wxWindow')
 
+      for key in self.formToUI.keys():
+        for count in range(len(self.formToUI[key][0])):
+          if self.formToUI[key][0][count].GetId() == object.GetId():
+            action = GFEvent('fireTRIGGER',key.trigger)
       
     #
     # Unhandled events
@@ -444,6 +451,32 @@
         EVT_CHAR(newWidget, self.uiEventTrap)
         EVT_MOUSE_EVENTS(newWidget, self.uiEventTrap)
 
+    return widget
+
+  def buttonHandler(self):
+    object    = self.currentObject[0]
+    container = self.currentWidget[0]
+    widget = []
+
+    if not hasattr(object,'hidden'):
+      if not hasattr(object,'visibleCount'):
+      #  count = int(object.visibleCount)
+      #else:
+        object.visibleCount = 1
+      
+      count = int(object.visibleCount)
+
+      for spacer in range(count):
+        spacer = int(spacer)
+        newWidget = wxButton(container,-1,str(object.label),
+                             
wxPoint(int(object.x)*int(self.widgetWidth),(int(object.y)+spacer)*int(self.widgetHeight)),
+                             
wxSize(int(object.width)*int(self.widgetWidth),int(object.height)*int(self.widgetHeight))
+                             )
+        
+       
newWidget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
+        widget.append(newWidget)
+        EVT_BUTTON(newWidget,newWidget.GetId(),self.uiEventTrap)
+                           
     return widget
 
   def labelHandler(self):



reply via email to

[Prev in Thread] Current Thread [Next in Thread]