ActionDialog (hwx.gui)#
- class ActionDialog(action=None, children=None, **kwds)#
Bases:
DialogBaseDialog that pops up under the specified SpriteAction.
Attribute Table# Name
Type
propertypropertypropertypropertypropertypropertypropertypropertypropertypropertypropertypropertypropertypropertypropertypropertypropertypropertypropertyonHideSignalonKeyPressSignalonKeyReleaseSignalonMouseEnterSignalonMouseLeaveSignalonMousePressSignalonMouseReleaseSignalonResizeSignalonShowSignalpropertypropertypropertypropertypropertyMethod Table# Name
Description
addChildren(self, children)Add child widgets/layouts into this widget.
createContents(self)To be implemented in derived class.
destroy(self)Deletes this and all its children.
enableGlobalActions(self, enable)Sets the state of Global Actions.
get()Get singleton when dialog is implemented as a subclass
getMousePosition(self)Returns the mouse position.
getRelativeMousePosition(self)Returns the mouse position relative to this widget.
hide(self)Hides the widget.
onCommand(self, event=None)positionUnder(self, relativeTo, checkWasMoved=True, xoffset=0)Positions the dialog under or over the relataveTo widget.
resize(self, width, height)Resize width/height of dialog.
saveAsPng(self, fname)Saves the widget as a .png file.
set(self, v)setF1HelpTopic(self, helptopic)Popup web-browser helps when the user hits F1 when over this.
show(self)Shows the widget.
Example
from hwx import gui class MyActionDialog(gui.ActionDialog): def createContents(self): self.caption = 'Dialog Toggled By Action' gui.HBoxLayout(gui.Table(values=[range(10) for _ in range(10)]), parent=self) self.layout.resizeMode = 'Auto' class MyButtonDialog(gui.ActionDialog): def createContents(self): self.caption = 'Dialog Toggled By Button' gui.HBoxLayout(gui.Table(values=[range(10) for _ in range(10)]), parent=self) self.layout.resizeMode = 'Auto' show(gui.HFrame( gui.SpriteActionGroup(children=[ gui.SpriteAction( text = "Action Group", icon = ("ribbonRigidGroupStrip-80.png", (0, 5)), ), gui.SpriteAction( icon = ("ribbonSatelliteListStrip-80.png", (3, 5)), dialog = MyActionDialog, # visible defaults to 'hover' ) ]), gui.Button( icon = "glyphAutomaticStrip-16.png", dialog = MyButtonDialog ) ))
- class TitleBar_(flags=0, **kwds)#
Bases:
FrameMethod Table# Name
Description
A method for adding buttons to the title bar of the dialog.
executeCreateandExitButton(self, command, **kwds)Shortcut for creating green check button.
executePlayButton(self, command, **kwds)Shortcut for creating a button that has the play icon
exitButton(self, **kwds)Shortcut for creating a button that has the red x icon.
maximizeRestoreButton(self, maximizeText=’Maximize’, restoreText=’Restore Down’)Adds a maximize and a restore tool button and implements
resetButton(self, command, **kwds)Shortcut for creating a button that has the reset icon.
- property active#
Returns True if it is visible and enabled, False otherwise. (readonly property)
- addChildren(children)#
Add child widgets/layouts into this widget.
Widget children get layed out using a VBoxLayout.
Typically, you’ll pass the parent/children into the constructor instead of calling this function directly.
- property advancedTooltip#
The advanced tooltip that appears while hovering mouse over widget.
- button(icon, command, **kwds)#
A method for adding buttons to the title bar of the dialog.
- Parameters:
icon (str) –
command (callback) – Callback method to be called when the button is clicked.
kwds (dict) – Any properties user wants to set for the button.
- Returns:
ToolButton
- property children#
All widgets immediately contained by this one.
- property command#
Method called when the widget is activated or changed.
- property descendents#
All the widgets ultimately contained by this one.
- destroy()#
Deletes this and all its children.
- enableGlobalActions(enable)#
Sets the state of Global Actions.
Disable the global actions to get key events.
- Parameters:
enable (bool) – Determines whether to enable or disable global actions.
- property enabled#
The availability of the widget.
Disabled widgets are greyed out and don’t respond to input events.
- executeCreateandExitButton(command, **kwds)#
Shortcut for creating green check button.
- Parameters:
command (callback) – Callback method to be called when the button is clicked.
- Returns:
A check button.
- Return type:
- executePlayButton(command, **kwds)#
Shortcut for creating a button that has the play icon
- Parameters:
command (callback) – Callback method to be called when the button is clicked.
kwds (dict) – Any property the user wants to set for the button.
- Returns:
ToolButton
- exitButton(**kwds)#
Shortcut for creating a button that has the red x icon.
- Parameters:
kwds (dict) – Any other properties user wants to set for the exit button.
- Returns:
The new exit button.
- Return type:
- property font#
The font used in this widget (set with font or dict).
- property frameShape#
Returns frame shape from the frame style. Below are the valid frame shape: - NOFRAME - BOX - PANEL - WINPANEL - HLINE - VLINE - STYLEDPANEL
- getMousePosition()#
Returns the mouse position.
- getRelativeMousePosition()#
Returns the mouse position relative to this widget.
- property height#
Fixed height of the widget.
- property helpTopic#
Popup web-browser helps when the user hits F1 when over this.
- Parameters:
helptopic (str) – Topic name user needs help in.
- hide()#
Hides the widget.
- property layout#
The layout that contains this widget’s children.
- maximizeRestoreButton(maximizeText='Maximize', restoreText='Restore Down')#
Adds a maximize and a restore tool button and implements the expected behavior when these are clicked.
- Parameters:
maximizeText (str) – The tooltip of maximize button.
restoreText (str) – The tooltip of restore button.
- Returns:
A list containing the maximize and minimize buttons.
- Return type:
- property maximumHeight#
The maximum allowable height inside the Layout.
- property maximumWidth#
The maximum allowable width inside the Layout.
- property minimumHeight#
The smallest allowable height inside the Layout.
- property minimumWidth#
The smallest allowable width inside the Layout.
- property name#
The unique identifier within a container.
- property parent#
The container that owns this widget.
- resetButton(command, **kwds)#
Shortcut for creating a button that has the reset icon.
- Returns:
The new reset button.
- Return type:
- saveAsPng(fname)#
Saves the widget as a .png file.
- Parameters:
fname (str) – The file name for the .png
- Returns:
True if it was saved succesfully, False otherwise.
- Return type:
bool
- setF1HelpTopic(helptopic)#
Popup web-browser helps when the user hits F1 when over this.
- Parameters:
helptopic (str) – Topic name user needs help in.
- setProperties(kwds)#
Internal method called from constructors.
- show()#
Shows the widget.
- property size#
The fixed size of the widget (width, height).
- property tooltip#
The tooltip that appears while hovering mouse over widget.
- property value#
The value of the widget.
- property visible#
The visibility of the widget.
- property width#
The fixed width of the widget.
If a string or list of strings are specified, the width will be calculated from the longest string given the font.
- property active#
Returns True if it is visible and enabled, False otherwise. (readonly property)
- addChildren(children)#
Add child widgets/layouts into this widget.
Widget children get layed out using a VBoxLayout.
Typically, you’ll pass the parent/children into the constructor instead of calling this function directly.
- property advancedTooltip#
The advanced tooltip that appears while hovering mouse over widget.
- property caption#
The text displayed in the titlebar.
- property children#
All widgets immediately contained by this one.
- property command#
Method called when the widget is activated or changed.
- createContents()#
To be implemented in derived class.
- property descendents#
All the widgets ultimately contained by this one.
- destroy()#
Deletes this and all its children.
- enableGlobalActions(enable)#
Sets the state of Global Actions.
Disable the global actions to get key events.
- Parameters:
enable (bool) – Determines whether to enable or disable global actions.
- property enabled#
The availability of the widget.
Disabled widgets are greyed out and don’t respond to input events.
- property font#
The font used in this widget (set with font or dict).
- getMousePosition()#
Returns the mouse position.
- getRelativeMousePosition()#
Returns the mouse position relative to this widget.
- property height#
Fixed height of the widget.
- property helpTopic#
Popup web-browser helps when the user hits F1 when over this.
- Parameters:
helptopic (str) – Topic name user needs help in.
- hide()#
Hides the widget.
- property layout#
Layout for the content area of the dialog.
Children widgets get added here.
- property maximumHeight#
The maximum allowable height inside the Layout.
- property maximumWidth#
The maximum allowable width inside the Layout.
- property minimumHeight#
The smallest allowable height inside the Layout.
- property minimumWidth#
The smallest allowable width inside the Layout.
- property name#
The unique identifier within a container.
- property parent#
The container that owns this widget.
- property position#
The location within the main window.
- positionUnder(relativeTo, checkWasMoved=True, xoffset=0)#
Positions the dialog under or over the relataveTo widget.
- Parameters:
relativeTo (Widget) – The widget to position relative to.
checkWasMoved (bool) – Determines whether to check if widget is moved or not.
xoffset (int) – The offset value for the widget for x-axis.
- resize(width, height)#
Resize width/height of dialog.
This does not prevent the user from manually resizing like setting the width/height does.
- saveAsPng(fname)#
Saves the widget as a .png file.
- Parameters:
fname (str) – The file name for the .png
- Returns:
True if it was saved succesfully, False otherwise.
- Return type:
bool
- setF1HelpTopic(helptopic)#
Popup web-browser helps when the user hits F1 when over this.
- Parameters:
helptopic (str) – Topic name user needs help in.
- setProperties(kwds)#
Internal method called from constructors.
- show()#
Shows the widget.
- property size#
The fixed size of the widget (width, height).
- property title#
The text displayed in the titlebar.
- property tooltip#
The tooltip that appears while hovering mouse over widget.
- property value#
The value of the widget.
- property visible#
The visibility of the dialog.
- property width#
The fixed width of the widget.
If a string or list of strings are specified, the width will be calculated from the longest string given the font.