summaryrefslogtreecommitdiff
path: root/grc/gui/NotebookPage.py
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2017-08-03 14:20:31 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2017-08-03 14:20:31 -0700
commit76e0041dc9c8da2d069c9a0f66d05dd0d1959055 (patch)
tree1c653b040cf402979a788088dbf1951697509f9d /grc/gui/NotebookPage.py
parentdea13b30e411b5239c39dd63bc13f5344c945701 (diff)
parent5999bce89cdad39a6eb678b7e4b4063aef211c1d (diff)
Merge remote-tracking branch 'github/pr/1393'
Diffstat (limited to 'grc/gui/NotebookPage.py')
-rw-r--r--grc/gui/NotebookPage.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/grc/gui/NotebookPage.py b/grc/gui/NotebookPage.py
index c9e8d0f18..79ad8bf20 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.