ValueError when resetting the BusyCursor

Martin Schulze joey at infodrom.org
Sun Apr 11 09:52:06 CEST 2004


Hi,

I noticed that when I utilise wxBeginBusyCursor() and
wxEndBusyCursor() in order to help the user understand that Thuban is
doing something when talking to a remote WMS resource,
Thuban/UI/view.py emits an error

  File: ".../Thuban/UI/view.py", line 206, in _do_redraw
    if self.render_iter.netxt():
ValueError: generator already executing

Even though I do understand the error: the function _do_redraw is
called within itself, which is not permitted, I don't understand why
this error is happening here.

This problem is caused by wxEndBusyCursor() in Extension/wms/wms.py
line 226, i.e. in the GetMapImg() method when resetting the mouse
cursor.  However, removing it could end up in long delays until Thuban
reacts again which has the potential to confuse the user, so that
doesn't seem to be an option, but only a workaround against this
exception.

Another way to circumvent this problem would be to explicitly ignore
ValueError in the render method:

Index: Thuban/UI/view.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/UI/view.py,v
retrieving revision 1.62
diff -u -r1.62 view.py
--- Thuban/UI/view.py	17 Feb 2004 13:14:49 -0000	1.62
+++ Thuban/UI/view.py	11 Apr 2004 07:45:58 -0000
@@ -223,6 +223,9 @@
                     if not self.dragging:
                         self.redraw()
                     finished = True
+            except ValueError:
+                finished = True
+                self.render_iter = None
             except StopIteration:
                 finished = True
                 self.render_iter = None

What do you think?

Regards,

	Joey

-- 
Life is too short to run proprietary software.  -- Bdale Garbee




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)