commit-gnue
[Top][All Lists]
Advanced

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

gnue gnue-common/src/GConnections.py gnue-commo...


From: James Thompson
Subject: gnue gnue-common/src/GConnections.py gnue-commo...
Date: Wed, 18 Jul 2001 13:38:14 -0700

CVSROOT:        /cvs
Module name:    gnue
Branch:         gnuef-new-datasources
Changes by:     James Thompson <address@hidden> 01/07/18 13:38:14

Modified files:
        gnue-common/src: GConnections.py GParser.py 
        gnuef/src      : GFClient.py GFForm.py GFInstance.py 
                         UIwxpython.py 
        gnuef/src/GFObjects: GFBlock.py 

Log message:
        Still broken changes during migration to new datasources
        Checking in so jcater can see the damage I'm doing

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GConnections.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.9&tr2=1.9.2.1&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GParser.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.18&tr2=1.18.2.1&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFClient.py.diff?cvsroot=OldCVS&only_with_tag=gnuef-new-datasources&tr1=1.24&tr2=1.24.2.1&r1=text&r2=text
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.1&tr2=1.110.2.2&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.1&tr2=1.16.2.2&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.1&tr2=1.104.2.2&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.1&tr2=1.4.2.2&r1=text&r2=text

Patches:
Index: gnue/gnue-common/src/GConnections.py
diff -u gnue/gnue-common/src/GConnections.py:1.8 
gnue/gnue-common/src/GConnections.py:1.9
--- gnue/gnue-common/src/GConnections.py:1.8    Wed Jun  6 15:31:15 2001
+++ gnue/gnue-common/src/GConnections.py        Mon Jun 25 12:29:11 2001
@@ -37,12 +37,12 @@
 import GLoginHandler
 from gnue.common import openResource
 
-class NotFoundError (Error): 
+class NotFoundError (StandardError): 
   # Raised if a requested connection name does not  
   # exist in the Connections Definition File.
   pass
 
-class InvalidFormatError (Error): 
+class InvalidFormatError (StandardError): 
   # Raised if the Connections Definition File is   
   # in an unreadable format.
   pass
Index: gnue/gnue-common/src/GParser.py
diff -u gnue/gnue-common/src/GParser.py:1.17 
gnue/gnue-common/src/GParser.py:1.18
--- gnue/gnue-common/src/GParser.py:1.17        Fri Jun 29 15:55:58 2001
+++ gnue/gnue-common/src/GParser.py     Wed Jul  4 17:24:11 2001
@@ -46,6 +46,7 @@
 import string
 import sys
 import GDebug
+import GTypecast
 
 
 #######################################################
@@ -114,10 +115,13 @@
 #
 # This is for typecasting strings
 #
+# NOTE: This is a redefinition of GTypecast.text.
+#   This redefinition will be removed as soon as all
+#   references to it are changes.  You should be using
+#   GTypecast from now on.
+#
 #######################################################
-def char (value): 
-  # Do we convert '&lt;',etc stuff here?
-  return str(value)
+char  = GTypecast.text
 
 
 #######################################################
@@ -126,18 +130,13 @@
 #
 # This is for typecasting booleans
 #
+# NOTE: This is a redefinition of GTypecast.boolean. 
+#   This redefinition will be removed as soon as all
+#   references to it are changes.  You should be using
+#   GTypecast from now on. 
+#
 #######################################################
-def bool (value): 
-  if value == 0 or value == 1: 
-    return value
-
-  rv = string.lower(string.strip(value))
-  if len(rv): 
-    return not (rv[0] == 'n' or rv[0] == 'f' or rv == '0')
-  else: 
-    # This may seem counter-intuitive, but if attribute was present 
-    # without a specified value, then treat as true
-    return 1
+bool = GTypecast.boolean
 
 
 #######################################################
Index: gnue/gnuef/src/GFClient.py
diff -u gnue/gnuef/src/GFClient.py:1.23 gnue/gnuef/src/GFClient.py:1.24
--- gnue/gnuef/src/GFClient.py:1.23     Fri Jun 29 17:59:05 2001
+++ gnue/gnuef/src/GFClient.py  Mon Jul  2 10:54:19 2001
@@ -34,7 +34,7 @@
 #
 # Copyright (c) 2000 Free Software Foundation
 #
-# $Id: GFClient.py,v 1.23 2001/06/30 00:59:05 jamest Exp $
+# $Id: GFClient.py,v 1.24 2001/07/02 17:54:19 jcater Exp $
 #
 
 import pstats
@@ -52,6 +52,7 @@
 from gnue.common import GDebug
 from gnue.common import GConfig
 from gnue.common.GClientApp import * 
+from gnue.forms import VERSION
 
 class GFClient(GClientApp):
   #
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.4 
gnue/gnuef/src/GFObjects/GFBlock.py:1.5
--- gnue/gnuef/src/GFObjects/GFBlock.py:1.4     Wed Jul 11 16:06:46 2001
+++ gnue/gnuef/src/GFObjects/GFBlock.py Mon Jul 16 20:09:41 2001
@@ -158,6 +158,13 @@
         self._currentRecord = self._recordCount    
     self.switchRecord(-1)
 
+  def jumpRecord(self, recordNumber):
+    if recordNumber > self._recordCount:
+      recordNumber = self._recordCount
+    jump = recordNumber - self._currentRecord
+    self._currentRecord = recordNumber
+    self.switchRecord(jump)
+    
       
   #
   # processCommit
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]