[GRASS-dev] how to start wx vdigit?

I'm testing a possible solution to compiling the wx vdigit on OSX, but I can't figure out how to start it.

In the wx gui, Vector->Develop vector map->Digitize vector map runs the TclTk v.digit, not the wxpython digitizer. I have my vdigit test built and it looks like it's installed (etc/wxpython/vdigit/_grass6_wxvdigit.so and grass6_wxvdigit.py). I don't see anything in bin/ or scripts/ that looks like it might run vdigit.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"I ache, therefore I am. Or in my case - I am, therefore I ache."

- Marvin

Hi,

there currently two ways

1) add vector map layer into the layer tree, right click and from
contextual menu choose 'Start editing'

2) select in Map display window toolbar 'Digitize' (the last tool in
the toolbar), then from enabled vdigit toolbar choose vector map layer
you want to edit (this map must be present the current layer tree). I
remember there was bug on Mac connected to wxComboBox inside wxToolbar
instance. So maybe you cannot see these comboboxes in the toolbars.
Then first way should work for you.

Martin

2008/3/9, William Kyngesburye <woklist@kyngchaos.com>:

I'm testing a possible solution to compiling the wx vdigit on OSX, but
I can't figure out how to start it.

In the wx gui, Vector->Develop vector map->Digitize vector map runs
the TclTk v.digit, not the wxpython digitizer. I have my vdigit test
built and it looks like it's installed (etc/wxpython/vdigit/
_grass6_wxvdigit.so and grass6_wxvdigit.py). I don't see anything in
bin/ or scripts/ that looks like it might run vdigit.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"I ache, therefore I am. Or in my case - I am, therefore I ache."

- Marvin

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

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

OK, here's what I got:

I wanted to start with an empty vector map, so I tried to create one from the GUI. Error in console:

Traceback (most recent call last):
   File "/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/wxgui.py", line 433, in OnMenuCmd
     menuform.GUI().ParseCommand(cmd, parentframe=self)
   File "/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/gui_modules/menuform.py", line 1390, in ParseCommand
     get_dcmd=get_dcmd, layer=layer)
   File "/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/gui_modules/menuform.py", line 608, in __init__
     mainFrame=self)
   File "/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/gui_modules/menuform.py", line 1050, in __init__
     txt3.SetValue(p['value']) # parameter previously set
   File "/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode/wx/_controls.py", line 2249, in SetValue
TypeError: in method 'SpinCtrl_SetValue', expected argument 2 of type 'int'

So I used v.edit from the Terminal to create one.

Now, added to the GUI display list, right-click (yes, the toolbar combo box is not there), start editing, and I get a dialog:

"
Unable to initialize display driver, see README file for more info.

Details: 'NoneType' object has no attribute 'OpenMap' (dynamic module does not define init function (init_grass6_wxvdigit))
"

It looks like the vdigit toolbar appears, and stays up, but the display list contextual menu still says "start editing" (stop is disabled), so it's probably not fully initialized, as the error says.

I'm not sure if this is from the way I setup my test build or something else.

Here is what I did to get it compiled: since _gdi_.so is technically an extension to [wx]Python, I figure that it should get loaded (maybe automatically?) by wxPython. So instead of directly linking it into vdigit, I used an OSX linker flag "-undefined dynamic_lookup" to tell the linker that the gdi.so symbols will be found at runtime.

But, I'm not sure it gdi is guaranteed to be loaded. Maybe it needs something in the vdigit code to trigger loading the extension, equivalent to import in Python code? Or maybe import it in grass6_wxvdigit.py, before importing _grass6_wxvdigit.so?

On Mar 9, 2008, at 1:26 PM, Martin Landa wrote:

Hi,

there currently two ways

1) add vector map layer into the layer tree, right click and from
contextual menu choose 'Start editing'

2) select in Map display window toolbar 'Digitize' (the last tool in
the toolbar), then from enabled vdigit toolbar choose vector map layer
you want to edit (this map must be present the current layer tree). I
remember there was bug on Mac connected to wxComboBox inside wxToolbar
instance. So maybe you cannot see these comboboxes in the toolbars.
Then first way should work for you.

Martin

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Time is an illusion - lunchtime doubly so."

- Ford Prefect

Hi,

2008/3/9, William Kyngesburye <woklist@kyngchaos.com>:

I wanted to start with an empty vector map, so I tried to create one
from the GUI. Error in console:

Traceback (most recent call last):
   File "/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/
wxgui.py", line 433, in OnMenuCmd
     menuform.GUI().ParseCommand(cmd, parentframe=self)
   File "/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/
gui_modules/menuform.py", line 1390, in ParseCommand
     get_dcmd=get_dcmd, layer=layer)
   File "/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/
gui_modules/menuform.py", line 608, in __init__
     mainFrame=self)
   File "/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/
gui_modules/menuform.py", line 1050, in __init__
     txt3.SetValue(p['value']) # parameter previously set
   File "/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/
Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-
unicode/wx/_controls.py", line 2249, in SetValue
TypeError: in method 'SpinCtrl_SetValue', expected argument 2 of type
'int'

Now fixed in trunk, http://trac.osgeo.org/grass/changeset/30510

Now, added to the GUI display list, right-click (yes, the toolbar
combo box is not there), start editing, and I get a dialog:

"
Unable to initialize display driver, see README file for more info.

Details: 'NoneType' object has no attribute 'OpenMap' (dynamic module
does not define init function (init_grass6_wxvdigit))
"

