wxGUI.toolboxes.html 7.1 KB

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