11from PyQt4 import QtCore , QtGui
22from string import find , rfind , rstrip , lstrip
33
4+ from tr import _translate
45from bmconfigparser import BMConfigParser
56from helper_sql import *
67from utils import *
78from settingsmixin import SettingsMixin
89
9- class AccountMixin (object ):
10+ # for pylupdate
11+ _translate ("MainWindow" , "inbox" )
12+ _translate ("MainWindow" , "new" )
13+ _translate ("MainWindow" , "sent" )
14+ _translate ("MainWindow" , "trash" )
15+
16+
17+ class AccountMixin (object ):
1018 ALL = 0
1119 NORMAL = 1
1220 CHAN = 2
@@ -97,7 +105,8 @@ def defaultLabel(self):
97105 retval , = row
98106 retval = unicode (retval , 'utf-8' )
99107 elif self .address is None or self .type == AccountMixin .ALL :
100- return unicode (str (QtGui .QApplication .translate ("MainWindow" , "All accounts" )), 'utf-8' )
108+ return unicode (
109+ str (_translate ("MainWindow" , "All accounts" )), 'utf-8' )
101110 if retval is None :
102111 return unicode (self .address , 'utf-8' )
103112 else :
@@ -115,17 +124,16 @@ def __init__(self, parent, pos = 0, address = "", folderName = "", unreadCount =
115124
116125 def setFolderName (self , fname ):
117126 self .folderName = str (fname )
118-
127+
119128 def data (self , column , role ):
120129 if column == 0 :
121130 if role == QtCore .Qt .DisplayRole :
122- return QtGui .QApplication .translate ("MainWindow" , self .folderName ) + (" (" + str (self .unreadCount ) + ")" if self .unreadCount > 0 else "" )
123- elif role == QtCore .Qt .EditRole :
124- return QtGui .QApplication .translate ("MainWindow" , self .folderName )
125- elif role == QtCore .Qt .ToolTipRole :
126- return QtGui .QApplication .translate ("MainWindow" , self .folderName )
127- elif role == QtCore .Qt .DecorationRole :
128- pass
131+ return _translate ("MainWindow" , self .folderName ) + (
132+ " (" + str (self .unreadCount ) + ")"
133+ if self .unreadCount > 0 else ""
134+ )
135+ elif role in (QtCore .Qt .EditRole , QtCore .Qt .ToolTipRole ):
136+ return _translate ("MainWindow" , self .folderName )
129137 elif role == QtCore .Qt .FontRole :
130138 font = QtGui .QFont ()
131139 font .setBold (self .unreadCount > 0 )
@@ -166,16 +174,19 @@ def __init__(self, parent, pos = 0, address = None, unreadCount = 0, enabled = T
166174 self .setEnabled (enabled )
167175 self .setUnreadCount (unreadCount )
168176 self .setType ()
169-
177+
170178 def _getLabel (self ):
171179 if self .address is None :
172- return unicode (QtGui .QApplication .translate ("MainWindow" , "All accounts" ).toUtf8 (), 'utf-8' , 'ignore' )
180+ return unicode (_translate (
181+ "MainWindow" , "All accounts" ).toUtf8 (), 'utf-8' , 'ignore' )
173182 else :
174183 try :
175- return unicode (BMConfigParser ().get (self .address , 'label' ), 'utf-8' , 'ignore' )
184+ return unicode (
185+ BMConfigParser ().get (self .address , 'label' ),
186+ 'utf-8' , 'ignore' )
176187 except :
177188 return unicode (self .address , 'utf-8' )
178-
189+
179190 def _getAddressBracket (self , unreadCount = False ):
180191 ret = ""
181192 if unreadCount :
0 commit comments