Modes

As discussed in the Concepts section on Modes, modes are a mechanism that allow Ginga to accommodate many key and pointer bindings for a large number of possible operations. Modes are associated with the basic Ginga viewer widget and so can be used even with the widget standalone in your own programs (i.e., apart from the Reference Viewer; see Developing with Ginga for details).

Invoking Modes

Modes are used to make bindings between keyboard, mouse, trackpad and gesture events and certain operations on the viewer widget. By invoking a mode, certain keystrokes and cursor bindings are enabled for certain operations within the viewer window in which the mode was entered. Typically, pressing the space key with the widget focus in the viewer window is used to enter the special “Meta” mode, in which you can then enter any one of the registered modes by following up pressing its mode activation key.

Only one mode (or no mode) can be active at a time in a particular viewer widget. Once a mode is activated, the mode indicator should turn on in one of the corners of the viewer window to indicate which mode is active:

../_images/mode_indicator.png

To exit a mode, press the Esc (escape) key.

Note

In the Reference Viewer, you can also enter and exit certain modes using the “Toolbar” plugin (see Toolbar).

Mode Types

The mode switching system has a mode type which can be set to one of:

  • oneshot: The mode is exited by initiating and finishing a cursor drag, or when Esc is pressed (if no cursor drag is performed)

  • locked: The mode is locked until the meta mode key is pressed again (or Esc)

By default most modes are activated in “locked” type.

Note

When the lock is active, it is signified by an additional “[L]” (locked) appearing in the mode indicator; oneshot mode is indicated by “[O]”. In the figure above, you can see the mode indicator showing that the viewer is in “contrast” mode, with the mode type as “Lock”. In the Reference Viewer, the same information can be seen in the Toolbar plugin, where the lock icon shows the state of the mode type (engaged == 'Lock').

Standard Modes

These are the set of modes that come with Ginga. Those interested in writing their own custom mode should refer to Developing Modes in the developers manual.

Note

The standard modes and default bindings are summarized in the Quick Reference Quick Reference. In the reference viewer, you can pop up a help tab with the bindings for the mode if you press ‘h’ in the channel viewer while that viewer is in a mode.

CMap

Contrast

Cuts

Dist

Pan

Zoom

Rotate

Naxis