commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef/src GFForm.py GFInstance.py UIbase.p...


From: Jason Cater
Subject: gnue/gnuef/src GFForm.py GFInstance.py UIbase.p...
Date: Sun, 22 Jul 2001 21:01:02 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Branch:         gnuef-new-datasources
Changes by:     Jason Cater <address@hidden>    01/07/22 21:01:01

Modified files:
        gnuef/src      : GFForm.py GFInstance.py UIbase.py UIwxpython.py 
        gnuef/src/GFObjects: GFBlock.py GFEntry.py GFObj.py 

Log message:
        lots o' bug fixes related to multiview, navigation, block inits, etc

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFForm.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.110.2.14&tr2=1.110.2.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFInstance.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.16.2.8&tr2=1.16.2.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/UIbase.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.40.2.5&tr2=1.40.2.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/UIwxpython.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.104.2.11&tr2=1.104.2.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFObjects/GFBlock.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.4.2.16&tr2=1.4.2.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFObjects/GFEntry.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.2.2.12&tr2=1.2.2.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFObjects/GFObj.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.2.2.2&tr2=1.2.2.3&r1=text&r2=text

Patches:
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.112 gnue/gnuef/src/GFForm.py:1.113
--- gnue/gnuef/src/GFForm.py:1.112      Thu Jul 12 20:56:13 2001
+++ gnue/gnuef/src/GFForm.py    Mon Jul 16 20:09:41 2001
@@ -783,6 +783,16 @@
             return message
     self._currentBlock.nextRecord()
 
+  def jumpRecord(self,count):
+    for block in self._blockList:
+      if hasattr(block,'master'):
+        masterBlock,masterField = string.split(block.master,'.')
+        if masterBlock == self._currentBlock.name:
+          if not block.isSaved():
+            message = GConfig.get('_msgNOTSAVED')
+            return message
+    self._currentBlock.jumpRecord(count)
+
 
   def toggleInsertMode(self):
     self._insertMode = not self._insertMode
Index: gnue/gnuef/src/GFInstance.py
diff -u gnue/gnuef/src/GFInstance.py:1.17 gnue/gnuef/src/GFInstance.py:1.18
--- gnue/gnuef/src/GFInstance.py:1.17   Thu Jul 12 20:56:13 2001
+++ gnue/gnuef/src/GFInstance.py        Mon Jul 16 20:09:41 2001
@@ -34,7 +34,7 @@
 #
 # Copyright (c) 2000 Free Software Foundation
 #
-# $Id: GFInstance.py,v 1.17 2001/07/13 03:56:13 jcater Exp $
+# $Id: GFInstance.py,v 1.18 2001/07/17 03:09:41 jamest Exp $
 #
 
 import pstats
@@ -72,7 +72,7 @@
                            'requestPREVBLOCK'    : self.previousBlock,
                            'requestPREVRECORD'   : self.prevRecord,
                            'requestNEXTRECORD'   : self.nextRecord,
-                           'requestJUMPRECORD'   : self.jumpRecords,
+                           'requestRECORDNUMBER' : self.jumpRecords,
                            'requestPAGE'         : self.gotoPage,
                            
                            'requestKEYPRESS'     : self.keyPress,
@@ -225,12 +225,18 @@
   # form move an arbitrary number of records
   #
   def jumpRecords(self,event):
-    count = event.data
-    for jumps in range(abs(count)):
-      if count > 0:
-        self._form.nextRecord()
-      if count < 0:
-        self._form.prevRecord()
+    try:
+      count = abs(int(event.data))-1
+    except ValueError:
+      message = "Invalid numeric value entered."
+    else:
+      message = self._form.jumpRecord(count)
+
+    if message:
+      messageBox = GFMsgBox(self,message)
+      messageBox.show()
+      return                    
+
     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
     self.updateRecordCounter()
     self.updateRecordStatus()
Index: gnue/gnuef/src/GFObjects/GFBlock.py
diff -u gnue/gnuef/src/GFObjects/GFBlock.py:1.5 
gnue/gnuef/src/GFObjects/GFBlock.py:1.6
--- gnue/gnuef/src/GFObjects/GFBlock.py:1.5     Mon Jul 16 20:09:41 2001
+++ gnue/gnuef/src/GFObjects/GFBlock.py Wed Jul 18 15:45:01 2001
@@ -31,8 +31,7 @@
 # Copyright (c) 2000 Free Software Foundation
 #
 
-from gnue.common.GObjects import * 
-from gnue.common.dbdrivers.factory import factory
+#from gnue.common.GObjects import * 
 from gnue.forms.GFEvent import *
 from gnue.forms.GFObjects.GFDataSource import GFDataSource
 
@@ -41,7 +40,6 @@
 from GFObj import GFObj
 
 import string
-import types
 
 # These should really go somewhere else
 TRUE = 1
Index: gnue/gnuef/src/GFObjects/GFEntry.py
diff -u gnue/gnuef/src/GFObjects/GFEntry.py:1.5 
gnue/gnuef/src/GFObjects/GFEntry.py:1.6
--- gnue/gnuef/src/GFObjects/GFEntry.py:1.5     Mon Jul 16 20:09:41 2001
+++ gnue/gnuef/src/GFObjects/GFEntry.py Wed Jul 18 15:45:01 2001
@@ -31,18 +31,10 @@
 # Copyright (c) 2000 Free Software Foundation
 #
 
-from gnue.common.GObjects import * 
-from gnue.common.dbdrivers.factory import factory
-
 from gnue.common import GDebug
 from gnue.common import GConfig
 from GFValue import GFValue
 import string
