Skip to content
Snippets Groups Projects
Commit 10f27f3f authored by Tristan Van Berkom's avatar Tristan Van Berkom Committed by Tristan Van Berkom
Browse files

_frontend/app.py: Notify session completions

Use the optionally implemented desktop notification method
to notify when a session completes.

Previously, this used to only notify when an interactive prompt
appears.

This is an attempt to fix #385
parent 1e3e2a93
No related branches found
No related tags found
Loading
Pipeline #28089763 passed
...@@ -269,6 +269,9 @@ class App(): ...@@ -269,6 +269,9 @@ class App():
else: else:
self._message(MessageType.FAIL, session_name, elapsed=elapsed) self._message(MessageType.FAIL, session_name, elapsed=elapsed)
# Notify session failure
self._notify("{} failed".format(session_name), "{}".format(e))
if self._started: if self._started:
self._print_summary() self._print_summary()
...@@ -286,6 +289,9 @@ class App(): ...@@ -286,6 +289,9 @@ class App():
if self._started: if self._started:
self._print_summary() self._print_summary()
# Notify session success
self._notify("{} succeeded".format(session_name), "")
# init_project() # init_project()
# #
# Initialize a new BuildStream project, either with the explicitly passed options, # Initialize a new BuildStream project, either with the explicitly passed options,
...@@ -419,6 +425,12 @@ class App(): ...@@ -419,6 +425,12 @@ class App():
# Local Functions # # Local Functions #
############################################################ ############################################################
# Local function for calling the notify() virtual method
#
def _notify(self, title, text):
if self.interactive:
self.notify(title, text)
# Local message propagator # Local message propagator
# #
def _message(self, message_type, message, **kwargs): def _message(self, message_type, message, **kwargs):
...@@ -571,8 +583,8 @@ class App(): ...@@ -571,8 +583,8 @@ class App():
while choice not in ['continue', 'quit', 'terminate', 'retry']: while choice not in ['continue', 'quit', 'terminate', 'retry']:
click.echo(summary, err=True) click.echo(summary, err=True)
self.notify("BuildStream failure", "{} on element {}" self._notify("BuildStream failure", "{} on element {}"
.format(failure.action_name, element.name)) .format(failure.action_name, element.name))
try: try:
choice = click.prompt("Choice:", default='continue', err=True, choice = click.prompt("Choice:", default='continue', err=True,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment