enable.trait_defs.ui.kiva_font_editor module

class enable.trait_defs.ui.kiva_font_editor.KivaFontEditor(*args, **traits)[source]

Bases: traitsui.editor_factory.EditorFactory

Editor factory for KivaFontEditors

format_func = Callable(str_font)

The default format func displays a description of the font.

high_resolution = Bool(True)

Switch to turn off high resolution rendering if needed.

sample_text = Str()

Alternative text to display instead of the font description.

class enable.trait_defs.ui.kiva_font_editor.ReadOnlyEditor(parent, **traits)[source]

Bases: enable.trait_defs.ui.editor_with_component.EditorWithLabelComponent

An Editor which displays a label using the font.

init(parent)[source]

Create and initialize the underlying toolkit widget.

This method must be overriden by subclasses. Implementations must ensure that the control trait is set to an appropriate toolkit object.

Parameters

parent (toolkit control) – The parent toolkit object of the editor’s toolkit objects.

string_value(value, format_func=None)[source]

Get a string value to display in the editor.

If the factory provides sample text, use that, otherwise follow the usual path, but default to using the str_font function.

update_editor()[source]

Handle the content of the editor changing.

class enable.trait_defs.ui.kiva_font_editor.SimpleEditor(parent, **traits)[source]

Bases: enable.trait_defs.ui.kiva_font_editor.ReadOnlyEditor

An Editor which displays a label using the font, click for font dialog.

button = Instance(ButtonTool)

Button tool connected to the Label component.

button_clicked(event)[source]

Display a Pyface FontDialog when the button tool is clicked.

create_component()[source]

Create and configure the Label component.

update_object(value)[source]

Handle changes to the font due to user action.

enable.trait_defs.ui.kiva_font_editor.WEIGHTS = {100: ' Thin', 200: ' Extra-light', 300: ' Light', 400: '', 500: ' Medium', 600: ' Semi-bold', 700: ' Bold', 800: ' Extra-bold', 900: ' Heavy', 1000: ' Extra-heavy'}

A mapping of Kiva weight constants to strings.

enable.trait_defs.ui.kiva_font_editor.face_name(font)[source]

Returns a Font’s typeface name.

enable.trait_defs.ui.kiva_font_editor.str_font(font)[source]

Returns the text representation of the specified font trait value