RetranslateMixin seems to be redundant
This commit is contained in:
parent
f5b4005c07
commit
46b3f6b48b
|
@ -1,9 +1,9 @@
|
|||
"""
|
||||
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
|
||||
|
||||
|
@ -14,13 +14,11 @@ import widgets
|
|||
from account import AccountMixin, GatewayAccount, MailchuckAccount, accountClass, getSortedAccounts
|
||||
from addresses import addBMIfNotPresent, decodeAddress, encodeVarint
|
||||
from inventory import Inventory
|
||||
from retranslateui import RetranslateMixin
|
||||
from tr import _translate
|
||||
|
||||
|
||||
class AddressCheckMixin(object):
|
||||
"""Base address validation class for QT UI"""
|
||||
# pylint: disable=too-few-public-methods
|
||||
|
||||
def __init__(self):
|
||||
self.valid = False
|
||||
|
@ -33,7 +31,9 @@ class AddressCheckMixin(object):
|
|||
pass
|
||||
|
||||
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(
|
||||
str(QString))
|
||||
self.valid = status == 'success'
|
||||
|
@ -102,8 +102,8 @@ class AddressDataDialog(QtGui.QDialog, AddressCheckMixin):
|
|||
super(AddressDataDialog, self).accept()
|
||||
|
||||
|
||||
class AddAddressDialog(AddressDataDialog, RetranslateMixin):
|
||||
"""QDialog for adding a new address, with validation and translation"""
|
||||
class AddAddressDialog(AddressDataDialog):
|
||||
"""QDialog for adding a new address"""
|
||||
|
||||
def __init__(self, parent=None, address=None):
|
||||
super(AddAddressDialog, self).__init__(parent)
|
||||
|
@ -113,8 +113,8 @@ class AddAddressDialog(AddressDataDialog, RetranslateMixin):
|
|||
self.lineEditAddress.setText(address)
|
||||
|
||||
|
||||
class NewAddressDialog(QtGui.QDialog, RetranslateMixin):
|
||||
"""QDialog for generating a new address, with translation"""
|
||||
class NewAddressDialog(QtGui.QDialog):
|
||||
"""QDialog for generating a new address"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(NewAddressDialog, self).__init__(parent)
|
||||
|
@ -175,8 +175,8 @@ class NewAddressDialog(QtGui.QDialog, RetranslateMixin):
|
|||
))
|
||||
|
||||
|
||||
class NewSubscriptionDialog(AddressDataDialog, RetranslateMixin):
|
||||
"""QDialog for subscribing to an address, with validation and translation"""
|
||||
class NewSubscriptionDialog(AddressDataDialog):
|
||||
"""QDialog for subscribing to an address"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(NewSubscriptionDialog, self).__init__(parent)
|
||||
|
@ -218,8 +218,8 @@ class NewSubscriptionDialog(AddressDataDialog, RetranslateMixin):
|
|||
))
|
||||
|
||||
|
||||
class RegenerateAddressesDialog(QtGui.QDialog, RetranslateMixin):
|
||||
"""QDialog for regenerating deterministic addresses, with translation"""
|
||||
class RegenerateAddressesDialog(QtGui.QDialog):
|
||||
"""QDialog for regenerating deterministic addresses"""
|
||||
def __init__(self, parent=None):
|
||||
super(RegenerateAddressesDialog, self).__init__(parent)
|
||||
widgets.load('regenerateaddresses.ui', self)
|
||||
|
@ -227,8 +227,10 @@ class RegenerateAddressesDialog(QtGui.QDialog, RetranslateMixin):
|
|||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
||||
|
||||
|
||||
class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin):
|
||||
"""QDialog for special address behaviour (e.g. mailing list functionality), with translation"""
|
||||
class SpecialAddressBehaviorDialog(QtGui.QDialog):
|
||||
"""
|
||||
QDialog for special address behaviour (e.g. mailing list functionality)
|
||||
"""
|
||||
|
||||
def __init__(self, parent=None, config=None):
|
||||
super(SpecialAddressBehaviorDialog, self).__init__(parent)
|
||||
|
@ -294,8 +296,8 @@ class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin):
|
|||
self.parent.rerenderMessagelistToLabels()
|
||||
|
||||
|
||||
class EmailGatewayDialog(QtGui.QDialog, RetranslateMixin):
|
||||
"""QDialog for email gateway control, with translation"""
|
||||
class EmailGatewayDialog(QtGui.QDialog):
|
||||
"""QDialog for email gateway control"""
|
||||
def __init__(self, parent, config=None, account=None):
|
||||
super(EmailGatewayDialog, self).__init__(parent)
|
||||
widgets.load('emailgateway.ui', self)
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
from PyQt4 import QtCore, QtGui
|
||||
from tr import _translate
|
||||
|
||||
import widgets
|
||||
from addresses import addBMIfNotPresent
|
||||
from bmconfigparser import BMConfigParser
|
||||
from dialogs import AddAddressDialog
|
||||
from helper_sql import sqlExecute, sqlQuery
|
||||
from retranslateui import RetranslateMixin
|
||||
from tr import _translate
|
||||
from utils import avatarize
|
||||
from uisignaler import UISignaler
|
||||
|
||||
|
||||
class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||
class Blacklist(QtGui.QWidget):
|
||||
def __init__(self, parent=None):
|
||||
super(Blacklist, self).__init__(parent)
|
||||
widgets.load('blacklist.ui', self)
|
||||
|
|
|
@ -13,7 +13,6 @@ from address_dialogs import (
|
|||
SpecialAddressBehaviorDialog
|
||||
)
|
||||
from newchandialog import NewChanDialog
|
||||
from retranslateui import RetranslateMixin
|
||||
from settings import SettingsDialog
|
||||
from tr import _translate
|
||||
from version import softwareVersion
|
||||
|
@ -27,7 +26,7 @@ __all__ = [
|
|||
]
|
||||
|
||||
|
||||
class AboutDialog(QtGui.QDialog, RetranslateMixin):
|
||||
class AboutDialog(QtGui.QDialog):
|
||||
"""The `About` dialog"""
|
||||
def __init__(self, parent=None):
|
||||
super(AboutDialog, self).__init__(parent)
|
||||
|
@ -55,7 +54,7 @@ class AboutDialog(QtGui.QDialog, RetranslateMixin):
|
|||
self.setFixedSize(QtGui.QWidget.sizeHint(self))
|
||||
|
||||
|
||||
class IconGlossaryDialog(QtGui.QDialog, RetranslateMixin):
|
||||
class IconGlossaryDialog(QtGui.QDialog):
|
||||
"""The `Icon Glossary` dialog, explaining the status icon colors"""
|
||||
def __init__(self, parent=None, config=None):
|
||||
super(IconGlossaryDialog, self).__init__(parent)
|
||||
|
@ -71,7 +70,7 @@ class IconGlossaryDialog(QtGui.QDialog, RetranslateMixin):
|
|||
self.setFixedSize(QtGui.QWidget.sizeHint(self))
|
||||
|
||||
|
||||
class HelpDialog(QtGui.QDialog, RetranslateMixin):
|
||||
class HelpDialog(QtGui.QDialog):
|
||||
"""The `Help` dialog"""
|
||||
def __init__(self, parent=None):
|
||||
super(HelpDialog, self).__init__(parent)
|
||||
|
@ -79,7 +78,7 @@ class HelpDialog(QtGui.QDialog, RetranslateMixin):
|
|||
self.setFixedSize(QtGui.QWidget.sizeHint(self))
|
||||
|
||||
|
||||
class ConnectDialog(QtGui.QDialog, RetranslateMixin):
|
||||
class ConnectDialog(QtGui.QDialog):
|
||||
"""The `Connect` dialog"""
|
||||
def __init__(self, parent=None):
|
||||
super(ConnectDialog, self).__init__(parent)
|
||||
|
|
|
@ -10,11 +10,10 @@ import widgets
|
|||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
from foldertree import AddressBookCompleter
|
||||
from retranslateui import RetranslateMixin
|
||||
from tr import _translate
|
||||
|
||||
|
||||
class Window(settingsmixin.SMainWindow, RetranslateMixin):
|
||||
class Window(settingsmixin.SMainWindow):
|
||||
"""The main PyBitmessage's window"""
|
||||
uifile = 'main.ui'
|
||||
|
||||
|
@ -92,6 +91,12 @@ class Window(settingsmixin.SMainWindow, RetranslateMixin):
|
|||
_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
|
||||
def change_translation(self, newlocale=None):
|
||||
"""Change translation language for the application"""
|
||||
|
|
|
@ -15,12 +15,11 @@ import shared
|
|||
import widgets
|
||||
from inventory import Inventory
|
||||
from network.connectionpool import BMConnectionPool
|
||||
from retranslateui import RetranslateMixin
|
||||
from tr import _translate
|
||||
from uisignaler import UISignaler
|
||||
|
||||
|
||||
class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||
class NetworkStatus(QtGui.QWidget):
|
||||
"""Network status tab"""
|
||||
def __init__(self, parent=None):
|
||||
super(NetworkStatus, self).__init__(parent)
|
||||
|
@ -34,8 +33,6 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
|||
header.setSortIndicator(0, QtCore.Qt.AscendingOrder)
|
||||
|
||||
self.startup = time.localtime()
|
||||
self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg(
|
||||
l10n.formatTimestamp(self.startup)))
|
||||
|
||||
self.UISignalThread = UISignaler.get()
|
||||
# pylint: disable=no-member
|
||||
|
@ -238,6 +235,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
|||
self.updateNumberOfObjectsToBeSynced()
|
||||
|
||||
def retranslateUi(self):
|
||||
super(NetworkStatus, self).retranslateUi()
|
||||
self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg(
|
||||
l10n.formatTimestamp(self.startup)))
|
||||
"""Update widgets' texts which is not taken from ui-file"""
|
||||
self.labelStartupTime.setText(_translate(
|
||||
"networkstatus", "Since startup on %1"
|
||||
).arg(l10n.formatTimestamp(self.startup)))
|
||||
|
|
|
@ -9,13 +9,13 @@ from PyQt4 import QtCore, QtGui
|
|||
import widgets
|
||||
from addresses import addBMIfNotPresent
|
||||
from addressvalidator import AddressValidator, PassPhraseValidator
|
||||
from queues import UISignalQueue, addressGeneratorQueue, apiAddressGeneratorReturnQueue
|
||||
from retranslateui import RetranslateMixin
|
||||
from queues import (
|
||||
addressGeneratorQueue, apiAddressGeneratorReturnQueue, UISignalQueue)
|
||||
from tr import _translate
|
||||
from utils import str_chan
|
||||
|
||||
|
||||
class NewChanDialog(QtGui.QDialog, RetranslateMixin):
|
||||
class NewChanDialog(QtGui.QDialog):
|
||||
"""The `New Chan` dialog"""
|
||||
def __init__(self, parent=None):
|
||||
super(NewChanDialog, self).__init__(parent)
|
||||
|
|
|
@ -17,11 +17,10 @@ import widgets
|
|||
from bmconfigparser import BMConfigParser
|
||||
from helper_sql import sqlExecute, sqlStoredProcedure
|
||||
from network.asyncore_pollchoose import set_rates
|
||||
from retranslateui import RetranslateMixin
|
||||
from tr import _translate
|
||||
|
||||
|
||||
class SettingsDialog(QtGui.QDialog, RetranslateMixin):
|
||||
class SettingsDialog(QtGui.QDialog):
|
||||
"""The "Settings" dialog"""
|
||||
def __init__(self, parent=None, firstrun=False):
|
||||
super(SettingsDialog, self).__init__(parent)
|
||||
|
|
Reference in New Issue
Block a user