[GRASS-SVN] r55385 - grass/trunk/gui/wxpython/web_services
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 14 13:26:24 PDT 2013
Author: annakrat
Date: 2013-03-14 13:26:24 -0700 (Thu, 14 Mar 2013)
New Revision: 55385
Modified:
grass/trunk/gui/wxpython/web_services/dialogs.py
grass/trunk/gui/wxpython/web_services/widgets.py
Log:
wxGUI: continue replacing events (capParsed)
Modified: grass/trunk/gui/wxpython/web_services/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/web_services/dialogs.py 2013-03-14 19:50:02 UTC (rev 55384)
+++ grass/trunk/gui/wxpython/web_services/dialogs.py 2013-03-14 20:26:24 UTC (rev 55385)
@@ -39,7 +39,7 @@
from gui_core.gselect import Select
from gui_core.widgets import ManageSettingsWidget
-from web_services.widgets import WSPanel, EVT_CAP_PARSED
+from web_services.widgets import WSPanel
class WSDialogBase(wx.Dialog):
"""!Base class for web service dialogs.
@@ -126,8 +126,8 @@
for ws in self.ws_panels.iterkeys():
self.ws_panels[ws]['panel'] = WSPanel(parent = self.reqDataPanel,
- web_service = ws,
- receiver = self)
+ web_service = ws)
+ self.ws_panels[ws]['panel'].capParsed.connect(self.OnPanelCapParsed)
# buttons
self.btn_close = wx.Button(parent = self, id = wx.ID_CLOSE)
@@ -148,8 +148,6 @@
self.settsManager.settingsLoaded.connect(self.OnSettingsLoaded)
self.settsManager.settingsSaving.connect(self.OnSettingsSaving)
- self.Bind(EVT_CAP_PARSED, self.OnPanelCapParsed)
-
def _doLayout(self):
dialogSizer = wx.BoxSizer(wx.VERTICAL)
@@ -366,14 +364,14 @@
password = self.password.GetValue())
self.ws_panels[ws]['panel'].Hide()
- def OnPanelCapParsed(self, event):
+ def OnPanelCapParsed(self, error_msg):
"""!Called when panel has downloaded and parsed capabilities file.
"""
# how many web service panels are finished
self.finished_panels_num += 1
- if event.error_msg:
- self.error_msgs += '\n' + event.error_msg
+ if error_msg:
+ self.error_msgs += '\n' + error_msg
# if all are finished, show panels, which succeeded in connection
if self.finished_panels_num == len(self.ws_panels):
@@ -733,10 +731,10 @@
self.LoadCapFiles(cmd = self.revert_cmd,
ws_cap_files = self.revert_ws_cap_files)
- def OnPanelCapParsed(self, event):
+ def OnPanelCapParsed(self, error_msg):
"""!Called when panel has downloaded and parsed capabilities file.
"""
- WSDialogBase.OnPanelCapParsed(self, event)
+ WSDialogBase.OnPanelCapParsed(self, error_msg)
if self.finished_panels_num == len(self.ws_panels):
if self.cmd_to_set:
Modified: grass/trunk/gui/wxpython/web_services/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/web_services/widgets.py 2013-03-14 19:50:02 UTC (rev 55384)
+++ grass/trunk/gui/wxpython/web_services/widgets.py 2013-03-14 20:26:24 UTC (rev 55385)
@@ -48,24 +48,24 @@
from wms_base import WMSDriversInfo
-wxOnCapParsed, EVT_CAP_PARSED = NewEvent()
+from grass.pydispatch.signal import Signal
class WSPanel(wx.Panel):
- def __init__(self, parent, receiver, web_service, **kwargs):
+ def __init__(self, parent, web_service, **kwargs):
"""!Show data from capabilities file.
- Events: EVT_CAP_PARSED - this event is released when capabilities file is downloaded
- (after ConnectToServer method was called)
+ Signal: capParsed - this signal is emitted when capabilities file is downloaded
+ (after ConnectToServer method was called)
@param parent - parent widget
- @param receiver - receives EVT_CAP_PARSED event
@param web_service - web service to be panel generated for
"""
wx.Panel.__init__(self, parent = parent, id = wx.ID_ANY)
self.parent = parent
self.ws = web_service
- self.receiver = receiver
+
+ self.capParsed = Signal('WSPanel.capParsed')
# stores widgets, which represents parameters/flags of d.wms
self.params = {}
@@ -458,7 +458,7 @@
self.ws_cmdl = self.ws_drvs[self.ws]['cmd'] + conn_cmd
def OnCapDownloadDone(self, event):
- """!Process donwloaded capabilities file and emits EVT_CAP_PARSED (see class constructor).
+ """!Process donwloaded capabilities file and emits capParsed signal (see class constructor).
"""
if event.pid != self.currentPid:
return
@@ -474,7 +474,7 @@
self._parseCapFile(self.cap_file)
def _parseCapFile(self, cap_file):
- """!Parse capabilities data and emits EVT_CAP_PARSED (see class constructor).
+ """!Parse capabilities data and emits capParsed signal (see class constructor).
"""
try:
self.cap = self.ws_drvs[self.ws]['cap_parser'](cap_file)
@@ -502,7 +502,7 @@
self._postCapParsedEvt(None)
def ParseCapFile(self, url, username, password, cap_file = None,):
- """!Parse capabilities data and emits EVT_CAP_PARSED (see class constructor).
+ """!Parse capabilities data and emits capParsed signal (see class constructor).
"""
self._prepareForNewConn(url, username, password)
@@ -591,8 +591,7 @@
def _postCapParsedEvt(self, error_msg):
"""!Helper function
"""
- cap_parsed_event = wxOnCapParsed(error_msg = error_msg)
- wx.PostEvent(self.receiver, cap_parsed_event)
+ self.capParsed.emit(error_msg=error_msg)
def CreateCmd(self):
"""!Create d.wms cmd from values of panels widgets
More information about the grass-commit
mailing list