How to use the reprounzip-qt.reprounzip_qt.qt_terminal.Terminal function in reprounzip-qt

To help you get started, we’ve selected a few reprounzip-qt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github VIDA-NYU / reprozip / reprounzip-qt / reprounzip_qt / qt_terminal.py View on Github external
def __init__(self, cmdline, env, input_enabled=False,
                 success_msg=None, fail_msg=None,
                 **kwargs):
        super(Terminal, self).__init__(**kwargs)

        self.success_msg = success_msg or "Command finished"
        self.fail_msg = fail_msg or "Command failed"

        layout = QtGui.QVBoxLayout()
        self.text = QtGui.QTextEdit(readOnly=True)
        layout.addWidget(self.text)
        if input_enabled:
            self.input = QtGui.QLineEdit()
            self.input.returnPressed.connect(self._enter)
            layout.addWidget(self.input)
        else:
            self.input = None
        self.setLayout(layout)

        self.process = QtCore.QProcess(self)
github VIDA-NYU / reprozip / reprounzip-qt / reprounzip_qt / qt_terminal.py View on Github external
def run_in_builtin_terminal(cmd, env,
                            text=None, success_msg=None, fail_msg=None):
    result = [False]

    def store_result(code):
        result[:] = [code]

    dialog = QtGui.QDialog()
    layout = QtGui.QVBoxLayout()
    if text is not None:
        layout.addWidget(QtGui.QLabel(text))
    terminal = Terminal(cmd, env, input_enabled=False,
                        success_msg=success_msg, fail_msg=fail_msg)
    terminal.finished.connect(store_result)
    layout.addWidget(terminal)
    buttons = QtGui.QHBoxLayout()
    buttons.addStretch(1)
    accept = QtGui.QPushButton("Close", enabled=False)
    accept.clicked.connect(dialog.accept)
    terminal.finished.connect(lambda _: accept.setEnabled(True))
    buttons.addWidget(accept)
    layout.addLayout(buttons)
    dialog.setLayout(layout)
    dialog.exec_()

    return result[0]