Action (hwx.gui)

GUI command used in Menus and ToolBars.

An action contains text, icons and a command callback. The action can be inserted into menus and/or toolbars. When the menu or toolbar button is clicked the action is called. Actions are used in Tool Wheel. The text displayed in the Tool Wheel is based on the text attribute which should be passed to tr() before.

Actions are modeled after Qts Action class. Refer to the Qt documentation for more information.

Public Methods

classmethod get (cls, name)
onCommand (self)
onToggle (self, on)

Property Details

accel()

Key sequence to activate/toggle this action, like “Ctrl+q”.

command()

Method called when the action button is clicked.

enabled()

The availability of the action.

Disabled actions are grayed out and the user cannot activate them.

exclusive()

The group exclusive property.

  • If this action is contained in a group and the group exclusive property is True, this action would toggle off when any other action in the group is toggled on.
  • Setting to False makes the actions toggle independently.
  • Setting to True simple does not do anything if the group is not set as exclusive.
icon()

File name of the icon.

  • Local names are looked up from the paths specified in addResourcePath.
  • When setting the icon the value can be a tuple of (icon, position) where position is the x,y translation of the icon.
ison()

Determines if the action is on or not.

name()

Unique identifier across profiles.

This is only settable in the constructor.

selectable()

The ability to select the action.

Setting to False allows for creating a background icon.

statustip()

Text displayed in the status bar when the cursor is over the icon or text.

text()

Text label displayed in the menu/toolbar.

tooltip()

Text displayed in a popup when cursor is over the icon or text.

visible()

The visibility of the action.

Setting to False will visually remove this from the menu/toolbar.

whatsthis()

Text displayed when cursor is over the icon or text and user hits F1.

Method Details

classmethod get(cls, name)

Returns the named action from defined in active profile.

param name:Action name.
type name:str
onCommand(self)

Calls command callback method when an Action is clicked.

onToggle(self, on)

Acts when an Action is toggled.

  • If is coupled to dialog it will show or hide the dialog.
  • If is coupled to a context it will get in and out the context.
  • If is coupled to callback it will run the callback with state or not.
param on:Determines whether to toggle on or off.
type on:bool