Example #1
0
    def accept(self):
        self.button_box.setEnabled(False)
        if self.radio_contact.isChecked():
            for contact in self.account.contacts:
                if contact['name'] == self.combo_contact.currentText():
                    pubkey = contact['pubkey']
                    break
        else:
            pubkey = self.edit_pubkey.text()

        password = yield from self.password_asker.async_exec()
        if password == "":
            self.button_box.setEnabled(True)
            return
        QApplication.setOverrideCursor(Qt.WaitCursor)
        result = yield from self.account.certify(password, self.community, pubkey)
        if result[0]:
            if self.app.preferences['notifications']:
                toast.display(self.tr("Certification"),
                              self.tr("Success sending certification"))
            else:
                yield from QAsyncMessageBox.information(self, self.tr("Certification"),
                                             self.tr("Success sending certification"))
            QApplication.restoreOverrideCursor()
            super().accept()
        else:
            if self.app.preferences['notifications']:
                toast.display(self.tr("Certification"), self.tr("Could not broadcast certification : {0}"
                                                                .format(result[1])))
            else:
                yield from QAsyncMessageBox.critical(self, self.tr("Certification"),
                                          self.tr("Could not broadcast certification : {0}"
                                                                .format(result[1])))
            QApplication.restoreOverrideCursor()
            self.button_box.setEnabled(True)
Example #2
0
    def accept(self):
        self.button_box.setEnabled(False)
        comment = self.edit_message.text()

        if self.radio_contact.isChecked():
            for contact in self.account.contacts:
                if contact["name"] == self.combo_contact.currentText():
                    recipient = contact["pubkey"]
                    break
        else:
            recipient = self.edit_pubkey.text()
        amount = self.spinbox_amount.value()

        if not amount:
            yield from QAsyncMessageBox.critical(
                self, self.tr("Money transfer"), self.tr("No amount. Please give the transfert amount"), QMessageBox.Ok
            )
            self.button_box.setEnabled(True)
            return

        password = yield from self.password_asker.async_exec()
        if self.password_asker.result() == QDialog.Rejected:
            return

        QApplication.setOverrideCursor(Qt.WaitCursor)
        QApplication.processEvents()
        result = yield from self.wallet.send_money(
            self.account.salt, password, self.community, recipient, amount, comment
        )
        if result[0]:
            if self.app.preferences["notifications"]:
                toast.display(self.tr("Transfer"), self.tr("Success sending money to {0}").format(recipient))
            else:
                yield from QAsyncMessageBox.information(
                    self, self.tr("Transfer"), self.tr("Success sending money to {0}").format(recipient)
                )
            QApplication.restoreOverrideCursor()

            # If we sent back a transaction we cancel the first one
            if self.transfer:
                self.transfer.cancel()

            super().accept()
        else:
            if self.app.preferences["notifications"]:
                toast.display(self.tr("Transfer"), "Error : {0}".format(result[1]))
            else:
                yield from QAsyncMessageBox.critical(self, self.tr("Transfer"), result[1])

            QApplication.restoreOverrideCursor()
            self.button_box.setEnabled(True)
Example #3
0
 def revoke_uid(self, checked=False):
     password = yield from self.password_asker.async_exec()
     if self.password_asker.result() == QDialog.Rejected:
         return
     result = yield from self.account.revoke(password, self.community)
     if result[0]:
         if self.app.preferences['notifications']:
             toast.display(self.tr("Revoke UID"), self.tr("Your UID was revoked successfully."))
         else:
             yield from QAsyncMessageBox.information(self, self.tr("Membership"),
                                                     self.tr("Your UID was revoked successfully."))
     else:
         if self.app.preferences['notifications']:
             toast.display(self.tr("Revoke UID"), result[1])
         else:
             yield from QAsyncMessageBox.critical(self, self.tr("UID"),
                                                     result[1])
Example #4
0
 def publish_uid(self, checked=False):
     password = yield from self.password_asker.async_exec()
     if self.password_asker.result() == QDialog.Rejected:
         return
     result = yield from self.account.send_selfcert(password, self.community)
     if result[0]:
         if self.app.preferences['notifications']:
             toast.display(self.tr("UID"), self.tr("Success publishing your UID"))
         else:
             yield from QAsyncMessageBox.information(self, self.tr("Membership"),
                                                     self.tr("Success publishing your UID"))
     else:
         if self.app.preferences['notifications']:
             toast.display(self.tr("UID"), result[1])
         else:
             yield from QAsyncMessageBox.critical(self, self.tr("UID"),
                                                     result[1])
Example #5
0
 def send_membership_demand(self, checked=False):
     password = yield from self.password_asker.async_exec()
     if self.password_asker.result() == QDialog.Rejected:
         return
     result = yield from self.account.send_membership(password, self.community, 'IN')
     if result[0]:
         if self.app.preferences['notifications']:
             toast.display(self.tr("Membership"), self.tr("Success sending Membership demand"))
         else:
             yield from QAsyncMessageBox.information(self, self.tr("Membership"),
                                                     self.tr("Success sending Membership demand"))
     else:
         if self.app.preferences['notifications']:
             toast.display(self.tr("Membership"), result[1])
         else:
             yield from QAsyncMessageBox.critical(self, self.tr("Membership"),
                                                     result[1])
Example #6
0
    def send_membership_leaving(self):
        reply = yield from QAsyncMessageBox.warning(self, self.tr("Warning"),
                             self.tr("""Are you sure ?
Sending a leaving demand  cannot be canceled.
The process to join back the community later will have to be done again.""")
.format(self.account.pubkey), QMessageBox.Ok | QMessageBox.Cancel)
        if reply == QMessageBox.Ok:
            password = self.password_asker.exec_()
            if self.password_asker.result() == QDialog.Rejected:
                return
            result = yield from self.account.send_membership(password, self.community, 'OUT')
            if result[0]:
                if self.app.preferences['notifications']:
                    toast.display(self.tr("Revoke"), self.tr("Success sending Revoke demand"))
                else:
                    yield from QAsyncMessageBox.information(self, self.tr("Revoke"),
                                                            self.tr("Success sending Revoke demand"))
            else:
                if self.app.preferences['notifications']:
                    toast.display(self.tr("Revoke"), result[1])
                else:
                    yield from QAsyncMessageBox.critical(self, self.tr("Revoke"),
                                                         result[1])