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 debug import logger
import widgets
class RetranslateMixin(object):
"""RetranslateMixin class for dynamically change language during runtime."""
def retranslateUi(self):
defaults = QtGui.QWidget()
widgets.load(self.__class__.__name__.lower() + '.ui', defaults)
@ -12,7 +15,9 @@ class RetranslateMixin(object):
if callable(setTextMethod):
getattr(self, attr).setText(getattr(defaults, attr).text())
elif isinstance(value, QtGui.QTableWidget):
for i in range (value.columnCount()):
getattr(self, attr).horizontalHeaderItem(i).setText(getattr(defaults, attr).horizontalHeaderItem(i).text())
for i in range (value.rowCount()):
getattr(self, attr).verticalHeaderItem(i).setText(getattr(defaults, attr).verticalHeaderItem(i).text())
for i in range(value.columnCount()):
getattr(self, attr).horizontalHeaderItem(i).setText(
getattr(defaults, attr).horizontalHeaderItem(i).text())
for i in range(value.rowCount()):
getattr(self, attr).verticalHeaderItem(i).setText(
getattr(defaults, attr).verticalHeaderItem(i).text())