Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6dfecbe
try to migrate to Python3 + PyQt6
kashikoibumi May 12, 2024
057e856
try to migrate to Python3 + PyQt6; part 2
kashikoibumi May 13, 2024
16019d4
enable TLS connection
kashikoibumi May 13, 2024
e646377
fix GUIs to work with PyQt6
kashikoibumi May 14, 2024
741f8dd
fix some parts of inventory syncing
kashikoibumi May 14, 2024
88b1497
fix decryption to work in Python 3
kashikoibumi May 15, 2024
4f0e34b
make message sending work in Python 3
kashikoibumi May 15, 2024
cdbe5f8
fix exception from network status
kashikoibumi May 15, 2024
2109fc0
fix sending v4 pubkey
kashikoibumi May 15, 2024
ba9734e
fix pubkey check
kashikoibumi May 15, 2024
6a090e8
fix some bugs related to the migration to Python3
kashikoibumi May 15, 2024
ec91d9f
fix HTML display such as URL, email address and image
kashikoibumi May 16, 2024
1b3ce71
use bytes for key of hashtable in replacement of hexlified string
kashikoibumi May 16, 2024
24b83aa
run autopep8 on src
kashikoibumi May 16, 2024
60af410
fix complains from flake8
kashikoibumi May 16, 2024
ab9fc0b
run autopep8 on src/bitmessageqt
kashikoibumi May 16, 2024
bcf02ff
fix complains from flake8; part 2
kashikoibumi May 16, 2024
3b37faf
change command from python2.7 to python3
kashikoibumi May 16, 2024
416463f
Revert "change command from python2.7 to python3"
kashikoibumi May 17, 2024
1077548
Revert "fix complains from flake8; part 2"
kashikoibumi May 17, 2024
1e53720
Revert "run autopep8 on src/bitmessageqt"
kashikoibumi May 17, 2024
a02ef70
Revert "fix complains from flake8"
kashikoibumi May 17, 2024
97c9b7e
Revert "run autopep8 on src"
kashikoibumi May 17, 2024
74bb876
fix small failures in migrating to Python3 + PyQt6
kashikoibumi May 18, 2024
8c2701c
Merge branch 'v0.6' into main
kashikoibumi May 18, 2024
bc254a9
eliminate semicolons
kashikoibumi May 18, 2024
3f808fb
fix to pass tests.py
kashikoibumi May 18, 2024
af52f80
fix to run with python3-prctl
kashikoibumi May 18, 2024
3368089
load data as 'bytes' instead of 'str' from SQLite
kashikoibumi May 18, 2024
75d2b36
fix UPnP support
kashikoibumi May 20, 2024
218cc97
make daemon mode runnable
kashikoibumi May 20, 2024
b12c7cd
replace remained arg() with format()
kashikoibumi May 22, 2024
149c90c
Merge branch 'v0.6'
kashikoibumi May 22, 2024
4c8bce4
fix type of literals that should be binary
kashikoibumi May 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix GUIs to work with PyQt6
Unresolved problems:
* File->Quit menu does not work.
* Validator in add chan dialog does not work.
  • Loading branch information
kashikoibumi committed May 14, 2024
commit e646377f22ffb8f92f3c1ff3ee1636fc9dd361b1
246 changes: 124 additions & 122 deletions src/bitmessageqt/__init__.py

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions src/bitmessageqt/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ def parseMessage(self, toAddress, fromAddress, subject, message):

self.toAddress = toAddress
self.fromAddress = fromAddress
if isinstance(subject, unicode):
self.subject = str(subject)
else:
self.subject = subject
self.subject = subject
self.message = message
self.fromLabel = self.getLabel(fromAddress)
self.toLabel = self.getLabel(toAddress)
Expand Down
32 changes: 14 additions & 18 deletions src/bitmessageqt/address_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from PyQt6 import QtCore, QtGui, QtWidgets

import queues
import bitmessageqt.widgets
import bitmessageqt.widgets as widgets
import state
from .account import AccountMixin, GatewayAccount, MailchuckAccount, accountClass
from addresses import addBMIfNotPresent, decodeAddress, encodeVarint
Expand All @@ -21,10 +21,6 @@ class AddressCheckMixin(object):

def __init__(self):
self.valid = False
QtCore.QObject.connect( # pylint: disable=no-member
self.lineEditAddress,
QtCore.SIGNAL("textChanged(QString)"),
self.addressChanged)

