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)

Bases: wx._core.Panel

The AutoTextCtrl class is essentially a wx.TextCtrl which is able to dynamically show a list of options to the user, with a AutoCompletePopup.

Create an AutoTextCtrl.

Parameters
  • parent – The wx parent object.

  • style – Can be ATC_CASE_SENSITIVE to restrict the auto-completion options to case sensitive matches.

  • modal – If True (the default), the AutoCompletePopup is 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 AutoCompletePopup or None if it is not currently shown.

AutoComplete(options)

Set the list of options to be shown to the user.

GetValue()

Returns the current value shown on this AutoTextCtrl.

SetValue(value)

Sets the current value shown on this AutoTextCtrl.

Note

Calling this method will result in an wx.EVT_TEXT event being generated - use ChangeValue() if you do not want this to occur.

ChangeValue(value)

Sets the current value shown on this AutoTextCtrl.

GetInsertionPoint()

Returns the cursor location in this AutoTextCtrl.

SetInsertionPoint(idx)

Sets the cursor location in this AutoTextCtrl.

GenEnterEvent()

Programmatically generates an EVT_ATC_TEXT_ENTER event.

SetTakeFocus(takeFocus)

If takeFocus is True, this AutoTextCtrl will give itself focus when its AutoCompletePopup is closed.

fsleyes_widgets.autotextctrl.ATC_CASE_SENSITIVE = 1

Syle flag for use with the AutoTextCtrl class. If set, the auto-completion pattern matching will be case sensitive.

fsleyes_widgets.autotextctrl.EVT_ATC_TEXT_ENTER = <wx.core.PyEventBinder object>

Identifier for the AutoTextCtrlEnterEvent, which is generated when the user presses enter in an AutoTextCtrl.

fsleyes_widgets.autotextctrl.AutoTextCtrlEnterEvent

alias of wx.lib.newevent.NewEvent.<locals>._Event

class fsleyes_widgets.autotextctrl.AutoCompletePopup(parent, atc, text, options, style=0)

Bases: wx._core.Dialog

The AutoCompletePopup class is used by the AutoTextCtrl to display a list of completion options to the user.

Create an AutoCompletePopup.

Parameters
  • parent – The wx parent object.

  • atc – The AutoTextCtrl that is using this popup.

  • text – Initial text value.

  • options – A list of all possible auto-completion options.

  • style – Set to ATC_CASE_SENSITIVE to make the pattern matching case sensitive.

GetCount()

Returns the number of auto-completion options currently available.

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

alias of wx.lib.newevent.NewEvent.<locals>._Event