fsleyes_widgets.autotextctrl
This module provides the AutoTextCtrl class, an alternative to the
wx.TextCtrl, which has auto-completion capability.
I wrote this class because wx.TextCtrl auto-completion does not work under
OSX, and the wx.ComboBox does not give me enough fine-grained control with
respect to managing focus.
- class fsleyes_widgets.autotextctrl.AutoTextCtrl(parent, style=0, modal=True)[source]
Bases:
PanelThe
AutoTextCtrlclass is essentially awx.TextCtrlwhich is able to dynamically show a list of options to the user, with aAutoCompletePopup.Create an
AutoTextCtrl. Supported style flags are:ATC_CASE_SENSITIVE: restrict the auto-completion options to case sensitive matches.ATC_NO_PROPAGATE_ENTER: Cause enter events on theAutoCompletePopupto not be propagated upwards asEVT_ATC_TEXT_ENTERevents.
- Parameters:
parent – The
wxparent object.style – Style flags.
modal – If
True(the default), theAutoCompletePopupis shoown modally. This option is primarily for testing purposes.
- property textCtrl
Returns a reference to the internal
wx.TextCtrl.
- property popup
Returns a reference to the
AutoCompletePopuporNoneif it is not currently shown.
- SetValue(value)[source]
Sets the current value shown on this
AutoTextCtrl.Note
Calling this method will result in an
wx.EVT_TEXTevent being generated - useChangeValue()if you do not want this to occur.
- GenEnterEvent()[source]
Programmatically generates an
EVT_ATC_TEXT_ENTERevent.
- fsleyes_widgets.autotextctrl.ATC_CASE_SENSITIVE = 1
Syle flag for use with the
AutoTextCtrlclass. If set, the auto-completion pattern matching will be case sensitive.
- fsleyes_widgets.autotextctrl.ATC_NO_PROPAGATE_ENTER = 2
Syle flag for use with the
AutoTextCtrlclass. If set, enter events which occur on theAutoCompletePopuplist will not be propagated asEVT_ATC_TEXT_ENTERevents.
- fsleyes_widgets.autotextctrl.EVT_ATC_TEXT_ENTER = <wx.core.PyEventBinder object>
Identifier for the
AutoTextCtrlEnterEvent, which is generated when the user presses enter in anAutoTextCtrl.
- fsleyes_widgets.autotextctrl.AutoTextCtrlEnterEvent
Event generated when the user presses enter in an
AutoTextCtrl. Contains a single attribute,text, which contains the text in theAutoTextCtrl.
- class fsleyes_widgets.autotextctrl.AutoCompletePopup(parent, atc, text, options, style=0)[source]
Bases:
DialogThe
AutoCompletePopupclass is used by theAutoTextCtrlto display a list of completion options to the user.Create an
AutoCompletePopup. Accepts the same style flags as theAutoTextCtrl.- Parameters:
parent – The
wxparent object.atc – The
AutoTextCtrlthat is using this popup.text – Initial text value.
options – A list of all possible auto-completion options.
style – Style flags.
- property textCtrl
Returns a reference to the
wx.TextCtrl.
- property listBox
Returns a reference to the
wx.ListBox.
- fsleyes_widgets.autotextctrl.EVT_ATC_POPUP_DESTROY = <wx.core.PyEventBinder object>
Identifier for the
ATCPopupDestroyEvent.
- fsleyes_widgets.autotextctrl.ATCPopupDestroyEvent
Event emitted when the
AutoCompletePopupis destroyed. This event is emitted because thewx.EVT_WINDOW_DESTROYis too unreliable.