Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug introduced in the issue #466 #500

Merged
merged 1 commit into from
May 7, 2020

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Apr 10, 2020

I confirm this bug #466. The solution is set the correct empty bitmap buffer size.

@tmszi tmszi changed the title Fix bug introduce in the issue #466 Fix bug introduced in the issue #466 Apr 10, 2020
@landam landam added bug Something isn't working GUI wxGUI related labels Apr 10, 2020
@landam landam added this to the 7.8.3 milestone Apr 10, 2020
@neteler
Copy link
Member

neteler commented Apr 10, 2020

Tested in relbranch78, it fixes the problem, thanks!

Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely sure this is the best solution, but I don't have anything better and I can't replicate the problem in the first place (although I've definitely had this issue before).

@tmszi
Copy link
Member Author

tmszi commented Apr 11, 2020

Hello,

The way how to reproduce this bug is start wxGUI in the fullscreen mode.
I'm using dwm window manager which enable monocle window layout (monocle is good for ensuring a window is kept maximized and focused).

Another way how to set wxGUI fullscreen mode:

  1. Start g.gui
  2. Maximize Layer Manage Window
  3. Maximize Map Display Window
  4. On the Layer Manager menu go to Settings -> Preferences -> General page (tab) -> Check Save current window layout as default -> Click on the Save button
  5. Close gui
  6. Start gui g.gui workspace=myworkspace.gxw

Some usefull information from debugging:

A. Start g.gui without workspace parameter

  1. During BufferedMapWindow class initialization self._buffer size (gui/wxpython/mapwin/buffered.py, row 192) is set to default map window size (825, 600) (gui/wxpython/core/globalvar.py, row 175)

  2. Two events are triggered:
    2.1 OnIdle event (destroy self._buffer and create new self._buffer with new size from map window self.Map.ChangeMapSize(self.GetClientSize()), row 658
    2.2 OnPaint event which paint empty bitmap buffer with new size corresponding map window client size

B. Start g.gui with workspace=myworkspace.gxw parameter

  1. same as in A
  2. One event is triggered
    2.1 OnPaint event which paint empty bitmap buffer with default map window size (825, 600). Size is not changed it to actual map window client size, because OnIdle event isn't triggered

map_window_fullscreen_rendering

@tmszi
Copy link
Member Author

tmszi commented Apr 11, 2020

You're welcome.

@petrasovaa
Copy link
Contributor

Given the debugging you showed I looked at it again and found the cause in _updateM function in buffered:

@@ -909,8 +914,6 @@ class BufferedMapWindow(MapWindowBase, Window):
         Debug.msg(1, "BufferedWindow.UpdateMap(): started "
                   "(render=%s, renderVector=%s)" % (render, renderVector))
 
-        self.resize = False
-
         # was if self.Map.cmdfile and ...
         if self.IsAlwaysRenderEnabled() and self.img is None:
             render = True

When you remove that line, it should start working again even without your patch. I was trying to figure out why the line was there in the first place but couldn't find or think of anything. This code has been changing so it could be a remnant, but it's hard to tell. I tested it and it doesn't seem to introduce any problems but perhaps others could test.

There is a separate bug now when closing map displays before loading workspace caused by my recent changes, I will address that in separate PR.

@tmszi
Copy link
Member Author

tmszi commented Apr 13, 2020

I tested your fix.

Test results:

A. g.gui workspace=myworkspace.gxw (fullscreen windows mode)

Empty bitmap buffer size is correct. The vector map was rendered fine.

B. g.gui workspace=myworkspace.gxw ('tile' windows mode)

The vector map wasn't rendered.

Error message:

Traceback (most recent call last):
  File "/usr/local/grass79/gui/wxpython/core/gthread.py",
line 121, in OnDone

event.ondone(event)
  File "/usr/local/grass79/gui/wxpython/core/render.py",
line 469, in OnRenderDone

self.updateProgress.emit(layer=self.layer)
  File
"/usr/local/grass79/etc/python/grass/pydispatch/signal.py",
line 229, in emit

dispatcher.send(signal=self, *args, **kwargs)
  File "/usr/local/grass79/etc/python/grass/pydispatch/dispa
tcher.py", line 349, in send

**named
  File "/usr/local/grass79/etc/python/grass/pydispatch/robus
tapply.py", line 60, in robustApply

return receiver(*arguments, **named)
  File "/usr/local/grass79/gui/wxpython/core/render.py",
line 743, in ReportProgress

self.renderDone.emit()
  File
"/usr/local/grass79/etc/python/grass/pydispatch/signal.py",
line 229, in emit

dispatcher.send(signal=self, *args, **kwargs)
  File "/usr/local/grass79/etc/python/grass/pydispatch/dispa
tcher.py", line 349, in send

**named
  File "/usr/local/grass79/etc/python/grass/pydispatch/robus
tapply.py", line 60, in robustApply

return receiver(*arguments, **named)
  File "/usr/local/grass79/gui/wxpython/core/render.py",
line 679, in OnRenderDone

self.Render()
  File "/usr/local/grass79/gui/wxpython/core/render.py",
line 604, in Render

if self._renderLayers(env, force) == 0:
  File "/usr/local/grass79/gui/wxpython/core/render.py",
line 543, in _renderLayers

layer.GetRenderMgr().updateProgress.emit(layer=layer)
  File
"/usr/local/grass79/etc/python/grass/pydispatch/signal.py",
line 229, in emit

dispatcher.send(signal=self, *args, **kwargs)
  File "/usr/local/grass79/etc/python/grass/pydispatch/dispa
tcher.py", line 349, in send

**named
  File "/usr/local/grass79/etc/python/grass/pydispatch/robus
tapply.py", line 60, in robustApply

return receiver(*arguments, **named)
  File "/usr/local/grass79/gui/wxpython/core/render.py",
line 743, in ReportProgress

self.renderDone.emit()
  File
"/usr/local/grass79/etc/python/grass/pydispatch/signal.py",
line 229, in emit

dispatcher.send(signal=self, *args, **kwargs)
  File "/usr/local/grass79/etc/python/grass/pydispatch/dispa
tcher.py", line 349, in send

**named
  File "/usr/local/grass79/etc/python/grass/pydispatch/robus
tapply.py", line 60, in robustApply

return receiver(*arguments, **named)
  File "/usr/local/grass79/gui/wxpython/core/render.py",
line 650, in OnRenderDone

raise GException(_("Rendering failed: %s" % msg))
core.gcmd
.
GException
:
Rendering failed: Expecting 860x454 image but got 1916x985
image.

@petrasovaa
Copy link
Contributor

I suspect this error is to certain extent unrelated as it has been showing up in different circumstances. The environment with the rendering dimensions needs to be consistent across the rendering commands, which apparently is not and it is being changed during the rendering process due to some resizing event.

@tmszi
Copy link
Member Author

tmszi commented May 5, 2020

I tested PR #552 (on the GNU/Linux, MS Win OS) with your patch

@@ -909,8 +914,6 @@ class BufferedMapWindow(MapWindowBase, Window):
         Debug.msg(1, "BufferedWindow.UpdateMap(): started "
                   "(render=%s, renderVector=%s)" % (render, renderVector))
 
-        self.resize = False
-
         # was if self.Map.cmdfile and ...
         if self.IsAlwaysRenderEnabled() and self.img is None:
             render = True

and it works properly.

@tmszi tmszi force-pushed the fix_map_display_buffer_size branch from e5504f6 to 9983f0c Compare May 5, 2020 13:00
@petrasovaa petrasovaa merged commit cd88745 into OSGeo:master May 7, 2020
petrasovaa pushed a commit that referenced this pull request May 7, 2020
…500)

Fixes #466, it is not quite clear what the now removed line was there for.
@tmszi tmszi deleted the fix_map_display_buffer_size branch July 28, 2020 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI wxGUI related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] wxGUI: map display incomplete when restoring settings from project file (gxw)
4 participants