Opened 14 years ago

Closed 8 years ago

#965 closed defect (wontfix)

Location wizard: doesn't create MYNAME

Reported by: hamish Owned by: martinl
Priority: normal Milestone: 7.0.5
Component: wxGUI Version: svn-releasebranch64
Keywords: location wizard Cc: grass-dev@…
CPU: All Platform: All

Description

Hi,

the wx new location wizard doesn't prompt the user to

Please enter a one line description for this location:

like the old lib/init/mke_loc.c does. So the PERMANENT/MYNAME file is never created and so e.g. ps.map gets (gracefully) upset that it's missing.

(G_myname() in lib/gis/myname.c)

Hamish

Change History (13)

comment:1 by martinl, 13 years ago

Cc: grass-dev@… added
Milestone: 6.4.06.4.1
Owner: changed from grass-dev@… to martinl
Status: newassigned

Please try out r44616

comment:2 by martinl, 13 years ago

Resolution: fixed
Status: assignedclosed

Please reopen the ticket if needed.

comment:3 by hamish, 13 years ago

Resolution: fixed
Status: closedreopened

thanks, placement in the location wizard looks nice.

Trying it out in 6.5svn I get the following error when I click on 'Finish':

$ grass65 -gui
Cleaning up temporary files ...
Starting GRASS ...
Traceback (most recent call last):
  File "/usr/local/src/grass/grass65/dist.i686-pc-linux-gnu/etc/wxpython/gis_set.py", line 411, in OnWizard
    grassdatabase = self.tgisdbase.GetValue())
  File "/usr/local/src/grass/grass65/dist.i686-pc-linux-gnu/etc/wxpython/gui_modules/location_wizard.py", line 1794, in __init__
    msg = self.OnWizFinished()
  File "/usr/local/src/grass/grass65/dist.i686-pc-linux-gnu/etc/wxpython/gui_modules/location_wizard.py", line 1986, in OnWizFinished
    desc = self.startpage.description)
TypeError: create_location() got an unexpected keyword argument 'desc'

? and the location is not created.

also, the MYNAME description should be limited to a single line, so any \n in the desc text should be replaced by a space. (if that's not already being done) [G_myname() reads & returns a single G_getl()]

cheers, Hamish

comment:4 by hamish, 13 years ago

perhaps wrongly applied, but G_myname() is using GNAME_MAX for the max length (256 chars in gis.h) of the description. So besides having the newlines removed it should be cut at char 255-1 for the null terminator(?). (or better: can python access the #defined values in the C include files directly as swig could?)

Hamish

in reply to:  3 comment:5 by martinl, 13 years ago

Replying to hamish:

> $ grass65 -gui
> Cleaning up temporary files ...
> Starting GRASS ...
> Traceback (most recent call last):
>   File "/usr/local/src/grass/grass65/dist.i686-pc-linux-gnu/etc/wxpython/gis_set.py", line 411, in OnWizard
>     grassdatabase = self.tgisdbase.GetValue())
>   File "/usr/local/src/grass/grass65/dist.i686-pc-linux-gnu/etc/wxpython/gui_modules/location_wizard.py", line 1794, in __init__
>     msg = self.OnWizFinished()
>   File "/usr/local/src/grass/grass65/dist.i686-pc-linux-gnu/etc/wxpython/gui_modules/location_wizard.py", line 1986, in OnWizFinished
>     desc = self.startpage.description)
> TypeError: create_location() got an unexpected keyword argument 'desc'

? and the location is not created.

your pythonlib is probably out-dated. Please run svn up & make in lib/python.

in reply to:  4 comment:6 by martinl, 13 years ago

Replying to hamish:

perhaps wrongly applied, but G_myname() is using GNAME_MAX for the max length (256 chars in gis.h) of the description. So besides having the newlines removed it should be cut at char 255-1 for the null terminator(?). (or better: can python access the #defined values in the C include files directly as swig could?)

question: why need to be description of the location only one-line text and moreover limited to the given number of chars. I guess that this limitation broken in GRASS7.

in reply to:  4 ; comment:7 by martinl, 13 years ago

Replying to hamish:

perhaps wrongly applied, but G_myname() is using GNAME_MAX for the max length (256 chars in gis.h) of the description.

yes, GNAME_MAX could be replaced by GPATH_MAX (or new GTITLE_MAX) to enlarge the buffer.

So besides having the newlines removed it should be cut at char 255-1 for the null terminator(?).

see changes in location wizard r44754

Or better: can python access the #defined values in the C include files directly as swig could?

Could be accessed using ctypes. Currently wxGUI is not using ctypes (except of 3D view mode).

comment:8 by hamish, 13 years ago

Hamish:

TypeError: create_location() got an unexpected keyword argument 'desc'

Martin:

your pythonlib is probably out-dated. Please run svn up & make in lib/python.

yes, that was it. works now.

I suggest to add a tooltip to the "Location title:" in the loc wiz to clarify that the title is descriptive text and another to the "Project location:" to clarify that that one is the real name that it will go by. It seems like it could get confused.

question: why need to be description of the location only one-line text

for grass 6 this is part of the specification for LOCATION file tree and should not be changed. at the low level G_myname() only reads 1 line of text for the location title.

and moreover limited to the given number of chars.

simply a function of the buffer size used in G_myname()

I guess that this limitation broken in GRASS7.

yes, but anything that uses G_myname() would have to be changed too. Currently it is the 1 line title of the location, not full metadata story about it. So it is used for example as the long map title in ps.map if you ask for an automatic header.

moreover the entire metadata system for grass7 needs to be overhauled, and this is one part of that.

perhaps wrongly applied, but G_myname() is using GNAME_MAX for the max length (256 chars in gis.h) of the description.

yes, GNAME_MAX could be replaced by GPATH_MAX (or new GTITLE_MAX) to enlarge the buffer.

what I meant was that GNAME_MAX is meant for map names, not arbitrary strings of text. If random things are using it which shouldn't be, we get afraid to change it later even if the change is safe for the intended map names. GPATH_MAX is abusing it even more, the loc title has nothing to do with filesystem limits. For a single line description I think 256 chars is appropriate, just not to hijack defined constants meant for another purpose. RECORD_LEN would actually be more appropriate, but for grass 6 that's stuck at 80 chars. meh, so I guess just leave this as-is.

thanks, Hamish

in reply to:  7 comment:9 by glynn, 13 years ago

Replying to martinl:

Or better: can python access the #defined values in the C include files directly as swig could?

Could be accessed using ctypes. Currently wxGUI is not using ctypes (except of 3D view mode).

They don't exist in the library, so you can't access them directly via ctypes in the same way as variables (i.e. ctypes.CDLL("libgrass_gis.so").GNAME_MAX won't work). However, ctypesgen includes preprocessor macros in the generated files, so they are present in the grass.lib.*.py modules.

Even so, simply importing grass.lib.* will load the corresponding dynamic library, which may kill the importing process if there are any problems (e.g. architecture or version mismatches), so I wouldn't recommend it.

comment:10 by martinl, 12 years ago

Milestone: 6.4.17.0.0

comment:11 by cmbarton, 12 years ago

Shouldn't this be happening in g.proj? This is what is making the location. The location wizard is only a wrapper around g.proj.

Michael

comment:12 by martinl, 8 years ago

Milestone: 7.0.07.0.5

comment:13 by martinl, 8 years ago

Resolution: wontfix
Status: reopenedclosed

Last comment is 4 years old, closing, feel free to reopen if needed.

Note: See TracTickets for help on using tickets.