-import types
-
-# These should really go somewhere else
-TRUE = 1
-FALSE = 0
 
 ############################################################
 # GFEntry
Index: gnue/gnuef/src/GFObjects/GFObj.py
diff -u gnue/gnuef/src/GFObjects/GFObj.py:1.2 
gnue/gnuef/src/GFObjects/GFObj.py:1.3
--- gnue/gnuef/src/GFObjects/GFObj.py:1.2       Tue Jul  3 17:54:41 2001
+++ gnue/gnuef/src/GFObjects/GFObj.py   Wed Jul 18 15:45:01 2001
@@ -31,17 +31,9 @@
 # Copyright (c) 2000 Free Software Foundation
 #
 
-from gnue.common import GDebug
-from gnue.common import GConfig
-from gnue.common.GObjects import * 
-
+from gnue.common.GObjects import GObj
 from gnue.forms.GFTrigger import GFTriggerAware
 
-
-# These should really go somewhere else
-TRUE = 1
-FALSE = 0
-
 #
 # Class GFObj
 #
@@ -57,7 +49,6 @@
     self._visibleIndex = 0
     self.name = "__%s__" % self
 
-
   #
   # get an Option 
   #
@@ -70,7 +61,6 @@
             if o.name == name:
               option = o.value
     return option
-           
 
   #
   # recalculateVisible
Index: gnue/gnuef/src/UIbase.py
diff -u gnue/gnuef/src/UIbase.py:1.40 gnue/gnuef/src/UIbase.py:1.41
--- gnue/gnuef/src/UIbase.py:1.40       Wed Jun 20 16:34:50 2001
+++ gnue/gnuef/src/UIbase.py    Sat Jul 21 16:33:49 2001
@@ -321,7 +321,7 @@
     # you do not want to just add 1 to count
     # as the formulas would then be off
     count = index
-    while count < int(event.data.visibleCount):
+    while count < int(event.data.rows):
       if count != index:
         if currentRecord+(count-index) > block._recordCount:
           if style == 'checkbox':
@@ -353,10 +353,10 @@
   def __init__(self, object, container, textWidth, textHeight, widgetWidth, 
widgetHeight, interface, initialize=1):
     self.widgets = []
 
-    if not hasattr(object,'visibleCount'):
-      object.visibleCount = 1
+    if not hasattr(object,'rows'):
+      object.rows = 1
     else:
-      object.visibleCount = int(object.visibleCount)
+      object.rows = int(object.rows)
 
     if hasattr(object,'gap'):
       object.gap = int(object.gap)
@@ -371,7 +371,7 @@
       self.itemHeight = -1
       
     if not object.hidden:
-      for spacer in range(int(object.visibleCount)):
+      for spacer in range(int(object.rows)):
         newWidget = self.createWidget(object, container, textWidth, 
textHeight, widgetWidth, widgetHeight, interface, spacer, initialize)
         self.widgets.append(newWidget)
         
Index: gnue/gnuef/src/UIwxpython.py
diff -u gnue/gnuef/src/UIwxpython.py:1.104 gnue/gnuef/src/UIwxpython.py:1.105
--- gnue/gnuef/src/UIwxpython.py:1.104  Tue Jul  3 18:42:45 2001
+++ gnue/gnuef/src/UIwxpython.py        Mon Jul 16 20:09:41 2001
@@ -42,8 +42,6 @@
 _NOTEBOOK = None
 _LOOPTRAP = 0
 
-
-
 #
 # Little global helper routine to set font according to options
 #
@@ -226,6 +224,8 @@
     EVT_MENU(self, 201, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEXTRECORD')))
     dataMenu.Append( 202, "Previous Record   
(Down)",GConfig.get('msg_previous'))
     EVT_MENU(self, 202, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestPREVRECORD')))
+    dataMenu.Append( 209, "Jump to Record...     (F2)",GConfig.get('msg_jump'))
+    EVT_MENU(self, 209, self.promptForRecordNumber)
     dataMenu.Append( 203, "New Record           
(F12)",GConfig.get('msg_insert'))
     EVT_MENU(self, 203, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEWRECORD')))
     dataMenu.Append( 204, "Delete Record          
(F5)",GConfig.get('msg_delete'))
@@ -438,6 +438,19 @@
     self.mainWindow.Close()
 
   #
+  # promptForRecordNumber
+  #
+  # Presents a dialog to user asking for the record number to jump to
+  #
+  def promptForRecordNumber(self, event= None):
+    dlg = wxTextEntryDialog(self.mainWindow, 'Enter record number to jump to',
+                                                        'Which record?')
+    if dlg.ShowModal() == wxID_OK:
+      self.dispatchEvent(GFEvent('requestRECORDNUMBER', dlg.GetValue()))
+      dlg.Destroy()
+                      
+
+  #
   # closeTrap
   #
   # intercepts the applications closure and generates an event to the form 
requesting
@@ -480,6 +493,9 @@
           elif (1728 <= event.KeyCode() <= 1791):
             offset = 1536
             action = GFEvent('requestKEYPRESS',chr(event.KeyCode()-offset))
+          elif event.KeyCode() == WXK_F2:
+            self.promptForRecordNumber()
+
             
     #
     # Mouse Events
@@ -1007,6 +1023,7 @@
 class UIMessageBox(wxMessageDialog, UIHelper):
   def __init__(self, interface, message, caption):
     wxMessageDialog.__init__(self, interface, message, caption, 
style=wxOK|wxICON_EXCLAMATION)
+
 
 
 



reply via email to

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