Browse Source

wxGUI/mapdisp: handling distance measuring messages with giface, measuring in d.mon works

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54883 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 12 years ago
parent
commit
54b0f82d4a
3 changed files with 15 additions and 10 deletions
  1. 1 0
      gui/wxpython/gui_core/goutput.py
  2. 8 1
      gui/wxpython/lmgr/frame.py
  3. 6 9
      gui/wxpython/mapdisp/frame.py

+ 1 - 0
gui/wxpython/gui_core/goutput.py

@@ -295,6 +295,7 @@ class GConsoleWindow(wx.SplitterWindow):
         (replace by priority: False=1, True=2)
         @param priority priority of this message
         (0=no priority, 1=normal, 2=medium, 3=high)
+        also not clear how deal with this
         """
 
         self.cmdOutput.SetStyle()

+ 8 - 1
gui/wxpython/lmgr/frame.py

@@ -52,7 +52,8 @@ from modules.mcalc_builder import MapCalcFrame
 from dbmgr.manager         import AttributeManager
 from core.workspace        import ProcessWorkspaceFile, ProcessGrcFile, WriteWorkspaceFile
 from core.gconsole         import GConsole, \
-    EVT_CMD_OUTPUT, EVT_IGNORED_CMD_RUN, EVT_IMPORTANT_CMD_RUN, EVT_WRITE_LOG
+    EVT_CMD_OUTPUT, EVT_IGNORED_CMD_RUN, EVT_IMPORTANT_CMD_RUN, \
+    EVT_WRITE_LOG, EVT_WRITE_WARNING, EVT_WRITE_ERROR
 from gui_core.goutput      import GConsoleWindow, EVT_GC_CONTENT_CHANGED, GC_SEARCH, GC_PROMPT
 from gui_core.dialogs      import GdalOutputDialog, DxfImportDialog, GdalImportDialog, MapLayersDialog
 from gui_core.dialogs      import EVT_APPLY_MAP_LAYERS
@@ -291,6 +292,12 @@ class GMFrame(wx.Frame):
         self._gconsole.Bind(EVT_WRITE_LOG,
                             lambda event:
                                 self._switchPageHandler(event = event, priority = event.priority))
+        self._gconsole.Bind(EVT_WRITE_WARNING,
+                            lambda event:
+                                self._switchPageHandler(event = event, priority = 2))
+        self._gconsole.Bind(EVT_WRITE_ERROR,
+                            lambda event:
+                                self._switchPageHandler(event = event, priority = 2))
         self._setCopyingOfSelectedText()
         
         # create 'search module' notebook page

+ 6 - 9
gui/wxpython/mapdisp/frame.py

@@ -930,10 +930,7 @@ class MapFrame(SingleMapFrame):
         self.totaldist = 0.0 # total measured distance
         
         self.SwitchTool(self.toolbars['map'], event)
-        
-        # switch Layer Manager to output console to show measure results
-        self._layerManager.notebook.SetSelectionByName('output')
-        
+
         # change mouse to draw line for measurement
         self.MapWindow.mouse['use'] = "measure"
         self.MapWindow.mouse['box'] = "line"
@@ -944,9 +941,10 @@ class MapFrame(SingleMapFrame):
         # change the cursor
         self.MapWindow.SetCursor(self.cursors["pencil"])
         
-        # initiating output
-        # TODO: this should be something like:
-        # write important message or write tip
+        # initiating output (and write a message)
+        # e.g., in Layer Manager switch to output console
+        # TODO: this should be something like: write important message or write tip
+        # TODO: mixed 'switching' and message? no, measuring handles 'swithing' on its own
         self._giface.WriteWarning(_('Click and drag with left mouse button '
                                               'to measure.%s'
                                               'Double click with left button to clear.') % \
@@ -974,7 +972,6 @@ class MapFrame(SingleMapFrame):
         """!Calculate map distance from screen distance
         and print to output window
         """
-        self._layerManager.notebook.SetSelectionByName('output')
         
         dist, (north, east) = self.MapWindow.Distance(beginpt, endpt)
         
@@ -1004,7 +1001,7 @@ class MapFrame(SingleMapFrame):
                    _('total distance'), strtotdist, tdunits,
                    '-' * 60)
         
-        self._giface.WriteLog(mstring)
+        self._giface.WriteLog(mstring, priority=2)
         
         return dist