GLXCurses.Entry module¶
-
class
GLXCurses.Entry.
Entry
[source]¶ Bases:
GLXCurses.Widget.Widget
,GLXCurses.Editable.Editable
,GLXCurses.libs.Movable.Movable
Entry — A single line text entry field
Description
The
GLXCurses.Entry
widget is a single line text entry widget. A fairly large set of key bindings are supported by default. If the entered text is longer than the allocation of the widget, the widget will scroll so that the cursor position is visible.When using an entry for passwords and other sensitive information, it can be put into “password mode” using
GLXCurses.Entry.set_visibility()
. In this mode, entered text is displayed using a “invisible” character. By default, GLXCurses picks the best invisible character that is available in the current font, but it can be changed withGLXCurses.Entry.set_invisible_char()
. GLXCurses displays a warning when Caps Lock or input methods might interfere with entering text in a password entry. The warning can be turned off with the “caps-lock-warning” property.-
activates_default
¶ Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed.
Default Value:
False
Returns: True
if the widget is the default widgetReturn type: bool Raises: TypeError – When activates_default
property value is not a bool type or None
-
attributes
¶ A list of attributes to apply to the text of the entry.
This is mainly useful to change the size or weight of the text.
The Attribute’s start_index and end_index must refer to the EntryBuffer text, i.e. without the preedit string.
Default Value:
[]
Returns: attributes to apply to the text of the entry Return type: list Raises: TypeError – When attributes
property value is not a list type or None
-
buffer
¶ Text buffer object which actually stores entry text.
Default Value:
GLXCurses.EntryBuffer()
Returns: The Text buffer object Return type: GLXCurses.EntryBuffer Raises: TypeError – When buffer
property value is not a GLXCurses.EntryBuffer instance or None
-
caps_locks_warning
¶ Whether password entries will show a warning when Caps Lock is on.
Note that the warning is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose.
Default Value:
True
Returns: True
if a warning icon is displayReturn type: bool Raises: TypeError – When caps_locks_warning
property value is not a bool type or None
-
completion
¶ The auxiliary completion object to use with the entry.
Returns: The Completion object Return type: GLXCurses.EntryCompletion Raises: TypeError – When completion
property value is not a GLXCurses.EntryCompletion instance or None
-
cursor_position
¶ The current position of the insertion cursor in chars.
- Allowed values: [0,65535]
- Default Value: 0
Returns: True
if the widget is the default widgetReturn type: bool Raises: TypeError – When cursor_position
property value is not a int type or None
-
editable
¶ Whether the entry contents can be edited.
Returns: True
if the entry contents can be editedReturn type: bool Raises: TypeError – When editable
property value is not a bool type or None
-
enable_emoji_completion
¶ Whether to suggest Emoji replacements.
Default value:
False
Returns: True
if the completion of emoji is enableReturn type: bool Raises: TypeError – When completion
property value is not a bool type or None
-
has_frame
¶ FALSE removes outside bevel from entry.
Default value:
True
Returns: False
removes outside bevel from entry.Return type: bool Raises: TypeError – When has_frame
property value is not a bool type or None
-
im_module
¶ Which IM (input method) module should be used for this entry. See GLXCurses.IMContext.
Setting this to a non-NULL value overrides the system-wide IM module setting. See the GLXCurses.Settings “glxcurses_im_module” property.
Default value:
None
Returns: IM (input method) as text Return type: str or None Raises: TypeError – When im_module
property value is not a str type or None
-
inner_border
¶ Sets the text area’s border between the text and the frame.
Returns: a GLXCurses.GLXC.BorderStyle item
Return type: str
Raises: - TypeError – When
inner_border
property value is not a str type or None - Value – When
inner_border
property value is not a GLXCurses.GLXC.BorderStyle
- TypeError – When
-
input_hints
¶ Additional hints (beyond “input_purpose”) that allow input methods to fine-tune their behaviour.
Returns: GLXC.InputHints item
Return type: str
Raises: - TypeError – When
input_hints
property value is not a str type or None - Value – When
input_hints
property value is not a GLXCurses.GLXC.InputHints
- TypeError – When
-
input_purpose
¶ The purpose of this text field.
This property can be used by on-screen keyboards and other input methods to adjust their behaviour.
Note that setting the purpose to GLXC.INPUT_PURPOSE_PASSWORD or GLXC.INPUT_PURPOSE_PIN is independent from setting “visibility”.
Returns: a GLXCurses.GLXC.InputPurpose item
Return type: str
Raises: - TypeError – When
input_purpose
property value is not a str type or None - Value – When
input_purpose
property value is not a GLXCurses.GLXC.InputPurpose item
- TypeError – When
-
invisible_char
¶ The invisible character is used when masking entry contents (in “password mode”)”). When it is not explicitly set with the “invisible-char” property, GLXCurses determines the character to use from a list of possible candidates, depending on availability in the current font.
This style property allows the theme to prepend a character to the list of candidates.
Default value: ‘*’
Returns: the invisible character Return type: str Raises: TypeError – When invisible_char
property value is not a str type or None
-
invisible_char_set
¶ Whether the invisible char has been set for the GLXCurses.Entry.
Default value:
False
Returns: True
if char has been set for the GLXCurses.Entry.Return type: bool Raises: TypeError – When invisible_char_set
property value is not a bool type or None
-
max_length
¶ Maximum number of characters for this entry. Zero if no maximum.
Default value:
0
Returns: Maximum number of characters for this entry Return type: int Raises: TypeError – When max_length
property value is not a bool type or None
-
max_width_chars
¶ The desired maximum width of the entry, in characters. If this property is set to -1, the width will be calculated automatically.
Allowed values: >= -1
Default value: -1
Returns: The desired maximum width of the entry Return type: int Raises: TypeError – When max_width_chars
property value is not a int type or None
-
overwrite_mode
¶ If text is overwritten when typing in the GLXCurses.Entry.
Default value:
False
Returns: True
If text is overwritten when typingReturn type: bool Raises: TypeError – When overwrite_mode
property value is not a bool type or None
-
placeholder_text
¶ The text that will be displayed in the GtkEntry when it is empty and unfocused.
Default value:
None
Returns: IM (input method) as text Return type: str or None Raises: TypeError – When im_module
property value is not a str type or None
-
populate_all
¶ If
populate_all
isTrue
, the populate-popup signal is also emitted for touch popups.Default value:
False
Returns: True
If populate-popup signal is also emitted for touch popups.Return type: bool Raises: TypeError – When populate_all
property value is not a bool type or None
-
primary_icon_activatable
¶ Whether the primary icon is activatable.
GLXCurses emits the “icon-press” and “icon-release” signals only on sensitive, activatable icons.
Sensitive, but non-activatable icons can be used for purely informational purposes.
Default value:
True
Returns: True
If emit “icon-press” and “icon-release” on sensitive, activable icon.Return type: bool Raises: TypeError – When primary_icon_activatable
property value is not a bool type or None
-
primary_icon_gicon
¶ The GIcon to use for the primary icon for the entry.
Default value:
None
Returns: something like a icon name Return type: str Raises: TypeError – When primary_icon_gicon
property value is not a str type or None
-
primary_icon_name
¶ The icon name to use for the primary icon for the entry.
Default value:
None
Returns: something like a icon name Return type: str Raises: TypeError – When primary_icon_gicon
property value is not a str type or None
-
primary_icon_sensitive
¶ Whether the primary icon is sensitive.
An insensitive icon appears grayed out. GLXCurses does not emit the “icon-press” and “icon-release” signals and does not allow DND from insensitive icons.
An icon should be set insensitive if the action that would trigger when clicked is currently not available.
Default value:
True
Returns: If True
an insensitive icon appears grayed out.Return type: bool Raises: TypeError – When primary_icon_sensitive
property value is not a bool type or None
-
primary_icon_tooltip_markdown
¶ The contents of the tooltip on the primary icon, which is marked up with the text markdown language
Returns: The contents of the tooltip with markdown format Return type: str or None
-
primary_icon_tooltip_text
¶ The contents of the tooltip on the primary icon, which is marked up with the text format
Returns: The contents of the tooltip with text format Return type: str or None
-
progress_fraction
¶ The current fraction of the task that’s been completed.
Allowed values: [0,1]
Default value: 0
Returns: The the fraction value Return type: float
-
new_with_buffer
(buffer=None)[source]¶ Creates a new entry with the specified text buffer.
Note
Utils.is_valid_id()
andUtils.new_id()
are used for identify if thebuffer
is a Galaxie-Curses component. That GLXCurses ID is automatically generate at the widget creation.Parameters: buffer – The buffer to use for the new
GLXCurses.Entry
.Returns: A Entry Buffer object.
Return type: Raises: - TypeError – if
buffer
is notGLXCurses.EntryBuffer
Type - TypeError – if
buffer
haven’t a valid GLXCurses ID
- TypeError – if
-
get_buffer
()[source]¶ Get the GLXCurses.EntryBuffer object which holds the text for this widget.
Returns: A EntryBuffer object. Return type: GLXCurse.Widget
-
set_buffer
(buffer=None)[source]¶ Set the EntryBuffer object which holds the text for this widget.
Parameters: buffer – The buffer to use for the GLXCurses.Entry.
-
set_text
(text)[source]¶ Sets the text in the widget to the given value, replacing the current contents.
See also
GLXCurses.EntryBuffer().set_text()
Parameters: text (String) – The new text
-
get_text
()[source]¶ Retrieves the contents of the entry widget. See also GLXCurses.Editable.get_chars().
This is equivalent to: `` self.buffer = GLXCurses.EntryBuffer() self.buffer.get_text() `` :return: A pointer to the contents of the widget as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored. :rtype: String
-
get_text_length
()[source]¶ Retrieves the current length of the text in entry .
This is equivalent to: `` self.buffer = GLXCurses.EntryBuffer() self.buffer.get_length() ``
Returns: The current number of characters in GtkEntry, or 0 if there are none. Return type: Int in range 0-65536
-
set_visibility
(visible=None)[source]¶ Sets whether the contents of the entry are visible or not. When visibility is set to FALSE, characters are displayed as the invisible char, and will also appear that way when the text in the entry widget is copied elsewhere.
By default, GLXCurse picks the best invisible character available in the current font, but it can be changed with set_invisible_char().
Note
You probably want to set “input_purpose” to glx.INPUT_PURPOSE_PASSWORD or glx.INPUT_PURPOSE_PIN to inform input methods about the purpose of this entry, in addition to setting visibility to FALSE.
Parameters: visible (bool) – True if the contents of the entry are displayed as plaintext Raises: TypeError – if visible
is not boolean type
-
set_invisible_char
(ch='*')[source]¶ Sets the character to use in place of the actual text when set_visibility() has been called to set text visibility to FALSE.
Note
this is the character used in “password mode” to show the user how many characters have been typed.
By default, GLXCurse picks the best invisible char available in the current font.
Note
If you set the invisible char to 0, then the user will get no feedback at all; there will be no text on the stdscr as they type
Parameters: ch (str) – a character Raises: TypeError – if ch
is not printable str
-
unset_invisible_char
()[source]¶ ” Unset the invisible char previously set with set_invisible_char(). So that the default invisible char is used again.
-
set_max_length
(max=None)[source]¶ Sets the maximum allowed length of the contents of the widget. If the current contents are longer than the given length, then they will be truncated to fit.
- This is equivalent to:
- self.buffer = GLXCurses.EntryBuffer() self.buffer.set_max_length()
Parameters: max (int) – The maximum length of the entry, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536.
-
get_activates_default
()[source]¶ Retrieves the value set by set_activates_default().
Returns: TRUE if the entry will activate the default widget Return type: bool
-
get_has_frame
()[source]¶ Gets the value set by set_has_frame().
Returns: whether the entry has a beveled frame Return type: bool
-
get_inner_border
()[source]¶ This function returns the entry’s “inner-border” property. See set_inner_border() for more information.
GLXC.BorderStyle Members:
GLXC.BORDER_STYLE_NONE No visible border GLXC.BORDER_STYLE_SOLID A single line segment GLXC.BORDER_STYLE_INSET Looks as if the content is sunken into the canvas GLXC.BORDER_STYLE_OUTSET Looks as if the content is coming out of the canvas GLXC.BORDER_STYLE_HIDDEN Same as glxc.BORDER_STYLE_NONE GLXC.BORDER_STYLE_DOTTED A series of round dots GLXC.BORDER_STYLE_DASHED A series of square-ended dashes GLXC.BORDER_STYLE_DOUBLE Two parallel lines with some space between them GLXC.BORDER_STYLE_GROOVE Looks as if it were carved in the canvas GLXC.BORDER_STYLE_RIDGE Looks as if it were coming out of the canvas
Returns: a GLXC.BorderStyle type Constant or GLXC.BORDER_STYLE_NONE if none was set Return type: str
-
get_width_chars
()[source]¶ Gets the value set by set_width_chars()
Returns: number of chars to request space for, or negative if unset
-
get_max_width_chars
()[source]¶ Retrieves the desired maximum width of entry , in characters.
set_max_width_chars().
Returns: the maximum width of the entry, in characters Return type: int
-
set_activates_default
(setting)[source]¶ If setting is True, pressing Enter in the entry will activate the default widget for the window containing the entry.
This usually means that the dialog box containing the entry will be closed, since the default widget is usually one of the dialog buttons.
(For experts: if setting is True, the entry calls activate_default() on the window containing the entry, in the default handler for the “activate” signal.)
Parameters: setting (bool) – True to activate window’s default widget on Enter keypress Raises: TypeError – if setting
is not bool type
-
set_has_frame
(setting=True)[source]¶ Sets whether the entry has a beveled frame around it.
Parameters: setting (bool) – False removes outside bevel from entry Raises: TypeError – if setting
is not bool type
-
set_inner_border
(border='BORDER_STYLE_NONE')[source]¶ Sets entry’s inner-border property to border , or clears it if None is passed. The inner-border is the area around the entry’s text, but inside its frame.
If set, this property overrides the inner-border style property. Overriding the style-provided border is useful when you want to do in-place editing of some text in a canvas or list widget, where pixel-exact positioning of the entry is important.
GLXC.BorderStyle
Describes how the border of a UI element should be rendered.
- Members:
- GLXC.BORDER_STYLE_NONE No visible border GLXC.BORDER_STYLE_SOLID A single line segment GLXC.BORDER_STYLE_INSET Looks as if the content is sunken into the canvas GLXC.BORDER_STYLE_OUTSET Looks as if the content is coming out of the canvas GLXC.BORDER_STYLE_HIDDEN Same as glxc.BORDER_STYLE_NONE GLXC.BORDER_STYLE_DOTTED A series of round dots GLXC.BORDER_STYLE_DASHED A series of square-ended dashes GLXC.BORDER_STYLE_DOUBLE Two parallel lines with some space between them GLXC.BORDER_STYLE_GROOVE Looks as if it were carved in the canvas GLXC.BORDER_STYLE_RIDGE Looks as if it were coming out of the canvas
Parameters: border (str) – a valid GLXC.BorderStyle
Raises: - TypeError – if
border
is not str type - TypeError – if
border
is not a valid GLXC.BorderStyle
-
set_width_chars
(n_chars=-1)[source]¶ Changes the size request of the entry to be about the right size for n_chars characters. Note that it changes the size request, the size can still be affected by how you pack the widget into containers.
If n_chars is -1, the size reverts to the default entry size.
Parameters: n_chars (int) – width in chars Raises: TypeError – if n_chars
is not int type
-
set_max_width_chars
(n_chars=-1)[source]¶ Sets the desired maximum width in characters of entry
Parameters: n_chars (int) – the new desired maximum width, in characters Raises: TypeError – if n_chars
is not int type
-
get_invisible_char
()[source]¶ Retrieves the character displayed in place of the real characters for entries with visibility set to false.
See also
set_invisible_char().
Returns: the current invisible char, or 0, if the entry does not show invisible text at all.
-
set_alignment
(xalign=0.0)[source]¶ Sets the alignment for the contents of the entry. This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the entry.
Parameters: xalign (float) – The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts Raises: TypeError – if xalign
is not float type
-
get_alignment
()[source]¶ Gets the value set by
GLXCurses.Entry.set_alignment()
.Returns: The horizontal alignment, from 0 (left) to 1 (right). Return type: float
-
set_placeholder_text
(text=None)[source]¶ Sets text to be displayed in entry when it is empty and unfocused. This can be used to give a visual hint of the expected contents of the
GLXCurses.Entry
.Note
that since the placeholder text gets removed when the entry received focus, using this feature is a bit problematic if the entry is given the initial focus in a window. Sometimes this can be worked around by delaying the initial focus setting until the first key event arrives.
Parameters: text (str or None) – a string to be displayed when entry is empty and unfocused, or None. Raises: TypeError – if text
is not str or None type
-
get_placeholder_text
()[source]¶ Retrieves the text that will be displayed when entry is empty and unfocused
Returns: a pointer to the placeholder text as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored.
-
set_overwrite_mode
(overwrite=False)[source]¶ Sets whether the text is overwritten when typing in the
GLXCurses.Entry
.Parameters: overwrite (bool) – new value Raises: TypeError – if overwrite
is not bool type
-
get_overwrite_mode
()[source]¶ Gets the value set by
GLXCurses.Entry.set_overwrite_mode()
.Returns: whether the text is overwritten when typing. Return type: bool
-
layout_index_to_text_index
()[source]¶ Raises: NotImplementedError – GLXCurses don’t get Pango management
-
text_index_to_layout_index
()[source]¶ Raises: NotImplementedError – GLXCurses don’t get Pango management
-
get_max_length
()[source]¶ Retrieves the maximum allowed length of the text in entry . See
GLXCurses.Entry.set_max_length()
.This is equivalent to getting entry ‘s
GLXCurses.EntryBuffer
and callingGLXCurses.EntryBuffer.get_max_length()
on it.Returns: the maximum allowed number of characters in GLXCurses.Entry, or 0 if there is no maximum. Return type: int
-
get_visibility
()[source]¶ Retrieves whether the text in entry is visible.
Note
GLXCurses.EntryBuffer.set_visibility()
Returns: True if the text is currently visible Return type: bool
-
set_completion
(completion=None)[source]¶ Sets completion to be the auxiliary completion object to use with entry . All further configuration of the completion mechanism is done on completion using the GtkEntryCompletion API. Completion is disabled if completion is set to None.
Parameters: completion (GLXCurses.EntryCompletion.EntryCompletion or None) – The GLXCurses.EntryCompletion.EntryCompletion or None. Raises: TypeError – when completion is not GLXCurses.EntryCompletion or None
-
get_completion
()[source]¶ Returns the auxiliary completion object currently in use by entry .
Returns: The auxiliary completion object currently in use by entry . Return type: GLXCurses.EntryCompletion or None
-
set_cursor_hadjustment
(adjustment=None)[source]¶ Hooks up an adjustment to the cursor position in an entry, so that when the cursor is moved, the adjustment is scrolled to show that position. See scrolled_window_get_hadjustment() for a typical way of obtaining the adjustment.
The adjustment has to be in char units and in the same coordinate system as the entry.
Parameters: adjustment (GLXCurses.Adjustment.Adjustment or None) – an adjustment which should be adjusted when the cursor is moved, or None. Raises: TypeError – when completion is not GLXCurses.Adjustment.Adjustment or None
-
get_cursor_hadjustment
()[source]¶ Retrieves the horizontal cursor adjustment for the entry. See GLXCurses.Adjustment.Adjustment.set_cursor_hadjustment().
Returns: the horizontal cursor adjustment, or NULL if none has been set. Return type: GLXCurses.Adjustment.Adjustment or None
-
set_progress_fraction
(fraction=0.0)[source]¶ Causes the entry’s progress indicator to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.
Parameters: fraction (float) – fraction of the task that’s been completed Raises: TypeError – when fraction is not float type
-
get_progress_fraction
()[source]¶ Returns the current fraction of the task that’s been completed. See GLXCurses.Entry.Entry.set_progress_fraction().
Returns: a fraction from 0.0 to 1.0 Return type: float
-
set_progress_pulse_step
(fraction=0.1)[source]¶ Sets the fraction of total entry width to move the progress bouncing block for each call to GLXCurses.Entry.Entry.progress_pulse().
Parameters: fraction (float) – fraction between 0.0 and 1.0 Raises: TypeError – when fraction is not float type
-
get_progress_pulse_step
()[source]¶ Retrieves the pulse step set with GLXCurses.Entry.Entry.set_progress_pulse_step().
Returns: a fraction from 0.0 to 1.0 Return type: float
-
progress_pulse
()[source]¶ Indicates that some progress is made, but you don’t know how much. Causes the entry’s progress indicator to enter “activity mode,” where a block bounces back and forth. Each call to GLXCurses.Entry.Entry.progress_pulse() causes the block to move by a little bit (the amount of movement per pulse is determined by GLXCurses.Entry.Entry.set_progress_pulse_step()).
Raises: NotImplementedError – GLXCurses don’t deal with that yet.
-
im_context_filter_keypress
()[source]¶ Allow the GLXCurses.Entry input method to internally handle key press and release events.
If this function returns TRUE, then no further processing should be done for this key event.
See GLXCurses.Entry.im_context_filter_keypress().
Note that you are expected to call this function from your handler when overriding key event handling. This is needed in the case when you need to insert your own key handling between the input method and the default key event handling of the GLXCurses.Entry.
See GLXCurses.Entry.text_view_reset_im_context() for an example of use.
Raises: NotImplementedError – GLXCurses don’t deal with that yet.
-
reset_im_context
()[source]¶ Reset the input method context of the entry if needed.
This can be necessary in the case where modifying the buffer would confuse on-going input method behavior.
Raises: NotImplementedError – GLXCurses don’t deal with that yet.
-
get_tabs
()[source]¶ Gets the tabstops that were set on the entry using gtk_entry_set_tabs(), if any.
Raises: NotImplementedError – GLXCurses don’t deal with that yet.
-
set_tabs
()[source]¶ Sets a PangoTabArray; the tabstops in the array are applied to the entry text.
Raises: NotImplementedError – GLXCurses don’t deal with that yet.
-
set_icon_from_icon_name
()[source]¶ Raises: NotImplementedError – GLXCurses don’t get icon’s management
-
set_icon_tooltip_markup
()[source]¶ Raises: NotImplementedError – GLXCurses don’t get icon’s management
-
get_icon_tooltip_markup
()[source]¶ Raises: NotImplementedError – GLXCurses don’t get icon’s management
-
get_current_icon_drag_source
()[source]¶ Raises: NotImplementedError – GLXCurses don’t get icon’s management
-
grab_focus_without_selecting
()[source]¶ Causes entry to have keyboard focus.
It behaves like gtk_widget_grab_focus(), except that it doesn’t select the contents of the entry. You only want to call this on some special entries which the user usually doesn’t want to replace all text in, such as search-as-you-type entries.
-