Context (hwx.inspire.gui)#

class Context#

Bases: ModelListener

A context is a GUI action that supports user interaction.

For example it can be used to create the workflow the lets a user create a fastener by selecting two parts.

The context is connected to the GUI by specifying the context class on the parameter of SpriteAction. When the SpriteAction is toggled on, the Context is created (if needed) and activated.

Activate/Deactivate:
  • onFirstActivate

  • onActivate

  • onDeactivate

  • onExitAccept

  • getActiveContext

  • isactive

Picking: get objects/features to create new objects
  • setPickable

  • onObjectsPicked

  • onObjectPicked

  • onPickListChanged

  • getPickedObjects

  • addPick

  • removePick

  • clearPickList

  • onPicking

  • isolatePicked

Selecting: select objects for editing, popup editor, context menu, …
  • setSelectable

  • selectObjects

  • deselectObjects

  • clearSelectList

  • getSelectedObjects

  • onSelecting

  • onObjectsSelected

  • onSelectionChanged

Pick/Select processing:
  • showPickedHovered

Guide the user
  • showObjectToolTip

  • showHelpMessage

  • showHelpTopic

  • showStatusMessage

  • popupObjectEditor

  • popupManipulators

Object utilities:
  • noteState

  • persistedAttributes

Cursors: set cursor tell the user the ‘state’ of the context
  • setMainCursor

  • setCursor

  • registerCursor

  • waitCursor

Messaging: show text message to tell the user the ‘state’ of the context
  • setHelpTopic

  • showHelpMessage

  • clearHelpMessage

  • showStatusMessage

  • clearStatusMessage

Usage Tracking: send the usage message to the license server
  • reportUsage

  • reportContextUsage

ModelListener methods
  • activateModelListener

  • deactivateModelListener

  • onObjectCreated

  • onObjectDeleted

  • onObjectModified

  • onNewProject

Lower level draw utilities to change how objects are rendered
  • drawHovered

  • drawHighlighted

  • drawUnhighlighted

  • isHighlighed

  • setObjectColor

  • makeModelTransparent

  • setObjectTransparency

  • setVisualizationStyle

Graphics view methods
  • redrawGraphics

  • getViewMatrix

  • fitView

Optimization methods
  • disableColorPicking

Lower level methods to respond to mouse/key signals
  • onKeyPress

  • onKeyRelease

  • onMousePress

  • onMouseRelease

  • onMouseMove

  • onMouseWheel

KeyModifiers
  • ctrlDown

  • altDown

  • shiftDown

Attribute Table#

Name

Type

action

NoneType

altDown

property

ctrlDown

property

graphicsWindow

property

isactive

property

manipulators

property

metaDown

property

modelIsTransparent

property

objectEditorDialog

property

persistedAttributes

property

popupEditor

NoneType

shiftDown

property

usageMessage

property

Method Table#

Name

Description

Destroy (self)

Destroys this context.

addEventTool (self, tool, before=False)

Add event tool to the context.

addPick (self, obj, makePickable=True)

Add the specified object to the PickedList.

canIsolate (self, objsToIsolate=None)

Determines if the objects can be isolated.

clearAllLists (self)

Clears the PickedList and select list.

clearHelpMessage (self)

Undisplays the help message.

clearPickList (self, makeUnpickable=False)

Removes all picked objects from the PickedList.

clearSelectList (self, objects=None)

Deselects all the selected objects.

clearStatusMessage (self)

Removes the message from the status bar if any.

deselectObjects (self, objects=None)

Deselects the specified objects from the selectList.

disableColorPicking (self)

Disables color based picking while in this context.

drawHighlighted (self, obj=None, highlight=True)

Renders objects highlighted to show the user objects of interest.

drawHovered (self, obj=None)

Draws the object in hover (prehighlight) mode.

drawUnhighlighted (self, obj=None, highlight=False)

Render objects highlighted to show the user objects of interest.

filterSelection (self, objects)

Overload this method to filter selectable objects when selecting from

fitView (self, objects=None, padded=True)

Center view on the entire model or passed objects.

getActiveContext ()

Returns the current active context.

getContextStack ()

Returns list of pushed contexts.

getIsolatedPick (self)

Returns the isolated object(s).

getObjectsForIsolate (self, objsToIsolate=None)

Returns a list of objects that can be isolated.

getPickedObjects (self)

Returns an ObjectList with the picked objects.

getSelectedObjects (self, beforeChange=False, active=True, **kwds)

Returns an ObjectList with the selected objects.

