Next: Creating custom graphical interfaces, Previous: Automatically loading python files at startup, Up: Python FAQ
GPS provides most of its tools through contextual menus, accessed by right clicking in various parts of GPS. Due to the number of tools provided by GPS, these contextual menus tend to be big, and you might want to control what should be displayed in them. There are several ways to control this:
If you are creating your own contextual menus through customization files and
XML, these menus are associated with actions (<action>
) that you have
created yourself most of the time. In this case, you need to define filters
appropriately, through the <filter>
tag, to decide when the action
is relevant, and therefore when the contextual menu should be displayed.
If you want to control the visibility of predefined contextual menus, or
for menus where you cannot easily modify the associated filter, you can
use shell and python commands to hide the menu entry. For this, you will
need to find out the name of the menu, which can be done by checking the
list returned by GPS.Contextual.list()
and using the most likely
entry. This name is also the value of the <title>
tag for contextual
menus that you have created yourself. Using this name, you can then disable
the contextual menu by executing:
GPS.Contextual ("name").hide()
in the python console