def _onSuccess(self, addressVersion, streamNumber, ripe):
pass
Expand Down Expand Up @@ -90,8 +86,8 @@ def accept(self):
"""Callback for QDIalog accepting value"""
if self.valid:
self.data = (
addBMIfNotPresent(str(self.lineEditAddress.text())),
str(self.lineEditLabel.text().toUtf8())
addBMIfNotPresent(self.lineEditAddress.text()),
self.lineEditLabel.text()
)
else:
queues.UISignalQueue.put(('updateStatusBar', _translate(
Expand All @@ -110,6 +106,7 @@ def __init__(self, parent=None, address=None):
AddressCheckMixin.__init__(self)
if address:
self.lineEditAddress.setText(address)
self.lineEditAddress.textChanged.connect(self.addressChanged)


class NewAddressDialog(QtWidgets.QDialog):
Expand All @@ -125,7 +122,7 @@ def __init__(self, parent=None):
self.radioButtonExisting.click()
self.comboBoxExisting.addItem(address)
self.groupBoxDeterministic.setHidden(True)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
self.show()

def accept(self):
Expand All @@ -142,7 +139,7 @@ def accept(self):
self.comboBoxExisting.currentText())[2]
queues.addressGeneratorQueue.put((
'createRandomAddress', 4, streamNumberForAddress,
str(self.newaddresslabel.text().toUtf8()), 1, "",
self.newaddresslabel.text(), 1, "",
self.checkBoxEighteenByteRipe.isChecked()
))
else:
Expand All @@ -169,7 +166,7 @@ def accept(self):
'createDeterministicAddresses', 4, streamNumberForAddress,
"unused deterministic address",
self.spinBoxNumberOfAddressesToMake.value(),
self.lineEditPassphrase.text().toUtf8(),
self.lineEditPassphrase.text(),
self.checkBoxEighteenByteRipe.isChecked()
))

Expand All @@ -181,6 +178,7 @@ def __init__(self, parent=None):
super(NewSubscriptionDialog, self).__init__(parent)
widgets.load('newsubscriptiondialog.ui', self)
AddressCheckMixin.__init__(self)
self.lineEditAddress.textChanged.connect(self.addressChanged)

def _onSuccess(self, addressVersion, streamNumber, ripe):
if addressVersion <= 3:
Expand Down Expand Up @@ -222,7 +220,7 @@ def __init__(self, parent=None):
super(RegenerateAddressesDialog, self).__init__(parent)
widgets.load('regenerateaddresses.ui', self)
self.groupBox.setTitle('')
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))


class SpecialAddressBehaviorDialog(QtWidgets.QDialog):
Expand Down Expand Up @@ -257,11 +255,9 @@ def __init__(self, parent=None, config=global_config):
else:
self.radioButtonBehaveNormalAddress.click()
mailingListName = config.safeGet(self.address, 'mailinglistname', '')
self.lineEditMailingListName.setText(
unicode(mailingListName, 'utf-8')
)
self.lineEditMailingListName.setText(mailingListName)

QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
self.show()

def accept(self):
Expand All @@ -281,7 +277,7 @@ def accept(self):
else:
self.config.set(str(self.address), 'mailinglist', 'true')
self.config.set(str(self.address), 'mailinglistname', str(
self.lineEditMailingListName.text().toUtf8()))
self.lineEditMailingListName.text()))
self.parent.setCurrentItemColor(
QtGui.QColor(137, 4, 177)) # magenta
self.parent.rerenderComboBoxSendFrom()
Expand Down Expand Up @@ -329,7 +325,7 @@ def __init__(self, parent, config=global_config, account=None):
else:
self.acct = MailchuckAccount(address)
self.lineEditEmail.setFocus()
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))

def accept(self):
"""Accept callback"""
Expand All @@ -343,7 +339,7 @@ def accept(self):

if self.radioButtonRegister.isChecked() \
or self.radioButtonRegister.isHidden():
email = str(self.lineEditEmail.text().toUtf8())
email = self.lineEditEmail.text()
self.acct.register(email)
self.config.set(self.acct.fromAddress, 'label', email)
self.config.set(self.acct.fromAddress, 'gateway', 'mailchuck')
Expand Down
42 changes: 21 additions & 21 deletions src/bitmessageqt/addressvalidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from queue import Empty

from PyQt6 import QtGui
from PyQt6 import QtGui, QtWidgets