getViewMatrix (self)

Returns a Matrix44 to convert from world to view coordinates.

initializeCounter (self, counterActionName)

Gets the SpriteCounterAction by this name and automatically manages it.

isAllowedToExit (self, exitControl)

Called when the user RightMouse clicks or presses escape.

isHighlighted (self, obj)

Checks if the specified object is drawn highlighted.

isPickable (self, obj)

Checks if an object is pickable via the PickList or SelectList.

isolatePicked (self, forward=True, pickList=None, padded=True)

Isolate the next/prev object from the pickList.

makeModelTransparent (self, transparent=True, filter=None)

Makes pickable/selectable objects stand out by making the rest of the

onAboutToExit (self)

Overload if you need to stop processing something when the user tries to

onAboutToSave (self)

Overload to do something right before Inspire saves an stmod.

onActivate (self)

Overload to initialize your context each time it is activated.

onDeactivate (self)

Overload to cleanup your context when it is being deactivated.

onExitAccept (self)

Overload to execute code on right mouse button exit.

onFirstActivate (self)

Overload to initialize your context the first time it is activated.

onKeyPress (self, event)

Overload this method to define behaviour when a key is pressed.

onKeyRelease (self, event)

Overload this method to define behaviour when a key is released.

onMouseDoubleClick (self, event)

Overload this method to define behaviour on mouse double click.

onMouseMove (self, event)

Overload this method to define behaviour when mouse moves.

onMousePress (self, event)

Overload this method to define behaviour when mouse is pressed.

onMouseRelease (self, event)

Overload this method to define behaviour when mouse is released.

onMouseWheel (self, event)

Overload this method to define behaviour when mouse wheel is active.

onNewProject (self)

Overload if you need to clean up when a new model is loaded.

onObjectCreated (self, obj)

Overload if interested when an object is created after

onObjectDeleted (self, obj)

Overload if interested when an object is deleted after

onObjectModified (self, obj, attr)

Overload if interested when an object is modified after

onObjectPicked (self, obj, why)

Called when a pickable object is picked.

onObjectSelected (self, obj)

Called when an object is selected from any view.

onObjectsPicked (self, objects, why)

Called when one or more pickable object are picked.

onObjectsSelected (self, objects)

Called when objects are selected from any view.

onPickListChanged (self)

Called when an object is added to/removed from the pickList.

onPicking (self, objects)

Overloaded in derived context to process a pick event.

onSelecting (self, objects)

Overload this method to process any/all selectList events.

onSelectionChanged (self)

Overload this method to process the selectList when it changes.

pop (self, **kwds)

Pops context off context stack, deactivating the context.

popActive ()

Removes active context.

popAll ()

Pops all contexts to the idle context.

popThisBeforeNewPush (self, contextToBePushed)

Specify if the passed context can be pushed on top of the current one.

popupManipulators (self, obj)

Overload to popup 1 or more gui.Manipulators when an object is selected.

popupObjectEditor (self, obj)

Overload to popup a gui.ObjectEditorDialog when an object is selected.

popupObjectEditors (self, obj)

Overload this to popup editors when an object of interest is selected.

processPickListEvent (self, objects)

Called on any mouse move/press/release from the PickList.

push (name=None, **kwds)

Pushs context onto context stack, activates the context.

pushOnTop (self, newContext)

Push newContext on top of current context.

redrawGraphics (self, now=True)

Force a redraw of the graphics immediately.

registerCursor (self, name, icon, mask=’’, x=1, y=1)

Cache cursor for lazy create in setCursor.

removePick (self, obj, makeUnpickable=False)

Removes the specified object from the PickedList.

reportContextUsage (message, contextName=’’)

Reports the usage message to the context.

reportUsage (self, message)

Report the usage message within this context.

selectObjects (self, objects=None, clear=True)

Selects the specified objects, if they are instances of the types

setCursor (self, name, ignored=True)

Set the named cursor if it is not the current one.

setHelpTopic (self, helpTopic)

Sets the help topic to display when F1 is pressed.

setMainCursor (self, icon=None, mask=None, x=1, y=1)

Sets the cursor to show what context the user is in.

setObjectColor (self, obj, color)

Draw the unhighlighted object(s) in the specified color.

setObjectTransparency (self, obj=None)

Ensure the transparency of the specfied object is correct or all objects

setPickable (self, pickable=None, ifvisible=False, style=None, **kwds)

Specifies the object(s)/types(s) that are pickable.