important is the last part of the message which comes when you try to
import grass6_wxvdigit Python module .

Try:

cd gui/wxpython/vdigit
python
import grass6_wxvdigit

you will get this error

It looks like the vdigit toolbar appears, and stays up, but the
display list contextual menu still says "start editing" (stop is
disabled), so it's probably not fully initialized, as the error says.

The problem is loading python module itself.

I'm not sure if this is from the way I setup my test build or
something else.

Here is what I did to get it compiled: since _gdi_.so is technically
an extension to [wx]Python, I figure that it should get loaded (maybe
automatically?) by wxPython. So instead of directly linking it into
vdigit, I used an OSX linker flag "-undefined dynamic_lookup" to tell
the linker that the gdi.so symbols will be found at runtime.

Hm, the last days I have not so much time to work on this, the way you
suggest maybe could solve it.

But, I'm not sure it gdi is guaranteed to be loaded. Maybe it needs
something in the vdigit code to trigger loading the extension,
equivalent to import in Python code? Or maybe import it in
grass6_wxvdigit.py, before importing _grass6_wxvdigit.so?

Martin

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

On Mar 9, 2008, at 2:43 PM, Martin Landa wrote:

Now fixed in trunk, http://trac.osgeo.org/grass/changeset/30510

Yep, works now.

important is the last part of the message which comes when you try to
import grass6_wxvdigit Python module .

Try:

cd gui/wxpython/vdigit
python
import grass6_wxvdigit

you will get this error

So is there a bug in grass6_wxvdigit.py?

I'm not sure if this is from the way I setup my test build or
something else.

Here is what I did to get it compiled: since _gdi_.so is technically
an extension to [wx]Python, I figure that it should get loaded (maybe
automatically?) by wxPython. So instead of directly linking it into
vdigit, I used an OSX linker flag "-undefined dynamic_lookup" to tell
the linker that the gdi.so symbols will be found at runtime.

Hm, the last days I have not so much time to work on this, the way you
suggest maybe could solve it.

I'm guessing "import wx" should import _gdi and load _gdi_.so, since _core imports _gdi. Didn't help with the init_grass6_wxvdigit error.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Those people who most want to rule people are, ipso-facto, those least suited to do it."

- A rule of the universe, from the HitchHiker's Guide to the Galaxy

Oops, forgot the -shared flag in the vdigit makefile. It ended up linking as a program. See: http://trac.osgeo.org/grass/ticket/61

Changed the shared flag to something appropriate for OSX, and I didn't need to add the "import wx" to grass6_wxvdigit.py.

I successfully digitized a boundary. Lots of messages in the Terminal - failed assertions and context errors.

I'll add to http://trac.osgeo.org/grass/ticket/58 with my results.

On Mar 9, 2008, at 3:18 PM, William Kyngesburye wrote:

important is the last part of the message which comes when you try to
import grass6_wxvdigit Python module .

Try:

cd gui/wxpython/vdigit
python
import grass6_wxvdigit

you will get this error

So is there a bug in grass6_wxvdigit.py?

I'm not sure if this is from the way I setup my test build or
something else.

Here is what I did to get it compiled: since _gdi_.so is technically
an extension to [wx]Python, I figure that it should get loaded (maybe
automatically?) by wxPython. So instead of directly linking it into
vdigit, I used an OSX linker flag "-undefined dynamic_lookup" to tell
the linker that the gdi.so symbols will be found at runtime.

Hm, the last days I have not so much time to work on this, the way you
suggest maybe could solve it.

I'm guessing "import wx" should import _gdi and load _gdi_.so, since _core imports _gdi. Didn't help with the init_grass6_wxvdigit error.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"History is an illusion caused by the passage of time, and time is an illusion caused by the passage of history."

- Hitchhiker's Guide to the Galaxy

Hi William,

2008/3/9, William Kyngesburye <woklist@kyngchaos.com>:
[snip]

>> Here is what I did to get it compiled: since _gdi_.so is technically
>> an extension to [wx]Python, I figure that it should get loaded (maybe
>> automatically?) by wxPython. So instead of directly linking it into
>> vdigit, I used an OSX linker flag "-undefined dynamic_lookup" to tell
>> the linker that the gdi.so symbols will be found at runtime.
>
> Hm, the last days I have not so much time to work on this, the way you
> suggest maybe could solve it.
I'm guessing "import wx" should import _gdi and load _gdi_.so, since
_core imports _gdi. Didn't help with the init_grass6_wxvdigit error.

yes, it should work, I have tried few days ago but I always get error
something like

grass6_wxvdigit.so: undefined symbol: _ZN10wxPseudoDC9AddToListEP5pdcOp

Can you send me your Mac-related Makefile for inspiration?

Thanks, Martin

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

I put bits of what I did in:

http://trac.osgeo.org/grass/ticket/58

http://trac.osgeo.org/grass/ticket/61

On Mar 10, 2008, at 6:59 AM, Martin Landa wrote:

Hi William,

I'm guessing "import wx" should import _gdi and load _gdi_.so, since
_core imports _gdi. Didn't help with the init_grass6_wxvdigit error.

yes, it should work, I have tried few days ago but I always get error
something like

grass6_wxvdigit.so: undefined symbol: _ZN10wxPseudoDC9AddToListEP5pdcOp

Can you send me your Mac-related Makefile for inspiration?

Thanks, Martin

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

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Those people who most want to rule people are, ipso-facto, those least suited to do it."

- A rule of the universe, from the HitchHiker's Guide to the Galaxy