Compare commits
1 Commits
v0.6
...
coolguy-ce
Author | SHA1 | Date | |
---|---|---|---|
da8bbc2103 |
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue
Block a user