setSelectable (self, selectable=None, ifvisible=True, style=None, **kwds)

Determines what objects/types can be selected by the user.

showHelpMessage (self, message, details=None, helpTopic=None, movie=None, movieTitle=’’, buttons=(), keys=(), width=None, relativeTo=None)

Puts a text message under the guide bar to inform the user.

showObjectToolTip (self, obj=None)

Set tool tip in the graphics window when hovering over an object to

showPickedHovered (self, pickedList, cursor=None)

Draws the objects hovered and sets the cursor, if there are any objects

showStatusMessage (self, msg, ms=None)

Shows a message in the status bar.

unsetCursor (self)

Reset the cursor to the default cursor.

updateCounter (self)

Updates the value that the CounterAction shows.

waitCursor (self, message=None)

Python context for displaying a wait cursor.

property isactive#

Returns True if this is the current active context, False otherwise.

onFirstActivate()#

Overload to initialize your context the first time it is activated.

onActivate()#

Overload to initialize your context each time it is activated.

onDeactivate()#

Overload to cleanup your context when it is being deactivated.

onExitAccept()#

Overload to execute code on right mouse button exit.

Return True to prevent the context from being deactivated.

setPickable(pickable=None, ifvisible=False, style=None, **kwds)#

Specifies the object(s)/types(s) that are pickable.

Picked objects are generally used to specify what is passed to the creation of an object. For example, when creating a motor the user picks two features or a fastener.

When objects are picked the onObjectsPicked method is called.

Parameters:
  • pickable (set) – The types/objects that are pickable.

  • ifvisible (bool) – Determines whether to pick only visible objects.

  • style (str) – The picking style.

  • **kwds – TogglePickingStyle kwds, i.e., - windowing = True, # override default - filter = None, # standard setPickable filter - attribute = None, # the object attribute to toggle

getPickedObjects()#

Returns an ObjectList with the picked objects.

addPick(obj, makePickable=True)#

Add the specified object to the PickedList.

Parameters:
  • obj (Union[Named, Feature, Hole]) – The object to be added to the PickedList.

  • makePickable (bool) – Determines whether the object is pickable.

removePick(obj, makeUnpickable=False)#

Removes the specified object from the PickedList.

Parameters:
  • obj (Union[Named, Feature, Hole]) – The object to be removed from the PickedList.

  • makeUnPickable (bool) – Determines whether the object is unpickable.

clearPickList(makeUnpickable=False)#

Removes all picked objects from the PickedList.

Parameters:

makeUnPickable (bool) – Determines whether the object is unpickable.

processPickListEvent(objects)#

Called on any mouse move/press/release from the PickList.

Parameters:

objects (PickedList) – A PickedList that contains the single or box picked objects.

onPicking(objects)#

Overloaded in derived context to process a pick event.

Called on any mouse move/press/release if any pickable objects are under the mouse or inside the pick window.

Parameters:

objects (PickedList) – A PickedList that contains the single or box picked objects.

onObjectsPicked(objects, why)#

Called when one or more pickable object are picked.

Utility method that calls onObjectPicked for each object in objects. Unless you specify windowing in setPickable it may be easier to overload onObjectPicked instead of this method.

Parameters:
  • objects (PickedList) – A PickedList that contains the single or box picked objects.

  • why (str) – Valid choices are: - “add” - “remove” - “inlist”

onObjectPicked(obj, why)#

Called when a pickable object is picked.

This is passed so connector contexts can either:

  • pick 2 features to create the connector: len (self.pickList) == 2

  • pick the same feature twice to connect to ground: why=”inlist”

Parameters:
  • objects (PickedList) – A PickedList that contains the single or box picked objects.

  • why (str) – Valid choices are: - “add” - “remove” - “inlist”

onPickListChanged()#

Called when an object is added to/removed from the pickList.

isolatePicked(forward=True, pickList=None, padded=True)#

Isolate the next/prev object from the pickList.

Tours the pickList - or the selectable objects, if something is selected. And zooms in on each of the items in the pickList, making that item the only one the user can pick.

Parameters:
  • forward (bool) – Determines whether to turn off isolation. None turns off isolation.

  • pickList (PickedList) – A PickedList that contains the single or box picked objects.

  • padded (bool | float) – Leave space around the objects. See hwx.inspire.gui.fitView

getObjectsForIsolate(objsToIsolate=None)#

Returns a list of objects that can be isolated.

Parameters:

objsToIsolate (str) – Valid choices are - “selectable” - “picked” - “pickable”

Returns:

The objects that can be isolated.

Return type:

PickList

canIsolate(objsToIsolate=None)#

Determines if the objects can be isolated.

Parameters:

objsToIsolate (str) – Valid choices are - “selectable” - “picked” - “pickable”

Returns:

True if the objects can be isolated, False otherwise.

Return type:

bool

getIsolatedPick()#

Returns the isolated object(s).

setSelectable(selectable=None, ifvisible=True, style=None, **kwds)#

Determines what objects/types can be selected by the user.

Selected objects are generally the objects being created by the context and when the object is created it is selected. By default the selected objects popup an editor and/or manipulators to modify its values.

Objects can be selected from the browser, tables or the graphics view.

Parameters:
  • (list[Named (selectable) – Feature]): The types and/or objects that can be selected.

  • ifvisible (bool) – Use False to allow picking through/behind other objects.

  • style (str) – The select style.

  • **kwds – Keyword arguments for SelectList.setSelectable.

selectObjects(objects=None, clear=True)#

Selects the specified objects, if they are instances of the types specified in setSelectable.

Parameters:
  • objects (list[Named | Feature | Hole]) – List of objects to be selected.

  • clear (bool) – Determines whether to add the objects to selectList.

deselectObjects(objects=None)#

Deselects the specified objects from the selectList.

Parameters:

objects (list[Union[Named, Feature, Hole]]) – List of objects to be deselected.

clearSelectList(objects=None)#

Deselects all the selected objects.

Parameters:

objects (list[Union[Named, Feature, Hole]]) – List of objects to be deselected.

getSelectedObjects(beforeChange=False, active=True, **kwds)#

Returns an ObjectList with the selected objects.

Parameters:
  • beforeChange (bool) – Determines whether to just return the current selected objects.

  • active (bool) – Determines whether to include only active objects.

  • **kwds – Keyword arguments for filtering with isa.

clearAllLists()#

Clears the PickedList and select list.

onSelecting(objects)#

Overload this method to process any/all selectList events.

Parameters:

objects (SelectList) – The list of selected objects.

Returns:

False to allow other listeners process the event. True to block.

Return type:

bool

filterSelection(objects)#

Overload this method to filter selectable objects when selecting from the browser or tables.

Parameters:

objects (PickedList) – The list of objects to process events.

Returns:

False to allow other listeners to process the event. True to block.

Return type:

bool

onObjectsSelected(objects)#

Called when objects are selected from any view.

Parameters:

objects (PickedList) – The list of selected objects.

onObjectSelected(obj)#

Called when an object is selected from any view.

Overload this method to process the selectList when object is selected.

Parameters:

obj (Union[Named, Feature, Hole]) – The selected object.

onSelectionChanged()#

Overload this method to process the selectList when it changes.

initializeCounter(counterActionName)#

Gets the SpriteCounterAction by this name and automatically manages it.

Parameters:

counterActionName (str) – The name of the SpriteCounterAction.

updateCounter()#

Updates the value that the CounterAction shows.

showPickedHovered(pickedList, cursor=None)#

Draws the objects hovered and sets the cursor, if there are any objects in the pickedList and hovering.

Parameters:
  • pickedList (PickedList) – The list of picked objects.

  • cursor (str) – The cursor type.

Returns:

False if pickedList is empty or hovering, True otherwise.

Return type:

bool

drawHovered(obj=None)#

Draws the object in hover (prehighlight) mode.

It ‘unhovers’ the previous ‘hovered’ from this call.

Parameters:

obj (Union[Named, Feature, Hole]) – The object to be hovered. Defaults to None, and unhovers all objects.

drawHighlighted(obj=None, highlight=True)#

Renders objects highlighted to show the user objects of interest.

Parameters:
  • obj (list[Union[Named, Feature, Hole]]) – The objects to be highlighted.

  • highlight (bool) – Determines whether to highlight the objects.

drawUnhighlighted(obj=None, highlight=False)#

Render objects highlighted to show the user objects of interest.

Parameters:
  • obj (list[Union[Named, Feature, Hole]]) – The objects to be highlighted.

  • highlight (bool) – Determines whether to highlight the objects.

isHighlighted(obj)#

Checks if the specified object is drawn highlighted.

isPickable(obj)#

Checks if an object is pickable via the PickList or SelectList.

Parameters:
  • obj (Union[Named, Feature, Hole]) – The object to be checked.

  • filter (function) – The funtion used to filter objects.

Returns:

True if the object is pickable, False otherwise.

Return type:

