Opened 11 years ago

Closed 10 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 by wenzeslaus, 11 years ago

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

comment:2 by huhabla, 11 years ago

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?

in reply to:  2 comment:3 by wenzeslaus, 11 years ago

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 by neteler, 11 years ago

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

in reply to:  4 comment:5 by wenzeslaus, 11 years ago

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 by wenzeslaus, 10 years ago

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.