diff options
Diffstat (limited to 'grc')
-rw-r--r-- | grc/core/Param.py | 8 | ||||
-rw-r--r-- | grc/gui/ActionHandler.py | 4 | ||||
-rw-r--r-- | grc/gui/NotebookPage.py | 25 | ||||
-rw-r--r-- | grc/scripts/freedesktop/gnuradio-grc.desktop | 3 |
4 files changed, 37 insertions, 3 deletions
diff --git a/grc/core/Param.py b/grc/core/Param.py index afa478b3a2..00c9e7d827 100644 --- a/grc/core/Param.py +++ b/grc/core/Param.py @@ -135,6 +135,14 @@ class TemplateArg(object): def __getitem__(self, item): return str(self._param.get_opt(item)) if self._param.is_enum() else NotImplemented + def __getattr__(self, item): + if not self._param.is_enum(): + raise AttributeError() + try: + return str(self._param.get_opt(item)) + except KeyError: + raise AttributeError() + def __str__(self): return str(self._param.to_code()) diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py index 5d48485238..017dab3346 100644 --- a/grc/gui/ActionHandler.py +++ b/grc/gui/ActionHandler.py @@ -626,9 +626,9 @@ class ActionHandler: elif action == Actions.FLOW_GRAPH_KILL: if page.get_proc(): try: - page.get_proc().kill() + page.term_proc() except: - print "could not kill process: %d" % page.get_proc().pid + print "could not terminate process: %d" % page.get_proc().pid elif action == Actions.PAGE_CHANGE: # pass and run the global actions pass elif action == Actions.RELOAD_BLOCKS: diff --git a/grc/gui/NotebookPage.py b/grc/gui/NotebookPage.py index c9e8d0f186..79ad8bf207 100644 --- a/grc/gui/NotebookPage.py +++ b/grc/gui/NotebookPage.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import pygtk pygtk.require('2.0') import gtk +import gobject import Actions from StateCache import StateCache from Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT @@ -152,6 +153,30 @@ class NotebookPage(gtk.HBox): """ self.process = process + def term_proc(self): + """ + Terminate the subprocess object + + Add a callback to kill the process + after 2 seconds if not already terminated + """ + def kill(process): + """ + Kill process if not already terminated + + Called by gobject.timeout_add + + Returns: + False to stop timeout_add periodic calls + """ + is_terminated = process.poll() + if is_terminated is None: + process.kill() + return False + + self.get_proc().terminate() + gobject.timeout_add(2000, kill, self.get_proc()) + def get_flow_graph(self): """ Get the flow graph. diff --git a/grc/scripts/freedesktop/gnuradio-grc.desktop b/grc/scripts/freedesktop/gnuradio-grc.desktop index 39beeca1b8..f065ce4568 100644 --- a/grc/scripts/freedesktop/gnuradio-grc.desktop +++ b/grc/scripts/freedesktop/gnuradio-grc.desktop @@ -1,7 +1,8 @@ [Desktop Entry] Version=1.0 Type=Application -Name=GRC +Name=GNU Radio Companion +Comment=Graphical tool for creating signal flow graphs and generating flow-graph source code Exec=gnuradio-companion %F Categories=Development; MimeType=application/gnuradio-grc; |