[GRASS-dev] question on workspace file - wxGui

Hello!

I’d like to get information in python script whether:

  • if wxGUI running or not, and if yes:

  • the name of the current workspace file, if set (opened or saved) or clearly a “no” answer if not

A multi-OS solution is welcome (linux ps filtering for wxgui works but I need something cross-platform, GRASS internal if possible)

I tried to look in sources but spent to much time and I have no idea still.

Any help is welcome.

Best regards and thanks

Robert

On Mon, Jul 11, 2016 at 9:35 AM, Robert Kuszinger <kuszinger@giscom.hu> wrote:

Hello!

I'd like to get information in python script whether:

if wxGUI running or not, and if yes:

the only thing related to that was implemented for g.gui.* modules:
https://trac.osgeo.org/grass/changeset/67232

which passes grass interface object to the main function of the
script. But this needs to be run from the GUI.

the name of the current workspace file, if set (opened or saved) or clearly
a "no" answer if not

there is information if workspace is loaded and if it has been changed
since, but it's not easily accessible, that would have to be part of
the interface. May I ask you what's your use case?

A multi-OS solution is welcome (linux ps filtering for wxgui works but I
need something cross-platform, GRASS internal if possible)

I tried to look in sources but spent to much time and I have no idea still.

Any help is welcome.

Best regards and thanks

Robert

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

Anna,

thanks for the information.

Actually this is a “quick ‘n’ dirty cartography / print sheet generator”

made with the help of Vaclav in the past few weeks. It consumes workspace files for map compositions.

Presently runs on bitmap output of the cairo driver but I also dream about utf-8 postsctript

page assembly later on…

https://github.com/kuszinger/grass7/tree/master/display/d.cartosim

d.cartosim is the esperimental name, still looking for the final name of it, possibly

better in the m.* group.

My goal with workspace query would be to reach this with present nomenclature:

d.cartosim -q

-q is for quick mode where it would get the name of workspace file, if any and would

create a pdf file of A4 landscape 300dpi at the same location with the name of the workspace

file as a quick printable pdf. (current region would be used also for the visual snapshot)

I quite often need good resolution printout of my workspace (~ kind of visual map) compositions on paper

as some professors are still “offline” who I need to work with. Fast printed handouts are very useful and time saving.

Since it is for office printing, 300-600 dpi bitmap processing is enough, no need for professional postscript with stroke fonts.

So, workspace information would also be a time saver (yes, those seconds of selecting the very same workspace file with a file dialog).

Yes, I’m lazy.

best regards

Robert

···

2016-07-11 22:40 GMT+02:00 Anna Petrášová <kratochanna@gmail.com>:

On Mon, Jul 11, 2016 at 9:35 AM, Robert Kuszinger <kuszinger@giscom.hu> wrote:

Hello!

I’d like to get information in python script whether:

if wxGUI running or not, and if yes:

the only thing related to that was implemented for g.gui.* modules:
https://trac.osgeo.org/grass/changeset/67232

which passes grass interface object to the main function of the
script. But this needs to be run from the GUI.

the name of the current workspace file, if set (opened or saved) or clearly
a “no” answer if not

there is information if workspace is loaded and if it has been changed
since, but it’s not easily accessible, that would have to be part of
the interface. May I ask you what’s your use case?

A multi-OS solution is welcome (linux ps filtering for wxgui works but I
need something cross-platform, GRASS internal if possible)

I tried to look in sources but spent to much time and I have no idea still.

Any help is welcome.

Best regards and thanks

Robert


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

On Tue, Jul 12, 2016 at 1:03 AM, Robert Kuszinger <kuszinger@giscom.hu> wrote:

Anna,

thanks for the information.

Actually this is a "quick 'n' dirty cartography / print sheet generator"
made with the help of Vaclav in the past few weeks. It consumes workspace
files for map compositions.

Presently runs on bitmap output of the cairo driver but I also dream about
utf-8 postsctript
page assembly later on...

https://github.com/kuszinger/grass7/tree/master/display/d.cartosim

d.cartosim is the esperimental name, still looking for the final name of it,
possibly
better in the m.* group.

My goal with workspace query would be to reach this with present
nomenclature:

d.cartosim -q

-q is for quick mode where it would get the name of workspace file, if any
and would
create a pdf file of A4 landscape 300dpi at the same location with the name
of the workspace
file as a quick printable pdf. (current region would be used also for the
visual snapshot)

I quite often need good resolution printout of my workspace (~ kind of
visual map) compositions on paper
as some professors are still "offline" who I need to work with. Fast printed
handouts are very useful and time saving.
Since it is for office printing, 300-600 dpi bitmap processing is enough, no
need for professional postscript with stroke fonts.

So, workspace information would also be a time saver (yes, those seconds of
selecting the very same workspace file with a file dialog).
Yes, I'm lazy.

There could be a way to implement that, but I am not convinced it's
worth it. Basically, in the link I sent you, we wouldn't test for
scripts starting with g.gui*, but we could test also specifically for
the name of your module. Then once you get interface, you have access
to Layer Manager and its attribute workspaceFile. You can try to
implement it, but I would keep the workspace file as input for cases
when you don't run it from GUI. I guess I could commit the change into
GRASS once your module becomes more mature.

Best,

Anna

best regards
Robert

2016-07-11 22:40 GMT+02:00 Anna Petrášová <kratochanna@gmail.com>:

On Mon, Jul 11, 2016 at 9:35 AM, Robert Kuszinger <kuszinger@giscom.hu>
wrote:
> Hello!
>
> I'd like to get information in python script whether:
>
> if wxGUI running or not, and if yes:

the only thing related to that was implemented for g.gui.* modules:
https://trac.osgeo.org/grass/changeset/67232

which passes grass interface object to the main function of the
script. But this needs to be run from the GUI.

> the name of the current workspace file, if set (opened or saved) or
> clearly
> a "no" answer if not

there is information if workspace is loaded and if it has been changed
since, but it's not easily accessible, that would have to be part of
the interface. May I ask you what's your use case?

>
> A multi-OS solution is welcome (linux ps filtering for wxgui works but I
> need something cross-platform, GRASS internal if possible)
>
> I tried to look in sources but spent to much time and I have no idea
> still.
>
> Any help is welcome.
>
> Best regards and thanks
>
> Robert
>
>
>
>
> _______________________________________________
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev