fix for select control?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

fix for select control?

Michael Barton
fix for select control? Jáchym,

I sort of understand what is happening to cause the bug you encountered with the select.Select control. When the mapset group item in the selection tree is expanded, it generates a wx.EVT_TREE_ITEM_EXPANDING event. This gets propagated up through the hierarchy or controls to the grandparent object, the GIS Manager layer tree, where it is handled by the wx.EVT_TREE_ITEM_EXPANDING handler method onExpandNode.

There may be a way to limit event propagation up the hierarchy that I don’t understand, but what I’ve done is added an explicit binding for this event (and the wx.EVT_TREE_ITEM_COLLAPSED event too) in the selection tree class. This calls a dummy handler in that class. Hopefully, this will keep the item expand event in the class where it belongs. If we can fix this, it may be possible to put the selection tree inside a different kind of widget if that is desirable. Please uncomment line #131 in select and try it out. Let me know what happens.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change    
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton


_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: fix for select control?

Jachym Cepicky
ok, thanks for it, I'll look at it
j

2007/4/10, Michael Barton <[hidden email]>:

>
>  Jáchym,
>
>  I sort of understand what is happening to cause the bug you encountered
> with the select.Select control. When the mapset group item in the selection
> tree is expanded, it generates a wx.EVT_TREE_ITEM_EXPANDING event. This gets
> propagated up through the hierarchy or controls to the grandparent object,
> the GIS Manager layer tree, where it is handled by the
> wx.EVT_TREE_ITEM_EXPANDING handler method onExpandNode.
>
>  There may be a way to limit event propagation up the hierarchy that I don't
> understand, but what I've done is added an explicit binding for this event
> (and the wx.EVT_TREE_ITEM_COLLAPSED event too) in the selection tree class.
> This calls a dummy handler in that class. Hopefully, this will keep the item
> expand event in the class where it belongs. If we can fix this, it may be
> possible to put the selection tree inside a different kind of widget if that
> is desirable. Please uncomment line #131 in select and try it out. Let me
> know what happens.
>
>  Michael
>  __________________________________________
>  Michael Barton, Professor of Anthropology
>  School of Human Evolution & Social Change
>  Center for Social Dynamics & Complexity
>  Arizona State University
>
>  phone: 480-965-6213
>  fax: 480-965-7671
>  www: http://www.public.asu.edu/~cmbarton
>
>


--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: fix for select control?

Jachym Cepicky
hi,
I tested it and it seems to be working for vector modules only, not for rasters.

When I try to add second (raster) layer, I get:

Traceback (most recent call last):
  File "/hardmnt/moll0/ssi/cepicky/src/gis/grass/grass6/dist.x86_64-unknown-linux-gnu/etc/wx/wxgui.py",
line 492, in addRaster
    self.SetTree('raster')
  File "/hardmnt/moll0/ssi/cepicky/src/gis/grass/grass6/dist.x86_64-unknown-linux-gnu/etc/wx/wxgui.py",
line 544, in SetTree
    self.maptree.AddLayer(disp_idx, layertype)
  File "/hardmnt/moll0/ssi/cepicky/src/gis/grass/grass6/dist.x86_64-unknown-linux-gnu/etc/wx/gui_modules/wxgui_utils.py",