from addresses import decodeAddress, addBMIfNotPresent
from bmconfigparser import config
Expand All @@ -32,7 +32,7 @@ def setParams(
self.addressMandatory = addressMandatory
self.isValid = False
# save default text
self.okButtonLabel = self.buttonBox.button(QtGui.QDialogButtonBox.Ok).text()
self.okButtonLabel = self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).text()

def setError(self, string):
"""Indicate that the validation is pending or failed"""
Expand All @@ -44,12 +44,12 @@ def setError(self, string):
self.feedBackObject.setText(string)
self.isValid = False
if self.buttonBox:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setEnabled(False)
if string is not None and self.feedBackObject is not None:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(
self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText(
_translate("AddressValidator", "Invalid"))
else:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(
self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText(
_translate("AddressValidator", "Validating..."))

def setOK(self, string):
Expand All @@ -62,8 +62,8 @@ def setOK(self, string):
self.feedBackObject.setText(string)
self.isValid = True
if self.buttonBox:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(self.okButtonLabel)
self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setEnabled(True)
self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText(self.okButtonLabel)

def checkQueue(self):
"""Validator queue loop"""
Expand All @@ -87,47 +87,47 @@ def checkQueue(self):

if not addressGeneratorReturnValue:
self.setError(_translate("AddressValidator", "Address already present as one of your identities."))
return (QtGui.QValidator.Intermediate, 0)
return (QtGui.QValidator.State.Intermediate, 0)
if addressGeneratorReturnValue[0] == 'chan name does not match address':
self.setError(
_translate(
"AddressValidator",
"Although the Bitmessage address you "
"entered was valid, it doesn't match the chan name."))
return (QtGui.QValidator.Intermediate, 0)
return (QtGui.QValidator.State.Intermediate, 0)
self.setOK(_translate("MainWindow", "Passphrase and address appear to be valid."))

def returnValid(self):
"""Return the value of whether the validation was successful"""
if self.isValid:
return QtGui.QValidator.Acceptable
return QtGui.QValidator.Intermediate
return QtGui.QValidator.State.Acceptable
return QtGui.QValidator.State.Intermediate

def validate(self, s, pos):
"""Top level validator method"""
if self.addressObject is None:
address = None
else:
address = str(self.addressObject.text().toUtf8())
address = self.addressObject.text()
if address == "":
address = None
if self.passPhraseObject is None:
passPhrase = ""
else:
passPhrase = str(self.passPhraseObject.text().toUtf8())
passPhrase = self.passPhraseObject.text()
if passPhrase == "":
passPhrase = None

# no chan name
if passPhrase is None:
self.setError(_translate("AddressValidator", "Chan name/passphrase needed. You didn't enter a chan name."))
return (QtGui.QValidator.Intermediate, pos)
return (QtGui.QValidator.State.Intermediate, pos)

if self.addressMandatory or address is not None:
# check if address already exists:
if address in config.addresses():
self.setError(_translate("AddressValidator", "Address already present as one of your identities."))
return (QtGui.QValidator.Intermediate, pos)
return (QtGui.QValidator.State.Intermediate, pos)

# version too high
if decodeAddress(address)[0] == 'versiontoohigh':
Expand All @@ -138,29 +138,29 @@ def validate(self, s, pos):
" address might be valid, its version number"
" is too new for us to handle. Perhaps you need"
" to upgrade Bitmessage."))
return (QtGui.QValidator.Intermediate, pos)
return (QtGui.QValidator.State.Intermediate, pos)

# invalid
if decodeAddress(address)[0] != 'success':
self.setError(_translate("AddressValidator", "The Bitmessage address is not valid."))
return (QtGui.QValidator.Intermediate, pos)
return (QtGui.QValidator.State.Intermediate, pos)

# this just disables the OK button without changing the feedback text
# but only if triggered by textEdited, not by clicking the Ok button
if not self.buttonBox.button(QtGui.QDialogButtonBox.Ok).hasFocus():
if not self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).hasFocus():
self.setError(None)

# check through generator
if address is None:
addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + str(passPhrase), passPhrase, False))
addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + passPhrase, passPhrase, False))
else:
addressGeneratorQueue.put(
('joinChan', addBMIfNotPresent(address),
"{} {}".format(str_chan, passPhrase), passPhrase, False))

if self.buttonBox.button(QtGui.QDialogButtonBox.Ok).hasFocus():
if self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).hasFocus():
return (self.returnValid(), pos)
return (QtGui.QValidator.Intermediate, pos)
return (QtGui.QValidator.State.Intermediate, pos)

def checkData(self):
"""Validator Qt signal interface"""
Expand Down
Loading