-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
705 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (C) 2014-2016 New York University | ||
# This file is part of ReproZip which is released under the Revised BSD License | ||
# See file LICENSE for full license details. | ||
|
||
from __future__ import division, print_function, unicode_literals | ||
|
||
from PyQt4 import QtGui | ||
|
||
from reprounzip_qt.gui.unpack import UnpackTab | ||
from reprounzip_qt.gui.run import RunTab | ||
|
||
|
||
class ReprounzipUi(QtGui.QMainWindow): | ||
def __init__(self, unpack={}, run={}, tab=None, **kwargs): | ||
super(ReprounzipUi, self).__init__(**kwargs) | ||
|
||
self.tabs = QtGui.QTabWidget() | ||
self.tabs.addTab(UnpackTab(**unpack), "Open package") | ||
self.tabs.addTab(RunTab(**run), "Run unpacked experiment") | ||
self.tabs.widget(0).unpacked.connect(self._unpacked) | ||
if tab is not None: | ||
self.tabs.setCurrentIndex(tab) | ||
self.setCentralWidget(self.tabs) | ||
|
||
def _unpacked(self, directory, root): | ||
self.tabs.widget(1).set_directory(directory, root=root) | ||
self.tabs.setCurrentIndex(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (C) 2014-2016 New York University | ||
# This file is part of ReproZip which is released under the Revised BSD License | ||
# See file LICENSE for full license details. | ||
|
||
from __future__ import division, print_function, unicode_literals | ||
|
||
from PyQt4 import QtCore, QtGui | ||
|
||
|
||
def error_msg(parent, message, severity, details=None): | ||
if severity == 'information': | ||
icon = QtGui.QMessageBox.Information | ||
elif severity == 'warning': | ||
icon = QtGui.QMessageBox.Warning | ||
else: | ||
icon = QtGui.QMessageBox.Critical | ||
|
||
msgbox = QtGui.QMessageBox(icon, "Error", message, QtGui.QMessageBox.Ok, | ||
parent, detailedText=details, | ||
textFormat=QtCore.Qt.PlainText) | ||
msgbox.exec_() | ||
|
||
|
||
def handle_error(parent, result): | ||
if result in (True, False): | ||
return result | ||
else: | ||
error_msg(parent, *result) | ||
return False | ||
|
||
|
||
class ResizableStack(QtGui.QStackedWidget): | ||
# See http://stackoverflow.com/a/14485901/711380 | ||
def __init__(self, **kwargs): | ||
super(ResizableStack, self).__init__(**kwargs) | ||
|
||
self.currentChanged[int].connect(self._current_changed) | ||
|
||
def addWidget(self, widget): | ||
widget.setSizePolicy(QtGui.QSizePolicy.Ignored, | ||
QtGui.QSizePolicy.Ignored) | ||
super(ResizableStack, self).addWidget(widget) | ||
|
||
def _current_changed(self, idx): | ||
widget = self.widget(idx) | ||
widget.setSizePolicy(QtGui.QSizePolicy.Expanding, | ||
QtGui.QSizePolicy.Expanding) | ||
widget.adjustSize() | ||
self.adjustSize() | ||
|
||
|
||
class ROOT(object): | ||
OPTION_TO_INDEX = {None: 0, 'sudo': 1, 'su': 2} | ||
INDEX_TO_OPTION = {0: None, 1: 'sudo', 2: 'su'} | ||
TEXT = ["no", "with sudo", "with su"] |
Oops, something went wrong.