commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef TODO samples/helloworld.gfd samples/...


From: James Thompson
Subject: gnue/gnuef TODO samples/helloworld.gfd samples/...
Date: Thu, 09 Nov 2000 15:50:23 -0800

CVSROOT:        /cvs
Module name:    gnue
Changes by:     James Thompson <address@hidden> 00/11/09 15:50:23

Modified files:
        gnuef          : TODO 
        gnuef/samples  : helloworld.gfd 
        gnuef/samples/zipcode: states.gfd 
        gnuef/src      : GFForm.py GFObjects.py UIwxpython.py 

Log message:
        Added still faulty rollback code to allow you to abort changes to
        a form
        
        ToDo's completed:
        
        Moving the focus from entry in one block to a different block does
        not result in the currentBlock switching to the new block
        
        creating a new record and marking for delete prior to any commit
        still causes record to commit
        
        mouse click out of field then F8 results in block error
        
        Autocreate a datasource for block that don't specify one

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/TODO.diff?r1=1.21&r2=1.22
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/helloworld.gfd.diff?r1=1.3&r2=1.4
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/zipcode/states.gfd.diff?r1=1.3&r2=1.4
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFForm.py.diff?r1=1.38&r2=1.39
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFObjects.py.diff?r1=1.35&r2=1.36
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/UIwxpython.py.diff?r1=1.29&r2=1.30

Patches:
Index: gnue/gnuef/TODO
diff -u gnue/gnuef/TODO:1.21 gnue/gnuef/TODO:1.22
--- gnue/gnuef/TODO:1.21        Tue Nov  7 21:00:26 2000
+++ gnue/gnuef/TODO     Thu Nov  9 15:50:23 2000
@@ -3,15 +3,15 @@
 
 **MUST HAVES for 0.1.0
 **  Create UI/Form event interactions for login[jamest]
-**  windows support (ODBC?)
-**  debug master/detail[jamest]
+**  debug master/detail [jamest]
 **  curses support up to date [arno]
 **  cvs cleanup[jamest]
+**  windows support (ODBC?)
+  
 
-**DONE for 0.1.0
-**  make packages (RPM and deb) [jade]
+  Add layout manager support[perlpoet]
+  named triggers[chris]
 
-  
   clean up code  [everyone working on the code]
     provide better seperation of Objects in the Data system
     restore proper encapsulation in system
