From ce392051f51ce484e81dd33bda9065b38e8763fb Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Fri, 25 Aug 2017 16:52:36 -0400 Subject: [PATCH] Add the Vis to the Qt GUI as well --- reprounzip-qt/reprounzip_qt/gui/unpack.py | 6 ++++++ reprounzip-qt/reprounzip_qt/reprounzip_interface.py | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/reprounzip-qt/reprounzip_qt/gui/unpack.py b/reprounzip-qt/reprounzip_qt/gui/unpack.py index a8b6608f1..ed3dbbf46 100644 --- a/reprounzip-qt/reprounzip_qt/gui/unpack.py +++ b/reprounzip-qt/reprounzip_qt/gui/unpack.py @@ -259,6 +259,9 @@ def __init__(self, package='', **kwargs): buttons = QtGui.QHBoxLayout() buttons.addStretch(1) + vis = QtGui.QPushButton("Show provenance") + vis.clicked.connect(self._show_vis) + buttons.addWidget(vis) self.unpack_widget = QtGui.QPushButton("Unpack experiment", enabled=False) self.unpack_widget.clicked.connect(self._unpack) @@ -318,3 +321,6 @@ def _unpack(self): options.get('root')) else: error_msg(self, "No unpacker selected", 'warning') + + def _show_vis(self): + handle_error(self, reprounzip.show_vis(self.package_widget.text())) diff --git a/reprounzip-qt/reprounzip_qt/reprounzip_interface.py b/reprounzip-qt/reprounzip_qt/reprounzip_interface.py index 6a9882d8f..6596cae67 100644 --- a/reprounzip-qt/reprounzip_qt/reprounzip_interface.py +++ b/reprounzip-qt/reprounzip_qt/reprounzip_interface.py @@ -301,6 +301,17 @@ def download(directory, name, path, unpacker=None, root=None): return code == 0 +def show_vis(package): + reprounzip = find_command('reprounzip') + if reprounzip is None: + return ("Couldn't find reprounzip command -- is reprounzip installed?", + 'critical') + + run_in_builtin_terminal([reprounzip, 'vis', package], {}, + text="Running provenance visualization") + return True + + def run_in_builtin_terminal_maybe(cmd, root, env={}, **kwargs): if root is None: code = run_in_builtin_terminal(cmd, env, **kwargs)