Loading...
Searching...
No Matches
lomiri::shell Namespace Reference

## Namespaces

namespace | emulators
namespace | fixture_setup
namespace | tests

## Classes

class | ShellView

## Functions

| disable_qml_mocking (fn)
| create_ephemeral_notification (summary='', body='', icon=None, hints=[], urgency='NORMAL')
| _get_urgency (urgency)

## Variables

| logger = logging.getLogger(__name__)

## Detailed Description

    lomiri shell autopilot tests and helpers - sub level package.

## Function Documentation

## _get_urgency()

lomiri.shell._get_urgency | ( |  | urgency | ) |

protected

    Translates urgency string to enum.

Definition at line 90 of file __init__.py.

def _get_urgency(urgency):
"""Translates urgency string to enum."""
_urgency_enums = {'LOW': Notify.Urgency.LOW,
'NORMAL': Notify.Urgency.NORMAL,
'CRITICAL': Notify.Urgency.CRITICAL}
return _urgency_enums.get(urgency.upper())

## create_ephemeral_notification()

lomiri.shell.create_ephemeral_notification | ( |  | summary = '',
|  |  | body = '',
|  |  | icon = None,
|  |  | hints = [],
|  |  | urgency = 'NORMAL' )

    Create an ephemeral (non-interactive) notification

    :param summary: Summary text for the notification
    :param body: Body text to display in the notification
    :param icon: Path string to the icon to use
    :param hint_strings: List of tuples containing the 'name' and value
        for setting the hint strings for the notification
    :param urgency: Urgency string for the noticiation, either: 'LOW',
        'NORMAL', 'CRITICAL'

Definition at line 51 of file __init__.py.

):
"""Create an ephemeral (non-interactive) notification
:param summary: Summary text for the notification
:param body: Body text to display in the notification
:param icon: Path string to the icon to use
:param hint_strings: List of tuples containing the 'name' and value
for setting the hint strings for the notification
:param urgency: Urgency string for the noticiation, either: 'LOW',
'NORMAL', 'CRITICAL'
"""
Notify.init('Lomiri')
logger.info(
"Creating ephemeral: summary(%s), body(%s), urgency(%r) "
"and Icon(%s)",
summary,
body,
urgency,
icon
)
notification = Notify.Notification.new(summary, body, icon)
for hint in hints:
key, value = hint
notification.set_hint_string(key, value)
logger.info("Adding hint to notification: (%s, %s)", key, value)
notification.set_urgency(_get_urgency(urgency))
return notification

## disable_qml_mocking()

lomiri.shell.disable_qml_mocking | ( |  | fn | ) |

    Simple decorator that disables the QML mocks from being loaded.

Definition at line 41 of file __init__.py.

def disable_qml_mocking(fn):
"""Simple decorator that disables the QML mocks from being loaded."""
@wraps(fn)
def wrapper(*args, **kwargs):
tests_self = args[0]
tests_self._qml_mock_enabled = False
return fn(*args, **kwargs)
return wrapper

## Variable Documentation

## logger

lomiri.shell.logger = logging.getLogger(__name__)

Definition at line 38 of file __init__.py.