@@ -19,16 +19,10 @@
   Speed, speed, speed (it's pretty bad now w/ complex forms)
     status bar speed is slow
 
+  need to add default attrib values support
+  
   the x/y width units problem
 
-  mouse click out of field then F8 results in block error
-
-  current detail/masta code bombs if masta doesn't have an entry widget
-  defined for that field.
-
-  creating a new record and marking for delete prior to any commit
-    still causes record to commit
-
   update status only on record switch induced bug:
     status bar record status not updating as soon as I'd like
     it's possible to exit/query w/o saving current record
@@ -38,12 +32,6 @@
 
   Add toolbar support
 
-  Add layout manager support[perlpoet]
-
-  need to add default attrib values support
-  
-  Autocreate a datasource for block that don't specify one
-
   Make modification of data lock the record in the backend
 
   Transaction support
@@ -57,8 +45,6 @@
   menus should disable options not available (maybe)
     might be better to let GFForm send alert
 
-  named triggers
-
   Move things like database init in GFForm out of __init__ and 
     into a initialize routine that is called via some type of 
     uiINITIALIZED event so that a UI windows can prompt for things
@@ -68,16 +54,8 @@
     call the initializes of their children so we can get rid of 
     more of the self.walk nonsense
  
-  Moving the focus from entry in one block to a different block does
-    not result in the currentBlock switching to the new block
- 
-  rewrite the whole friggen braindead focus system to accomidate
-    mouse navigation to different blocks
-
   taborder support
 
-  Create GNUE Forms: Designer the screen painter
-
   Tweaks:
     certain attributes should only apply when in normal mode
     (numeric allowing % during query is a working example)
@@ -91,8 +69,15 @@
     is an enduser request i see it being done with text query inserting %
     between each char s%l%o%p%p%y%q%u%e%r%y
 
+    current detail/masta code bombs if masta doesn't have an entry widget
+    defined for that field.
+
+  Long term:
 
+    Create GNUE Forms: Designer the screen painter
 
+    rewrite the whole friggen braindead focus system to accomidate
+      mouse navigation to different blocks
 
 
 
Index: gnue/gnuef/samples/helloworld.gfd
diff -u gnue/gnuef/samples/helloworld.gfd:1.3 
gnue/gnuef/samples/helloworld.gfd:1.4
--- gnue/gnuef/samples/helloworld.gfd:1.3       Thu Nov  9 11:56:11 2000
+++ gnue/gnuef/samples/helloworld.gfd   Thu Nov  9 15:50:23 2000
@@ -8,9 +8,8 @@
   <width>400</width>
 </options>
 
-  <datasource name="nil" cache="5" />
   <page>
-    <block name="HelloWorldBlock" datasource="nil">
+    <block name="HelloWorldBlock">
       <label text="User Name" x="20" y="10" />
       <entry name="user" field="user" value="Type Here" x="20" y="20" 
width="300" height="25">
       </entry>
@@ -21,7 +20,7 @@
 #User name trigger
 #
 print "Trigger fired in block %s" % self.block.name
-print "HelloWorldBlock.datasource = %s" % HelloWorldBlock.datasource
+print "You can see this is a ", HelloWorldBlock.getObjectType()
 print "User name updated to %s" % HelloWorldBlock.fields.user
 print "User passwd updated to %s" % HelloWorldBlock.fields.password
 HelloWorldBlock.fields.user = "Wazzup!"
Index: gnue/gnuef/samples/zipcode/states.gfd
diff -u gnue/gnuef/samples/zipcode/states.gfd:1.3 
gnue/gnuef/samples/zipcode/states.gfd:1.4
--- gnue/gnuef/samples/zipcode/states.gfd:1.3   Tue Nov  7 21:00:26 2000
+++ gnue/gnuef/samples/zipcode/states.gfd       Thu Nov  9 15:50:23 2000
@@ -22,7 +22,7 @@
 
 
     <!-- Block of cities -->
-    <block name="cities" datasource="cities" master="state.state" 
detail="state_code">
+    <block name="cities"  master="state.state" detail="state_code">
       <label text="City" x="5" y="100"/>
       <entry name="city" field="city" x="5" y="110" width="150" height="20" 
visibleCount="5" />
 
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.38 gnue/gnuef/src/GFForm.py:1.39
--- gnue/gnuef/src/GFForm.py:1.38       Thu Nov  9 12:52:12 2000
+++ gnue/gnuef/src/GFForm.py    Thu Nov  9 15:50:23 2000
@@ -51,6 +51,7 @@
                            'requestQUERY'      : self.requestQuery,
                            'executeQUERY'      : self.executeQuery,
                            'requestCOMMIT'     : self.executeCommit,
+                           'requestROLLBACK'   : self.executeRollback,
                            'requestEXIT'       : self.executeExit,
 
                            'recordSWITCHED'    : self.recordSwitched,
@@ -85,7 +86,7 @@
     
     # Close the parser
     parser.close()
-
+    
     # set the initial focus
     self.walk(self.setInitialFocus)
 
@@ -274,7 +275,12 @@
       self.updateRecordCounter()
     else:
       self.dispatchEvent(GFEvent('formALERT','Form is readonly'))
-                               
+
+  def executeRollback(self,event):
+    self.dispatchEvent(GFEvent('processROLLBACK',self.currentBlock))
+    self.updateRecordStatus()
+    self.updateRecordCounter()
+    
   def recordSwitched(self, event):
     self.dispatchEvent(GFEvent('updateENTRY',event.data))
 
@@ -359,6 +365,7 @@
     event.data.processTrigger('Pre-FocusIn')
 
     self.currentEntry = event.data
+    self.currentBlock = self.currentEntry.block
 
     event.data.processTrigger('Post-FocusIn')
 
Index: gnue/gnuef/src/GFObjects.py
diff -u gnue/gnuef/src/GFObjects.py:1.35 gnue/gnuef/src/GFObjects.py:1.36
--- gnue/gnuef/src/GFObjects.py:1.35    Thu Nov  9 12:52:12 2000
+++ gnue/gnuef/src/GFObjects.py Thu Nov  9 15:50:23 2000
@@ -157,6 +157,7 @@
                            'initQUERY'     : self.processQuery,
                            'processQUERY'  : self.processQuery,
                            'processCOMMIT' : self.processCommit,
+                           'processROLLBACK': self.processRollback,
                            'updateDETAILBLOCK'  : self.updateDetail,
                            'valueUPDATE'  : self.updateEntry
                            }