line 160, in AddLayer
    if (self.layer_selected and self.layer_selected != self.GetRootItem() and \
  File "/usr/lib64/python2.3/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py",
line 4996, in __ne__
    return _controls_.TreeItemId___ne__(*args, **kwargs)
TypeError: in method 'TreeItemId___ne__', expected argument 2 of type
'wxTreeItemId const *'

j

2007/4/10, Jachym Cepicky <[hidden email]>:

> ok, thanks for it, I'll look at it
> j
>
> 2007/4/10, Michael Barton <[hidden email]>:
> >
> >  Jáchym,
> >
> >  I sort of understand what is happening to cause the bug you encountered
> > with the select.Select control. When the mapset group item in the selection
> > tree is expanded, it generates a wx.EVT_TREE_ITEM_EXPANDING event. This gets
> > propagated up through the hierarchy or controls to the grandparent object,
> > the GIS Manager layer tree, where it is handled by the
> > wx.EVT_TREE_ITEM_EXPANDING handler method onExpandNode.
> >
> >  There may be a way to limit event propagation up the hierarchy that I don't
> > understand, but what I've done is added an explicit binding for this event
> > (and the wx.EVT_TREE_ITEM_COLLAPSED event too) in the selection tree class.
> > This calls a dummy handler in that class. Hopefully, this will keep the item
> > expand event in the class where it belongs. If we can fix this, it may be
> > possible to put the selection tree inside a different kind of widget if that
> > is desirable. Please uncomment line #131 in select and try it out. Let me
> > know what happens.
> >
> >  Michael
> >  __________________________________________
> >  Michael Barton, Professor of Anthropology
> >  School of Human Evolution & Social Change
> >  Center for Social Dynamics & Complexity
> >  Arizona State University
> >
> >  phone: 480-965-6213
> >  fax: 480-965-7671
> >  www: http://www.public.asu.edu/~cmbarton
> >
> >
>
>
> --
> Jachym Cepicky
> e-mail: jachym.cepicky gmail com
> URL: http://les-ejk.cz
> GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
>


--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: fix for select control?

Michael Barton
I'm betting that I'll need to add item selected bindings to the selection
tree too. It's weird that it's working for vectors and not rasters, though.
The code in menuform.py is exactly the same.

Michael


On 4/10/07 5:56 AM, "Jachym Cepicky" <[hidden email]> wrote:

> hi,
> I tested it and it seems to be working for vector modules only, not for
> rasters.
>
> When I try to add second (raster) layer, I get:
>
> Traceback (most recent call last):
>   File
> "/hardmnt/moll0/ssi/cepicky/src/gis/grass/grass6/dist.x86_64-unknown-linux-gnu
> /etc/wx/wxgui.py",
> line 492, in addRaster
>     self.SetTree('raster')
>   File
> "/hardmnt/moll0/ssi/cepicky/src/gis/grass/grass6/dist.x86_64-unknown-linux-gnu
> /etc/wx/wxgui.py",
> line 544, in SetTree
>     self.maptree.AddLayer(disp_idx, layertype)
>   File
> "/hardmnt/moll0/ssi/cepicky/src/gis/grass/grass6/dist.x86_64-unknown-linux-gnu
> /etc/wx/gui_modules/wxgui_utils.py",
> line 160, in AddLayer
>     if (self.layer_selected and self.layer_selected != self.GetRootItem() and
> \
>   File
> "/usr/lib64/python2.3/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py",
> line 4996, in __ne__
>     return _controls_.TreeItemId___ne__(*args, **kwargs)
> TypeError: in method 'TreeItemId___ne__', expected argument 2 of type
> 'wxTreeItemId const *'
>
> j
>
> 2007/4/10, Jachym Cepicky <[hidden email]>:
>> ok, thanks for it, I'll look at it
>> j
>>
>> 2007/4/10, Michael Barton <[hidden email]>:
>>>
>>>  Jáchym,
>>>
>>>  I sort of understand what is happening to cause the bug you encountered
>>> with the select.Select control. When the mapset group item in the selection
>>> tree is expanded, it generates a wx.EVT_TREE_ITEM_EXPANDING event. This gets
>>> propagated up through the hierarchy or controls to the grandparent object,
>>> the GIS Manager layer tree, where it is handled by the
>>> wx.EVT_TREE_ITEM_EXPANDING handler method onExpandNode.
>>>
>>>  There may be a way to limit event propagation up the hierarchy that I don't
>>> understand, but what I've done is added an explicit binding for this event
>>> (and the wx.EVT_TREE_ITEM_COLLAPSED event too) in the selection tree class.
>>> This calls a dummy handler in that class. Hopefully, this will keep the item
>>> expand event in the class where it belongs. If we can fix this, it may be
>>> possible to put the selection tree inside a different kind of widget if that
>>> is desirable. Please uncomment line #131 in select and try it out. Let me
>>> know what happens.
>>>
>>>  Michael
>>>  __________________________________________
>>>  Michael Barton, Professor of Anthropology
>>>  School of Human Evolution & Social Change
>>>  Center for Social Dynamics & Complexity
>>>  Arizona State University
>>>
>>>  phone: 480-965-6213
>>>  fax: 480-965-7671
>>>  www: http://www.public.asu.edu/~cmbarton
>>>
>>>
>>
>>
>> --
>> Jachym Cepicky
>> e-mail: jachym.cepicky gmail com
>> URL: http://les-ejk.cz
>> GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
>>
>

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton



_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: fix for select control?

Michael Barton
In reply to this post by Jachym Cepicky
I've added the other handlers. See how it works now with the line
uncommented.

Michael


On 4/10/07 5:56 AM, "Jachym Cepicky" <[hidden email]> wrote:

> hi,
> I tested it and it seems to be working for vector modules only, not for
> rasters.
>
> When I try to add second (raster) layer, I get:
>
> Traceback (most recent call last):
>   File
> "/hardmnt/moll0/ssi/cepicky/src/gis/grass/grass6/dist.x86_64-unknown-linux-gnu
> /etc/wx/wxgui.py",
> line 492, in addRaster
>     self.SetTree('raster')
>   File
> "/hardmnt/moll0/ssi/cepicky/src/gis/grass/grass6/dist.x86_64-unknown-linux-gnu
> /etc/wx/wxgui.py",
> line 544, in SetTree
>     self.maptree.AddLayer(disp_idx, layertype)
>   File
> "/hardmnt/moll0/ssi/cepicky/src/gis/grass/grass6/dist.x86_64-unknown-linux-gnu
> /etc/wx/gui_modules/wxgui_utils.py",
> line 160, in AddLayer
>     if (self.layer_selected and self.layer_selected != self.GetRootItem() and
> \
>   File
> "/usr/lib64/python2.3/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py",
> line 4996, in __ne__
>     return _controls_.TreeItemId___ne__(*args, **kwargs)
> TypeError: in method 'TreeItemId___ne__', expected argument 2 of type
> 'wxTreeItemId const *'
>
> j
>
> 2007/4/10, Jachym Cepicky <[hidden email]>:
>> ok, thanks for it, I'll look at it
>> j
>>
>> 2007/4/10, Michael Barton <[hidden email]>:
>>>
>>>  Jáchym,
>>>
>>>  I sort of understand what is happening to cause the bug you encountered
>>> with the select.Select control. When the mapset group item in the selection
>>> tree is expanded, it generates a wx.EVT_TREE_ITEM_EXPANDING event. This gets
>>> propagated up through the hierarchy or controls to the grandparent object,
>>> the GIS Manager layer tree, where it is handled by the
>>> wx.EVT_TREE_ITEM_EXPANDING handler method onExpandNode.
>>>
>>>  There may be a way to limit event propagation up the hierarchy that I don't
>>> understand, but what I've done is added an explicit binding for this event
>>> (and the wx.EVT_TREE_ITEM_COLLAPSED event too) in the selection tree class.
>>> This calls a dummy handler in that class. Hopefully, this will keep the item
>>> expand event in the class where it belongs. If we can fix this, it may be
>>> possible to put the selection tree inside a different kind of widget if that
>>> is desirable. Please uncomment line #131 in select and try it out. Let me
>>> know what happens.
>>>
>>>  Michael
>>>  __________________________________________
>>>  Michael Barton, Professor of Anthropology
>>>  School of Human Evolution & Social Change
>>>  Center for Social Dynamics & Complexity
>>>  Arizona State University
>>>
>>>  phone: 480-965-6213
>>>  fax: 480-965-7671
>>>  www: http://www.public.asu.edu/~cmbarton
>>>
>>>
>>
>>
>> --
>> Jachym Cepicky
>> e-mail: jachym.cepicky gmail com
>> URL: http://les-ejk.cz
>> GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
>>
>

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton



_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui