ae.enaml_app
enaml application widgets, helper functions and classes
the enaml module widgets is providing widgets to write themed applications which can switch their font colors and backgrounds at run-time between dark and light.
another set of widgets provided by this namespace portion allows the automatic change of the application flow with only few lines of code.
to convert colors between the enaml and other formats the functions declared in the functions
of this package
can be used.
main application class for GUIApp-conform Enaml app
the classes FrameworkApp
and EnamlMainApp
of this ae portion are bundling and adding useful
attributes and methods for your application and are extendable by creating a subclass.
the class EnamlMainApp
is implementing a main app class that is reducing the amount of code needed to create a
Python application based on the enaml framework.
EnamlMainApp
is based on the following classes:
the abstract base class
MainAppBase
which is providing application status (including app state variables and app state constants), application flow and application events.the class
ConsoleApp
is adding config files, config variables and config options.the class
AppBase
is adding application logging and application debugging.
the main app class EnamlMainApp
is also encapsulating the enaml app class for the Qt widget set
(<enaml.QtApplication>) within the FrameworkApp
class.
an instance of the Enaml app class can be directly accessed from the main app class instance via the
framework_app
attribute.
enaml application events
this portion is firing application events additional to the ones provided by MainAppBase
.
these framework app events get fired after on_app_run()
in the following order:
on_app_build (fired on start of the application event loop).
on_app_stopped (fired after the main application window got closed)
Functions
|
converts the Qt key-press/-release event into a modifiers and key code string. |
Classes
|
enaml application main base class |
|
enaml framework application class with atom member/attribute support. |
- convert_key_event_to_code(event)[source]
converts the Qt key-press/-release event into a modifiers and key code string.
- class FrameworkApp(*args, **kwargs)[source]
Bases:
QtApplication
enaml framework application class with atom member/attribute support.
- app_state_flow_id
A value of type str.
By default, bytes will NOT be promoted to strings. Pass strict=False to the constructor to enable loose string checking.
- app_state_flow_path
A List member which supports container notifications.
- app_state_font_size
A value of type float.
By default, ints and longs will be promoted to floats. Pass strict=True to the constructor to enable strict float checking.
- app_state_light_theme
A value of type bool.
- app_state_sound_volume
A value of type float.
By default, ints and longs will be promoted to floats. Pass strict=True to the constructor to enable strict float checking.
- app_state_win_rectangle
A member which allows tuple values.
If item validation is used, then assignment will create a copy of the original tuple before validating the items, since validation may change the item values.
- app_state_flow_id_ink
A member which allows list values.
Assigning to a list creates a copy. The orginal list will remain unmodified. This is similar to the semantics of the assignment operator on the C++ STL container classes.
- app_state_flow_path_ink
A member which allows list values.
Assigning to a list creates a copy. The orginal list will remain unmodified. This is similar to the semantics of the assignment operator on the C++ STL container classes.
- app_state_selected_item_ink
A member which allows list values.
Assigning to a list creates a copy. The orginal list will remain unmodified. This is similar to the semantics of the assignment operator on the C++ STL container classes.
- app_state_unselected_item_ink
A member which allows list values.
Assigning to a list creates a copy. The orginal list will remain unmodified. This is similar to the semantics of the assignment operator on the C++ STL container classes.
- landscape
saved via win_rectangle app state
- max_font_size
maximum font size in pixels bound to window size
- min_font_size
minimum - “ -
- mixed_back_ink
mixed color - used for user pref dropdown opening button
- __atom_specific_members__ = frozenset({'app_state_flow_id', 'app_state_flow_id_ink', 'app_state_flow_path', 'app_state_flow_path_ink', 'app_state_font_size', 'app_state_light_theme', 'app_state_selected_item_ink', 'app_state_sound_volume', 'app_state_unselected_item_ink', 'app_state_win_rectangle', 'landscape', 'max_font_size', 'min_font_size', 'mixed_back_ink'})
- __slotnames__ = []
- class EnamlMainApp(**console_app_kwargs)[source]
Bases:
MainAppBase
enaml application main base class
- init_app(framework_app_class=<class 'ae.enaml_app.FrameworkApp'>)[source]
initialize framework app instance and root window/layout, return GUI event loop start/stop methods.
- cached_icon(icon_name, size, light)[source]
get cached image/icon object.
- Return type:
Optional
[Icon
]
- call_method_delayed(_delay, callback, *args, **kwargs)[source]
delay not implemented - for now redirect to direct call.
- Return type:
- focus_widget(widget)[source]
set input/keyboard focus to the passed widget.
- Parameters:
widget¶ (
Widget
) – widget/window that will receive the focus.
- focused_widget()[source]
enaml/qt focus debug helper method determining tool tip of the current qt widget with focus
- Return type:
- Returns:
tool tip string of current focus or app window status.
- key_press_from_enaml(event)[source]
convert/normalize enaml/Qt key press/down event and pass it to MainAppBase key press dispatcher.
- key_release_from_enaml(event)[source]
convert/normalize enaml/Qt key release/up event and pass it to MainAppBase key release dispatcher.
- on_font_size_change(_flow_key, event_kwargs)[source]
font size app state flow change confirmation event handler.
- win_activated(main_window)[source]
main window activated event handler, called only once on app startup via widgets.enaml/ThemeMainWindow.