1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
<!-- meta page description: wxGUI Toolboxes -->
<!-- meta page index: wxGUI -->
<h2>KEYWORDS</h2>
<a href="general.html">general</a>, <a href="topic_GUI.html">GUI</a>
<h2>DESCRIPTION</h2>
The <b>Toolboxes</b> is a way to customize items in <em><a href="wxGUI.html">wxGUI</a></em>
menu. Toolboxes enable to:
<ul>
<li> hide unused menu items in menu (e.g. Imagery, Database) or submenu (e.g. Wildfire modeling)</li>
<li> change order of menu items and subitems</li>
<li> add new menu items (e.g. Temporal)</li>
<li> add addons modules</li>
<li> add your own modules</li>
</ul>
<p>
Toolboxes are configured through two XML files (<code>main_menu.xml</code> and
<code>toolboxes.xml</code>) located in your user home
GRASS directory, subdirectory <code>toolboxes</code>
(<code>$HOME/.grass8/toolboxes/</code> on UNIX).
Currently, there is no GUI front-end for toolboxes,
however only simple editing of text files is needed.</p>
<h3>Brief description of file <code>main_menu.xml</code></h3>
<p>This file represents the main menu (File, Settings, Raster, ...).
By modifying this file you show and hide menu items which are
represented by <code>subtoolbox</code> tag.</p>
<p>Tag <code>user-toolboxes-list</code> is interpreted as a menu containing a list of all user-defined toolboxes. If not needed it can be removed.</p>
<p>Following lines can be copied to <code>.grass8/toolboxes/main_menu.xml</code>
and by removing, adding or reordering lines users can change the main menu items. See further examples.</p>
<div class="code"><pre>
<?xml version="1.0" encoding="UTF-8"?>
<toolbox name="MyMainMenu">
<label>Default GRASS GIS main menu bar</label>
<items>
<subtoolbox name="File"/>
<subtoolbox name="Settings"/>
<subtoolbox name="Raster"/>
<subtoolbox name="Vector"/>
<subtoolbox name="Imagery"/>
<subtoolbox name="Volumes"/>
<subtoolbox name="Database"/>
<user-toolboxes-list />
<subtoolbox name="Help"/>
</items>
</toolbox>
</pre></div>
<h3>Brief description of file <code>toolboxes.xml</code></h3>
<p>This file contains structure and description of individual toolboxes.
Note that both <em>Raster</em> and e.g. <em>Query raster maps</em>
are individual toolboxes although one contains the other.
Tag <code>toolbox</code> contains <code>subtoolbox</code> tags
which are defined later in the file. These nested toolboxes are linked
through <code>name</code> attribute.</p>
<p>Apart from <code>subtoolbox</code> tag, tag <code>toolbox</code> can contain individual items (modules)
and separators (for visual separation in the menu tree).</p>
<div class="code"><pre>
<?xml version="1.0" encoding="UTF-8"?>
<toolboxes>
<toolbox name="Raster">
<label>&amp;Raster</label>
<items>
<subtoolbox name="DevelopRasterMap"/>
<subtoolbox name="ManageRasterColors"/>
<subtoolbox name="QueryRasterMaps"/>
<subtoolbox name="RasterMapTypeConversions"/>
<separator/>
<module-item name="r.buffer">
<label>Buffer rasters</label>
</module-item>
...
...
<toolbox name="QueryRasterMaps">
<label>Query raster maps</label>
<items>
<module-item name="r.what">
<label>Query values by coordinates</label>
</module-item>
<module-item name="r.what.color">
<label>Query colors by value</label>
</module-item>
</items>
</toolbox>
</pre></div>
<p>To redefine a toolbox (or use it as a template),
copy specific part of file <code>grass7/gui/wxpython/xml/toolboxes.xml</code>
from GRASS installation to a new file in user home
(<code>.grass8/toolboxes/toolboxes.xml</code>) and edit it.
Rename this new toolbox.</p>
<h2>EXAMPLES</h2>
<h3>Hiding menu items</h3>
<p>If we are for example working only with raster data,
we can hide menu items <em>Vector</em> and <em>Database</em>.
The file <code>main_menu.xml</code> then contains the following lines
where we omitted the two toolboxes:</p>
<div class="code"><pre>
<?xml version="1.0" encoding="UTF-8"?>
<toolbox name="CustomizedMainMenu">
<label>Default GRASS GIS main menu bar</label>
<items>
<subtoolbox name="File"/>
<subtoolbox name="Settings"/>
<subtoolbox name="Raster"/>
<subtoolbox name="Imagery"/>
<subtoolbox name="Volumes"/>
<user-toolboxes-list />
<subtoolbox name="Help"/>
</items>
</toolbox>
</pre></div>
<h3>Creating custom toolbox</h3>
<p>In this example we create a new toolbox <em>Favorites</em> containing
existing GRASS module and toolbox, custom module
created by the user and addon module.
The <code>toolboxes.xml</code> file contains following lines:</p>
<div class="code"><pre>
<?xml version="1.0" encoding="UTF-8"?>
<toolboxes>
<toolbox name="MyFavorites">
<label>&amp;Favorites</label>
<items>
<module-item name="g.region">
<label>Set region</label>
</module-item>
<module-item name="r.mask">
<label>Mask</label>
</module-item>
<separator/>
<module-item name="m.myown">
<label>Do my own stuff</label>
</module-item>
<module-item name="i.histo.match">
<label>Calculate histogram matching</label>
</module-item>
<subtoolbox name="RasterReportsAndStatistics"/>
</items>
</toolbox>
</toolboxes>
</pre></div>
<p>Optionally, we can add this toolbox to the main menu items.
The <code>main_menu.xml</code> file contains following lines:</p>
<div class="code"><pre>
<?xml version="1.0" encoding="UTF-8"?>
<toolbox name="CustomizedMainMenu">
<label>Default GRASS GIS main menu bar</label>
<items>
<subtoolbox name="File"/>
<subtoolbox name="Settings"/>
<subtoolbox name="Raster"/>
<subtoolbox name="Vector"/>
<subtoolbox name="Imagery"/>
<subtoolbox name="Volumes"/>
<subtoolbox name="Database"/>
<user-toolboxes-list />
<subtoolbox name="Favorites"/>
<subtoolbox name="Help"/>
</items>
</toolbox>
</pre></div>
<p>If we have <code>user-toolboxes-list</code> tag in the <code>main_menu.xml</code> file,
our custom toolbox will be listed in the automatically added <em>Toolboxes</em> main menu item. The screenshot shows the resulting menu:</p>
<center>
<br><img src="wxGUI_toolboxes.jpg" border="0" alt="Toolboxes - menu customization"><br><br>
</center>
<h2>NOTES</h2>
<p>After the first start of wxGUI with custom toolboxes,
<code>.grass/toolboxes</code> directory will contain file
<code>menudata.xml</code> which is auto-generated and should not be edited.</p>
<h2>SEE ALSO</h2>
<em>
<a href="wxGUI.html">wxGUI</a>,
<a href="wxGUI.components.html">wxGUI components</a>
</em>
<h2>AUTHORS</h2>
Anna Petrasova, OSGeoREL, Faculty of Civil Engineering, Czech Technical University in Prague<br>
Vaclav Petras, OSGeoREL, Faculty of Civil Engineering, Czech Technical University in Prague
|