[GRASS-SVN] r55396 - in grass/trunk/gui/wxpython: gmodeler gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Mar 15 12:13:57 PDT 2013
Author: annakrat
Date: 2013-03-15 12:13:56 -0700 (Fri, 15 Mar 2013)
New Revision: 55396
Modified:
grass/trunk/gui/wxpython/gmodeler/dialogs.py
grass/trunk/gui/wxpython/gui_core/goutput.py
grass/trunk/gui/wxpython/gui_core/prompt.py
Log:
wxGUI: continue replacing events (promptRunCmd)
Modified: grass/trunk/gui/wxpython/gmodeler/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/dialogs.py 2013-03-15 17:53:35 UTC (rev 55395)
+++ grass/trunk/gui/wxpython/gmodeler/dialogs.py 2013-03-15 19:13:56 UTC (rev 55396)
@@ -35,7 +35,7 @@
from gui_core.widgets import SearchModuleWidget, SimpleValidator
from core.gcmd import GError, EncodeString
from gui_core.dialogs import SimpleDialog, MapLayersDialogForModeler
-from gui_core.prompt import GPromptSTC, EVT_GPROMPT_RUN_CMD
+from gui_core.prompt import GPromptSTC
from gui_core.forms import CmdPanel
from gui_core.gselect import Select, ElementSelect
from gmodeler.model import *
@@ -161,7 +161,7 @@
modulesData = ModulesData()
self.cmd_prompt = GPromptSTC(parent = self, modulesData = modulesData, updateCmdHistory = False)
- self.cmd_prompt.Bind(EVT_GPROMPT_RUN_CMD, self.OnCommand)
+ self.cmd_prompt.promptRunCmd.connect(self.OnCommand)
self.search = SearchModuleWidget(parent = self.panel,
modulesData = modulesData,
showTip = True)
@@ -239,10 +239,10 @@
return False
return True
- def OnCommand(self, event):
+ def OnCommand(self, cmd):
"""!Command in prompt confirmed"""
- if self.ValidateCmd(event.cmd):
- self._command = event.cmd
+ if self.ValidateCmd(cmd):
+ self._command = cmd
self.EndModal(wx.ID_OK)
def OnOk(self, event):
Modified: grass/trunk/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/goutput.py 2013-03-15 17:53:35 UTC (rev 55395)
+++ grass/trunk/gui/wxpython/gui_core/goutput.py 2013-03-15 19:13:56 UTC (rev 55396)
@@ -35,7 +35,7 @@
from core.gconsole import GConsole, \
EVT_CMD_OUTPUT, EVT_CMD_PROGRESS, EVT_CMD_RUN, EVT_CMD_DONE, \
EVT_WRITE_LOG, EVT_WRITE_CMD_LOG, EVT_WRITE_WARNING, EVT_WRITE_ERROR
-from gui_core.prompt import GPromptSTC, EVT_GPROMPT_RUN_CMD
+from gui_core.prompt import GPromptSTC
from core.settings import UserSettings
from gui_core.widgets import SearchModuleWidget
from core.modulesdata import ModulesData
@@ -122,9 +122,8 @@
# move to the if below
# search depends on cmd prompt
self.cmdPrompt = GPromptSTC(parent = self, modulesData = modulesData)
- self.cmdPrompt.Bind(EVT_GPROMPT_RUN_CMD,
- lambda event:
- self._gconsole.RunCmd(command = event.cmd))
+ self.cmdPrompt.promptRunCmd.connect(lambda cmd:
+ self._gconsole.RunCmd(command=cmd))
self.cmdPrompt.showNotification.connect(self.showNotification)
if not self._gcstyle & GC_PROMPT:
Modified: grass/trunk/gui/wxpython/gui_core/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/prompt.py 2013-03-15 17:53:35 UTC (rev 55395)
+++ grass/trunk/gui/wxpython/gui_core/prompt.py 2013-03-15 19:13:56 UTC (rev 55396)
@@ -24,8 +24,6 @@
import wx
import wx.stc
-from wx.lib.newevent import NewEvent
-
from grass.script import core as grass
from grass.script import task as gtask
@@ -35,10 +33,12 @@
from core import utils
from core.gcmd import EncodeString, DecodeString, GetRealCmd
-gPromptRunCmd, EVT_GPROMPT_RUN_CMD = NewEvent()
class GPrompt(object):
"""!Abstract class for interactive wxGUI prompt
+
+ Signal promptRunCmd - emitted to run command from prompt
+ - attribute 'cmd'
See subclass GPromptPopUp and GPromptSTC.
"""
@@ -46,6 +46,8 @@
self.parent = parent # GConsole
self.panel = self.parent.GetPanel()
+ self.promptRunCmd = Signal('GPrompt.promptRunCmd')
+
# probably only subclasses need this
self.modulesData = modulesData
@@ -112,7 +114,7 @@
cmd = utils.split(EncodeString((cmdString)))
cmd = map(DecodeString, cmd)
- wx.PostEvent(self, gPromptRunCmd(cmd = cmd))
+ self.promptRunCmd.emit(cmd=cmd)
# add command to history & clean prompt
self.UpdateCmdHistory(cmd)
More information about the grass-commit
mailing list