[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue common/src/GDebug.py common/src/GObjects.p...
From: |
James Thompson |
Subject: |
gnue common/src/GDebug.py common/src/GObjects.p... |
Date: |
Wed, 17 Apr 2002 11:25:16 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: James Thompson <address@hidden> 02/04/17 11:25:16
Modified files:
common/src : GDebug.py GObjects.py GTrigger.py
forms/src : GFInstance.py
forms/src/GFObjects: GFBlock.py GFEntry.py
forms/src/uidrivers/_base: UIdriver.py
Log message:
More cleanup and performance enhancements
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GDebug.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GObjects.py.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GTrigger.py.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFInstance.py.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFBlock.py.diff?tr1=1.47&tr2=1.48&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFEntry.py.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/_base/UIdriver.py.diff?tr1=1.66&tr2=1.67&r1=text&r2=text
Patches:
Index: gnue/common/src/GDebug.py
diff -c gnue/common/src/GDebug.py:1.6 gnue/common/src/GDebug.py:1.7
*** gnue/common/src/GDebug.py:1.6 Fri Apr 12 22:25:39 2002
--- gnue/common/src/GDebug.py Wed Apr 17 11:25:15 2002
***************
*** 60,67 ****
_DEBUGGER = debugger
def setDebug (level, file=None):
! global _DEBUG_LEVEL
! _DEBUG_LEVEL = level
if (file):
fh = open( file, 'w' )
catchStderr( fh )
--- 60,70 ----
_DEBUGGER = debugger
def setDebug (level, file=None):
! global _DEBUG_LEVEL, printMesg
! _DEBUG_LEVEL = int(level)
!
! if _DEBUG_LEVEL > 0:
! printMesg = _printMesg
if (file):
fh = open( file, 'w' )
catchStderr( fh )
***************
*** 87,95 ****
text = string.join(strings, '')
printMesg(0, text)
! def printMesg(level, message, dropToDebugger=0):
! global _fh, _DEBUGGER
! if ( int(level) <= int(_DEBUG_LEVEL) ):
caller = extract_stack()[-2]
try:
if caller[0][-3:] == '.py':
--- 90,106 ----
text = string.join(strings, '')
printMesg(0, text)
! #
! # We use _noPrintMesg and _printMesg assignment to printMesg
! # to speed things up when debug mode is not being used. It's
! # assigned in setDebug()
! #
! def _noPrintMesg(level, message, dropToDebugger=0):
! pass
!
! def _printMesg(level, message, dropToDebugger=0):
! if ( level <= _DEBUG_LEVEL ):
! global _fh, _DEBUGGER
caller = extract_stack()[-2]
try:
if caller[0][-3:] == '.py':
***************
*** 106,111 ****
--- 117,125 ----
if dropToDebugger and _DEBUGGER:
_DEBUGGER.set_trace()
+ printMesg = _noPrintMesg
+
+
class GETrace(Exception):
#
#Exception class representing a debug message
***************
*** 115,119 ****
--- 129,137 ----
Exception.__init__(self)
self.level = level
self.message = message
+
+
+
+
Index: gnue/common/src/GObjects.py
diff -c gnue/common/src/GObjects.py:1.32 gnue/common/src/GObjects.py:1.33
*** gnue/common/src/GObjects.py:1.32 Tue Apr 16 22:05:17 2002
--- gnue/common/src/GObjects.py Wed Apr 17 11:25:15 2002
***************
*** 57,66 ****
def __init__(self, parent=None, type='GObj'):
GTriggerCore.__init__(self)
self._type = type
! self._parent = parent
! self._children = []
self._attributes = {}
! self._inits = []
self._xmlnamespace = None
if parent :
parent.addChild(self)
--- 57,66 ----
def __init__(self, parent=None, type='GObj'):
GTriggerCore.__init__(self)
self._type = type
! self._parent = parent # The object that contains this object
! self._children = [] # The objects contained by this object
self._attributes = {}
! self._inits = [] # functions called during phaseInit stage
self._xmlnamespace = None
if parent :
parent.addChild(self)
***************
*** 202,211 ****
def walk(self, function, *args, **parms):
function(self, *args, **parms)
! if self._children:
! for child in self._children:
! if isinstance(child, GObj):
! child.walk(function, *args, **parms)
#
# findParentOfType
--- 202,210 ----
def walk(self, function, *args, **parms):
function(self, *args, **parms)
! for child in self._children:
! if isinstance(child, GObj):
! child.walk(function, *args, **parms)
#
# findParentOfType
***************
*** 219,234 ****
parentObject = self
else:
parentObject = self._parent
! if parentObject is None:
return None
- while (parentObject._parent != None and parentObject._type != type):
parentObject = parentObject._parent
! if parentObject._type == type:
! return parentObject
! else:
! return None
#
# getDescription
--- 218,247 ----
parentObject = self
else:
parentObject = self._parent
! #
! # Replacing this code with code below decreased startup
! # function call time by approx 33%
! #
! # if parentObject is None:
! # return None
! #
! # while (parentObject._parent != None and parentObject._type != type):
! # parentObject = parentObject._parent
! #
! # if parentObject._type == type:
! # return parentObject
! # else:
! # return None
!
! while 1:
! if parentObject == None:
return None
+ elif parentObject._type == type:
+ return parentObject
parentObject = parentObject._parent
!
#
# getDescription
Index: gnue/common/src/GTrigger.py
diff -c gnue/common/src/GTrigger.py:1.12 gnue/common/src/GTrigger.py:1.13
*** gnue/common/src/GTrigger.py:1.12 Sun Apr 14 01:13:04 2002
--- gnue/common/src/GTrigger.py Wed Apr 17 11:25:15 2002
***************
*** 185,190 ****
--- 185,191 ----
def __setattr__(self, name, value):
if self.__dict__.has_key(name) and \
isinstance(self.__dict__[name], GTriggerNSObject):
+ if isinstance(self.__dict__[name], GTriggerNSObject):
if self.__dict__[name]._triggerSet:
self.__dict__[name]._triggerSet(value)
else:
Index: gnue/forms/src/GFInstance.py
diff -c gnue/forms/src/GFInstance.py:1.44 gnue/forms/src/GFInstance.py:1.45
*** gnue/forms/src/GFInstance.py:1.44 Fri Apr 12 22:25:39 2002
--- gnue/forms/src/GFInstance.py Wed Apr 17 11:25:16 2002
***************
*** 329,335 ****
--- 329,337 ----
if not self._form.endEditing():
return
try:
+ print "GFInstance ed", event.data
count = abs(int(event.data))-1
+ print "GFInstance c", count
except ValueError:
message = "Invalid numeric value entered."
else:
***************
*** 345,361 ****
def jumpRecords(self,event):
if not self._form.endEditing():
return
!
count = event.data
# Doing this to reduce comparisons in the loop
if count > 0:
method = self._form.nextRecord
else:
method = self._form.prevRecord
!
for jumps in range(abs(int(count))):
method()
!
self._entryUpdated()
def executeExit(self, event):
--- 347,363 ----
def jumpRecords(self,event):
if not self._form.endEditing():
return
!
count = event.data
# Doing this to reduce comparisons in the loop
if count > 0:
method = self._form.nextRecord
else:
method = self._form.prevRecord
! print "GFInstance count", count
for jumps in range(abs(int(count))):
method()
!
self._entryUpdated()
def executeExit(self, event):
Index: gnue/forms/src/GFObjects/GFBlock.py
diff -c gnue/forms/src/GFObjects/GFBlock.py:1.47
gnue/forms/src/GFObjects/GFBlock.py:1.48
*** gnue/forms/src/GFObjects/GFBlock.py:1.47 Sun Apr 14 01:13:04 2002
--- gnue/forms/src/GFObjects/GFBlock.py Wed Apr 17 11:25:16 2002
***************
*** 85,90 ****
--- 85,91 ----
if index > cnt:
raise IndexError
+ print "GFBlock", index
self.jumpRecord(index)
if cnt == index and self.isEmpty():
Index: gnue/forms/src/GFObjects/GFEntry.py
diff -c gnue/forms/src/GFObjects/GFEntry.py:1.54
gnue/forms/src/GFObjects/GFEntry.py:1.55
*** gnue/forms/src/GFObjects/GFEntry.py:1.54 Tue Apr 16 22:05:18 2002
--- gnue/forms/src/GFObjects/GFEntry.py Wed Apr 17 11:25:16 2002
***************
*** 75,81 ****
'get':self.getReadonly
},
}
! self._triggerSet = self.setValue
self._triggerGet = self.getValue
--- 75,81 ----
'get':self.getReadonly
},
}
! self._triggerSet = self.triggerSetValue
self._triggerGet = self.getValue
***************
*** 206,225 ****
if value == None: value = ''
#CheckBox does not work if comment following "if" block (ra3vat)
! if value == '' and self.style == 'checkbox': value = 0
return value
! def setValue(self, value):
! if value =='' and self.style=='checkbox':
value = 0
-
- # Number fields
- # TODO: This is being done in the display handler but
- # TODO: triggers don't use that. We're leaving here
- # TODO: until we decide what to do. jst
if self.typecast == "number" and value != None:
value = float(value)
if self._block.mode == 'query':
self._block._queryValues[self] = value
--- 206,235 ----
if value == None: value = ''
#CheckBox does not work if comment following "if" block (ra3vat)
! if self.style == 'checkbox' and value == '': value = 0
return value
! #
! # triggerSetValue
! #
! # does proper typecasting when value is set via a trigger
! #
! def triggerSetValue(self, value):
! if self.style=='checkbox' and value =='':
value = 0
if self.typecast == "number" and value != None:
value = float(value)
+ self.setValue(value)
+
+ def setValue(self, value):
+ # TODO: This is now being done in the display handler
+ #if self.style=='checkbox' and value =='':
+ # value = 0
+ #
+ # Number fields
+ #if self.typecast == "number" and value != None:
+ # value = float(value)
if self._block.mode == 'query':
self._block._queryValues[self] = value
Index: gnue/forms/src/uidrivers/_base/UIdriver.py
diff -c gnue/forms/src/uidrivers/_base/UIdriver.py:1.66
gnue/forms/src/uidrivers/_base/UIdriver.py:1.67
*** gnue/forms/src/uidrivers/_base/UIdriver.py:1.66 Sun Apr 14 01:13:04 2002
--- gnue/forms/src/uidrivers/_base/UIdriver.py Wed Apr 17 11:25:16 2002
***************
*** 120,145 ****
self._formToUIWidget[self._currentObject[0]]=uiWidget
# If the widget list is not empty then do the following
if not widget == []:
# Create a cross reference to the GFObject that created
# one or more UI widgets
self._formToUI[self._currentObject[0]] = widget
# If the current object is a container then add the
# just created first created widget to it's widget list
! if self._currentObject[0].getObjectType() in self.containerWidgets:
self.currentWidget.insert(0,widget[0])
except KeyError:
pass
if self._currentObject[0]._children:
! for child in self._currentObject[0]._children:
if isinstance(child, GObj):
self._currentObject.insert(0,child)
self._buildUI()
self._currentObject.pop(0)
! if self._currentObject[0].getObjectType() in self.containerWidgets:
self.currentWidget.pop(0)
#############################################################################
--- 120,147 ----
self._formToUIWidget[self._currentObject[0]]=uiWidget
# If the widget list is not empty then do the following
+ # list would be empty on hidden fields
if not widget == []:
# Create a cross reference to the GFObject that created
# one or more UI widgets
self._formToUI[self._currentObject[0]] = widget
# If the current object is a container then add the
# just created first created widget to it's widget list
! if self._currentObject[0]._type in self.containerWidgets:
self.currentWidget.insert(0,widget[0])
except KeyError:
pass
+
if self._currentObject[0]._children:
! for child in self._currentObject[0]._children:
if isinstance(child, GObj):
self._currentObject.insert(0,child)
self._buildUI()
self._currentObject.pop(0)
! if self._currentObject[0]._type in self.containerWidgets:
self.currentWidget.pop(0)
#############################################################################
***************
*** 300,305 ****
--- 302,309 ----
self._formToUIWidget[entry].setValue(value,count)
+
+ # Fill current spot
value = handler.getDisplayFiller(entry.getValue())
self._formToUIWidget[entry].setValue(value, index)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue common/src/GDebug.py common/src/GObjects.p...,
James Thompson <=