fsleyes_widgets.texttag¶
This module provides two classes:
StaticTextTag |
The StaticTextTag class is a wx.Panel which contains a StaticText control, and a close button. |
TextTagPanel |
The TextTagPanel is a panel which contains a control allowing the user to add new tags, and a collection of StaticTextTag controls. |
-
class
fsleyes_widgets.texttag.StaticTextTag(parent, text=None, bgColour='#aaaaaa', borderColour='#ffcdcd')¶ Bases:
wx._core.PanelThe
StaticTextTagclass is awx.Panelwhich contains aStaticTextcontrol, and a close button. The displayed text and background colour are configurable.When the close button is pushed, an
EVT_STT_CLOSEis generated.Create a
StaticTextTag.Parameters: - parent – The
wxparent object. - text – Initial text to display.
- bgColour – Initial background colour.
- borderColour – Initial border colour.
-
__init__(parent, text=None, bgColour='#aaaaaa', borderColour='#ffcdcd')¶ Create a
StaticTextTag.Parameters: - parent – The
wxparent object. - text – Initial text to display.
- bgColour – Initial background colour.
- borderColour – Initial border colour.
- parent – The
-
__str__()¶ Returns a string representation of this
StaticTextTag.
-
closeButton¶ Returns a reference to the
StaticTextcontrol used as the close button.
-
text¶ Returns a reference to the
StaticTextcontrol used for displaying the tag text.
-
SetBackgroundColour(colour)¶ Sets the background colour of this
StaticTextTag.
-
SetBorderColour(colour)¶ Sets the border colour of this
StaticTextTag, for when it has focus.
-
SetText(text)¶ Sets the text shown on this
StaticTextTag.
-
GetText()¶ Returns the text shown on this
StaticTextTag.
-
_StaticTextTag__onCloseButton(ev)¶ Called when the close button is pushed. Generates an
EVT_STT_CLOSE.
-
_StaticTextTag__onKillFocus(ev)¶ Called when this
StaticTextTagloses focus. Clears the border colour.
-
_StaticTextTag__onSetFocus(ev)¶ Called when this
StaticTextTaggains focus. Changes the border colour.
-
__module__= 'fsleyes_widgets.texttag'¶
- parent – The
-
fsleyes_widgets.texttag.EVT_STT_CLOSE= <wx.core.PyEventBinder object>¶ Identifier for the event generated by a
StaticTextTagwhen its close button is pushed.
-
fsleyes_widgets.texttag.StaticTextTagCloseEvent¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event
-
class
fsleyes_widgets.texttag.TextTagPanel(parent, style=None)¶ Bases:
wx._core.PanelThe
TextTagPanelis a panel which contains a control allowing the user to add new tags, and a collection ofStaticTextTagcontrols.The
TextTagPanelsupports the following styles:TTP_ALLOW_NEW_TAGSStyle flag for use with a TextTagPanel- if set, the user is able to type in tag names that are not known by theAutoTextCtrl.TTP_ADD_NEW_TAGSStyle flag for use with a TextTagPanel- if set, when the user types in a tag name that is not known by theAutoTextCtrl, that name is added to its list of options.TTP_NO_DUPLICATESStyle flag for use with a TextTagPanel- if set, the user will be prevented from adding the same tag more than once.TTP_CASE_SENSITIVEStyle flag for use with a TextTagPanel- if set, the auto-completion options will be case sensitive.TTP_KEYBOARD_NAVStyle flag for use with a TextTagPanel- if set, the user can use the left and right arrow keys to move between the new tag control and the tags and, when a tag is focused can use the delete/backspace keys to remove it.The
TextTagPanelgenerates the following events:EVT_TTP_TAG_REMOVEDInstances of this class are used to bind specific events to event handlers. EVT_TTP_TAG_ADDEDInstances of this class are used to bind specific events to event handlers. EVT_TTP_TAG_SELECTInstances of this class are used to bind specific events to event handlers. Create a
TextTagPanel.Parameters: - parent – The
wxparent object. - style – Style flags. Defaults to
TTP_ALLOW_NEW_TAGS | TTP_ADD_NEW_TAGS.
-
__init__(parent, style=None)¶ Create a
TextTagPanel.Parameters: - parent – The
wxparent object. - style – Style flags. Defaults to
TTP_ALLOW_NEW_TAGS | TTP_ADD_NEW_TAGS.
- parent – The
-
newTagCtrl¶ Returns a reference to the
AutoTextCtrl.
Returns a list containing all
StaticTextTagwidgets.
-
FocusNewTagCtrl()¶ Gives focus to the new tag control (an
AutoTextCtrl).
-
SelectTag(tag)¶ Gives focus to the
StaticTextTagcontrol with the specified tag, if it exists.
-
SetOptions(options, colours=None)¶ Sets the tag options made available to the user via the
AutoTextCtrl.Parameters: - options – A sequence of tags that the user can choose from.
- colours – A sequence of corresponding colours for each tag.
-
GetOptions()¶ Returns a list of all the tags that are currently available to the user.
-
AddTag(tag, colour=None)¶ Add a new
StaticTextTagto thisTextTagPanel.Parameters: - tag – The tag text.
- colour – The tag background colour.
-
RemoveTag(tag)¶ Removes the specified tag.
-
GetTags()¶ Returns a list containing all active tags in this
TextTagPanel.
-
ClearTags()¶ Removes all tags from this
TextTagPanel.
-
GetTagIndex(tag)¶ Returns the index of the specified tag.
-
TagCount()¶ Returns the number of tags currently visible.
-
HasTag(tag)¶ Returns
Trueif the given tag is currently shown,Falseotherwise.
-
GetTagColour(tag)¶ Returns the background colour of the specified
tag, orNoneif there is no default colour for the tag.
-
SetTagColour(tag, colour)¶ Sets the background colour on all
StaticTextTagitems which have the given tag text.
-
_TextTagPanel__onNewTagKeyDown(ev)¶ Called on key down events from the new tag control (if the
TTP_KEYBOARD_NAVstyle is set). If the right arrow key is pushed, the firstStaticTextTagis given input focus.
-
_TextTagPanel__onTagClose(ev)¶ Called when the user pushes the close button on a
StaticTextTag. Removes the tag, and generates aEVT_TTP_TAG_REMOVEDevent.
-
_TextTagPanel__onTagKeyDown(ev)¶ Called on key down events from a
StaticTextTagobject. If the left/right arrow keys are pushed, the focus is shifted accordingly.
-
_TextTagPanel__onTagLeftDown(ev)¶ Called on left mouse down events on
StaticTextTagobjects (only if theTTP_KEYBOARD_NAVstyle is set). Gives the tag focus.
-
_TextTagPanel__onTextCtrl(ev)¶ Called when the user enters a new value via the
TextCtrl(if thisTextTagPanelallows new tags). Adds the new tag, and generates anEVT_TTP_TAG_ADDEDevent.
-
_TextTagPanel__selectTag(stt)¶ Called by event handlers which listen for mouse/keyboard activity on
StaticTextTagwidgets. Focuses the givenStaticTextTag, and generates anEVT_TTP_TAG_SELECTevent.
-
_TextTagPanel__updateNewTagOptions()¶ Updates the options shown on the new tag control.
-
__module__= 'fsleyes_widgets.texttag'¶
- parent – The
-
fsleyes_widgets.texttag.TTP_ALLOW_NEW_TAGS= 1¶ Style flag for use with a
TextTagPanel- if set, the user is able to type in tag names that are not known by theAutoTextCtrl.
-
fsleyes_widgets.texttag.TTP_ADD_NEW_TAGS= 2¶ Style flag for use with a
TextTagPanel- if set, when the user types in a tag name that is not known by theAutoTextCtrl, that name is added to its list of options. This flag only has an effect if theTTP_ALLOW_NEW_TAGSflag is also set.
-
fsleyes_widgets.texttag.TTP_NO_DUPLICATES= 4¶ Style flag for use with a
TextTagPanel- if set, the user will be prevented from adding the same tag more than once.
-
fsleyes_widgets.texttag.TTP_CASE_SENSITIVE= 8¶ Style flag for use with a
TextTagPanel- if set, the auto-completion options will be case sensitive. This flag only has an effect if theTTP_ALLOW_NEW_TAGSflag is also set.
-
fsleyes_widgets.texttag.TTP_KEYBOARD_NAV= 16¶ Style flag for use with a
TextTagPanel- if set, the user can use the left and right arrow keys to move between the new tag control and the tags and, when a tag is focused can use the delete/backspace keys to remove it.
-
fsleyes_widgets.texttag.EVT_TTP_TAG_ADDED= <wx.core.PyEventBinder object>¶ Identifier for the event generated when a tag is added to a
TextTagPanel.
-
fsleyes_widgets.texttag.TextTagPanelTagAddedEvent¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event
-
fsleyes_widgets.texttag.EVT_TTP_TAG_REMOVED= <wx.core.PyEventBinder object>¶ Identifier for the event generated when a tag is removed from a
TextTagPanel.
-
fsleyes_widgets.texttag.TextTagPanelTagRemovedEvent¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event
-
fsleyes_widgets.texttag.EVT_TTP_TAG_SELECT= <wx.core.PyEventBinder object>¶ Identifier for the event generated when a tag is selected in a
TextTagPanel.
-
fsleyes_widgets.texttag.TextTagPanelTagSelectEvent¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event