bool

makeModelTransparent(transparent=True, filter=None)#

Makes pickable/selectable objects stand out by making the rest of the objects transparent.

Parameters:
  • transparent (bool) – Enable/disable this mode.

  • filter (function(Named) -> bool) – Control which objects go transparent. Return True to keep object opaque. Defaults to pickable/selectable objects.

setObjectTransparency(obj=None)#

Ensure the transparency of the specfied object is correct or all objects if no object is specified.

Parameters:

obj (Union[Named, Feature, Hole]) – The object to checked for transparency. If it is None, apply to all objects.

property modelIsTransparent#

Returns True if the model is transparent, False otherwise.

setObjectColor(obj, color)#

Draw the unhighlighted object(s) in the specified color.

Parameters:
  • obj (Named) – Object(s) to apply the color to

  • color (str, list[float]) – The color to be applied.

redrawGraphics(now=True)#

Force a redraw of the graphics immediately.

Graphic updates are automatically queued to be redrawn on idle but you may want to force it before a long running operation.

Parameters:

now – Does nothing, exists for backwards compatibility.

property objectEditorDialog#

Most recently popped up gui.ObjectEditorDialog

property manipulators#

Most recently popped up gui.Manipulators

property persistedAttributes#

Return values from the popup editor which are used to create objects

When a user creates an object, it is selected, the popup editor is displayed. We want to use the values he changed in editor when the next object is created.

noteState(state=None)#

Shortcut to set a history noteState. This is required after data model operations to support undo/redo

Parameters:

state (str) – name for noteState.

getViewMatrix()#

Returns a Matrix44 to convert from world to view coordinates.

fitView(objects=None, padded=True)#

Center view on the entire model or passed objects.

Parameters:
  • objects (list[Named] | list[Feature] | None) –

  • padded (bool | float) – Leave space around objects. False => 1.0 True => 4.0 for Features, 1.5 for Named objects. 1.0 => Fit at tightest possible size. 2.0 => Show objects at half the screen size. 0.5 => Zoom in extra so only half the objects is visible.

disableColorPicking()#

Disables color based picking while in this context.

Color based picking is the default for picking objects in the graphics view. It is faster than non-color picking, but it can slow down redrawing of the graphics.

You might want to disable it for contexts that require rapid redraws, like animation.

popupObjectEditors(obj)#

Overload this to popup editors when an object of interest is selected.

Editors are ObjectEditorDialog and Manipulator subclasses.

This method defaults to calling popupObjectEditor and popupManipulators so you can optionally implement those instead.

Parameters:

obj (Named) – The last selected object.

popupObjectEditor(obj)#

Overload to popup a gui.ObjectEditorDialog when an object is selected.

Parameters:

obj (Named) – the selected object.

popupManipulators(obj)#

Overload to popup 1 or more gui.Manipulators when an object is selected.

Parameters:

obj (Named) – The last selected object.

showObjectToolTip(obj=None)#

Set tool tip in the graphics window when hovering over an object to let the user know what the object is.

Parameters:

obj (str | Named | Feature) – The object being hovered.

showHelpMessage(message, details=None, helpTopic=None, movie=None, movieTitle='', buttons=(), keys=(), width=None, relativeTo=None)#

Puts a text message under the guide bar to inform the user.

Parameters:
  • message (str) – The message to be printed.

  • details (str) – The longer message that gets displayed when user clicks on message.

  • str) (helpTopic) – The help topic to display when F1 is pressed.

  • movie (str) – The path to an animated gif file.

  • movieTitle (str) – The movie title.

  • buttons (list) – A list of pairs (button, text) where button is a string, which contains a combination of LeftButton, MidButton, RightButton, ShiftButton, ControlButton or AltButton.

  • keys (list) – A list of (key, text) where key is the string name.

  • width (int) – The width of message in pixels.

  • relativeTo (Widget) – The place where to locate the message.

clearHelpMessage()#

Undisplays the help message.

setHelpTopic(helpTopic)#

Sets the help topic to display when F1 is pressed.

Parameters:

helpTopic (str) – The help topic to display.

showStatusMessage(msg, ms=None)#

Shows a message in the status bar.

Parameters:
  • msg (str) – The message to be shown.

  • ms (int) – Indicates the miliseconds that the message will stay for.

clearStatusMessage()#

Removes the message from the status bar if any.

property usageMessage#

Returns and sets the usage message to be reported when the context gets activated.

reportUsage(message)#

Report the usage message within this context.

Parameters:

