[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/06: grc: show fg return code if not 0 (B
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/06: grc: show fg return code if not 0 (Bug #726) |
Date: |
Wed, 1 Oct 2014 19:33:00 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 71aad443dfd5dd75942babec5ba26b55a71e79fc
Author: Sebastian Koslowski <address@hidden>
Date: Thu Sep 18 10:01:15 2014 -0400
grc: show fg return code if not 0 (Bug #726)
---
grc/gui/ActionHandler.py | 15 +++++++++------
grc/gui/Messages.py | 8 +++++---
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index c06dc96..2e968fa 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -491,9 +491,11 @@ class ActionHandler:
ExecFlowGraphThread(self)
elif action == Actions.FLOW_GRAPH_KILL:
if self.get_page().get_proc():
- try: self.get_page().get_proc().kill()
- except: print "could not kill process:
%d"%self.get_page().get_proc().pid
- elif action == Actions.PAGE_CHANGE: #pass and run the global actions
+ try:
+ self.get_page().get_proc().kill()
+ except:
+ print "could not kill process: %d" %
self.get_page().get_proc().pid
+ elif action == Actions.PAGE_CHANGE: # pass and run the global actions
pass
elif action == Actions.RELOAD_BLOCKS:
self.platform.load_blocks()
@@ -579,7 +581,7 @@ class ActionHandler:
sensitive = self.get_flow_graph().is_valid() and not
self.get_page().get_proc()
Actions.FLOW_GRAPH_GEN.set_sensitive(sensitive)
Actions.FLOW_GRAPH_EXEC.set_sensitive(sensitive)
- Actions.FLOW_GRAPH_KILL.set_sensitive(self.get_page().get_proc() !=
None)
+ Actions.FLOW_GRAPH_KILL.set_sensitive(self.get_page().get_proc() is
not None)
class ExecFlowGraphThread(Thread):
"""Execute the flow graph as a new process and wait on it to finish."""
@@ -615,13 +617,14 @@ class ExecFlowGraphThread(Thread):
"""
#handle completion
r = "\n"
- while(r):
+ while r:
gobject.idle_add(Messages.send_verbose_exec, r)
r = os.read(self.p.stdout.fileno(), 1024)
+ self.p.poll()
gobject.idle_add(self.done)
def done(self):
"""Perform end of execution tasks."""
- Messages.send_end_exec()
+ Messages.send_end_exec(self.p.returncode)
self.page.set_proc(None)
self.update_exec_stop()
diff --git a/grc/gui/Messages.py b/grc/gui/Messages.py
index f220b6d..90f508d 100644
--- a/grc/gui/Messages.py
+++ b/grc/gui/Messages.py
@@ -24,15 +24,17 @@ import os
## A list of functions that can receive a message.
MESSENGERS_LIST = list()
+
def register_messenger(messenger):
"""
Append the given messenger to the list of messengers.
Args:
- messenger: a method thats takes a string
+ messenger: a method that takes a string
"""
MESSENGERS_LIST.append(messenger)
+
def send(message):
"""
Give the message to each of the messengers.
@@ -102,8 +104,8 @@ def send_start_exec(file_path):
def send_verbose_exec(verbose):
send(verbose)
-def send_end_exec():
- send('\n>>> Done\n')
+def send_end_exec(returncode=0):
+ send('\n>>> Done%s\n' % (" (return code %s)" % returncode if returncode
else ""))
################# functions for saving flow graphs
########################################
def send_fail_save(file_path):
- [Commit-gnuradio] [gnuradio] branch master updated (029079c -> d598e49), git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 05/06: Merge branch 'maint', git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 06/06: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 04/06: grc: move font size definition in Constants.py, git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 01/06: grc: making qt-gui the default (Feature #634), git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 03/06: grc: switch timestamp in grc files from modified to created, git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 02/06: grc: show fg return code if not 0 (Bug #726),
git <=