Compare commits

...

1 Commits

Author SHA1 Message Date
da8bbc2103
fixed CQ for bitmessageqt.retranslateui module 2020-09-09 12:11:39 +05:30

View File

@ -1,9 +1,12 @@
from os import path """RetranslateMixin module.
"""
# pylint: disable=too-few-public-methods
from PyQt4 import QtGui from PyQt4 import QtGui
from debug import logger
import widgets import widgets
class RetranslateMixin(object): class RetranslateMixin(object):
"""RetranslateMixin class for dynamically change language during runtime."""
def retranslateUi(self): def retranslateUi(self):
defaults = QtGui.QWidget() defaults = QtGui.QWidget()
widgets.load(self.__class__.__name__.lower() + '.ui', defaults) widgets.load(self.__class__.__name__.lower() + '.ui', defaults)
@ -13,6 +16,8 @@ class RetranslateMixin(object):
getattr(self, attr).setText(getattr(defaults, attr).text()) getattr(self, attr).setText(getattr(defaults, attr).text())
elif isinstance(value, QtGui.QTableWidget): elif isinstance(value, QtGui.QTableWidget):
for i in range(value.columnCount()): for i in range(value.columnCount()):
getattr(self, attr).horizontalHeaderItem(i).setText(getattr(defaults, attr).horizontalHeaderItem(i).text()) getattr(self, attr).horizontalHeaderItem(i).setText(
getattr(defaults, attr).horizontalHeaderItem(i).text())
for i in range(value.rowCount()): for i in range(value.rowCount()):
getattr(self, attr).verticalHeaderItem(i).setText(getattr(defaults, attr).verticalHeaderItem(i).text()) getattr(self, attr).verticalHeaderItem(i).setText(
getattr(defaults, attr).verticalHeaderItem(i).text())