message (str) – message to be reported.

unsetCursor()#

Reset the cursor to the default cursor.

setMainCursor(icon=None, mask=None, x=1, y=1)#

Sets the cursor to show what context the user is in.

Parameters:
  • icon (str) – The path to icon file.

  • mask (str) – The cursor mask.

  • x (int) – The x location where to place the cursor.

  • y (int) – The y location where to place the cursor.

setCursor(name, ignored=True)#

Set the named cursor if it is not the current one.

Parameters:
  • name (str) –

    The name of the cursor.

    Valid choices are: - “” : The default cursor (arrow) - “MAIN” : show the user what context he is in - ‘+’ : show an object that can be added to the PickedList - ‘-’ : show an object that can be removed from the PickedList - ‘+- : show an object that can be toggled (windowMode) - ‘x’ : show an object that is in the PickedList - .png : The name of an icon file - other : The name of a registered cursor

  • ignored (bool) – For backwards compatibility.

registerCursor(name, icon, mask='', x=1, y=1)#

Cache cursor for lazy create in setCursor.

Parameters:
  • icon (str) – The path to icon file.

  • mask (str) – The cursor mask.

  • x (int) – The x location where to place the cursor.

  • y (int) – The y location where to place the cursor.

waitCursor(message=None)#

Python context for displaying a wait cursor.

Parameters:

message (str) – The message to be displayed in the status bar.

onObjectCreated(obj)#

Overload if interested when an object is created after ListenForModelChanges is called.

Parameters:

obj (Event) – The event being processed.

onObjectDeleted(obj)#

Overload if interested when an object is deleted after ListenForModelChanges is called.

Parameters:

obj (Event) – The event being processed.

onObjectModified(obj, attr)#

Overload if interested when an object is modified after ListenForModelChanges is called.

Parameters:
  • obj (Event) – The event being processed.

  • attr (str) – Name of the attribute that was modified.

onNewProject()#

Overload if you need to clean up when a new model is loaded.

onAboutToExit()#

Overload if you need to stop processing something when the user tries to exit the application during a long loop, like doing an analysis.

onAboutToSave()#

Overload to do something right before Inspire saves an stmod.

If you have a GeneralObject sitting around storing things you don’t want saved in to the stmod, for example.

onMousePress(event)#

Overload this method to define behaviour when mouse is pressed.

Parameters:

event (Event) – The event being processed.

onMouseRelease(event)#

Overload this method to define behaviour when mouse is released.

Parameters:

event (Event) – The event being processed.

onMouseMove(event)#

Overload this method to define behaviour when mouse moves.

Parameters:

event (Event) – The event being processed.

onMouseDoubleClick(event)#

Overload this method to define behaviour on mouse double click.

Parameters:

event (Event) – The event being processed.

onMouseWheel(event)#

Overload this method to define behaviour when mouse wheel is active.

Parameters:

event (Event) – The event being processed.

onKeyPress(event)#

Overload this method to define behaviour when a key is pressed.

Parameters:

event (Event) – The event being processed.

onKeyRelease(event)#

Overload this method to define behaviour when a key is released.

Parameters:

event (Event) – The event being processed.

property ctrlDown#

Returns True if Control key is pressed, False otherwise.

property shiftDown#

Returns True if Shift key is pressed, False otherwise.

property altDown#

Returns True if Alt key is pressed, False otherwise.

property metaDown#

Returns True if Meta key is pressed, False otherwise.

addEventTool(tool, before=False)#

Add event tool to the context.

Parameters:
  • tool (EventTool) – The tool to be added to context.

  • before (bool) – Determines whether to add the tool in the beginning of events list.

pop(**kwds)#

Pops context off context stack, deactivating the context.

Parameters:

**kwds – Forwarded to context’s onDeactivate method

Destroy()#

Destroys this context.

popThisBeforeNewPush(contextToBePushed)#

Specify if the passed context can be pushed on top of the current one.

By default this returns False unless the contextToBePushed._stackable = True.

Overload to support a custom stack of contexts.

Parameters:

contextToBePushed (gui.Context) – Context about to be pushed.

Returns:

bool

pushOnTop(newContext)#

Push newContext on top of current context.

popThisBeforeNewPush is not called since False is implied.

isAllowedToExit(exitControl)#

Called when the user RightMouse clicks or presses escape.

Parameters:

exitControl (int) – Valid choices are: - self.RMB_RELEASE - self.ESC_KEY - self.F1_KEY

Returns:

[description]

Return type:

[type]