@@ -169,8 +170,12 @@
 
   def initialize(self):
     self.walk(self.buildEntryList)
-    self.dataSourceLink = self.form.datasourceDictionary[self.datasource]
-    self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+    if hasattr(self,'datasource'):
+      self.dataSourceLink = self.form.datasourceDictionary[self.datasource]
+    else:
+      self.dataSourceLink = GFDataSource(self)
+      self.dataSourceLink.initialize()
+    self.recordCount = self.dataSourceLink.getLastRecordNumber()
 
   def buildEntryList(self, object):
     if object.getObjectType() == 'GFEntry':
@@ -192,7 +197,8 @@
   def newRecord(self, event):
     if event.data == self:
       self.dataSourceLink.new()
-      self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+      #self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+      self.recordCount = self.dataSourceLink.getLastRecordNumber()
       
       oldRecord = self.currentRecord
       self.currentRecord = 0
@@ -240,7 +246,8 @@
     self.mode='commit'
     self.dispatchEvent(GFEvent('requestNEXTRECORD'));
     self.dataSourceLink.commit()
-    self.recordCount   = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+    #self.recordCount   = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+    self.recordCount = self.dataSourceLink.getLastRecordNumber()
     self.currentRecord = 0
 
     # Switch to first record
@@ -251,6 +258,18 @@
     self.mode='normal'
 
   #
+  # processRollback
+  #
+  def processRollback(self,event):
+    
+    self.dataSourceLink.rollback()
+
+    # Switch to first record
+    self.dispatchEvent(GFEvent('switchRECORD',[-1,0]));
+    self.dispatchEvent(GFEvent('requestPREVRECORD',None))
+    self.dispatchEvent(GFEvent('requestNEXTRECORD',None))
+
+  #
   # processQuery
   #
   def processQuery(self, event):
@@ -266,7 +285,8 @@
         self.dispatchEvent(GFEvent('requestPREVRECORD',None))
         self.dispatchEvent(GFEvent('requestNEXTRECORD',None))
         self.dataSourceLink.clear()
-        self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+        #self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+        self.recordCount = self.dataSourceLink.getLastRecordNumber()
         self.currentRecord = self.recordCount
         self.dispatchEvent(GFEvent('switchRECORD',[-1,0]));
 
@@ -275,10 +295,12 @@
           self.mode = 'normal'
           self.dispatchEvent(GFEvent('switchRECORD',[0,0]));
           self.dataSourceLink.query()
-          self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+          #self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+          self.recordCount = self.dataSourceLink.getLastRecordNumber()
           if self.recordCount < 0:
             self.dataSourceLink.clear()
-            self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+            self.recordCount = self.dataSourceLink.getLastRecordNumber()
+            #self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
                             
           self.dispatchEvent(GFEvent('switchRECORD',[-1,0]));
           self.currentRecord = 0
@@ -301,7 +323,8 @@
           self.dataSourceLink.setField(0,self.detail,fieldValue)
           self.dataSourceLink.query()
         
-        self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+        #self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
+        self.recordCount = self.dataSourceLink.getLastRecordNumber()
         self.dispatchEvent(GFEvent('switchRECORD',[-1,0]));
         self.currentRecord = 0      
 
@@ -339,7 +362,6 @@
 
   def initialize(self):
     self.block.dataSourceLink.addField(self.field)
-#    GFObj.initialize()
 
   def setValue(self, value):
     self.value = value
@@ -361,7 +383,6 @@
     if not self.value:
       self.value = ""
     self.cursorPosition = len(self.value)
-    #self.dispatchEvent(GFEvent('uiNEXTRECORD',self))
     self.dispatchEvent(GFEvent('recordSWITCHED',self));
 
   #
@@ -372,7 +393,7 @@
     if hasattr(self,'foreign_key'):
       value = 0
       datasourceName,fieldName = string.split(self.foreign_key,'.')
