dabo Commit
Revision 5972
Date: 2010-09-01 05:15:43 -0700 (Wed, 01 Sep 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5972
Changed:
U trunk/dabo/ui/uiwx/dDialog.py
U trunk/dabo/ui/uiwx/dForm.py
U trunk/dabo/ui/uiwx/dFormMain.py
U trunk/dabo/ui/uiwx/dFormMixin.py
Log:
Removed trailing whitespace in these files. No coding/logic changes.
Diff:
Modified: trunk/dabo/ui/uiwx/dDialog.py
===================================================================
--- trunk/dabo/ui/uiwx/dDialog.py 2010-09-01 12:12:58 UTC (rev 5971)
+++ trunk/dabo/ui/uiwx/dDialog.py 2010-09-01 12:15:43 UTC (rev 5972)
@@ -36,7 +36,7 @@
kwargs["style"] = defaultStyle
preClass = wx.PreDialog
- fm.dFormMixin.__init__(self, preClass, parent,
properties=properties,
+ fm.dFormMixin.__init__(self, preClass, parent,
properties=properties,
*args, **kwargs)
# Hook method, so that we add the buttons last
@@ -75,7 +75,7 @@
def showModal(self):
"""Show the dialog modally."""
- ## pkm: We had to override this, because the default in
dPemMixin doesn't
+ ## pkm: We had to override this, because the default in
dPemMixin doesn't
## actually result in a modal dialog.
self.Modal = True
self.show()
@@ -96,7 +96,7 @@
def show(self):
# Call _afterShow() once immediately, and then once after the
dialog is visible, which
- # will correct minor mistakes such as the height of wordwrapped
labels not being
+ # will correct minor mistakes such as the height of wordwrapped
labels not being
# accounted for. If we only called it after the dialog was
already shown, then we
# risk the dialog being too jumpy.
self._afterShow()
@@ -105,11 +105,11 @@
ret = self.ShowModal()
return {wx.ID_OK: kons.DLG_OK, wx.ID_CANCEL:
kons.DLG_CANCEL}.get(ret, ret)
return self.Show(True)
-
+
def _addControls(self):
- """Any controls that need to be added to the dialog
+ """Any controls that need to be added to the dialog
can be added in this method in framework classes, or
in addControls() in instances.
"""
@@ -189,8 +189,8 @@
def _setModal(self, val):
self._modal = val
-
+
def _getShowStat(self):
# Dialogs cannot have status bars.
return False
@@ -201,7 +201,7 @@
_("When True, the dialog resizes to fit the added
controls. (bool)"))
Borderless = property(_getBorderless, _setBorderless, None,
- _("""Must be passed at construction time. When set to
True, the dialog displays
+ _("""Must be passed at construction time. When set to
True, the dialog displays
without a title bar or borders (bool)"""))
Caption = property(_getCaption, _setCaption, None,
@@ -212,8 +212,8 @@
Modal = property(_getModal, _setModal, None,
_("Determines if the dialog is shown modal (default) or
modeless. (bool)"))
-
+
DynamicAutoSize = makeDynamicProperty(AutoSize)
DynamicCaption = makeDynamicProperty(Caption)
DynamicCentered = makeDynamicProperty(Centered)
@@ -221,10 +221,10 @@
class dStandardButtonDialog(dDialog):
- """Creates a dialog with standard buttons and associated functionality.
You can
- choose the buttons that display by passing True for any of the
following
+ """Creates a dialog with standard buttons and associated functionality.
You can
+ choose the buttons that display by passing True for any of the following
properties:
-
+
OK
Cancel
Yes
@@ -234,9 +234,9 @@
If you don't specify buttons, only the OK will be included; if you do
specify buttons,
you must specify them all; in other words, OK is only assumed if
nothing is specified.
Then add your custom controls in the addControls() hook method, and
respond to
- the pressing of the standard buttons in the run*() handlers, where * is
the name of the
- associated property (e.g., runOK(), runOo(), etc.). You can query the
Accepted property
- to find out if the user pressed "OK" or "Yes"; if neither of these was
pressed,
+ the pressing of the standard buttons in the run*() handlers, where * is
the name of the
+ associated property (e.g., runOK(), runOo(), etc.). You can query the
Accepted property
+ to find out if the user pressed "OK" or "Yes"; if neither of these was
pressed,
Accepted will be False.
"""
def __init__(self, parent=None, properties=None, *args, **kwargs):
@@ -270,10 +270,10 @@
yes = self._yes
no = self._no
help = self._help
- if (ok is None and cancel is None and yes is None and
+ if (ok is None and cancel is None and yes is None and
no is None and help is None):
ok = True
-
+
flags = 0
if ok:
flags = flags | wx.OK
@@ -332,7 +332,7 @@
# Force the escape button to be set appropriately:
self.CancelOnEscape = self.CancelOnEscape
-
+
# Wx rearranges the order of the buttons per platform
conventions, but
# doesn't rearrange the tab order for us. So, we do it manually:
buttons = []
@@ -375,10 +375,10 @@
################################################
- # Handlers for the standard buttons.
+ # Handlers for the standard buttons.
################################################
- # Note that onOK() and
- # onCancel() are the names of the old event handlers, and
+ # Note that onOK() and
+ # onCancel() are the names of the old event handlers, and
# code has been written to use these. So as not to break this
# older code, we issue a deprecation warning and call the
# old handler.
@@ -387,7 +387,7 @@
try:
self.onOK()
except TypeError:
- warnings.warn(_("The onOK() handler is deprecated. Use
the runOK() method instead"),
+ warnings.warn(_("The onOK() handler is deprecated. Use
the runOK() method instead"),
Warning)
self.onOK(None)
except AttributeError:
@@ -401,13 +401,13 @@
try:
self.onCancel()
except TypeError:
- warnings.warn(_("The onCancel() handler is deprecated.
Use the runCancel() method instead"),
+ warnings.warn(_("The onCancel() handler is deprecated.
Use the runCancel() method instead"),
Warning)
self.onCancel(None)
except AttributeError:
# New code should not have onCancel
pass
-
+
if self.runCancel() is not False:
self.EndModal(kons.DLG_CANCEL)
else:
@@ -435,16 +435,16 @@
def runHelp(self): pass
################################################
-
+
def addControls(self):
- """Use this method to add controls to the dialog. The standard
buttons will be added
+ """Use this method to add controls to the dialog. The standard
buttons will be added
after this method runs, so that they appear at the bottom of
the dialog.
"""
pass
-
-
+
+
def addControlSequence(self, seq):
- """This takes a sequence of 3-tuples or 3-lists, and adds
controls
+ """This takes a sequence of 3-tuples or 3-lists, and adds
controls
to the dialog as a grid of labels and data controls. The first
element of
the list/tuple is the prompt, the second is the data type, and
the third
is the RegID used to retrieve the entered value.
@@ -469,15 +469,15 @@
gs.setColExpand(True, 1)
self.Sizer.insert(self.LastPositionInSizer, gs, "x")
self.layout()
-
-
+
+
def _getAccepted(self):
- return self._accepted
+ return self._accepted
def _setAccepted(self, val):
self._accepted = val
-
-
+
+
def _getButtonSizer(self):
return getattr(self, "stdButtonSizer", None)
@@ -508,20 +508,20 @@
def _getHelpButton(self):
return self.btnHelp
-
+
def _getOKButton(self):
return self.btnOK
-
+
def _getNoButton(self):
return self.btnNo
-
+
def _getYesButton(self):
return self.btnYes
-
+
Accepted = property(_getAccepted, _setAccepted, None,
_("Specifies whether the user accepted the dialog, or
canceled. (bool)"))
@@ -533,27 +533,27 @@
CancelButton = property(_getCancelButton, None, None,
_("Reference to the Cancel button on the form, if
present (dButton or None)."))
-
+
CancelOnEscape = property(_getCancelOnEscape, _setCancelOnEscape, None,
- _("""When True (default), pressing the Escape key will
perform the same action
- as clicking the Cancel button. If no Cancel button is
present but there is a No button,
- the No behavior will be executed. If neither button is
present, the default button's
+ _("""When True (default), pressing the Escape key will
perform the same action
+ as clicking the Cancel button. If no Cancel button is
present but there is a No button,
+ the No behavior will be executed. If neither button is
present, the default button's
action will be executed (bool)"""))
HelpButton = property(_getHelpButton, None, None,
_("Reference to the Help button on the form, if present
(dButton or None)."))
-
+
NoButton = property(_getNoButton, None, None,
_("Reference to the No button on the form, if present
(dButton or None)."))
-
+
OKButton = property(_getOKButton, None, None,
_("Reference to the OK button on the form, if present
(dButton or None)."))
-
+
YesButton = property(_getYesButton, None, None,
_("Reference to the Yes button on the form, if present
(dButton or None)."))
-
-
+
+
class dOkCancelDialog(dStandardButtonDialog):
def __init__(self, parent=None, properties=None, *args, **kwargs):
kwargs["Yes"] = kwargs["No"] = False
@@ -605,8 +605,8 @@
self.Right = min(self.Right, maxW-5)
self.Bottom = min(self.Bottom, maxH-5)
super(_FloatDialog, self).show()
-
+
def _getAbove(self):
return self._above
Modified: trunk/dabo/ui/uiwx/dForm.py
===================================================================
--- trunk/dabo/ui/uiwx/dForm.py 2010-09-01 12:12:58 UTC (rev 5971)
+++ trunk/dabo/ui/uiwx/dForm.py 2010-09-01 12:15:43 UTC (rev 5972)
@@ -17,13 +17,13 @@
class BaseForm(fm.dFormMixin):
"""Creates a bizobj-aware form.
- dForm knows how to handle one or more dBizobjs, providing proxy methods
+ dForm knows how to handle one or more dBizobjs, providing proxy methods
like next(), last(), save(), and requery().
"""
def __init__(self, preClass, parent, properties, attProperties, *args,
**kwargs):
self.bizobjs = {}
self._primaryBizobj = None
-
+
# If this is True, a panel will be automatically added to the
# form and sized to fill the form.
# self.mainPanel = None
@@ -32,7 +32,7 @@
# self.mkPanel = (self.mkPanel == "True")
# else:
# self.mkPanel = self._extractKey((kwargs, properties),
"panel", False)
-
+
# Use this for timing queries and other long-
# running events
self.stopWatch = wx.StopWatch()
@@ -41,14 +41,14 @@
# Determines if the user is prompted to save changes when the
form is closed
# or a requery is about to happen.
self._checkForChanges = True
-
+
fm.dFormMixin.__init__(self, preClass, parent, properties,
attProperties, *args, **kwargs)
# if self.mainPanel:
# # Can't do this in the _afterInit, as properties
haven't been
# # applied at that point.
# self.mainPanel.BackColor = self.BackColor
-
+
# Used to override some cases where the status
# text should be displayed despite other processes
# trying to overwrite it
@@ -60,8 +60,8 @@
def _beforeSetProperties(self, props):
if "UseSizers" in props and not hasattr(self, "UseSizers"):
del props["UseSizers"]
-
-
+
+
def _afterInit(self):
self.Sizer = dabo.ui.dSizer("vertical")
self.Sizer.layout()
@@ -72,11 +72,11 @@
super(BaseForm, self)._afterInit()
if self.RequeryOnLoad:
dabo.ui.callAfter(self.requery)
-
-
+
+
def _beforeClose(self, evt=None):
""" See if there are any pending changes in the form, if the
- form is set for checking for this. If everything's OK, call the
+ form is set for checking for this. If everything's OK, call the
hook method.
"""
ret = True
@@ -86,8 +86,8 @@
if ret:
ret = super(BaseForm, self)._beforeClose(evt)
return ret
-
-
+
+
def notifyUser(self, msg, title=None, severe=False, exception=None):
""" Displays an alert messagebox for the user. You can customize
this in your own classes if you prefer a different display.
@@ -104,15 +104,15 @@
def update(self, interval=None):
- """Updates the contained controls with current values from the
source.
+ """Updates the contained controls with current values from the
source.
This method is called repeatedly from many different places
during
a single change in the UI, so by default the actual execution
is cached
using callAfterInterval(). The default interval is 100
milliseconds. You
can change that to suit your app needs by passing a different
interval
in milliseconds.
-
- Sometimes, though, you want to force immediate execution of the
+
+ Sometimes, though, you want to force immediate execution of the
update. In these cases, pass an interval of 0 to this method,
which
means don't wait; execute now.
"""
@@ -124,22 +124,22 @@
dabo.ui.callAfterInterval(interval, self.__update)
def __update(self):
super(BaseForm, self).update()
-
-
+
+
def confirmChanges(self, bizobjs=None):
"""Ask the user if they want to save changes, discard changes,
or cancel.
The user will be queried if the form's CheckForChanges property
is True, and
if there are any pending changes on the form's bizobjs as
specified in either
- the 'bizobjs' parameter, or, if no parameter is sent, the
return value of
+ the 'bizobjs' parameter, or, if no parameter is sent, the
return value of
getBizobjsToCheck().
If all the above are True, the dialog will be presented. "Yes"
will cause
- all changes to be saved. "No" will discard any changes before
proceeding
+ all changes to be saved. "No" will discard any changes before
proceeding
with the operation that caused confirmChanges() to be called in
the first
place (e.g. a requery() or the form being closed). "Cancel"
will not save
any changes, but also cancel the requery or form close.
-
+
See also: getBizobjsToCheck() method, CheckForChanges property.
"""
if not self.CheckForChanges:
@@ -152,11 +152,11 @@
else:
bizList = bizobjs
changedBizList = []
-
+
for biz in bizList:
if biz and biz.isAnyChanged():
changedBizList.append(biz)
-
+
if changedBizList:
queryMessage =
self.getConfirmChangesQueryMessage(changedBizList)
response = dabo.ui.areYouSure(queryMessage, parent=self)
@@ -171,13 +171,13 @@
if biz.RowCount:
self.cancel(dataSource=biz.DataSource)
return True
-
+
def getConfirmChangesQueryMessage(self, changedBizList):
"""Return the "Save Changes?" message for use in the query
dialog.
The default is to return "Do you wish to save your changes?".
Subclasses
- can override with whatever message they want, possibly
iterating the
+ can override with whatever message they want, possibly
iterating the
changed bizobj list to introspect the exact changes made to
construct the
message.
"""
@@ -187,18 +187,18 @@
def getBizobjsToCheck(self):
"""Return the list of bizobj's to check for changes during
confirmChanges().
- The default behavior is to simply check the primary bizobj,
however there
- may be cases in subclasses where a different bizobj may be
checked, or even
- several. In those cases, override this method and return
a list of the
+ The default behavior is to simply check the primary bizobj,
however there
+ may be cases in subclasses where a different bizobj may be
checked, or even
+ several. In those cases, override this method and return
a list of the
required bizobjs.
"""
return (self.PrimaryBizobj, )
-
-
+
+
def addBizobj(self, bizobj):
""" Add a bizobj to this form.
- Make the bizobj the form's primary bizobj if it is the first
bizobj to
+ Make the bizobj the form's primary bizobj if it is the first
bizobj to
be added. For convenience, return the bizobj to the caller
"""
self.bizobjs[bizobj.DataSource] = bizobj
@@ -223,7 +223,7 @@
if bizobj is None:
# Running in preview or some other non-live mode
return
- return self._moveRecordPointer(bizobj.moveToRowNumber,
dataSource=bizobj,
+ return self._moveRecordPointer(bizobj.moveToRowNumber,
dataSource=bizobj,
rowNumber=rowNumber)
@@ -260,7 +260,7 @@
else:
if biz.RowNumber != oldRowNum:
# Notify listeners that the row number changed:
- dabo.ui.callAfter(self.raiseEvent,
dEvents.RowNumChanged,
+ dabo.ui.callAfter(self.raiseEvent,
dEvents.RowNumChanged,
newRowNumber=biz.RowNumber,
oldRowNumber=oldRowNum,
bizobj=biz)
self.update()
@@ -327,8 +327,8 @@
return
self._moveRecordPointer(bizobj.next, dataSource)
self.afterNext()
-
+
def filter(self, dataSource=None, fld=None, expr=None, op="="):
"""Apply a filter to the bizobj's data."""
self.dataSourceParameter = dataSource
@@ -355,8 +355,8 @@
# Running in preview or some other non-live mode
return
self._moveRecordPointer(bizobj.removeFilter, dataSource)
-
+
def removeFilters(self, dataSource=None):
"""Remove all filters from the bizobj's data."""
self.dataSourceParameter = dataSource
@@ -365,8 +365,8 @@
# Running in preview or some other non-live mode
return
self._moveRecordPointer(bizobj.removeFilters, dataSource)
-
+
def save(self, dataSource=None):
""" Ask the bizobj to commit its changes to the backend."""
self.dataSourceParameter = dataSource
@@ -385,10 +385,10 @@
bizobj.saveAll()
else:
bizobj.save()
-
+
self.setStatusText(_("Changes to %s saved.") % (
self.SaveAllRows and "all records" or
"current record",))
-
+
except dException.ConnectionLostException, e:
msg = self._connectionLostMsg(ustr(e))
self.notifyUser(msg, title=_("Data Connection Lost"),
severe=True, exception=e)
@@ -398,7 +398,7 @@
# No records were saved. No big deal; just let 'em know.
self.setStatusText(_("Nothing to save!"))
return True
-
+
except (dException.BusinessRuleViolation,
dException.DBQueryException), e:
self.setStatusText(_("Save failed."))
txt = _("Save Failed")
@@ -409,8 +409,8 @@
self.afterSave()
self.refresh()
return True
-
-
+
+
def cancel(self, dataSource=None, ignoreNoRecords=None):
""" Ask the bizobj to cancel its changes.
@@ -481,7 +481,7 @@
response = bizobj.requery()
self.stopWatch.Pause()
elapsed = round(self.stopWatch.Time()/1000.0, 3)
-
+
self.update()
# del busy
@@ -524,8 +524,8 @@
self.update()
self.refresh()
return ret
-
+
def delete(self, dataSource=None, message=None, prompt=True):
""" Ask the bizobj to delete the current record."""
self.dataSourceParameter = dataSource
@@ -540,12 +540,12 @@
biz_caption = ds
self.activeControlValid()
-
+
if not bizobj.RowCount > 0:
# Nothing to delete!
self.setStatusText(_("Nothing to delete!"))
return
-
+
err = self.beforeDelete()
if err:
self.notifyUser(err)
@@ -603,8 +603,8 @@
self.afterDeleteAll()
self.update()
self.refresh()
-
+
def new(self, dataSource=None):
""" Ask the bizobj to add a new record to the recordset."""
self.dataSourceParameter = dataSource
@@ -613,16 +613,16 @@
# Running in preview or some other non-live mode
return
self.activeControlValid()
-
+
err = self.beforeNew()
if err:
self.notifyUser(err)
- return
+ return
try:
bizobj.new()
except dException.dException, e:
- self.notifyUser(_("Add new record failed with
response:\n\n%s") % e,
+ self.notifyUser(_("Add new record failed with
response:\n\n%s") % e,
severe=True, exception=e)
statusText = self.getCurrentRecordText(dataSource)
@@ -634,8 +634,8 @@
self.afterNew()
self.update()
self.refresh()
-
+
def afterNew(self): pass
@@ -647,8 +647,8 @@
def setSQL(self, sql, dataSource=None):
""" Set the SQL for the bizobj."""
self.getBizobj(dataSource).setSQL(sql)
-
+
def _connectionLostMsg(self, err):
return _("""The connection to the database has closed for
unknown reasons.
Any unsaved changes to the data will be lost.
@@ -657,15 +657,15 @@
def getBizobj(self, dataSource=None, parentBizobj=None):
- """ Return the bizobj with the passed dataSource. If no
+ """ Return the bizobj with the passed dataSource. If no
dataSource is passed, getBizobj() will return the primary
bizobj.
"""
if not parentBizobj and not dataSource:
return self.PrimaryBizobj
-
+
if not parentBizobj and self.bizobjs.has_key(dataSource):
return self.bizobjs[dataSource]
-
+
if isinstance(dataSource, dabo.biz.dBizobj):
return dataSource
@@ -674,7 +674,7 @@
# The form isn't using bizobjs, but locally-bound data
# controls
return self
-
+
# See if it is the RegID of a registered control
reg = self.getObjectByRegID(dataSource)
if reg:
@@ -701,8 +701,8 @@
return bo
# if we got here, none were found
return None
-
+
def onFirst(self, evt): self.first()
def onPrior(self, evt): self.prior()
def onNext(self, evt): self.next()
@@ -769,8 +769,8 @@
def validateField(self, ctrl):
- """Call the bizobj for the control's DataSource. If the
control's
- value is rejected for field validation reasons, a
+ """Call the bizobj for the control's DataSource. If the
control's
+ value is rejected for field validation reasons, a
BusinessRuleViolation exception will be raised, and the form
can then respond to this.
"""
@@ -807,30 +807,30 @@
def onFieldValidationFailed(self, ctrl, ds, df, val, err):
"""Basic handling of field-level validation failure. You should
- override it with your own code to handle this failure
+ override it with your own code to handle this failure
appropriately for your application.
"""
self.StatusText = _(u"Validation failed for %(df)s: %(err)s") %
locals()
dabo.ui.callAfter(ctrl.setFocus)
self._fieldValidationControl = ctrl
-
-
+
+
def onFieldValidationPassed(self, ctrl, ds, df, val):
- """Basic handling when field-level validation succeeds.
- You should override it with your own code to handle this event
+ """Basic handling when field-level validation succeeds.
+ You should override it with your own code to handle this event
appropriately for your application.
"""
pass
-
-
+
+
# Property get/set/del functions follow.
def _getCheckForChanges(self):
return self._checkForChanges
-
+
def _setCheckForChanges(self, value):
self._checkForChanges = bool(value)
-
+
def _getPrimaryBizobj(self):
"""The attribute '_primaryBizobj' should be a bizobj, but due
to old code design, might be a data source name. These methods
@@ -846,7 +846,7 @@
# Update to bizobj reference
self._primaryBizobj = bo
return bo
-
+
def _setPrimaryBizobj(self, bizOrDataSource):
if isinstance(bizOrDataSource, dabo.biz.dBizobj):
self._primaryBizobj = bizOrDataSource
@@ -877,28 +877,28 @@
return self._SaveAllRows
except AttributeError:
return True
-
+
def _setSaveAllRows(self, value):
self._SaveAllRows = bool(value)
# Property definitions:
- CheckForChanges = property(_getCheckForChanges, _setCheckForChanges,
None,
+ CheckForChanges = property(_getCheckForChanges, _setCheckForChanges,
None,
_("""Specifies whether the user is prompted to save or
discard changes. (bool)
If True (the default), when operations such as
requery() or the closing
of the form are about to occur, the user will be
presented with a dialog
- box asking whether to save changes, discard changes, or
cancel the
+ box asking whether to save changes, discard changes, or
cancel the
operation that led to the dialog being presented.""") )
- PrimaryBizobj = property(_getPrimaryBizobj, _setPrimaryBizobj, None,
+ PrimaryBizobj = property(_getPrimaryBizobj, _setPrimaryBizobj, None,
_("Reference to the primary bizobj for this form
(dBizobj)") )
RequeryOnLoad = property(_getRequeryOnLoad, _setRequeryOnLoad, None,
- _("""Specifies whether an automatic requery happens
when the
+ _("""Specifies whether an automatic requery happens
when the
form is loaded. (bool)"""))
- SaveAllRows = property(_getSaveAllRows, _setSaveAllRows, None,
+ SaveAllRows = property(_getSaveAllRows, _setSaveAllRows, None,
_("Specifies whether dataset is row- or table-buffered.
(bool)") )
@@ -954,7 +954,7 @@
def _getVisible(self):
return self.IsShown()
-
+
def _setVisible(self, val):
if self._constructed():
val = bool(val)
@@ -983,8 +983,8 @@
Visible = property(_getVisible, _setVisible, None,
_("Specifies whether the form is shown or hidden.
(bool)") )
-
+
class dToolForm(BaseForm, wx.MiniFrame):
def __init__(self, parent=None, properties=None, attProperties=None,
*args, **kwargs):
self._baseClass = dToolForm
@@ -992,7 +992,7 @@
self._mdi = False
style = kwargs.get("style", 0)
kwargs["style"] = style | wx.RESIZE_BORDER | wx.CAPTION |
wx.MINIMIZE_BOX | \
- wx.MAXIMIZE_BOX | wx.CLOSE_BOX
+ wx.MAXIMIZE_BOX | wx.CLOSE_BOX
kwargs["TinyTitleBar"] = True
kwargs["ShowStatusBar"] = False
kwargs["ShowToolBar"] = False
@@ -1014,7 +1014,7 @@
kwargs["MenuBarClass"] = None
preClass = wx.PreFrame
BaseForm.__init__(self, preClass, parent, properties,
attProperties, *args, **kwargs)
-
+
def Show(self, show=True, *args, **kwargs):
self._gtk_show_fix(show)
wx.Frame.Show(self, show, *args, **kwargs)
@@ -1027,7 +1027,7 @@
print _("Activate")
def onDeactivate(self, evt):
print _("Deactivate")
-
+
class _dBorderlessForm_test(dBorderlessForm):
def afterInit(self):
self.btn = dabo.ui.dButton(self, Caption=_("Close Borderless
Form"))
@@ -1035,14 +1035,14 @@
self.layout()
self.btn.bindEvent(dEvents.Hit, self.close)
dabo.ui.callAfter(self.setSize)
-
+
def setSize(self):
self.Width, self.Height = self.btn.Width+60, self.btn.Height+60
self.layout()
self.Centered = True
-
-
-
+
+
+
if __name__ == "__main__":
import test
test.Test().runTest(_dForm_test)
Modified: trunk/dabo/ui/uiwx/dFormMain.py
===================================================================
--- trunk/dabo/ui/uiwx/dFormMain.py 2010-09-01 12:12:58 UTC (rev 5971)
+++ trunk/dabo/ui/uiwx/dFormMain.py 2010-09-01 12:15:43 UTC (rev 5972)
@@ -12,27 +12,27 @@
"""
def __init__(self, preClass, parent=None, properties=None, *args,
**kwargs):
fm.dFormMixin.__init__(self, preClass, parent, properties,
*args, **kwargs)
-
+
def _beforeClose(self, evt=None):
forms2close = [frm for frm in self.Application.uiForms
if frm is not self and not isinstance(frm,
dabo.ui.deadObject)]
while forms2close:
frm = forms2close[0]
# This will allow forms to veto closing (i.e., user
doesn't
- # want to save pending changes).
+ # want to save pending changes).
if frm.close() == False:
# The form stopped the closing process. The user
- # must deal with this form (save changes, etc.)
+ # must deal with this form (save changes, etc.)
# before the app can exit.
frm.bringToFront()
return False
else:
forms2close.remove(frm)
-
+
class dFormMain(dFormMainBase, wx.Frame):
def __init__(self, parent=None, properties=None, *args, **kwargs):
self._baseClass = dFormMain
Modified: trunk/dabo/ui/uiwx/dFormMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dFormMixin.py 2010-09-01 12:12:58 UTC (rev 5971)
+++ trunk/dabo/ui/uiwx/dFormMixin.py 2010-09-01 12:15:43 UTC (rev 5972)
@@ -16,7 +16,7 @@
class dFormMixin(pm.dPemMixin):
- def __init__(self, preClass, parent=None, properties=None,
attProperties=None,
+ def __init__(self, preClass, parent=None, properties=None,
attProperties=None,
src=None, *args, **kwargs):
self._cxnName = ""
self._connection = None
@@ -26,13 +26,13 @@
self._alwaysDrawSizerOutlines = False
self._drawSizerChildren = False
self._statusBarClass = dabo.ui.dStatusBar
-
+
# Extract the menu definition file, if any
- self._menuBarFile = self._extractKey((properties,
attProperties, kwargs),
+ self._menuBarFile = self._extractKey((properties,
attProperties, kwargs),
"MenuBarFile", "")
if self._menuBarFile:
self._menuBarClass = self._menuBarFile
-
+
if False and parent:
## pkm 3/10/05: I like it better now without the float
on parent option
## and think it is a better default to
stick with the wx
@@ -57,7 +57,7 @@
self.__needOutlineRedraw = False
# When in designer mode, we need to turn off various behaviors.
self._designerMode = False
- # Default behavior used to be for the form to set the status
bar text with the
+ # Default behavior used to be for the form to set the status
bar text with the
# current record position. Now we only turn it on for data apps.
self._autoUpdateStatusText = False
# Flag to denote temporary forms
@@ -71,22 +71,22 @@
# Flag to prevent infinite loops when doing field-level
validation
self._fieldValidationControl = None
- super(dFormMixin, self).__init__(preClass, parent, properties,
+ super(dFormMixin, self).__init__(preClass, parent, properties,
attProperties, *args, **kwargs)
dabo.ui.callAfter(self._createStatusBar)
- self._createToolBar()
- if not self._designerMode:
+ self._createToolBar()
+ if not self._designerMode:
self.restoreSizeAndPosition()
def _getInitPropertiesList(self):
- additional = ["BorderResizable", "FloatOnParent",
"ShowCloseButton", "ShowInTaskBar",
+ additional = ["BorderResizable", "FloatOnParent",
"ShowCloseButton", "ShowInTaskBar",
"ShowMaxButton", "ShowMinButton",
"ShowSystemMenu", "StayOnTop", "TinyTitleBar"]
original = list(super(dFormMixin,
self)._getInitPropertiesList())
return tuple(original + additional)
-
+
def _afterInit(self):
app = self.Application
mbc = self.MenuBarClass
@@ -108,7 +108,7 @@
self._statusStack = []
if app is not None:
app.uiForms.add(self)
-
+
# Centering information
self._normLeft = self.Left
self._normTop = self.Top
@@ -125,19 +125,19 @@
self.createBizobjs()
# If there are custom menu hotkey bindings, re-set them
wx.CallAfter(self._restoreMenuPrefs)
-
+
super(dFormMixin, self)._afterInit()
## pkm 2010-08-03: The below results in smoother, nicer forms
(no menu flickering or
- ## other weird artifacts like page tabs
partially disappearing),
- ## however there are reports of python.exe
maxing out the CPU and the
- ## process needing to be killed by the user. My
testing was with
+ ## other weird artifacts like page tabs
partially disappearing),
+ ## however there are reports of python.exe
maxing out the CPU and the
+ ## process needing to be killed by the user. My
testing was with
## Python 2.5.4 / wx 2.8.11.0 / Windows Vista.
Perhaps we just need to
## play around with where we make this call, or
set double buffered off
## every now and then with a timer or
something...
##self.SetDoubleBuffered(True)
-
-
+
+
def _initEvents(self):
super(dFormMixin, self)._initEvents()
self.Bind(wx.EVT_ACTIVATE, self.__onWxActivate)
@@ -146,14 +146,14 @@
self.bindEvent(dEvents.Close, self.__onClose)
self.bindEvent(dEvents.Paint, self.__onPaint)
self.bindEvent(dEvents.Idle, self.__onIdle)
-
-
+
+
def __onWxClose(self, evt):
self.raiseEvent(dEvents.Close, evt)
if evt.CanVeto():
evt.Veto()
-
-
+
+
def __onWxActivate(self, evt):
""" Raise the Dabo Activate or Deactivate appropriately."""
if bool(evt.GetActive()):
@@ -171,8 +171,8 @@
if self._fieldValidationControl is ctrl:
# Clear it
self._fieldValidationControl = None
-
-
+
+
def Maximize(self, maximize=True, *args, **kwargs):
# On Mac MDI Child Frames, Maximize(False) erroneously
maximizes. Not sure
# how to restore a maximized frame in this case, but at least
we can catch
@@ -185,7 +185,7 @@
def SetPosition(self, val):
# On Windows MDI Child frames when the main form has a toolbar,
setting the
- # top position results in a position too low by the height of
the toolbar.
+ # top position results in a position too low by the height of
the toolbar.
left, top = val
tb = None
if self.Form:
@@ -193,7 +193,7 @@
if sys.platform.startswith("win") \
and self.MDI \
and tb:
- top -= tb.Height
+ top -= tb.Height
super(dFormMixin, self).SetPosition((left, top))
@@ -208,7 +208,7 @@
def _createStatusBar(self):
modal = getattr(self, "Modal", False)
- if (self and self.ShowStatusBar
+ if (self and self.ShowStatusBar
and self.StatusBar is None
and not isinstance (self, wx.Dialog)
and not modal
@@ -221,25 +221,25 @@
if self.Application is not None and self.Application.ActiveForm
== self:
self.Application.clearActiveForm(self)
-
+
def __onPaint(self, evt):
if self.Application:
self.__needOutlineRedraw =
self.Application.DrawSizerOutlines
else:
self.__needOutlineRedraw = False
-
-
+
+
def __onIdle(self, evt):
if self.__needOutlineRedraw or self._alwaysDrawSizerOutlines:
for sz in self.SizersToOutline:
sz.drawOutline(self,
recurse=self._recurseOutlinedSizers,
drawChildren=self._drawSizerChildren)
-
-
+
+
def __onClose(self, evt):
app = self.Application
- if not self._designerMode:
+ if not self._designerMode:
self.saveSizeAndPosition()
force = evt.EventData["force"]
@@ -249,13 +249,13 @@
return
# Run the cleanup code.
self.closing()
-
+
self._isClosed = True
if self._isModal:
self.MakeModal(False)
# On the Mac, this next line prevents Bus Errors when closing a
form.
- self.Visible = False
+ self.Visible = False
if app is not None:
app.uiForms.remove(self)
@@ -264,7 +264,7 @@
def activeControlValid(self):
""" Force the control-with-focus to fire its KillFocus code.
- The bizobj will only get its field updated during the control's
+ The bizobj will only get its field updated during the control's
KillFocus code. This function effectively commands that update
to
happen before it would have otherwise occurred.
"""
@@ -283,8 +283,8 @@
using callAfterInterval(). The default interval is 100
milliseconds. You
can change that to suit your app needs by passing a different
interval
in milliseconds.
-
- Sometimes, though, you want to force immediate execution of the
+
+ Sometimes, though, you want to force immediate execution of the
refresh. In these cases, pass an interval of 0 to this method,
which
means don't wait; execute now.
"""
@@ -348,7 +348,7 @@
menuItem = mb
for pth in relPath.split("."):
try:
- menuItem = [ch for ch in
menuItem.Children
+ menuItem = [ch for ch in
menuItem.Children
if hasattr(ch,
"Caption")
and
cleanMenuCaption(ch.Caption) == pth][0]
except IndexError:
@@ -359,7 +359,7 @@
if setting == "hotkey":
menuItem.HotKey = hk
-
+
def _gtk_show_fix(self, show=True):
# On Gtk, in wxPython 2.8.1.1 at least, the form will get
re-shown at its
# initial position, instead of the position the user last put
it at.
@@ -377,13 +377,13 @@
def showModal(self):
"""Shows the form in a modal fashion. Other forms can still be
activated, but all controls are disabled.
- NOTE: wxPython does not currently support this. DO NOT USE
+ NOTE: wxPython does not currently support this. DO NOT USE
this method.
"""
raise dException.FeatureNotSupportedException(
_("The underlying UI toolkit does not support
modal forms. Use a dDialog instead."))
-
-
+
+
def release(self):
""" Instead of just destroying the object, make sure that
we close it properly and clean up any references to it.
@@ -395,7 +395,7 @@
""" This method will close the form. If force = False (default)
the beforeClose methods will be called, and these will have
an opportunity to conditionally block the form from closing.
- If force=True, the form is closed without any chance of
+ If force=True, the form is closed without any chance of
preventing it.
"""
if not force:
@@ -415,36 +415,36 @@
"""
if self:
self.Destroy()
-
+
def _beforeClose(self, evt=None):
""" See if there are any pending changes in the form, if the
- form is set for checking for this. If everything's OK, call the
+ form is set for checking for this. If everything's OK, call the
hook method.
"""
if self._floatingPanel:
self._floatingPanel.release()
ret = self.beforeClose(evt)
return ret
-
-
+
+
def beforeClose(self, evt):
- """ Hook method. Returning False will prevent the form from
+ """ Hook method. Returning False will prevent the form from
closing. Gives you a chance to determine the status of the form
to see if changes need to be saved, etc.
"""
return True
-
-
+
+
def closing(self):
""" Stub method to be customized in subclasses. At this point,
the form is going to close. If you need to do something that
might
- prevent the form from closing, code it in the beforeClose()
+ prevent the form from closing, code it in the beforeClose()
method instead.
"""
pass
-
+
def afterSetMenuBar(self):
""" Subclasses can extend the menu bar here."""
pass
@@ -454,38 +454,38 @@
""" Get the navigation menu for this form.
Every form maintains an internal menu of actions appropriate to
itself.
- For instance, a dForm with a primary bizobj will maintain a
menu with
- 'requery', 'save', 'next', etc. choices.
+ For instance, a dForm with a primary bizobj will maintain a
menu with
+ 'requery', 'save', 'next', etc. choices.
- This function sets up the internal menu, which can optionally
be
+ This function sets up the internal menu, which can optionally be
inserted into the mainForm's menu bar during SetFocus.
"""
menu = dMenu.dMenu()
return menu
-
-
+
+
def onEditUndo(self, evt):
"""If you want your form to respond to the Undo menu item in
- the Edit menu that is installed in the Dabo base menu, override
+ the Edit menu that is installed in the Dabo base menu, override
this method, and either return nothing, or return something
other
than False.
"""
return False
-
-
+
+
def onEditRedo(self, evt):
"""If you want your form to respond to the Redo menu item in
- the Edit menu that is installed in the Dabo base menu, override
+ the Edit menu that is installed in the Dabo base menu, override
this method, and either return nothing, or return something
other
than False.
"""
return False
-
-
+
+
def restoreSizeAndPosition(self):
""" Restore the saved window geometry for this form.
- Ask dApp for the last saved setting of height, width, left, and
top,
+ Ask dApp for the last saved setting of height, width, left, and
top,
and set those properties on this form.
"""
if not self.Application or not self.SaveRestorePosition:
@@ -505,7 +505,7 @@
if state not in ("Minimized", "Maximized", "Normal",
"FullScreen"):
state = self.WindowState
-
+
if state == "Minimized":
state = "Normal"
@@ -549,13 +549,13 @@
app.setUserSetting("%s.top" % name, top)
app.setUserSetting("%s.width" % name,
width)
app.setUserSetting("%s.height" % name,
height)
-
+
def setStatusText(self, *args):
"""Moved functionality to the StatusText property setter."""
self._setStatusText(*args)
-
-
+
+
def layout(self):
""" Wrap the wx sizer layout call. """
self.Layout()
@@ -566,13 +566,13 @@
pass
if self.Application.Platform == "Win":
self.refresh()
-
-
+
+
def registerObject(self, obj):
"""Stores a reference to the passed object using the RegID key
- property of the object for later retrieval. You may reference
the
+ property of th
(11039 bytes were truncated as it was too long for the email (max 40000 bytes.)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]