Lomiri
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.

90def _get_urgency(urgency):
91 """Translates urgency string to enum."""
92 _urgency_enums = {'LOW': Notify.Urgency.LOW,
93 'NORMAL': Notify.Urgency.NORMAL,
94 'CRITICAL': Notify.Urgency.CRITICAL}
95 return _urgency_enums.get(urgency.upper())
96
97

◆ 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.

57):
58 """Create an ephemeral (non-interactive) notification
59
60 :param summary: Summary text for the notification
61 :param body: Body text to display in the notification
62 :param icon: Path string to the icon to use
63 :param hint_strings: List of tuples containing the 'name' and value
64 for setting the hint strings for the notification
65 :param urgency: Urgency string for the noticiation, either: 'LOW',
66 'NORMAL', 'CRITICAL'
67 """
68 Notify.init('Lomiri')
69
70 logger.info(
71 "Creating ephemeral: summary(%s), body(%s), urgency(%r) "
72 "and Icon(%s)",
73 summary,
74 body,
75 urgency,
76 icon
77 )
78
79 notification = Notify.Notification.new(summary, body, icon)
80
81 for hint in hints:
82 key, value = hint
83 notification.set_hint_string(key, value)
84 logger.info("Adding hint to notification: (%s, %s)", key, value)
85 notification.set_urgency(_get_urgency(urgency))
86
87 return notification
88
89

◆ 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.

41def disable_qml_mocking(fn):
42 """Simple decorator that disables the QML mocks from being loaded."""
43 @wraps(fn)
44 def wrapper(*args, **kwargs):
45 tests_self = args[0]
46 tests_self._qml_mock_enabled = False
47 return fn(*args, **kwargs)
48 return wrapper
49
50

Variable Documentation

◆ logger

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

Definition at line 38 of file __init__.py.