[GRASS-SVN] r55388 - in grass/trunk/gui/wxpython: gmodeler gui_core modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 14 15:44:09 PDT 2013
Author: annakrat
Date: 2013-03-14 15:44:09 -0700 (Thu, 14 Mar 2013)
New Revision: 55388
Modified:
grass/trunk/gui/wxpython/gmodeler/dialogs.py
grass/trunk/gui/wxpython/gui_core/goutput.py
grass/trunk/gui/wxpython/gui_core/gselect.py
grass/trunk/gui/wxpython/gui_core/widgets.py
grass/trunk/gui/wxpython/modules/extensions.py
Log:
wxGUI: continue replacing events (moduleSelected), disable currently unused wxGdalSelect event
Modified: grass/trunk/gui/wxpython/gmodeler/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/dialogs.py 2013-03-14 21:04:51 UTC (rev 55387)
+++ grass/trunk/gui/wxpython/gmodeler/dialogs.py 2013-03-14 22:44:09 UTC (rev 55388)
@@ -32,7 +32,7 @@
from core import globalvar
from core import utils
from core.modulesdata import ModulesData
-from gui_core.widgets import SearchModuleWidget, EVT_MODULE_SELECTED, SimpleValidator
+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
@@ -165,9 +165,8 @@
self.search = SearchModuleWidget(parent = self.panel,
modulesData = modulesData,
showTip = True)
- self.search.Bind(EVT_MODULE_SELECTED,
- lambda event:
- self.cmd_prompt.SetTextAndFocus(event.name + ' '))
+ self.search.moduleSelected.connect(lambda name:
+ self.cmd_prompt.SetTextAndFocus(name + ' '))
wx.CallAfter(self.cmd_prompt.SetFocus)
self.btnCancel = wx.Button(self.panel, wx.ID_CANCEL)
Modified: grass/trunk/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/goutput.py 2013-03-14 21:04:51 UTC (rev 55387)
+++ grass/trunk/gui/wxpython/gui_core/goutput.py 2013-03-14 22:44:09 UTC (rev 55388)
@@ -37,7 +37,7 @@
EVT_WRITE_LOG, EVT_WRITE_CMD_LOG, EVT_WRITE_WARNING, EVT_WRITE_ERROR
from gui_core.prompt import GPromptSTC, EVT_GPROMPT_RUN_CMD
from core.settings import UserSettings
-from gui_core.widgets import SearchModuleWidget, EVT_MODULE_SELECTED
+from gui_core.widgets import SearchModuleWidget
from core.modulesdata import ModulesData
@@ -141,9 +141,8 @@
self.MakeSearchPaneContent(self.searchPane.GetPane(), modulesData)
self.searchPane.Collapse(True)
self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnSearchPaneChanged, self.searchPane)
- self.search.Bind(EVT_MODULE_SELECTED,
- lambda event:
- self.cmdPrompt.SetTextAndFocus(event.name + ' '))
+ self.search.moduleSelected.connect(lambda name:
+ self.cmdPrompt.SetTextAndFocus(name + ' '))
else:
self.search = None
Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py 2013-03-14 21:04:51 UTC (rev 55387)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py 2013-03-14 22:44:09 UTC (rev 55388)
@@ -46,8 +46,6 @@
import wx.lib.buttons as buttons
import wx.lib.filebrowsebutton as filebrowse
-from wx.lib.newevent import NewEvent
-
from core import globalvar
import grass.script as grass
@@ -62,8 +60,6 @@
from core.settings import UserSettings
from core.debug import Debug
-wxGdalSelect, EVT_GDALSELECT = NewEvent()
-
class Select(wx.combo.ComboCtrl):
def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE,
type = None, multiple = False, nmaps = 1,
@@ -1149,7 +1145,10 @@
}
return formatToExt.get(name, '')
-
+
+# unused code since r47938
+# wxGdalSelect, EVT_GDALSELECT = NewEvent()
+
class GdalSelect(wx.Panel):
def __init__(self, parent, panel, ogr = False, link = False, dest = False,
default = 'file', exclude = [], envHandler = None):
@@ -1643,13 +1642,14 @@
grassName = GetValidLayerName(baseName.split('.', -1)[0])
data.append((layerId, baseName, grassName))
layerId += 1
- if self.ogr:
- dsn += '@OGR'
+# unused code since r47938
+# if self.ogr:
+# dsn += '@OGR'
+#
+# evt = wxGdalSelect(dsn = dsn)
+# evt.SetId(self.input[self.dsnType][1].GetId())
+# wx.PostEvent(self.parent, evt)
- evt = wxGdalSelect(dsn = dsn)
- evt.SetId(self.input[self.dsnType][1].GetId())
- wx.PostEvent(self.parent, evt)
-
if self.parent.GetName() == 'MultiImportDialog':
self.parent.list.LoadData(data)
if len(data) > 0:
Modified: grass/trunk/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/widgets.py 2013-03-14 21:04:51 UTC (rev 55387)
+++ grass/trunk/gui/wxpython/gui_core/widgets.py 2013-03-14 22:44:09 UTC (rev 55388)
@@ -845,16 +845,18 @@
event.Skip()
-gModuleSelected, EVT_MODULE_SELECTED = NewEvent()
-
-
class SearchModuleWidget(wx.Panel):
- """!Search module widget (used in SearchModuleWindow)"""
+ """!Search module widget (used in SearchModuleWindow)
+
+ Signal moduleSelected - attribute 'name' is module name
+ """
def __init__(self, parent, modulesData, id = wx.ID_ANY,
showChoice = True, showTip = False, **kwargs):
self.showTip = showTip
self.showChoice = showChoice
self.modulesData = modulesData
+
+ self.moduleSelected = Signal('SearchModuleWidget.moduleSelected')
wx.Panel.__init__(self, parent = parent, id = id, **kwargs)
@@ -960,8 +962,7 @@
"""!Module selected from choice, update command prompt"""
cmd = event.GetString().split(' ', 1)[0]
- moduleEvent = gModuleSelected(name = cmd)
- wx.PostEvent(self, moduleEvent)
+ self.moduleSelected.emit(name = cmd)
desc = self.modulesData.GetCommandDesc(cmd)
if self.showTip:
Modified: grass/trunk/gui/wxpython/modules/extensions.py
===================================================================
--- grass/trunk/gui/wxpython/modules/extensions.py 2013-03-14 21:04:51 UTC (rev 55387)
+++ grass/trunk/gui/wxpython/modules/extensions.py 2013-03-14 22:44:09 UTC (rev 55388)
@@ -34,7 +34,7 @@
from core.gcmd import GError, RunCommand
from core.utils import SetAddOnPath
from gui_core.forms import GUI
-from gui_core.widgets import ItemTree, GListCtrl, SearchModuleWidget, EVT_MODULE_SELECTED
+from gui_core.widgets import ItemTree, GListCtrl, SearchModuleWidget
class ExtensionModulesData(object):
@@ -148,7 +148,7 @@
self.search = SearchModuleWidget(parent = self.panel, modulesData = self.modulesData,
showChoice = False)
self.search.SetSelection(0)
- self.search.Bind(EVT_MODULE_SELECTED, self.OnShowItem)
+ self.search.moduleSelected.connect(lambda name: self.OnShowItem(None))
# show text in statusbar when notification appears
self.search.showNotification.connect(lambda message: self.SetStatusText(message))
More information about the grass-commit
mailing list