[GRASS-dev] [GRASS GIS] #1859: d.mon is broken

#1859: d.mon is broken
------------------------+---------------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: d.mon, wx0 | Platform: Linux
      Cpu: x86-64 |
------------------------+---------------------------------------------------
{{{
GRASS 7.0.svn (utm43wgs84):~/src/grass7.0 > d.mon wx0
GRASS 7.0.svn (utm43wgs84):~/src/grass7.0 > Traceback (most recent call
last):
   File "/home/soeren/src/grass7.0/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/gui/wxpython/mapdisp/main.py", line 332, in <module>
     gmMap = MapApp(0)
   File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 7981, in __init__
     self._BootstrapApp()
   File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 7555, in _BootstrapApp
     return _core_.PyApp__BootstrapApp(*args, **kwargs)
   File "/home/soeren/src/grass7.0/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/gui/wxpython/mapdisp/main.py", line 249, in OnInit
     size = monSize)
   File "/home/soeren/src/grass7.0/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/gui/wxpython/mapdisp/frame.py", line 94, in __init__
     self.AddToolbar(toolb)
   File "/home/soeren/src/grass7.0/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/gui/wxpython/mapdisp/frame.py", line 377, in AddToolbar
     self.toolbars['map'] = MapToolbar(self, self.Map)
   File "/home/soeren/src/grass7.0/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/gui/wxpython/mapdisp/toolbars.py", line 90, in __init__
     log.WriteCmdLog(_('3D view mode not available'))
UnboundLocalError: local variable 'log' referenced before assignment
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1859&gt;
GRASS GIS <http://grass.osgeo.org>

#1859: d.mon is broken
------------------------+---------------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: d.mon, wx0 | Platform: Linux
      Cpu: x86-64 |
------------------------+---------------------------------------------------

Comment(by wenzeslaus):

It is working for me on Ubuntu 10.04 and 12.04, grass 7 r54755.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1859#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1859: d.mon is broken
------------------------+---------------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: d.mon, wx0 | Platform: Linux
      Cpu: x86-64 |
------------------------+---------------------------------------------------

Comment(by huhabla):

Besides the fact that it is not working for me on two different Ubuntu
12.04 machines, is this part of code bad style:
gui/wxpython/mapdisp/toolbars.py line 82 - 91
{{{
         if self.parent.GetLayerManager():
             log = self.parent.GetLayerManager().GetLogWindow()

         if haveNviz:
             choices.append(_('3D view'))
             self.toolId['3d'] = 1
         else:
             from nviz.main import errorMsg
             log.WriteCmdLog(_('3D view mode not available'))
             log.WriteWarning(_('Reason: %s') % str(errorMsg))
}}}

What happens in case there is no parent with a layer manager? In this case
the application crashes! This exception should be handled, for example to
use a
different log window or the console log?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1859#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1859: d.mon is broken
------------------------+---------------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: d.mon, wx0 | Platform: Linux
      Cpu: x86-64 |
------------------------+---------------------------------------------------

Comment(by wenzeslaus):

Replying to [comment:2 huhabla]:
> Besides the fact that it is not working for me on two different Ubuntu
12.04 machines

I don't understand what is your configuration. The error means that you
don't have NVIZ.

> is this part of code bad style:
> gui/wxpython/mapdisp/toolbars.py line 82 - 91
>
> What happens in case there is no parent with a layer manager? In this
case the application crashes! This exception should be handled, for
example to use a
> different log window or the console log?

You are completely right! This is subject to ongoing refactoring
(currently paused). This will be fixed, probably, in next days. (Anna will
provide fix for now.)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1859#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1859: d.mon is broken
------------------------+---------------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: d.mon, wx0 | Platform: Linux
      Cpu: x86-64 |
------------------------+---------------------------------------------------

Comment(by neteler):

For me (Fedora 18) it works. Has the code style in question been updated?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1859#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1859: d.mon is broken
------------------------+---------------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: d.mon, wx0 | Platform: Linux
      Cpu: x86-64 |
------------------------+---------------------------------------------------
Changes (by wenzeslaus):

  * priority: critical => normal

Comment:

Replying to [comment:4 neteler]:
> For me (Fedora 18) it works.

To test this properly you need to have GRASS configured without NVIZ
(OpenGL?), I think. It shout be fixed by r54756.

Replying to [comment:4 neteler]:
> Has the code style in question been updated?

Not yet, file `gui/wxpython/mapdisp/toolbars.py` needs its own large
refactoring and this may be part of it.

Since it is working and the rest is more about refactoring, downgrading
priority.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1859#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1859: d.mon is broken
----------------------+-----------------------------------------------------
  Reporter: huhabla | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Resolution: fixed | Keywords: d.mon, wx0, nviz
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Changes (by wenzeslaus):

  * keywords: d.mon, wx0 => d.mon, wx0, nviz
  * status: new => closed
  * resolution: => fixed

Comment:

Original error is fixed. Let's not keep this ticket open because the whole
GUI needs a lot of refactoring.

By the way, considering current code, grass interface should be used in
this case for writing error messages.

Reopen if d.mon error complaining about 3D appears again.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1859#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>