[GRASS-dev] [GRASS GIS] #2080: wxGUI: changing properties of barscale or legend

#2080: wxGUI: changing properties of barscale or legend
-------------------------+--------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: unspecified
Keywords: decorations | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Hi,

when changing properties of barscale or legend you need to go through two
dialogs. The first dialog allows to disable/enable decoration and launch
properties (autogenerated) dialog. Here 'Apply' button has no effect, so
you cannot see immediately the change. You close the properties dialog and
then the first dialog. After these steps decoration is re-rendered.

My suggestion is to avoid the first dialog. Clicking on decoration would
launch properties dialog immediately. Right click shows contextual menu
with one item 'Hide'. To show decoration you would go to the toolbar and
to add selected decoration again. Or global contextual menu (which has
currently only one item 'Copy to clipboard..') could have item to
'Show/hide barscale', 'Show/hide legend', ...

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-------------------------+--------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: unspecified
Keywords: decorations | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mlennert):

Replying to [ticket:2080 martinl]:
> Hi,
>
> when changing properties of barscale or legend you need to go through
two dialogs. The first dialog allows to disable/enable decoration and
launch properties (autogenerated) dialog. Here 'Apply' button has no
effect, so you cannot see immediately the change. You close the properties
dialog and then the first dialog. After these steps decoration is re-
rendered.
>
> My suggestion is to avoid the first dialog. Clicking on decoration would
launch properties dialog immediately. Right click shows contextual menu
with one item 'Hide'. To show decoration you would go to the toolbar and
to add selected decoration again.

+1

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2080#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-----------------------------------------------+----------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: unspecified
Keywords: decorations, d.barscale, d.legend | Platform: All
      Cpu: All |
-----------------------------------------------+----------------------------
Changes (by hamish):

  * keywords: decorations => decorations, d.barscale, d.legend
  * platform: Unspecified => All
  * cpu: Unspecified => All

Comment:

martinl:
> Right click shows contextual menu with one item 'Hide'.

how would you make that "discoverable" for new users without them having
to read the docs in frustration to find out how to do it? perhaps clicking
the barscale/legend icons in the top bar could present a drop down menu?
(?) [afair the reason that Macs only have one mouse button was to force
the programmers to come up with intuitive solutions]

I can't find a ticket for it right now in a search, but the other big
issue with the GUI legends and barscales is the full-window "glass pane"
slide. If you grab on one side of the decoration it works, on the other
side it doesn't. the solution seems to be to render the graphic at=50,50,
then crop away to ~15 pixels around the outer extent of the graphics so
grabbing the top-"glass pane" will move the decoration you expect, not the
one who's "glass pane" happens to be on top. ..or find some other method
to overlay them on the map canvas.

