Opened 13 years ago
Closed 13 years ago
#7552 closed enhancement (fixed)
combo item icon in template preset
Reported by: | kendzi | Owned by: | team |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Core | Version: | |
Keywords: | combo | Cc: |
Description (last modified by )
There is no way to define icon for combo items in template preset.
It should be possible to define icon for combo items. For example:
<combo key="roof:shape" text="Type" values="flat,gabled"> <comboItem icon="roofs/flat.png" /> <comboItem icon=”roofs/gabled.png” /> </combo>
Attachments (8)
Change History (37)
comment:1 by , 13 years ago
Summary: | combo item in template preset → combo item icon in template preset |
---|
comment:2 by , 13 years ago
Description: | modified (diff) |
---|
comment:3 by , 13 years ago
Description: | modified (diff) |
---|
by , 13 years ago
by , 13 years ago
Attachment: | 7552_alpha.patch added |
---|
comment:4 by , 13 years ago
Patch attached, not the ideal solution as it abuses <short_description>
without using a separate attribute (such as <short_description icon="">
). However, the latter requires some adoption in the preset parsing/handling.
<combo key="sac_scale" text="SAC Scale" values="hiking,mountain_hiking,demanding_mountain_hiking,alpine_hiking,demanding_alpine_hiking,difficult_alpine_hiking" default="" delete_if_empty="true" display_values="T1 - hiking trail,T2 - mountain hiking trail,T3 - difficult\, exposed hiking trail,T4 - difficult\, exposed\, steep alpine trail,T5 - difficult alpine trail with climbing,T6 - hazardous alpine trail with climbing"> <short_description>img:presets/path.png</short_description> <short_description>img:http://www.openstreetmap.org/assets/osm_logo-caccd6371f095ca973c373b8e2014896.png</short_description> <short_description>exposed sites may be secured with ropes or chains, possible need to use hands for balance. Partly exposed sites with fall hazard, scree, pathless jagged rocks</short_description> <short_description>sometimes need for hand use to get ahead. Terrain quite exposed, precarious grassy acclivities, jagged rocks, facile snow-free glaciers.</short_description> <short_description>single plainly climbing up to second grade. Exposed, demanding terrain, jagged rocks, few dangerous glacier and snow</short_description> <short_description>climbing up to second grade. Often very exposed, precarious jagged rocks, glacier with danger to slip and fall</short_description> </combo>
follow-up: 6 comment:5 by , 13 years ago
I try to test it by applying it to version from svn but variable short_descriptions is never set up.
You commited some change to XmlObjectParser.java but there are missing in this path and svn. More over there are missing in next commit on github.
I think it would be better if combo look more like this:
<combo key="key" text="text”> <comboItem value=”...” display_value=”...” icon="...">short description</comboItem> </combo>
follow-up: 7 comment:6 by , 13 years ago
Replying to kendzi:
You commited some change to XmlObjectParser.java but there are missing in this path and svn. More over there are missing in next commit on github.
Handling short_description
has been fixed in r5130.
I think it would be better if combo look more like this:
<combo key="key" text="text”> <comboItem value=”...” display_value=”...” icon="...">short description</comboItem> </combo>
To not break backward compatibility, I suggest:
<combo key="sac_scale" text="SAC Scale" values="hiking,mountain_hiking,demanding_mountain_hiking,alpine_hiking,demanding_alpine_hiking,difficult_alpine_hiking" default="" delete_if_empty="true" display_values="T1 - hiking trail,T2 - mountain hiking trail,T3 - difficult\, exposed hiking trail,T4 - difficult\, exposed\, steep alpine trail,T5 - difficult alpine trail with climbing,T6 - hazardous alpine trail with climbing"> <short_description icon="icon">text</short_description> <!-- ... --> </combo>
follow-up: 9 comment:7 by , 13 years ago
I think this r5135 commit broke short_description
again.
Replying to simon04:
Replying to kendzi:
You commited some change to XmlObjectParser.java but there are missing in this path and svn. More over there are missing in next commit on github.
Handling
short_description
has been fixed in r5130.
I think it would be better if combo look more like this:
<combo key="key" text="text”> <comboItem value=”...” display_value=”...” icon="...">short description</comboItem> </combo>To not break backward compatibility, I suggest:
<combo key="sac_scale" text="SAC Scale" values="hiking,mountain_hiking,demanding_mountain_hiking,alpine_hiking,demanding_alpine_hiking,difficult_alpine_hiking" default="" delete_if_empty="true" display_values="T1 - hiking trail,T2 - mountain hiking trail,T3 - difficult\, exposed hiking trail,T4 - difficult\, exposed\, steep alpine trail,T5 - difficult alpine trail with climbing,T6 - hazardous alpine trail with climbing"> <short_description icon="icon">text</short_description> <!-- ... --> </combo>
comment:8 by , 13 years ago
I would do
<combo key="sac_scale" text="SAC Scale" values="hiking,mountain_hiking,demanding_mountain_hiking,alpine_hiking,demanding_alpine_hiking,difficult_alpine_hiking" default="" icons="icon1.png,,,icon4.png,," delete_if_empty="true" display_values="T1 - hiking trail,T2 - mountain hiking trail,T3 - difficult\, exposed hiking trail,T4 - difficult\, exposed\, steep alpine trail,T5 - difficult alpine trail with climbing,T6 - hazardous alpine trail with climbing"> <short_description>text</short_description> <!-- ... --> </combo>
or what kendzi suggested.
follow-up: 10 comment:9 by , 13 years ago
Replying to kendzi:
I think this r5135 commit broke
short_description
again.
Oh, no – again … Instead of fixing this, I'd like to push forward this ticket (as then the fix is no longer needed).
Beta patch attached. I guess, we can drop support for <short_description>
, can't we?
<combo key="sac_scale" text="SAC Scale"> <list_entry value="hiking" display_value="T1 - hiking trail" short_description="Trail well cleared. Area flat or slightly sloped, no fall hazard" /> <list_entry value="mountain_hiking" display_value="T2 - mountain hiking trail" short_description="Trail with continuous line and balanced ascent. Terrain partially steep, fall hazard possible" /> <list_entry value="demanding_mountain_hiking" display_value="T3 - difficult, exposed hiking trail" short_description="exposed sites may be secured with ropes or chains, possible need to use hands for balance. Partly exposed sites with fall hazard, scree, pathless jagged rocks" /> <list_entry value="alpine_hiking" display_value="T4 - difficult, exposed, steep alpine trail" short_description="sometimes need for hand use to get ahead. Terrain quite exposed, precarious grassy acclivities, jagged rocks, facile snow-free glaciers" /> <list_entry value="demanding_alpine_hiking" display_value="T5 - difficult alpine trail with climbing" short_description="single plainly climbing up to second grade. Exposed, demanding terrain, jagged rocks, few dangerous glacier and snow" /> <list_entry value="difficult_alpine_hiking" display_value="T6 - hazardous alpine trail with climbing" short_description="climbing up to second grade. Often very exposed, precarious jagged rocks, glacier with danger to slip and fall" /> </combo>
by , 13 years ago
Attachment: | 7552_beta.patch added |
---|
comment:10 by , 13 years ago
It is working great!
Only problem is then there is no attribute “display_value” in preset, it throw exception:
java.lang.NullPointerException at org.openstreetmap.josm.gui.tagging.TaggingPreset$PresetListEntry.toString(TaggingPreset.java:245) at javax.swing.plaf.basic.BasicComboBoxEditor.setItem(BasicComboBoxEditor.java:60)
Replying to simon04:
Replying to kendzi:
I think this r5135 commit broke
short_description
again.
Oh, no – again … Instead of fixing this, I'd like to push forward this ticket (as then the fix is no longer needed).
Beta patch attached. I guess, we can drop support for
<short_description>
, can't we?
<combo key="sac_scale" text="SAC Scale"> <list_entry value="hiking" display_value="T1 - hiking trail" short_description="Trail well cleared. Area flat or slightly sloped, no fall hazard" /> <list_entry value="mountain_hiking" display_value="T2 - mountain hiking trail" short_description="Trail with continuous line and balanced ascent. Terrain partially steep, fall hazard possible" /> <list_entry value="demanding_mountain_hiking" display_value="T3 - difficult, exposed hiking trail" short_description="exposed sites may be secured with ropes or chains, possible need to use hands for balance. Partly exposed sites with fall hazard, scree, pathless jagged rocks" /> <list_entry value="alpine_hiking" display_value="T4 - difficult, exposed, steep alpine trail" short_description="sometimes need for hand use to get ahead. Terrain quite exposed, precarious grassy acclivities, jagged rocks, facile snow-free glaciers" /> <list_entry value="demanding_alpine_hiking" display_value="T5 - difficult alpine trail with climbing" short_description="single plainly climbing up to second grade. Exposed, demanding terrain, jagged rocks, few dangerous glacier and snow" /> <list_entry value="difficult_alpine_hiking" display_value="T6 - hazardous alpine trail with climbing" short_description="climbing up to second grade. Often very exposed, precarious jagged rocks, glacier with danger to slip and fall" /> </combo>
by , 13 years ago
Attachment: | 7552_gamma.patch added |
---|
comment:12 by , 13 years ago
follow-up: 14 comment:13 by , 13 years ago
I did not look at the issue itself, but the help text in patch is broken.
comment:14 by , 13 years ago
Replying to stoecker:
I did not look at the issue itself, but the help text in patch is broken.
In which sense?
by , 13 years ago
Attachment: | 7552_delta.patch added |
---|
comment:17 by , 13 years ago
Replying to simon04:
δ: Handle translations correctly.
It is working quite well. When it well be added to svn? - I didn't saw your answer
To delta patch:
Attributes display_value, short_description are translated correctly, but when it is specified only attribute “value” it is not translated. It is intentionality? (values from old “valuses” attribute in combo are translated)
eg.
<list_entry value="up" />
To version on svn:
Translation for attributes value, display_value, short_description are not working.
To future :)
After choosing value with images, it could be good idea to show this image on template form near chosen text value. But it should support values write to combo text field too. When it is match with list_entry it could be show image.
follow-up: 20 comment:19 by , 13 years ago
One more problem.
When combo items are specified using list_entry, default value is not working.
This is working:
<combo values="yes,no" text="test1" key="test1" default="yes" />
This is not working:
<combo text="test2" key="test2" default="yes"> <list_entry value="yes" /> <list_entry value="no" /> </combo>
comment:21 by , 13 years ago
Replying to kendzi:
With new combo preset icon above attributes stop appearing too.
I don't really understand – please explain in more detail and/or attach a small example.
comment:23 by , 13 years ago
I guess the answer is in http://josm.openstreetmap.de/browser/josm/trunk/data/defaultpresets.xml?rev=5164#L103
To be more specific, try to add the attribute match="key
to your <combo>
.
follow-up: 27 comment:24 by , 13 years ago
The list entry is missing a specification for the translation context for the values ("values_context" in <combo>), as well as for short description. Also it seems that normal short-description in the combo is not translated, only in <list_entry>.
comment:25 by , 13 years ago
comment:27 by , 13 years ago
Replying to stoecker:
The list entry is missing a specification for the translation context for the values ("values_context" in <combo>)
Done.
as well as for short description.
Currently, we don't have a context for short_description
in <combo>
neither. Shall we add one or reuse values_context
?
Also it seems that normal short-description in the combo is not translated, only in <list_entry>.
Fixed.
follow-up: 29 comment:28 by , 13 years ago
Currently, we don't have a context for short_description in <combo> neither. Shall we add one or reuse values_context?
I think a "description_context" would be correct here. Meaning of values and descriptions may differ a lot, so contexts should not be same. Thought text conflicts with the short description texts are very unlikely, so a context is not that important.
comment:29 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to stoecker:
Thought text conflicts with the short description texts are very unlikely, so a context is not that important.
Maybe we'll keep this for later when there's need for contexts in short description texts. Currently short descriptions are used very rarely (once in the defaultpresets
).
layout