RetranslateMixin is not needed in most of dialogs

This commit is contained in:
Dmitri Bogomolov 2018-11-20 14:11:18 +02:00
parent f3e432140c
commit 7830ac8de5
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
5 changed files with 40 additions and 34 deletions

View File

@ -1,9 +1,7 @@
""" """
src/bitmessageqt/address_dialogs.py Dialogs that work with BM address.
===================================
""" """
# pylint: disable=attribute-defined-outside-init # pylint: disable=attribute-defined-outside-init,too-few-public-methods
import hashlib import hashlib
@ -14,13 +12,11 @@ import widgets
from account import AccountMixin, GatewayAccount, MailchuckAccount, accountClass, getSortedAccounts from account import AccountMixin, GatewayAccount, MailchuckAccount, accountClass, getSortedAccounts
from addresses import addBMIfNotPresent, decodeAddress, encodeVarint from addresses import addBMIfNotPresent, decodeAddress, encodeVarint
from inventory import Inventory from inventory import Inventory
from retranslateui import RetranslateMixin
from tr import _translate from tr import _translate
class AddressCheckMixin(object): class AddressCheckMixin(object):
"""Base address validation class for QT UI""" """Base address validation class for QT UI"""
# pylint: disable=too-few-public-methods
def __init__(self): def __init__(self):
self.valid = False self.valid = False
@ -33,7 +29,9 @@ class AddressCheckMixin(object):
pass pass
def addressChanged(self, QString): def addressChanged(self, QString):
"""Address validation callback, performs validation and gives feedback""" """
Address validation callback, performs validation and gives feedback
"""
status, addressVersion, streamNumber, ripe = decodeAddress( status, addressVersion, streamNumber, ripe = decodeAddress(
str(QString)) str(QString))
self.valid = status == 'success' self.valid = status == 'success'
@ -102,8 +100,8 @@ class AddressDataDialog(QtGui.QDialog, AddressCheckMixin):
super(AddressDataDialog, self).accept() super(AddressDataDialog, self).accept()
class AddAddressDialog(AddressDataDialog, RetranslateMixin): class AddAddressDialog(AddressDataDialog):
"""QDialog for adding a new address, with validation and translation""" """QDialog for adding a new address"""
def __init__(self, parent=None, address=None): def __init__(self, parent=None, address=None):
super(AddAddressDialog, self).__init__(parent) super(AddAddressDialog, self).__init__(parent)
@ -113,8 +111,8 @@ class AddAddressDialog(AddressDataDialog, RetranslateMixin):
self.lineEditAddress.setText(address) self.lineEditAddress.setText(address)
class NewAddressDialog(QtGui.QDialog, RetranslateMixin): class NewAddressDialog(QtGui.QDialog):
"""QDialog for generating a new address, with translation""" """QDialog for generating a new address"""
def __init__(self, parent=None): def __init__(self, parent=None):
super(NewAddressDialog, self).__init__(parent) super(NewAddressDialog, self).__init__(parent)
@ -175,8 +173,8 @@ class NewAddressDialog(QtGui.QDialog, RetranslateMixin):
)) ))
class NewSubscriptionDialog(AddressDataDialog, RetranslateMixin): class NewSubscriptionDialog(AddressDataDialog):
"""QDialog for subscribing to an address, with validation and translation""" """QDialog for subscribing to an address"""
def __init__(self, parent=None): def __init__(self, parent=None):
super(NewSubscriptionDialog, self).__init__(parent) super(NewSubscriptionDialog, self).__init__(parent)
@ -218,8 +216,8 @@ class NewSubscriptionDialog(AddressDataDialog, RetranslateMixin):
)) ))
class RegenerateAddressesDialog(QtGui.QDialog, RetranslateMixin): class RegenerateAddressesDialog(QtGui.QDialog):
"""QDialog for regenerating deterministic addresses, with translation""" """QDialog for regenerating deterministic addresses"""
def __init__(self, parent=None): def __init__(self, parent=None):
super(RegenerateAddressesDialog, self).__init__(parent) super(RegenerateAddressesDialog, self).__init__(parent)
widgets.load('regenerateaddresses.ui', self) widgets.load('regenerateaddresses.ui', self)
@ -227,8 +225,10 @@ class RegenerateAddressesDialog(QtGui.QDialog, RetranslateMixin):
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin): class SpecialAddressBehaviorDialog(QtGui.QDialog):
"""QDialog for special address behaviour (e.g. mailing list functionality), with translation""" """
QDialog for special address behaviour (e.g. mailing list functionality)
"""
def __init__(self, parent=None, config=None): def __init__(self, parent=None, config=None):
super(SpecialAddressBehaviorDialog, self).__init__(parent) super(SpecialAddressBehaviorDialog, self).__init__(parent)
@ -294,8 +294,8 @@ class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin):
self.parent.rerenderMessagelistToLabels() self.parent.rerenderMessagelistToLabels()
class EmailGatewayDialog(QtGui.QDialog, RetranslateMixin): class EmailGatewayDialog(QtGui.QDialog):
"""QDialog for email gateway control, with translation""" """QDialog for email gateway control"""
def __init__(self, parent, config=None, account=None): def __init__(self, parent, config=None, account=None):
super(EmailGatewayDialog, self).__init__(parent) super(EmailGatewayDialog, self).__init__(parent)
widgets.load('emailgateway.ui', self) widgets.load('emailgateway.ui', self)

View File