Another issue with the current method is that the north arrows (which
should probably be presented separate to the barscales in the GUI (perhaps
using wrapper scripts?) tend to get clipped off the edge of the
transparent background layer they are rendered on when using the default
placement. Otherwise I would have liked to swap the default GUI
legend/barscale placement top-bottom.

thanks,
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-----------------------------------------------+----------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: unspecified
Keywords: decorations, d.barscale, d.legend | Platform: All
      Cpu: All |
-----------------------------------------------+----------------------------

Comment(by annakrat):

Replying to [ticket:2080 martinl]:
> My suggestion is to avoid the first dialog. Clicking on decoration would
launch properties dialog immediately. Right click shows contextual menu
with one item 'Hide'. To show decoration you would go to the toolbar and
to add selected decoration again. Or global contextual menu (which has
currently only one item 'Copy to clipboard..') could have item to
'Show/hide barscale', 'Show/hide legend', ...

This sounds good to me. Right click is intuitive enough for me but usually
the functionality is also accessible in another way (and now I have no
idea how).

Replying to [comment:2 hamish]:
>
> I can't find a ticket for it right now in a search, but the other big
issue with the GUI legends and barscales is the full-window "glass pane"
slide. If you grab on one side of the decoration it works, on the other
side it doesn't. the solution seems to be to render the graphic at=50,50,
then crop away to ~15 pixels around the outer extent of the graphics so
grabbing the top-"glass pane" will move the decoration you expect, not the
one who's "glass pane" happens to be on top. ..or find some other method
to overlay them on the map canvas.

Actually, I found a solution for it recently but I haven't implemented it
yet. PIL can trim the image automatically:

{{{
     imageBox = pilImage.getbbox()
     cropped = pilImage.crop(imageBox)
}}}

so you just have to convert it to PIL (or load it directly from file) and
back to wx. And place the legend or barscale on a reasonable place (not
just 0, 0).

>
> Another issue with the current method is that the north arrows (which
should probably be presented separate to the barscales in the GUI (perhaps
using wrapper scripts?) tend to get clipped off the edge of the
transparent background layer they are rendered on when using the default
placement. Otherwise I would have liked to swap the default GUI
legend/barscale placement top-bottom.

wrapper script seems to be a good idea

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-----------------------------------------------+----------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: unspecified
Keywords: decorations, d.barscale, d.legend | Platform: All
      Cpu: All |
-----------------------------------------------+----------------------------

Comment(by martinl):

Replying to [comment:3 annakrat]:

[...]

> > Another issue with the current method is that the north arrows (which
should probably be presented separate to the barscales in the GUI (perhaps
using wrapper scripts?) tend to get clipped off the edge of the
transparent background layer they are rendered on when using the default
placement. Otherwise I would have liked to swap the default GUI
legend/barscale placement top-bottom.
>
> wrapper script seems to be a good idea

currently you can add barscale or north arrow, but not both. Moreover
north arrow is not rendered well, better to say only right-side of the
north arrow is rendered (because default `x=0,95`).

Instead of making wrapper for adding north arrow (it will also require to
hide north arrow related options when adding barscale in wxGUI) what about
splitting this functionality into two separate modules, ie. `d.barscale`
and `d.northarrow`?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-----------------------------------------------+----------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: unspecified
Keywords: decorations, d.barscale, d.legend | Platform: All
      Cpu: All |
-----------------------------------------------+----------------------------

Comment(by annakrat):

Replying to [comment:4 martinl]:
> Replying to [comment:3 annakrat]:
>
> [...]
>
> > > Another issue with the current method is that the north arrows
(which should probably be presented separate to the barscales in the GUI
(perhaps using wrapper scripts?) tend to get clipped off the edge of the
transparent background layer they are rendered on when using the default
placement. Otherwise I would have liked to swap the default GUI
legend/barscale placement top-bottom.
> >
> > wrapper script seems to be a good idea
>
> currently you can add barscale or north arrow, but not both. Moreover
north arrow is not rendered well, better to say only right-side of the
north arrow is rendered (because default `x=0,95`).
>
> Instead of making wrapper for adding north arrow (it will also require
to hide north arrow related options when adding barscale in wxGUI) what
about splitting this functionality into two separate modules, ie.
`d.barscale` and `d.northarrow`?

I completely agree. I just thought there is some reason that it's one
module.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-----------------------------------------------+----------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: unspecified
Keywords: decorations, d.barscale, d.legend | Platform: All
      Cpu: All |
-----------------------------------------------+----------------------------

Comment(by martinl):

Replying to [comment:2 hamish]:
> martinl:
> > Right click shows contextual menu with one item 'Hide'.
>
> how would you make that "discoverable" for new users without them having
to read the docs in frustration to find out how to do it? perhaps clicking
the barscale/legend icons in the top bar could present a drop down menu?
(?) [afair the reason that Macs only have one mouse button was to force
the programmers to come up with intuitive solutions]

hm, the most of applications which I use behave similarly. When I want to
delete or change properties of selected object eg. in `Dia` I go to the
contextual menu (open by right click on the object). So I usually expect
this behaviour without reading any documentation and having any
"frustration".

I do not claim that my suggestion is perfect. Please suggest another. My
motivation is to avoid extra dialog as we have now. It's just annoying
when you want to change style of selected decoration, you need to go
through two dialogs. Moreover "Apply" button doesn't behave in the sense
which could be expected by the user. Current situation is not good, let's
find better.

Ideally the functionality to hide/show decoration could be accessible in
different ways. Eg. in contextual menu (object-related) and check menu
item in toolbar (it will introduce limitation, you will be able to add
only one decoration of given type). The question is if we want to allow
the user to add multiple barscales, northarrows or legends.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-------------------------------------------------------------+--------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: decorations, d.barscale, d.legend, d.northarrow | Platform: All
      Cpu: All |
-------------------------------------------------------------+--------------
Changes (by hamish):

  * keywords: decorations, d.barscale, d.legend => decorations,
               d.barscale, d.legend, d.northarrow
  * version: unspecified => svn-trunk

Comment:

annakrat:
> Right click is intuitive enough for me but usually the functionality
> is also accessible in another way (and now I have no idea how).

Yes, I don't mind at all if right click opens a context menu, it could
be a nice time-saver, but I think it should be available in another way
too. IIUC the idea is to right-click on the menubar icon? If so I don't
think that's something I would ever try if not told about it, but maybe
I should try that more & there's a world of functionality I've never
discovered.

but maybe I don't understand the suggestion, ie what's being right-
clicked?

an idea for a single barscale or north arrow would be to keep the menu-
bar icon depressed when active as a push-button, and clicking to raise
it again would turn it off. Like how a bold or italics button works in a
word processor. the help page could instruct to use command layers to add
a second legend for the rare times people would like to do that.

so single click on the menubar icon calls the d.* module with --ui, then
when the user presses ok the decoration is drawn on the monitor, and
the menubar icon remains depressed. right clicking on the depressed icon
would get you back to the module --ui (if command line options were
remembered you can do full command line + '--ui' to get pre-seeded menus
using the recently-used option settings; or at least that works in G6).
left clicking on the depressed menubar icon removes it from the display
and raises the button again.

second legends, barscales, and north arrows could be added as command
layers with an mini-tutorial in the help pages on how to do that.

what do you think? could the at= option survive for the second entry into
the module UI? (e.g. if you like the placement but want to change the
color when the backdrop raster is replaced by one of similar hue to the
symbol)

>> "glass pane" slide.
>
> Actually, I found a solution for it recently but I haven't implemented
> it yet. PIL can trim the image automatically:
{{{
> imageBox = pilImage.getbbox()
> cropped = pilImage.crop(imageBox)
}}}
> so you just have to convert it to PIL (or load it directly from file)
> and back to wx. And place the legend or barscale on a reasonable place
> (not just 0, 0).

that is excellent news, thanks. (you mentioned it before and I forgot? :slight_smile:

martinl:
> Instead of making wrapper for adding north arrow (it will also require
> to hide north arrow related options when adding barscale in wxGUI) what
> about splitting this functionality into two separate modules,
> ie. d.barscale and d.northarrow?

sure, done.

annakrat:
> I completely agree. I just thought there is some reason that it's one
module.

barscale and north arrows were in one module simply because they shared
many
of the same placement, color, & text options and it saved some time to
only
maintain the code once. but it makes sense to split them out, the
background/fill
color had problems trying to be two things at once anyway.

martinl:
> (it will introduce limitation, you will be able to add only one
> decoration of given type). The question is if we want to allow the
> user to add multiple barscales, northarrows or legends.

multiple barscales can be useful for showing both miles and km, and of
course allowing both a barscale and a northarrow at the same time is
desirable.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-------------------------------------------------------------+--------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: decorations, d.barscale, d.legend, d.northarrow | Platform: All
      Cpu: All |
-------------------------------------------------------------+--------------

Comment(by hamish):

ps- D_line_width() seems broken, also for d.vect. Setting it has no
effect.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-------------------------------------------------------------+--------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: decorations, d.barscale, d.legend, d.northarrow | Platform: All
      Cpu: All |
-------------------------------------------------------------+--------------

Comment(by annakrat):

Replying to [comment:7 hamish]:
> but maybe I don't understand the suggestion, ie what's being right-
clicked?
>

Right click on the decoration itself, like now double-click opens the
dialog.

Thanks for the splitting of the module, I will try to have a look at the
GUI today or in the next days.

Anna

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-------------------------------------------------------------+--------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: decorations, d.barscale, d.legend, d.northarrow | Platform: All
      Cpu: All |
-------------------------------------------------------------+--------------

Comment(by annakrat):

Please test r57738 if it is acceptable for you or you have any better
suggestions.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-------------------------------------------------------------+--------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: decorations, d.barscale, d.legend, d.northarrow | Platform: All
      Cpu: All |
-------------------------------------------------------------+--------------

Comment(by martinl):

Replying to [comment:10 annakrat]:
> Please test r57738 if it is acceptable for you or you have any better
suggestions.

much much more better! There is only one limitation - you cannot add
multiple barscales, legends, or northarrows, right?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:11&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-------------------------------------------------------------+--------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: decorations, d.barscale, d.legend, d.northarrow | Platform: All
      Cpu: All |
-------------------------------------------------------------+--------------

Comment(by annakrat):

Replying to [comment:11 martinl]:
> Replying to [comment:10 annakrat]:
> > Please test r57738 if it is acceptable for you or you have any better
suggestions.
>
> much much more better! There is only one limitation - you cannot add
multiple barscales, legends, or northarrows, right?

Yes, but this limitation was there even before. The workaround is to add
the command layer which then behaves little differently (no moving
around). But I guess this is not the common requirement.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:12&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
-------------------------------------------------------------+--------------
Reporter: martinl | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: decorations, d.barscale, d.legend, d.northarrow | Platform: All
      Cpu: All |
-------------------------------------------------------------+--------------

Comment(by martinl):

Replying to [comment:12 annakrat]:
> > much much more better! There is only one limitation - you cannot add
multiple barscales, legends, or northarrows, right?
>
> Yes, but this limitation was there even before. The workaround is to add
the command layer which then behaves little differently (no moving
around). But I guess this is not the common requirement.

right, the correct sentence is "There is *still* one limitation".

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2080#comment:13&gt;
GRASS GIS <http://grass.osgeo.org>

#2080: wxGUI: changing properties of barscale or legend
--------------------------+-------------------------------------------------
  Reporter: martinl | Owner: grass-dev@…
      Type: enhancement | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: decorations, d.barscale, d.legend, d.northarrow
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Changes (by wenzeslaus):

  * status: new => closed
  * resolution: => fixed

Comment:

Replying to [comment:13 martinl]:
> Replying to [comment:12 annakrat]:
> > > much much more better! There is only one limitation - you cannot add
multiple barscales, legends, or northarrows, right?
> >
> > Yes, but this limitation was there even before. The workaround is to
add the command layer which then behaves little differently (no moving
around). But I guess this is not the common requirement.
>
> right, the correct sentence is "There is *still* one limitation".

Original issue is solved. Closing.

Please, open a new enhancement ticket if you want track this limitation.

See also
[wiki:GSoC/2015#CompletebasiccartographysuiteinGRASSGISwxGUIMapDisplay
GSoC 2015] ideas page.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2080#comment:14&gt;
GRASS GIS <http://grass.osgeo.org>