Opened 14 months ago
Closed 14 months ago
#7552 closed enhancement (fixed)
combo item icon in template preset
| Reported by: | kendzi | Owned by: | team |
|---|---|---|---|
| Priority: | major | Component: | Core |
| Version: | Keywords: | combo | |
| Cc: |
Description (last modified by skyper)
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 Changed 14 months ago by kendzi
- Summary changed from combo item in template preset to combo item icon in template preset
comment:2 Changed 14 months ago by kendzi
- Description modified (diff)
comment:3 Changed 14 months ago by skyper
- Description modified (diff)
Changed 14 months ago by simon04
Changed 14 months ago by simon04
comment:4 Changed 14 months ago by simon04
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>
comment:5 follow-up: ↓ 6 Changed 14 months ago by kendzi
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>
comment:6 in reply to: ↑ 5 ; follow-up: ↓ 7 Changed 14 months ago by 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:7 in reply to: ↑ 6 ; follow-up: ↓ 9 Changed 14 months ago by kendzi
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 Changed 14 months ago by bastiK
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.
comment:9 in reply to: ↑ 7 ; follow-up: ↓ 10 Changed 14 months ago by 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>
Changed 14 months ago by simon04
comment:10 in reply to: ↑ 9 Changed 14 months ago by kendzi
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>
Changed 14 months ago by simon04
comment:11 follow-up: ↓ 12 Changed 14 months ago by simon04
(Hopefully) fixed in ɣ.
comment:12 in reply to: ↑ 11 Changed 14 months ago by kendzi
comment:13 follow-up: ↓ 14 Changed 14 months ago by stoecker
I did not look at the issue itself, but the help text in patch is broken.
comment:14 in reply to: ↑ 13 Changed 14 months ago by simon04
Replying to stoecker:
I did not look at the issue itself, but the help text in patch is broken.
In which sense?
Changed 14 months ago by simon04
comment:15 follow-up: ↓ 17 Changed 14 months ago by simon04
δ: Handle translations correctly.
comment:16 Changed 14 months ago by simon04
In 5158/josm:
comment:17 in reply to: ↑ 15 Changed 14 months ago by kendzi
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.
comment:18 Changed 14 months ago by simon04
In 5159/josm:
comment:19 follow-up: ↓ 20 Changed 14 months ago by anonymous
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:20 in reply to: ↑ 19 Changed 14 months ago by kendzi
With new combo preset icon above attributes stop appearing too.
comment:21 Changed 14 months ago by simon04
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:22 Changed 14 months ago by simon04
In 5164/josm:
comment:23 Changed 14 months ago by simon04
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>.
comment:24 follow-up: ↓ 27 Changed 14 months ago by stoecker
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 Changed 14 months ago by simon04
comment:26 Changed 14 months ago by simon04
In 5173/josm:
comment:27 in reply to: ↑ 24 Changed 14 months ago by simon04
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.
comment:28 follow-up: ↓ 29 Changed 14 months ago by stoecker
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 in reply to: ↑ 28 Changed 14 months ago by simon04
- Resolution set to fixed
- Status changed from new to 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