RetranslateMixin seems to be redundant
This commit is contained in:
parent
f5b4005c07
commit
46b3f6b48b
|
@ -1,9 +1,9 @@
|
||||||
"""
|
"""
|
||||||
src/bitmessageqt/address_dialogs.py
|
src/bitmessageqt/address_dialogs.py
|
||||||
===================================
|
===================================
|
||||||
|
A dialogs which deal 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 +14,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 +31,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 +102,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 +113,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 +175,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 +218,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 +227,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 +296,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)
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from tr import _translate
|
|
||||||
import widgets
|
import widgets
|
||||||
from addresses import addBMIfNotPresent
|
from addresses import addBMIfNotPresent
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from dialogs import AddAddressDialog
|
from dialogs import AddAddressDialog
|
||||||
from helper_sql import sqlExecute, sqlQuery
|
from helper_sql import sqlExecute, sqlQuery
|
||||||
from retranslateui import RetranslateMixin
|
from tr import _translate
|
||||||
from utils import avatarize
|
from utils import avatarize
|
||||||
from uisignaler import UISignaler
|
from uisignaler import UISignaler
|
||||||
|
|
||||||
|
|
||||||
class Blacklist(QtGui.QWidget, RetranslateMixin):
|
class Blacklist(QtGui.QWidget):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(Blacklist, self).__init__(parent)
|
super(Blacklist, self).__init__(parent)
|
||||||
widgets.load('blacklist.ui', self)
|
widgets.load('blacklist.ui', self)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -10,11 +10,10 @@ import widgets
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from debug import logger
|
from debug import logger
|
||||||
from foldertree import AddressBookCompleter
|
from foldertree import AddressBookCompleter
|
||||||
from retranslateui import RetranslateMixin
|
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
|
|
||||||
|
|
||||||
class Window(settingsmixin.SMainWindow, RetranslateMixin):
|
class Window(settingsmixin.SMainWindow):
|
||||||
"""The main PyBitmessage's window"""
|
"""The main PyBitmessage's window"""
|
||||||
uifile = 'main.ui'
|
uifile = 'main.ui'
|
||||||
|
|
||||||
|
@ -92,6 +91,12 @@ class Window(settingsmixin.SMainWindow, RetranslateMixin):
|
||||||
_translate("MainWindow", "Go offline", None)
|
_translate("MainWindow", "Go offline", None)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def retranslateUi(self):
|
||||||
|
"""Update widgets' texts which is not taken from ui-file"""
|
||||||
|
self.updateHumanFriendlyTTLDescription(int(
|
||||||
|
self.horizontalSliderTTL.tickPosition() ** 3.199 + 3600))
|
||||||
|
self.networkstatus.retranslateUi()
|
||||||
|
|
||||||
# FIXME: this is not best place for this func
|
# FIXME: this is not best place for this func
|
||||||
def change_translation(self, newlocale=None):
|
def change_translation(self, newlocale=None):
|
||||||
"""Change translation language for the application"""
|
"""Change translation language for the application"""
|
||||||
|
|
|
@ -15,12 +15,11 @@ import shared
|
||||||
import widgets
|
import widgets
|
||||||
from inventory import Inventory
|
from inventory import Inventory
|
||||||
from network.connectionpool import BMConnectionPool
|
from network.connectionpool import BMConnectionPool
|
||||||
from retranslateui import RetranslateMixin
|
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
from uisignaler import UISignaler
|
from uisignaler import UISignaler
|
||||||
|
|
||||||
|
|
||||||
class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
class NetworkStatus(QtGui.QWidget):
|
||||||
"""Network status tab"""
|
"""Network status tab"""
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(NetworkStatus, self).__init__(parent)
|
super(NetworkStatus, self).__init__(parent)
|
||||||
|
@ -34,8 +33,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
|
||||||
|
@ -238,6 +235,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||||
self.updateNumberOfObjectsToBeSynced()
|
self.updateNumberOfObjectsToBeSynced()
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
super(NetworkStatus, self).retranslateUi()
|
"""Update widgets' texts which is not taken from ui-file"""
|
||||||
self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg(
|
self.labelStartupTime.setText(_translate(
|
||||||
l10n.formatTimestamp(self.startup)))
|
"networkstatus", "Since startup on %1"
|
||||||
|
).arg(l10n.formatTimestamp(self.startup)))
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -17,11 +17,10 @@ import widgets
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from helper_sql import sqlExecute, sqlStoredProcedure
|
from helper_sql import sqlExecute, sqlStoredProcedure
|
||||||
from network.asyncore_pollchoose import set_rates
|
from network.asyncore_pollchoose import set_rates
|
||||||
from retranslateui import RetranslateMixin
|
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
|
|
||||||
|
|
||||||
class SettingsDialog(QtGui.QDialog, RetranslateMixin):
|
class SettingsDialog(QtGui.QDialog):
|
||||||
"""The "Settings" dialog"""
|
"""The "Settings" dialog"""
|
||||||
def __init__(self, parent=None, firstrun=False):
|
def __init__(self, parent=None, firstrun=False):
|
||||||
super(SettingsDialog, self).__init__(parent)
|
super(SettingsDialog, self).__init__(parent)
|
||||||
|
|
Reference in New Issue
Block a user