fixed CQ for bitmessageqt.retranslateui module

This commit is contained in:
coolguy-cell 2020-06-09 15:14:41 +05:30
parent 95fc981ae2
commit da8bbc2103
No known key found for this signature in database
GPG Key ID: CD3A42E1D470AD70

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)
@ -13,6 +16,8 @@ class RetranslateMixin(object):
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())
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())
getattr(self, attr).verticalHeaderItem(i).setText(
getattr(defaults, attr).verticalHeaderItem(i).text())