[GRASS-SVN] r39192 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Sep 14 05:12:17 EDT 2009
Author: martinl
Date: 2009-09-14 05:12:16 -0400 (Mon, 14 Sep 2009)
New Revision: 39192
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI dialog: remove stop button (it's already in prompt)
add some key shortcuts
(merge r39191 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2009-09-14 09:09:13 UTC (rev 39191)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2009-09-14 09:12:16 UTC (rev 39192)
@@ -529,7 +529,7 @@
def OnCmdAbort(self, event):
"""!Abort running command"""
self.cmdThread.abort()
-
+
def OnCmdRun(self, event):
"""!Run command"""
self.WriteCmdLog('(%s)\n%s' % (str(time.ctime()), ' '.join(event.cmd)))
@@ -544,17 +544,17 @@
_('Command aborted'),
(time.time() - event.time)))
# pid=self.cmdThread.requestId)
+ self.btn_abort.Enable(False)
else:
try:
# Process results here
self.WriteCmdLog('(%s) %s (%d sec)' % (str(time.ctime()),
_('Command finished'),
(time.time() - event.time)))
- # pid=event.pid)
except KeyError:
# stopped deamon
pass
-
+ self.btn_abort.Enable(False)
if event.onDone:
event.onDone(returncode = event.returncode)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2009-09-14 09:09:13 UTC (rev 39191)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2009-09-14 09:12:16 UTC (rev 39192)
@@ -663,12 +663,12 @@
btnsizer = wx.BoxSizer(orient=wx.HORIZONTAL)
# cancel
self.btn_cancel = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
- self.btn_cancel.SetToolTipString(_("Close this window without executing the command"))
+ self.btn_cancel.SetToolTipString(_("Close this window without executing the command (Ctrl+Q)"))
btnsizer.Add(item=self.btn_cancel, proportion=0, flag=wx.ALL | wx.ALIGN_CENTER, border=10)
self.btn_cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
# help
self.btn_help = wx.Button(parent=self.panel, id=wx.ID_HELP)
- self.btn_help.SetToolTipString(_("Show manual page of the command"))
+ self.btn_help.SetToolTipString(_("Show manual page of the command (Ctrl+H)"))
self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp)
if not hasattr(self.notebookpanel, "manual_tab_id"):
self.btn_help.Hide()
@@ -689,19 +689,19 @@
else: # We're standalone
# run
self.btn_run = wx.Button(parent=self.panel, id=wx.ID_OK, label= _("&Run"))
- self.btn_run.SetToolTipString(_("Run the command"))
+ self.btn_run.SetToolTipString(_("Run the command (Ctrl+R)"))
self.btn_run.SetDefault()
# abort
- self.btn_abort = wx.Button(parent=self.panel, id=wx.ID_STOP)
- self.btn_abort.SetToolTipString(_("Abort the running command"))
- self.btn_abort.Enable(False)
+ ### self.btn_abort = wx.Button(parent=self.panel, id=wx.ID_STOP)
+ ### self.btn_abort.SetToolTipString(_("Abort the running command"))
+ ### self.btn_abort.Enable(False)
# copy
- self.btn_clipboard = wx.Button(parent=self.panel, id=wx.ID_COPY)
- self.btn_clipboard.SetToolTipString(_("Copy the current command string to the clipboard"))
+ self.btn_clipboard = wx.Button(parent=self.panel, id=wx.ID_COPY, label = _("C&opy"))
+ self.btn_clipboard.SetToolTipString(_("Copy the current command string to the clipboard (Ctrl+C)"))
- btnsizer.Add(item=self.btn_abort, proportion=0,
- flag=wx.ALL | wx.ALIGN_CENTER,
- border=10)
+ ### btnsizer.Add(item=self.btn_abort, proportion=0,
+ ### flag=wx.ALL | wx.ALIGN_CENTER,
+ ### border=10)
btnsizer.Add(item=self.btn_run, proportion=0,
flag=wx.ALL | wx.ALIGN_CENTER,
@@ -712,7 +712,7 @@
border=10)
self.btn_run.Bind(wx.EVT_BUTTON, self.OnRun)
- self.btn_abort.Bind(wx.EVT_BUTTON, self.OnAbort)
+ ### self.btn_abort.Bind(wx.EVT_BUTTON, self.OnAbort)
self.btn_clipboard.Bind(wx.EVT_BUTTON, self.OnCopy)
# add help button
@@ -744,8 +744,9 @@
flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
border=5)
- self.Bind(wx.EVT_CLOSE, self.OnCancel)
-
+ self.Bind(wx.EVT_CLOSE, self.OnCancel)
+ self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
+
#constrained_size = self.notebookpanel.GetSize()
# 80 takes the tabbar into account
#self.notebookpanel.SetSize( (constrained_size[0] + 25, constrained_size[1]) )
@@ -790,6 +791,30 @@
"""!Update status bar data"""
self.SetStatusText(' '.join(self.notebookpanel.createCmd(ignoreErrors = True)) )
+ def OnKeyUp(self, event):
+ """!Key released (check hot-keys)"""
+ try:
+ kc = chr(event.GetKeyCode())
+ except ValueError:
+ event.Skip()
+ return
+
+ if not event.ControlDown():
+ return
+
+ if kc == 'Q':
+ self.OnCancel(None)
+ elif kc == 'S':
+ self.OnAbort(None)
+ elif kc == 'H':
+ self.OnHelp(None)
+ elif kc == 'R':
+ self.OnRun(None)
+ elif kc == 'C':
+ self.OnCopy(None)
+
+ event.Skip()
+
def OnOK(self, event):
"""!OK button pressed"""
cmd = self.OnApply(event)
@@ -839,7 +864,7 @@
self.btn_clipboard,
self.btn_help):
btn.Enable(False)
- self.btn_abort.Enable(True)
+ ### self.btn_abort.Enable(True)
def OnAbort(self, event):
"""!Abort running command"""
@@ -885,9 +910,10 @@
if hasattr(self.notebookpanel, "manual_tab_id"):
self.notebookpanel.notebook.SetSelection(self.notebookpanel.manual_tab_id)
self.notebookpanel.OnPageChange(None)
-
- event.Skip()
+ if event:
+ event.Skip()
+
def createCmd(self, ignoreErrors = False):
"""!Create command string (python list)"""
return self.notebookpanel.createCmd(ignoreErrors=ignoreErrors)
More information about the grass-commit
mailing list