[GRASS-dev] Re: wxGUI: MapDisplay mouse events

Hi Vasek,

I just tried your API in my rstream GUI and it works very well, thanks a lot for your work! To devs who have SVN writing permission, may I ask if is it possible to commit this patch into the core code please?

Thanks,

madi

---------- Forwarded message ----------
From: Wenzeslaus <wenzeslaus@gmail.com>
To: grass-dev@lists.osgeo.org
Date: Tue, 16 Aug 2011 19:44:11 +0200
Subject: [GRASS-dev] Re: wxGUI: MapDisplay mouse events
Hi list,

I have suggestion about processing mouse events from MapDisplay
(BufferedWindow, GLWindow). In mapdisplay_mouse_events.diff is
implementation of API which should be enough generic to be used by
more than one module.

You can bind your own handler to MapDisplay (MapWindow to be precise)
MouseEvents by public API. It is no longer necessary to edit code in
mapdisp.py files. (It is the main advantage.)

I have attached test code (mapdisplay_mouse_events_example.diff). It
gets coordinates from MapDisplay. I think it is
something like Margarita needs in her rstream module. Example is also
included in doc string.

Suggested code works with both 2D (BufferedWindow) and 3D (GLWindow)
and with multiple MapDisplays. It is also possible to override
current cursor.

It doesn’t work with Digitizer (VDigitWindow) (no errors but functions
report unsuccessful binds).

The handler can be also unbound with this API. However all other
handlers will be unbounded (and only MapWindow handlers will be
bounded again). Unbind only one handler is not possible in wxPython.

I’m not sure how to handle standard behaviour of mouse events in
MapWindow and its subclasses. Now, functions connected with
mouse[‘use’] are disabled by setting mouse[‘use’] to other value. But
there are also other aproaches. Functions can be disabled in wxPython
way by Unbind() or we can let functions to do what they do usualy, but
it will be very confusing, I think.

Vasek


Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360

Hi,

2011/8/17 Margherita Di Leo <dileomargherita@gmail.com>:

I just tried your API in my rstream GUI and it works very well, thanks a lot
for your work! To devs who have SVN writing permission, may I ask if is it
possible to commit this patch into the core code please?

it's in my TODO to review it, it will take a time.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,

2011/8/17 Martin Landa <landa.martin@gmail.com>:

I just tried your API in my rstream GUI and it works very well, thanks a lot
for your work! To devs who have SVN writing permission, may I ask if is it
possible to commit this patch into the core code please?

it's in my TODO to review it, it will take a time.

I see this contribution as very useful, committed to trunk in r47744
(devbr6 in r47745) for testing.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa