DockWindow (hwx.gui)#
- class DockWindow(area='left', parent='MainWindow', name='', children=None, **kwds)#
Bases:
DialogBase
A dockable window.
It can exist in a floating state or can be attached to the main application window.
# Name
Type
property
onDock
Signal
onUnDock
Signal
property
property
property
property
property
property
property
property
property
property
property
property
property
property
property
property
property
property
property
onHide
Signal
onKeyPress
Signal
onKeyRelease
Signal
onMouseEnter
Signal
onMouseLeave
Signal
onMousePress
Signal
onMouseRelease
Signal
onResize
Signal
onShow
Signal
property
property
property
property
property
# 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.
setProperties
(self, kwds)show
(self)Shows the widget.
Example
from hwx import gui window = gui.DockWindow( caption="Run", docked=False, children=gui.HFrame( gui.Label(icon="dialogBooleanCombineStrip-32.png"), gui.Label(icon="dialogBooleanIntersectStrip-32.png"), gui.Label(icon="dialogBooleanSubtractStrip-32.png") ), height=145, width=150 ) # buttons in the titlebar are added from right to left # so the order matters window.titleBar.exitButton() window.titleBar.resetButton( command=lambda: gui.tellUser("Reset button clicked.") ) window.titleBar.executeCreateandExitButton( command=lambda: gui.tellUser("Create and Exit button clicked.") ) window.titleBar.executePlayButton( command=lambda: gui.tellUser("Play button clicked.") ) window.show()
- class DockArea(value)#
Bases:
Enum
An enumeration.
# Name
Type
bottom
DockArea
left
DockArea
right
DockArea
top
DockArea
- setProperties(kwds)#
Internal method called from constructors.
- property docked#
Docks/Undocks the window and returns if the window is docked.
- class TitleBar_(flags=0, **kwds)#
Bases:
Frame
# 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.
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.
- 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.