Python PyQt5.QtWidgets.QMessageBox.Retry() Examples

The following are 8 code examples of PyQt5.QtWidgets.QMessageBox.Retry(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWidgets.QMessageBox , or try the search function .
Example #1
Source File: tor.py    From gridsync with GNU General Public License v3.0 6 votes vote down vote up
def get_tor_with_prompt(reactor, parent=None):
    tor = yield get_tor(reactor)
    while not tor:
        msgbox = QMessageBox(parent)
        msgbox.setIcon(QMessageBox.Critical)
        msgbox.setWindowTitle("Tor Required")
        msgbox.setText(
            "This connection can only be made over the Tor network, however, "
            "no running Tor daemon was found or Tor has been disabled."
        )
        msgbox.setInformativeText(
            "Please ensure that Tor is running and try again.<p>For help "
            "installing Tor, visit "
            "<a href=https://torproject.org>https://torproject.org</a>"
        )
        msgbox.setStandardButtons(QMessageBox.Abort | QMessageBox.Retry)
        if msgbox.exec_() == QMessageBox.Retry:
            tor = yield get_tor(reactor)
        else:
            break
    return tor 
Example #2
Source File: tabMNConf.py    From PIVX-SPMT with MIT License 5 votes vote down vote up
def findPubKey(self):
        printDbg("Computing public key...")
        currSpath = self.ui.edt_spath.value()
        currHwAcc = self.ui.edt_hwAccount.value()
        # Check HW device
        if self.caller.hwStatus != 2:
            myPopUp_sb(self.caller, "crit", 'SPMT - hw device check', "Connect to HW device first")
            printDbg("Unable to connect to hardware device. The device status is: %d" % self.caller.hwStatus)
            return None

        result = self.caller.hwdevice.scanForPubKey(currHwAcc, currSpath, self.isTestnet())

        # Connection pop-up
        warningText = "Unable to find public key. The action was refused on the device or another application "
        warningText += "might have taken over the USB communication with the device.<br><br>"
        warningText += "To continue click the <b>Retry</b> button.\nTo cancel, click the <b>Abort</b> button."
        mBox = QMessageBox(QMessageBox.Critical, "WARNING", warningText, QMessageBox.Retry)
        mBox.setStandardButtons(QMessageBox.Retry | QMessageBox.Abort);

        while result is None:
            ans = mBox.exec_()
            if ans == QMessageBox.Abort:
                return
            # we need to reconnect the device
            self.caller.hwdevice.clearDevice()
            self.caller.hwdevice.initDevice(self.caller.header.hwDevices.currentIndex())

            result = self.caller.hwdevice.scanForPubKey(currHwAcc, currSpath, self.isTestnet())

        mess = "Found public key:\n%s" % result
        myPopUp_sb(self.caller, "info", "SPMT - findPubKey", mess)
        printOK("Public Key: %s" % result)
        self.ui.edt_pubKey.setText(result) 
Example #3
Source File: recovery.py    From gridsync with GNU General Public License v3.0 5 votes vote down vote up
def _on_decryption_failed(self, msg):
        logging.error("%s", msg)
        self.crypter_thread.quit()
        if msg == "Decryption failed. Ciphertext failed verification":
            msg = "The provided passphrase was incorrect. Please try again."
        reply = QMessageBox.critical(
            self.parent,
            "Decryption Error",
            msg,
            QMessageBox.Abort | QMessageBox.Retry,
        )
        self.crypter_thread.wait()
        if reply == QMessageBox.Retry:
            self._load_from_file(self.filepath) 
Example #4
Source File: test_tor.py    From gridsync with GNU General Public License v3.0 5 votes vote down vote up
def test_get_tor_with_prompt_retry(monkeypatch):
    monkeypatch.setattr(
        "gridsync.tor.get_tor", MagicMock(side_effect=[None, "FakeTxtorcon"])
    )
    monkeypatch.setattr(
        "PyQt5.QtWidgets.QMessageBox.exec_",
        MagicMock(return_value=QMessageBox.Retry),
    )
    tor = yield get_tor_with_prompt(None)
    assert tor == "FakeTxtorcon" 
Example #5
Source File: load_partial.py    From pan-fca with Apache License 2.0 5 votes vote down vote up
def show_critical_error(self, message_list):

        message = '''
        <p>
        {message}
        <br>
        Error: {error}
        </p>
        '''.format(message=message_list[0], error=message_list[1])

        result = QMessageBox.critical(self, 'ERROR', message, QMessageBox.Abort, QMessageBox.Retry)

        # Abort
        if result == QMessageBox.Abort:
            self.close()

        # Retry
        else:

            # set error flag to True -- implies error
            self._flag_error = True
            return

##############################################
# FILL COMBO BOXES
############################################## 
Example #6
Source File: load_partial.py    From pan-fca with Apache License 2.0 5 votes vote down vote up
def show_critical_error(self, message_list):

        message = '''
        <p>
        {message}
        <br>
        Error: {error}
        </p>
        '''.format(message=message_list[0], error=message_list[1])

        result = QMessageBox.critical(self, 'ERROR', message, QMessageBox.Abort, QMessageBox.Retry)

        # Abort
        if result == QMessageBox.Abort:
            self.close()

        # Retry
        else:

            # set error flag to True -- implies error
            self._flag_error = True
            return


##############################################
# MAIN WINDOW
############################################## 
Example #7
Source File: load_partial.py    From pan-fca with Apache License 2.0 5 votes vote down vote up
def _show_critical_error(self, message_list):

        message = '''
        <p>
        {message}
        <br>
        Error: {error}
        </p>
        '''.format(message=message_list[0], error=message_list[1])

        result = QMessageBox.critical(self, 'ERROR', message, QMessageBox.Abort, QMessageBox.Retry)

        # Abort
        if result == QMessageBox.Abort:
            self.close()

        # Retry
        else:

            # set error flag to True -- implies error
            self._flag_error = True
            return


############################################################################
# MAIN
############################################################################ 
Example #8
Source File: ledgerClient.py    From PIVX-SPMT with MIT License 4 votes vote down vote up
def signMess(self, caller, hwpath, message, isTestnet=False):
        if isTestnet:
            path = MPATH_TESTNET + hwpath
        else:
            path = MPATH + hwpath
        # Ledger doesn't accept characters other that ascii printable:
        # https://ledgerhq.github.io/btchip-doc/bitcoin-technical.html#_sign_message
        message = message.encode('ascii', 'ignore')
        message_sha = splitString(single_sha256(message).hex(), 32);

        # Connection pop-up
        mBox = QMessageBox(caller)
        warningText = "Another application (such as Ledger Wallet app) has probably taken over "
        warningText += "the communication with the Ledger device.<br><br>To continue, close that application and "
        warningText += "click the <b>Retry</b> button.\nTo cancel, click the <b>Abort</b> button"
        mBox.setText(warningText)
        mBox.setWindowTitle("WARNING")
        mBox.setStandardButtons(QMessageBox.Retry | QMessageBox.Abort);

        # Ask confirmation
        with self.lock:
            info = self.chip.signMessagePrepare(path, message)

            while info['confirmationNeeded'] and info['confirmationType'] == 34:
                ans = mBox.exec_()

                if ans == QMessageBox.Abort:
                    raise Exception("Reconnect HW device")

                # we need to reconnect the device
                self.initDevice()
                info = self.chip.signMessagePrepare(path, message)

            printOK('Signing Message')
            self.mBox = QMessageBox(caller)
            messageText = "Check display of your hardware device\n\n- message hash:\n\n%s\n\n-path:\t%s\n" % (
            message_sha, path)
            self.mBox.setText(messageText)
            self.mBox.setIconPixmap(caller.tabMain.ledgerImg.scaledToHeight(200, Qt.SmoothTransformation))
            self.mBox.setWindowTitle("CHECK YOUR LEDGER")
            self.mBox.setStandardButtons(QMessageBox.NoButton)
            self.mBox.show()

        # Sign message
        ThreadFuns.runInThread(self.signMessageSign, (), self.signMessageFinish)