@ -771,6 +771,8 @@ class Ui_MainWindow(object):
self.actionRegenerateDeterministicAddresses.setText(_translate("MainWindow", "Regenerate deterministic addresses", None)) self.actionRegenerateDeterministicAddresses.setText(_translate("MainWindow", "Regenerate deterministic addresses", None))
self.actionDeleteAllTrashedMessages.setText(_translate("MainWindow", "Delete all trashed messages", None)) self.actionDeleteAllTrashedMessages.setText(_translate("MainWindow", "Delete all trashed messages", None))
self.actionJoinChan.setText(_translate("MainWindow", "Join / Create chan", None)) self.actionJoinChan.setText(_translate("MainWindow", "Join / Create chan", None))
self.updateNetworkSwitchMenuLabel()
import bitmessage_icons_rc import bitmessage_icons_rc

View File

@ -13,7 +13,6 @@ from address_dialogs import (
SpecialAddressBehaviorDialog SpecialAddressBehaviorDialog
) )
from newchandialog import NewChanDialog from newchandialog import NewChanDialog
from retranslateui import RetranslateMixin
from settings import SettingsDialog from settings import SettingsDialog
from tr import _translate from tr import _translate
from version import softwareVersion from version import softwareVersion
@ -27,7 +26,7 @@ __all__ = [
] ]
class AboutDialog(QtGui.QDialog, RetranslateMixin): class AboutDialog(QtGui.QDialog):
"""The `About` dialog""" """The `About` dialog"""
def __init__(self, parent=None): def __init__(self, parent=None):
super(AboutDialog, self).__init__(parent) super(AboutDialog, self).__init__(parent)
@ -55,7 +54,7 @@ class AboutDialog(QtGui.QDialog, RetranslateMixin):
self.setFixedSize(QtGui.QWidget.sizeHint(self)) self.setFixedSize(QtGui.QWidget.sizeHint(self))
class IconGlossaryDialog(QtGui.QDialog, RetranslateMixin): class IconGlossaryDialog(QtGui.QDialog):
"""The `Icon Glossary` dialog, explaining the status icon colors""" """The `Icon Glossary` dialog, explaining the status icon colors"""
def __init__(self, parent=None, config=None): def __init__(self, parent=None, config=None):
super(IconGlossaryDialog, self).__init__(parent) super(IconGlossaryDialog, self).__init__(parent)
@ -71,7 +70,7 @@ class IconGlossaryDialog(QtGui.QDialog, RetranslateMixin):
self.setFixedSize(QtGui.QWidget.sizeHint(self)) self.setFixedSize(QtGui.QWidget.sizeHint(self))
class HelpDialog(QtGui.QDialog, RetranslateMixin): class HelpDialog(QtGui.QDialog):
"""The `Help` dialog""" """The `Help` dialog"""
def __init__(self, parent=None): def __init__(self, parent=None):
super(HelpDialog, self).__init__(parent) super(HelpDialog, self).__init__(parent)
@ -79,7 +78,7 @@ class HelpDialog(QtGui.QDialog, RetranslateMixin):
self.setFixedSize(QtGui.QWidget.sizeHint(self)) self.setFixedSize(QtGui.QWidget.sizeHint(self))
class ConnectDialog(QtGui.QDialog, RetranslateMixin): class ConnectDialog(QtGui.QDialog):
"""The `Connect` dialog""" """The `Connect` dialog"""
def __init__(self, parent=None): def __init__(self, parent=None):
super(ConnectDialog, self).__init__(parent) super(ConnectDialog, self).__init__(parent)

View File

@ -1,7 +1,5 @@
""" """
src/bitmessageqt/networkstatus.py Network status tab widget definition.
=================================
""" """
import time import time
@ -34,8 +32,6 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
header.setSortIndicator(0, QtCore.Qt.AscendingOrder) header.setSortIndicator(0, QtCore.Qt.AscendingOrder)
self.startup = time.localtime() self.startup = time.localtime()
self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg(
l10n.formatTimestamp(self.startup)))
self.UISignalThread = UISignaler.get() self.UISignalThread = UISignaler.get()
# pylint: disable=no-member # pylint: disable=no-member
@ -240,6 +236,15 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
self.updateNumberOfObjectsToBeSynced() self.updateNumberOfObjectsToBeSynced()
def retranslateUi(self): def retranslateUi(self):
"""Conventional Qt Designer method for dynamic l10n"""
super(NetworkStatus, self).retranslateUi() super(NetworkStatus, self).retranslateUi()
self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg( self.labelTotalConnections.setText(
l10n.formatTimestamp(self.startup))) _translate(
"networkstatus", "Total Connections: %1").arg(
str(self.tableWidgetConnectionCount.rowCount())))
self.labelStartupTime.setText(_translate(
"networkstatus", "Since startup on %1"
).arg(l10n.formatTimestamp(self.startup)))
self.updateNumberOfMessagesProcessed()
self.updateNumberOfBroadcastsProcessed()
self.updateNumberOfPubkeysProcessed()

View File

@ -9,13 +9,13 @@ from PyQt4 import QtCore, QtGui
import widgets import widgets
from addresses import addBMIfNotPresent from addresses import addBMIfNotPresent
from addressvalidator import AddressValidator, PassPhraseValidator from addressvalidator import AddressValidator, PassPhraseValidator
from queues import UISignalQueue, addressGeneratorQueue, apiAddressGeneratorReturnQueue from queues import (
from retranslateui import RetranslateMixin addressGeneratorQueue, apiAddressGeneratorReturnQueue, UISignalQueue)
from tr import _translate from tr import _translate
from utils import str_chan from utils import str_chan
class NewChanDialog(QtGui.QDialog, RetranslateMixin): class NewChanDialog(QtGui.QDialog):
"""The `New Chan` dialog""" """The `New Chan` dialog"""
def __init__(self, parent=None): def __init__(self, parent=None):
super(NewChanDialog, self).__init__(parent) super(NewChanDialog, self).__init__(parent)