-      datasource = self.block.form.datasourceDictionary[datasourceName]
+      datasource = self.block.datasource
 
       for count in range(datasource.getLastRecordNumber()+1):
         if datasource.getField(count,fieldName) == self.value:
@@ -387,8 +408,8 @@
     values = {}
     if hasattr(self,'foreign_key'):
       datasourceName,fieldName = string.split(self.foreign_key,'.')
-      datasource = self.block.form.datasourceDictionary[datasourceName]
-
+#      datasource = self.block.form.datasourceDictionary[datasourceName]
+      datasource = self.block.datasource
       for count in range(datasource.getLastRecordNumber()+1):
         if hasattr(self,'foreign_key_description'):
           description = datasource.getField(count,self.foreign_key_description)
@@ -452,6 +473,7 @@
       newentry[key] = self.emptyRecord[key]  
     self.resultSet.append(newentry)
     self.resultSetStatus.append('saved')
+    print "cleared and is saved? ", self.isSaved()
     
   def rollback(self):
     self.clear() 
@@ -462,6 +484,7 @@
   def isSaved(self):
     value = 1
     for count in range(len(self.resultSetStatus)):
+      print "stat", self.resultSetStatus[count] 
       if self.resultSetStatus[count] != 'saved':
         value = 0
         break
@@ -573,17 +596,19 @@
     self.resultSetStatus.append('saved')
 
   def markForRemoval(self,recordNumber):
-    print "The key is 
",self.resultSet[recordNumber][self.dataConnection.uniqueKey]
-    if self.resultSet[recordNumber][self.dataConnection.uniqueKey]:
-      self.resultSet[recordNumber][self.dataConnection.uniqueKey] = \
-      int(self.resultSet[recordNumber][self.dataConnection.uniqueKey]) * -1
-    else:
-      # The record had never really been saved so doesn't have an oid
+    if not self.resultSet[recordNumber].has_key(self.dataConnection.uniqueKey):
       self.resultSet[recordNumber][self.dataConnection.uniqueKey] = 'delete'
-      print "Never saved so I've set it to 
",self.resultSet[recordNumber][self.dataConnection.uniqueKey]
+    else:
+      if self.resultSet[recordNumber][self.dataConnection.uniqueKey] == 
'delete':
+        del self.resultSet[recordNumber][self.dataConnection.uniqueKey]
+      else:
+        self.resultSet[recordNumber][self.dataConnection.uniqueKey] = \
+        int(self.resultSet[recordNumber][self.dataConnection.uniqueKey]) * -1
+
     self.resultSetStatus[recordNumber] = 'modified'
     if GFOptions.DEBUG:
       print "removing object: %s" % 
(self.resultSet[recordNumber][self.dataConnection.uniqueKey])
+
     
   def getField(self,recordNumber,fieldName):
     try:
@@ -652,7 +677,6 @@
     self.uniqueKey = self.link.getUniqueKey(table)
     return self.link.getFieldList(table)    
 
-
 class GFFields:
   def __init__(self,block):
     self.block = block
@@ -668,7 +692,6 @@
     try:
       for item in self.__dict__['block'].__dict__['entryList']:
         if item.name == name:
-#         item.__dict__['value'] = value
          item.cursorPosition = len(value)
          item.setValue(value)
          return
Index: gnue/gnuef/src/UIwxpython.py
diff -u gnue/gnuef/src/UIwxpython.py:1.29 gnue/gnuef/src/UIwxpython.py:1.30
--- gnue/gnuef/src/UIwxpython.py:1.29   Thu Nov  9 12:52:12 2000
+++ gnue/gnuef/src/UIwxpython.py        Thu Nov  9 15:50:23 2000
@@ -418,6 +418,8 @@
     fileMenu = wxMenu()
     fileMenu.Append( 100, "Commit changes","Save all alterations to database")
     EVT_MENU(self, 100, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestCOMMIT')))
+    fileMenu.Append( 102, "Rollback","Discard alterations to database")
+    EVT_MENU(self, 102, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestROLLBACK')))
     fileMenu.AppendSeparator()
     fileMenu.Append( 101, "E&xit", "Leave the program" )
     EVT_MENU(self, 101,  self.TimeToQuit)



reply via email to

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