dabo Commit
Revision 2806
Date: 2007-02-11 14:02:01 -0800 (Sun, 11 Feb 2007)
Author: Paul
Changed:
U trunk/dabo/ui/uiwx/dForm.py
U trunk/dabo/ui/uiwx/dGrid.py
U trunk/dabo/ui/uiwx/dPemMixin.py
Log:
Reworked the last grid change to keep the mediation through the form, if
possible. This required making dForm.moveRecordPointer return a boolean, so
that dGrid can respond correctly.
Moved notifyUser back to dForm where it belongs.
Diff:
Modified: trunk/dabo/ui/uiwx/dForm.py
===================================================================
--- trunk/dabo/ui/uiwx/dForm.py 2007-02-11 21:21:50 UTC (rev 2805)
+++ trunk/dabo/ui/uiwx/dForm.py 2007-02-11 22:02:01 UTC (rev 2806)
@@ -85,6 +85,17 @@
return ret
+ def notifyUser(self, msg, title="Notice", severe=False):
+ """ Displays an alert messagebox for the user. You can customize
+ this in your own classes if you prefer a different display.
+ """
+ if severe:
+ func = dabo.ui.stop
+ else:
+ func = dabo.ui.info
+ func(message=msg, title=title)
+
+
def confirmChanges(self):
"""Ask the user if they want to save changes, discard changes,
or cancel.
@@ -170,7 +181,7 @@
if bizobj is None:
# Running in preview or some other non-live mode
return
- self._moveRecordPointer(bizobj.moveToRowNumber, dataSource,
rowNumber)
+ return self._moveRecordPointer(bizobj.moveToRowNumber,
dataSource, rowNumber)
def _moveRecordPointer(self, func, dataSource=None, *args, **kwargs):
@@ -183,23 +194,28 @@
err = self.beforePointerMove()
if err:
self.notifyUser(err)
- return
+ return False
try:
response = func(*args, **kwargs)
except dException.NoRecordsException:
self.setStatusText(_("No records in dataset."))
+ return False
except dException.BeginningOfFileException:
self.setStatusText(self.getCurrentRecordText(dataSource) + " (BOF)")
+ return False
except dException.EndOfFileException:
self.setStatusText(self.getCurrentRecordText(dataSource) + " (EOF)")
+ return False
except dException.dException, e:
self.notifyUser(str(e))
+ return False
else:
if biz.RowNumber != oldRowNum:
# Notify listeners that the row number changed:
dabo.ui.callAfter(self.raiseEvent,
dEvents.RowNumChanged)
self.update()
self.afterPointerMove()
+ return True
def first(self, dataSource=None):
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2007-02-11 21:21:50 UTC (rev 2805)
+++ trunk/dabo/ui/uiwx/dGrid.py 2007-02-11 22:02:01 UTC (rev 2806)
@@ -2988,11 +2988,17 @@
bizobj = self.getBizobj()
if bizobj:
if bizobj.RowCount > newRow and
bizobj.RowNumber != newRow:
- try:
- bizobj.RowNumber = newRow
- except
dException.BusinessRuleViolation, e:
- self.notifyUser(e)
- dabo.ui.callAfter(self.refresh)
+ if isinstance(self.Form, dabo.ui.dForm):
+ # run it through the form:
+ if not
self.Form.moveToRowNumber(newRow):
+
dabo.ui.callAfter(self.refresh)
+ else:
+ # run it through the bizobj
directly:
+ try:
+ bizobj.RowNumber =
newRow
+ except
dException.BusinessRuleViolation, e:
+ dabo.ui.stop(e)
+
dabo.ui.callAfter(self.refresh)
else:
# We are probably trying to select row
0 when there are no records
# in the bizobj.
Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py 2007-02-11 21:21:50 UTC (rev 2805)
+++ trunk/dabo/ui/uiwx/dPemMixin.py 2007-02-11 22:02:01 UTC (rev 2806)
@@ -597,17 +597,6 @@
self.raiseEvent(dEvents.Resize, evt)
- def notifyUser(self, msg, title="Notice", severe=False):
- """ Displays an alert messagebox for the user. You can customize
- this in your own classes if you prefer a different display.
- """
- if severe:
- func = dabo.ui.stop
- else:
- func = dabo.ui.info
- func(message=msg, title=title)
-
-
def bindKey(self, keyCombo, callback, **kwargs):
"""Bind a key combination such as "ctrl+c" to a callback
function.
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev