dabo Commit
Revision 1466
Date: 2005-10-18 16:31:15 -0700 (Tue, 18 Oct 2005)
Author: paul
Changed:
U trunk/dabo/dApp.py
U trunk/dabo/ui/uiwx/dBaseMenuBar.py
U trunk/dabo/ui/uiwx/dFormMixin.py
U trunk/dabo/ui/uiwx/uiApp.py
Log:
Added dApp property ShowCommandWindowMenu which determines whether the
command window menu appears in the File menu of the base menu bar. Default
is True for the usual behavior, but I'm about to deliver my first Dabo
app and I don't want the client to have easy access under the hood at
runtime.
Diff:
Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py 2005-10-18 23:02:06 UTC (rev 1465)
+++ trunk/dabo/dApp.py 2005-10-18 23:31:15 UTC (rev 1466)
@@ -318,12 +318,24 @@
dabo.infoLog.write(_("User interface already set to
'%s', so dApp didn't "
" touch it." % (self.UI,)))
+
+ def onCmdWin(self, evt):
+ self.showCommandWindow()
+
+
+ def showCommandWindow(self, context=None):
+ """Display a command window for debugging."""
+ if context is None:
+ context = self.ActiveForm
+ dlg = dabo.ui.dShell.dShell(context)
+ dlg.Show()
+
+
+
########################
# This next section simply passes menu events to the UI
# layer to be handled there.
- def onCmdWin(self, evt):
- self.uiApp.onCmdWin(evt)
def onWinClose(self, evt):
self.uiApp.onWinClose(evt)
def onFileExit(self, evt):
@@ -362,13 +374,38 @@
dlg.show()
+
+
+ def _getActiveForm(self):
+ if self.uiApp is not None:
+ return self.uiApp.ActiveForm
+ else:
+ return None
+
+ def _setActiveForm(self, frm):
+ if self.uiApp is not None:
+ self.uiApp._setActiveForm(frm)
+ else:
+ dabo.errorLog.write("Can't set ActiveForm: no uiApp.")
+
+
+ def _getCrypto(self):
+ if self._cryptoProvider is None:
+ # Use the default crypto
+ self._cryptoProvider = SimpleCrypt()
+ return self._cryptoProvider
+
+ def _setCrypto(self, val):
+ self._cryptoProvider = val
+
+
def _getDrawSizerOutlines(self):
return self.uiApp.DrawSizerOutlines
def _setDrawSizerOutlines(self, val):
self.uiApp.DrawSizerOutlines = val
-
+
def _getHomeDirectory(self):
try:
hd = self._homeDirectory
@@ -441,6 +478,17 @@
raise TypeError, _("SecurityManager must descend from
dSecurityManager.")
+ def _getShowCommandWindowMenu(self):
+ try:
+ v = self._showCommandWindowMenu
+ except AttributeError:
+ v = self._showCommandWindowMenu = True
+ return v
+
+ def _setShowCommandWindowMenu(self, val):
+ self._showCommandWindowMenu = bool(val)
+
+
def _getUI(self):
try:
return dabo.ui.getUIType()
@@ -496,29 +544,7 @@
return "?"
- def _getActiveForm(self):
- if self.uiApp is not None:
- return self.uiApp.ActiveForm
- else:
- return None
-
- def _setActiveForm(self, frm):
- if self.uiApp is not None:
- self.uiApp._setActiveForm(frm)
- else:
- dabo.errorLog.write("Can't set ActiveForm: no uiApp.")
-
- def _getCrypto(self):
- if self._cryptoProvider is None:
- # Use the default crypto
- self._cryptoProvider = SimpleCrypt()
- return self._cryptoProvider
-
- def _setCrypto(self, val):
- self._cryptoProvider = val
-
-
ActiveForm = property(_getActiveForm, None, None,
_("Returns the form that currently has focus, or None.
(dForm)" ) )
@@ -570,6 +596,22 @@
This will be one of 'Mac', 'Win' or 'GTK'.""") )
+ SecurityManager = property(_getSecurityManager, _setSecurityManager,
None,
+ _("""Specifies the Security Manager, if any.
+
+ You must subclass dSecurityManager, overriding the
appropriate hooks
+ and properties, and then set dApp.SecurityManager to an
instance of your
+ subclass. There is no security manager by default - you
explicitly set
+ this to use Dabo security.""") )
+
+ ShowCommandWindowMenu = property(_getShowCommandWindowMenu,
+ _setShowCommandWindowMenu, None,
+ _("""Specifies whether the command window option is
shown in the menu.
+
+ If True (the default), there will be a File|Command
Window option
+ available in the base menu. If False, your code can
still start the
+ command window by calling app.showCommandWindow()
directly.""") )
+
UI = property(_getUI, _setUI, None,
_("""Specifies the user interface to load, or None.
(str)
@@ -591,11 +633,3 @@
directory inside the user's home directory, and will be
instantiated by Dabo
automatically."""))
- SecurityManager = property(_getSecurityManager, _setSecurityManager,
None,
- _("""Specifies the Security Manager, if any.
-
- You must subclass dSecurityManager, overriding the
appropriate hooks
- and properties, and then set dApp.SecurityManager to an
instance of your
- subclass. There is no security manager by default - you
explicitly set
- this to use Dabo security.""") )
-
Modified: trunk/dabo/ui/uiwx/dBaseMenuBar.py
===================================================================
--- trunk/dabo/ui/uiwx/dBaseMenuBar.py 2005-10-18 23:02:06 UTC (rev 1465)
+++ trunk/dabo/ui/uiwx/dBaseMenuBar.py 2005-10-18 23:31:15 UTC (rev 1466)
@@ -21,8 +21,9 @@
app = self.Application
self.Caption = _("&File")
- self.append(_("Command Window") + "\tCtrl+D",
bindfunc=app.onCmdWin,
- help=_("Open up a command window for
debugging") )
+ if self.Application.ShowCommandWindowMenu:
+ self.append(_("Command Window") + "\tCtrl+D",
bindfunc=app.onCmdWin,
+ help=_("Open up a command window for
debugging") )
prmpt = _("Close Windo&w") + "\tCtrl+W"
self.append(prmpt, bindfunc=app.onWinClose,
Modified: trunk/dabo/ui/uiwx/dFormMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dFormMixin.py 2005-10-18 23:02:06 UTC (rev 1465)
+++ trunk/dabo/ui/uiwx/dFormMixin.py 2005-10-18 23:31:15 UTC (rev 1466)
@@ -338,11 +338,7 @@
"""
pass
- def onCmdWin(self, evt):
- dlg = dabo.ui.dShell.dShell(self)
- dlg.Show()
-
def refresh(self):
"""Refreshed the values of the controls, and also calls the
wxPython Refresh to update the form.
Modified: trunk/dabo/ui/uiwx/uiApp.py
===================================================================
--- trunk/dabo/ui/uiwx/uiApp.py 2005-10-18 23:02:06 UTC (rev 1465)
+++ trunk/dabo/ui/uiwx/uiApp.py 2005-10-18 23:31:15 UTC (rev 1466)
@@ -395,15 +395,6 @@
return user, password
- def onCmdWin(self, evt):
- """Display a command window for debugging."""
- try:
- self.ActiveForm.onCmdWin(evt)
- except AttributeError:
- # Either no form active, or it's not a proper Dabo form
- pass
-
-
def _getActiveForm(self):
try:
v = self._activeForm
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev