This repository has been archived on 2024-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-20/src/bitmessageqt/retranslateui.py
Jeroen van Bennekum 12de1fc3f0
Removed 33 E501 line-too-long errors from pycodestyle (3 left).
Fixed some other styling issues too.
2022-08-31 14:52:48 +02:00

21 lines
950 B
Python

from os import path
from PyQt4 import QtGui
from debug import logger
import widgets
class RetranslateMixin(object):
def retranslateUi(self):
defaults = QtGui.QWidget()
widgets.load(self.__class__.__name__.lower() + '.ui', defaults)
for attr, value in defaults.__dict__.iteritems():
setTextMethod = getattr(value, "setText", None)
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())