Opened 8 years ago

Closed 5 years ago

#3153 closed defect (fixed)

g.gui.animation freezes when trying to add decorations

Reported by: veroandreo Owned by: grass-dev@…
Priority: normal Milestone: 7.2.4
Component: wxGUI Version: svn-trunk
Keywords: g.gui.animation Cc:
CPU: Unspecified Platform: Linux

Description

g.gui.animation freezes when trying to add decorations and the only possibility is to close it, loosing all the settings.

Traceback (most recent call last):
  File "/home/veroandreo/software/grass-7.3.svn/dist.x86_64-pc-linux-gnu/gui/wxpython/animation/dialogs.py", line 1502, in OnExport
    decorations=self.GetDecorations())
  File "/home/veroandreo/software/grass-7.3.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/pydispatch/signal.py", line 229, in emit
    dispatcher.send(signal=self, *args, **kwargs)
  File "/home/veroandreo/software/grass-7.3.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/pydispatch/dispatcher.py", line 349, in send
    **named
  File "/home/veroandreo/software/grass-7.3.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/pydispatch/robustapply.py", line 60, in robustApply
    return receiver(*arguments, **named)
  File "/home/veroandreo/software/grass-7.3.svn/dist.x86_64-pc-linux-gnu/gui/wxpython/animation/controller.py", line 610, in _export
    bgcolor, fgcolor).ConvertToImage()
  File "/home/veroandreo/software/grass-7.3.svn/dist.x86_64-pc-linux-gnu/gui/wxpython/animation/utils.py", line 250, in RenderText
    w, h = dc.GetTextExtent(text)
  File "/usr/lib64/python2.7/site-packages/wx-3.0-gtk3/wx/_gdi.py", line 4127, in GetTextExtent
    return _gdi_.DC_GetTextExtent(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "m_graphicContext" failed at ./src/common/dcgraph.cpp(1147) in DoGetTextExtent(): wxGCDC(cg)::DoGetTextExtent - invalid DC

It would be useful to be able to export those settings or configurations to keep them as templates, then, or so.

Attachments (2)

g_gui_animation_refresh_missing.jpg (81.1 KB ) - added by neteler 8 years ago.
g.gui.animation: refresh missing
wx_animation.diff (546 bytes ) - added by neteler 7 years ago.
Patch from comment #3

Download all attachments as: .zip

Change History (24)

comment:1 by annakrat, 8 years ago

I can't reproduce it with wxPython 3.0.2.0 on Ubuntu 16. What are the exact steps and configuration?

comment:2 by veroandreo, 8 years ago

Sorry for the delay...

I just select a raster or vector time series to display, then go to "export animation" and before actually exporting, I add some decoration, i.e.: timestamp, image or text, and when I click over export, rather nothing happens or "Preparing export, please wait..." sign freezes in the screen forever, while in the output window, I get the same error as reported before...

System info:

GRASS version: 7.3.svn                                                          
GRASS SVN revision: r69574M                                                     
Build date: 2016-09-26                                                          
Build platform: x86_64-pc-linux-gnu                                             
GDAL: 2.0.2                                                                     
PROJ.4: 4.9.2                                                                   
GEOS: 3.5.0                                                                     
SQLite: 3.13.0                                                                  
Python: 2.7.12                                                                  
wxPython: 3.0.2.0                                                               
Platform: Linux-4.7.4-200.fc24.x86_64-x86_64-with-fedora-24-Twenty_Four

in reply to:  2 comment:3 by annakrat, 8 years ago

I still can't reproduce it, even with wxpython 3.0.2.0. First try using different font, but I don't think that would help. Next try to apply this change and recompile:

Index: animation/utils.py
===================================================================
--- animation/utils.py	(revision 69577)
+++ animation/utils.py	(working copy)
@@ -245,7 +245,7 @@
 
 def RenderText(text, font, bgcolor, fgcolor):
     """Renderes text with given font to bitmap."""
-    dc = wx.MemoryDC()
+    dc = wx.MemoryDC(wx.EmptyBitmap(20, 20))
     dc.SetFont(font)
     w, h = dc.GetTextExtent(text)
     bmp = wx.EmptyBitmap(w + 2, h + 2)

I hope this could help, otherwise I have no idea.

comment:4 by veroandreo, 8 years ago

Unfortunatelly, no... still same behaviour with a freshly updated trunk r69591M :( No idea

comment:5 by annakrat, 8 years ago

It might be something specific for Fedora. I hoped that diff could fix it, but I am clueless now.

comment:6 by neteler, 8 years ago

I have the same issue (also on F24). Any hints how to debug that?

in reply to:  6 comment:7 by annakrat, 8 years ago

Replying to neteler:

I have the same issue (also on F24). Any hints how to debug that?

That diff is the only idea I have, please try it. You can also put there

print dc.IsOk() 

before

w, h = dc.GetTextExtent(text)

to see if the dc is ok to use.

by neteler, 8 years ago

g.gui.animation: refresh missing

comment:8 by neteler, 8 years ago

I applied the patch and it no longer freezes. The print patch did not have any effect (nothing is printed).

I attach a screenshot to show that when enlarging the window black borders come up which have a refresh issue when moving the legend around. Perhaps related?

I'm using wxPython-3.0.2.0-10.fc24.x86_64.

in reply to:  8 comment:9 by annakrat, 8 years ago

Replying to neteler:

I applied the patch and it no longer freezes. The print patch did not have any effect (nothing is printed).

So do you confirm the patch solved the issue? Do the exported images/gif and the text look correct?

I attach a screenshot to show that when enlarging the window black borders come up which have a refresh issue when moving the legend around. Perhaps related?

Could be related, but it's a little bit different problem, please create a new ticket.

comment:10 by veroandreo, 8 years ago

I applied the patch. Buttons "Cancel" and "Export" still freeze when I add decorations (i.e.: remain completely irresponsive) if I try to click on them. Luckily, I can reach them by <Tab> and the animation is exported correctly with the decorations I added. However in the teminal I get the following:

/home/veroandreo/software/grass-7.3.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/imaging/images2gif.py:344: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future
  im2 = im[y0:y1, x0:x1]

If I do not add any decorations and only export the animation as-is directly, buttons work fine. But I get the same warning in the terminal:

/home/veroandreo/software/grass-7.3.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/imaging/images2gif.py:344: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future
  im2 = im[y0:y1, x0:x1]

Tested with a STRDS in NC climatic Location. Grass trunk, revision=r69647M. If you have any ideas, I'm happy to keep testing.

by neteler, 7 years ago

Attachment: wx_animation.diff added

Patch from comment #3

comment:11 by annakrat, 7 years ago

I committed the patch and backported it. That's about all I can do now. I suggest to close this and open new tickets if needed.

comment:12 by veroandreo, 7 years ago

I have tested both in trunk r69822 and 72 release branch r69821 and the issue prevails. Steps to reproduce are:

  1. call g.gui.animation from terminal
  2. add new animation
  3. add stvds -> ok -> ok (animation works fine)
  4. go to export icon
  5. set a file type and name
  6. go to decorations tab
  7. add text
  8. click export from there... No way, it does not respond. It is frozen. The only remaining option is to close.

If you try to export directly, without touching the decoration tab, it works fine. However you don't get any decoration.

comment:13 by annakrat, 7 years ago

I understood the patch was working for Markus. You have both Fedora, right?

in reply to:  13 comment:14 by neteler, 7 years ago

Replying to annakrat:

I understood the patch was working for Markus.

I followed the procedure of Vero: I can still switch between "Format" und "Decorations" tab but both the "Cancel" and "Export" buttons are like disabled.

In the terminal there is many times:

(g.gui.animation:6695): Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkNotebook

You have both Fedora, right?

Yes.

comment:15 by neteler, 7 years ago

Just to clarify: (for me) g.gui.animation is not freezing, I think the ticket's title is a bit misleading. "Simply" the buttons get somehow disconnected, i.e. deactivated in the decorations dialog while the tabs etc remain working.

Closing the decorations dialog with the upper right X brings me back to the main window of the module which remains working (except for this decorations dialog.

in reply to:  15 comment:16 by veroandreo, 7 years ago

Replying to neteler:

Just to clarify: (for me) g.gui.animation is not freezing, I think the ticket's title is a bit misleading. "Simply" the buttons get somehow disconnected, i.e. deactivated in the decorations dialog while the tabs etc remain working.

Closing the decorations dialog with the upper right X brings me back to the main window of the module which remains working (except for this decorations dialog.

Yes, the same for me... Sorry if the tittle is missleading, did not find the proper words at time :(

comment:17 by neteler, 7 years ago

Milestone: 7.2.07.2.1

Ticket retargeted after milestone closed

comment:18 by martinl, 7 years ago

Milestone: 7.2.17.2.2

comment:19 by neteler, 7 years ago

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:20 by martinl, 6 years ago

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:21 by martinl, 6 years ago

Milestone: 7.2.4

comment:22 by veroandreo, 5 years ago

Resolution: fixed
Status: newclosed

I can't reproduce the reported bahavior any longer, closing

Note: See TracTickets for help on using tickets.