gui.actions

Creates a series of gtk.Action objects that encapsulate the operations the user can start from the main window’s menu. (For the actions in the Debug menu, see gui.debug.)

Clients normally only need to call createActionGroup() to receive a gtk.ActionGroup consisting of all the actions.

To create a new action, you need to:

Functions

gui.actions.createActionGroup(mainWindowHandler)
Creates a gtk.ActionGroup object with the actions that are required to create the main window’s menu. The actions that are created are added to mainWindowHandler._actions.
gui.actions._makeMenuAction(name, text, actionGroup)
For some reason, GTK wants actions associated with menu items that have a submenu. This function creates them.

Error Messages

gui.actions.NOT_CALIBRATED_ERROR_MESSAGE
An error message that is displayed if the user activates an action when the system isn’t calibrated even though that is not supposed to be possible for that action. Should only be needed if something goes very, very wrong.
gui.actions.NO_CALIBRATION_DATA_ERROR_MESSAGE
An error message that is displayed if the user activates an action when the system’s calibration data has no measurements even though that is not supposed to be possible for that action. Should only be needed if something goes very, very wrong.
gui.actions.NO_SIMULATION_ERROR_MESSAGE
An error message that is displayed if the user activates an action when the system isn’t simulated even though that is not supposed to be possible for that action. Should only be needed if something goes very, very wrong.

NoseAction

class gui.actions.NoseAction(mainWindowHandler, actionGroup)

An abstract base class for actions the user can perform in NOSE. Simplifies the creation of gtk.Action and gtk.RadioAction instances, and keeps a gui.main.MainWindowHandler around that might be required by many actual actions.

Instance Attributes

mainWindowHandler:
The gui.main.MainWindowHandler this action is associated with.
system:
A property that provides convenient access to the mainWindowHandler‘s system.
gtkAction:
The gtk.Action or gtk.RadioAcition associated with this NoseAction.

Class Attributes

name
The action’s unique internal name, as used in menu.xml.
text
The text shown in menu items associated with the action. Underscores can be used to create shortcuts.
stock
An optional stock ID (gtk.STOCK_FOO) that is used by the action. Determines the icon (except for radio actions) and maybe the accelerator.
accelerator
An optional accelerator, such as '<Ctrl><Alt>X'. When in doubt, check gtk.accelerator_parse(). Should be internationalized.
radioGroupName
If set, the action becomes a radio action, that is, it can be toggled between an active and an inactive state, and only one action with the given radioGroupName can be active at any time.
radioValue
An arbitrary integer that is used as the value for radio actions. See gtk.RadioAction. Can be safely ignored.
radioActive
Determines whether a radio action should be set to be initially active. Should only be set to True for one action in a given action group.
requiresCalibrationData
If set to True, the action can only be activated if the system has at least one calibration measurement. If it isn’t, the action is automatically set insensitive.
requiresSimulation
If set to True, the action an only be activated if the system is simulated.

Instance Methods

__init__(mainWindowHandler, actionGroup)
Creates a new instance of this class that is associated with the given gui.main.MainWindowHandler, and creates a gtk.Action or gtk.RadioAction that belongs to the given gtk.ActionGroup.
activate(*parameters)
Called when the action is activated. Calls run(), unless its not supposed to be possible to activate the action right now.
run()
Called when the action is activated. Subclasses need to be override this method.
_handleCalibrationDataChange(event)
Receives calibration data change events if requiresCalibration is set to True, and sets the action’s sensitivity depending on whether the system is calibrated.

The Actual Actions

class gui.actions.QuitAction(mainWindowHandler, actionGroup)
Quits the program.
class gui.actions.ShowCalibrationDialogAction(mainWindowHandler, actionGroup)
Shows the calibration dialog.
class gui.actions.LoadCalibrationDataAction(mainWindowHandler, actionGroup)
Loads the calibration data from a file.
class gui.actions.SaveCalibrationDataAction(mainWindowHandler, actionGroup)
Saves the calibration data to a file.
class gui.actions.SaveCalibrationDataAsAction(mainWindowHandler, actionGroup)
Saves the calibration data to a new file.
class gui.actions.ClearCalibrationDataAction(mainWindowHandler, actionGroup)
Clears the calibration data.

Table Of Contents

Previous topic

gui

Next topic

gui.io