Marked folder names for translation
This commit is contained in:
parent
eb97face61
commit
6bcbad63b9
|
@ -1,11 +1,19 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from string import find, rfind, rstrip, lstrip
|
from string import find, rfind, rstrip, lstrip
|
||||||
|
|
||||||
|
from tr import _translate
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from helper_sql import *
|
from helper_sql import *
|
||||||
from utils import *
|
from utils import *
|
||||||
from settingsmixin import SettingsMixin
|
from settingsmixin import SettingsMixin
|
||||||
|
|
||||||
|
# for pylupdate
|
||||||
|
_translate("MainWindow", "inbox")
|
||||||
|
_translate("MainWindow", "new")
|
||||||
|
_translate("MainWindow", "sent")
|
||||||
|
_translate("MainWindow", "trash")
|
||||||
|
|
||||||
|
|
||||||
class AccountMixin(object):
|
class AccountMixin(object):
|
||||||
ALL = 0
|
ALL = 0
|
||||||
NORMAL = 1
|
NORMAL = 1
|
||||||
|
@ -97,7 +105,8 @@ class AccountMixin (object):
|
||||||
retval, = row
|
retval, = row
|
||||||
retval = unicode(retval, 'utf-8')
|
retval = unicode(retval, 'utf-8')
|
||||||
elif self.address is None or self.type == AccountMixin.ALL:
|
elif self.address is None or self.type == AccountMixin.ALL:
|
||||||
return unicode(str(QtGui.QApplication.translate("MainWindow", "All accounts")), 'utf-8')
|
return unicode(
|
||||||
|
str(_translate("MainWindow", "All accounts")), 'utf-8')
|
||||||
if retval is None:
|
if retval is None:
|
||||||
return unicode(self.address, 'utf-8')
|
return unicode(self.address, 'utf-8')
|
||||||
else:
|
else:
|
||||||
|
@ -119,13 +128,12 @@ class Ui_FolderWidget(QtGui.QTreeWidgetItem, AccountMixin):
|
||||||
def data(self, column, role):
|
def data(self, column, role):
|
||||||
if column == 0:
|
if column == 0:
|
||||||
if role == QtCore.Qt.DisplayRole:
|
if role == QtCore.Qt.DisplayRole:
|
||||||
return QtGui.QApplication.translate("MainWindow", self.folderName) + (" (" + str(self.unreadCount) + ")" if self.unreadCount > 0 else "")
|
return _translate("MainWindow", self.folderName) + (
|
||||||
elif role == QtCore.Qt.EditRole:
|
" (" + str(self.unreadCount) + ")"
|
||||||
return QtGui.QApplication.translate("MainWindow", self.folderName)
|
if self.unreadCount > 0 else ""
|
||||||
elif role == QtCore.Qt.ToolTipRole:
|
)
|
||||||
return QtGui.QApplication.translate("MainWindow", self.folderName)
|
elif role in (QtCore.Qt.EditRole, QtCore.Qt.ToolTipRole):
|
||||||
elif role == QtCore.Qt.DecorationRole:
|
return _translate("MainWindow", self.folderName)
|
||||||
pass
|
|
||||||
elif role == QtCore.Qt.FontRole:
|
elif role == QtCore.Qt.FontRole:
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setBold(self.unreadCount > 0)
|
font.setBold(self.unreadCount > 0)
|
||||||
|
@ -169,10 +177,13 @@ class Ui_AddressWidget(QtGui.QTreeWidgetItem, AccountMixin, SettingsMixin):
|
||||||
|
|
||||||
def _getLabel(self):
|
def _getLabel(self):
|
||||||
if self.address is None:
|
if self.address is None:
|
||||||
return unicode(QtGui.QApplication.translate("MainWindow", "All accounts").toUtf8(), 'utf-8', 'ignore')
|
return unicode(_translate(
|
||||||
|
"MainWindow", "All accounts").toUtf8(), 'utf-8', 'ignore')
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
return unicode(BMConfigParser().get(self.address, 'label'), 'utf-8', 'ignore')
|
return unicode(
|
||||||
|
BMConfigParser().get(self.address, 'label'),
|
||||||
|
'utf-8', 'ignore')
|
||||||
except:
|
except:
|
||||||
return unicode(self.address, 'utf-8')
|
return unicode(self.address, 'utf-8')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user