Opened 7 years ago

Closed 6 years ago

#1859 closed defect (fixed)

d.mon is broken

Reported by: huhabla Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Display Version: svn-trunk
Keywords: d.mon, wx0, nviz Cc:
CPU: x86-64 Platform: Linux

Description

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

Change History (6)

comment:1 Changed 7 years ago by wenzeslaus

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

comment:2 Changed 7 years ago 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?

comment:3 in reply to:  2 Changed 7 years ago by wenzeslaus

Replying to 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.)

comment:4 Changed 7 years ago by neteler

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

comment:5 in reply to:  4 Changed 7 years ago by wenzeslaus

Priority: criticalnormal

Replying to 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 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.

comment:6 Changed 6 years ago by wenzeslaus

Keywords: nviz added
Resolution: fixed
Status: newclosed

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.

Note: See TracTickets for help on using tickets.