@@ -176,7 +176,7 @@ def init_file_menu(self):
176176 QtCore .QObject .connect (
177177 self .ui .pushButtonAddChan ,
178178 QtCore .SIGNAL ("clicked()" ),
179- self .click_actionJoinChan ) # also used for creating chans.
179+ self .click_actionJoinChan ) # also used for creating chans.
180180 QtCore .QObject .connect (self .ui .pushButtonNewAddress , QtCore .SIGNAL (
181181 "clicked()" ), self .click_NewAddressDialog )
182182 QtCore .QObject .connect (self .ui .pushButtonAddAddressBook , QtCore .SIGNAL (
@@ -1760,7 +1760,8 @@ def changeEvent(self, event):
17601760 self .ui .blackwhitelist .init_blacklist_popup_menu (False )
17611761 if event .type () == QtCore .QEvent .WindowStateChange :
17621762 if self .windowState () & QtCore .Qt .WindowMinimized :
1763- if config .getboolean ('bitmessagesettings' , 'minimizetotray' ) and not 'darwin' in sys .platform :
1763+ if (config .getboolean ('bitmessagesettings' , 'minimizetotray' )
1764+ and 'darwin' not in sys .platform ):
17641765 QtCore .QTimer .singleShot (0 , self .appIndicatorHide )
17651766 elif event .oldState () & QtCore .Qt .WindowMinimized :
17661767 # The window state has just been changed to
@@ -1873,7 +1874,7 @@ def calcTrayIcon(self, iconFileName, inboxUnreadCount):
18731874 painter .setPen (
18741875 QtGui .QPen (QtGui .QColor (255 , 0 , 0 ), QtCore .Qt .SolidPattern ))
18751876 painter .setFont (font )
1876- painter .drawText (24 - rect .right ()- marginX , - rect .top ()+ marginY , txt )
1877+ painter .drawText (24 - rect .right () - marginX , - rect .top () + marginY , txt )
18771878 painter .end ()
18781879 return QtGui .QIcon (pixmap )
18791880
@@ -1950,7 +1951,7 @@ def updateSentItemStatusByAckdata(self, ackdata, textToDisplay):
19501951 try :
19511952 newlinePosition = textToDisplay .indexOf ('\n ' )
19521953 except :
1953- # If someone misses adding a "_translate" to a string before passing it to this function,
1954+ # If someone misses adding a "_translate" to a string before passing it to this function,
19541955 # this function won't receive a qstring which will cause an exception.
19551956 newlinePosition = 0
19561957 if newlinePosition > 1 :
@@ -1987,8 +1988,7 @@ def newVersionAvailable(self, version):
19871988 "MainWindow" ,
19881989 "New version of PyBitmessage is available: %1. Download it"
19891990 " from https://github.com/Bitmessage/PyBitmessage/releases/latest"
1990- ).arg (self .notifiedNewVersion )
1991- )
1991+ ).arg (self .notifiedNewVersion ))
19921992
19931993 def displayAlert (self , title , text , exitAfterUserClicksOk ):
19941994 self .updateStatusBar (text )
@@ -2011,7 +2011,7 @@ def rerenderMessagelistToLabels(self):
20112011 messagelist .item (i , 0 ).setLabel ()
20122012
20132013 def rerenderAddressBook (self ):
2014- def addRow (address , label , type ):
2014+ def addRow (address , label , type ):
20152015 self .ui .tableWidgetAddressBook .insertRow (0 )
20162016 newItem = Ui_AddressBookWidgetItemLabel (address , text_type (label , 'utf-8' ), type )
20172017 self .ui .tableWidgetAddressBook .setItem (0 , 0 , newItem )
@@ -2157,14 +2157,16 @@ def click_pushButtonSend(self):
21572157 "MainWindow" ,
21582158 "You are trying to send an email instead of a bitmessage. "
21592159 "This requires registering with a gateway. Attempt to register?" ),
2160- QtGui .QMessageBox .Yes | QtGui .QMessageBox .No ) != QtGui .QMessageBox .Yes :
2160+ QtGui .QMessageBox .Yes | QtGui .QMessageBox .No ) != QtGui .QMessageBox .Yes :
21612161 continue
21622162 email = acct .getLabel ()
2163- if email [- 14 :] != "@mailchuck.com" : # attempt register
2163+ if email [- 14 :] != "@mailchuck.com" : # attempt register
21642164 # 12 character random email address
21652165 email = '' .join (
2166- random .SystemRandom ().choice (string .ascii_lowercase ) for _ in range (12 )
2167- ) + "@mailchuck.com"
2166+ random .SystemRandom ().
2167+ choice (string .ascii_lowercase )
2168+ for _ in range (12 )
2169+ ) + "@mailchuck.com"
21682170 acct = MailchuckAccount (fromAddress )
21692171 acct .register (email )
21702172 config .set (fromAddress , 'label' , email )
@@ -2176,8 +2178,7 @@ def click_pushButtonSend(self):
21762178 " an email gateway. Sending registration"
21772179 " now as %1, please wait for the registration"
21782180 " to be processed before retrying sending."
2179- ).arg (email )
2180- )
2181+ ).arg (email ))
21812182 return
21822183 status , addressVersionNumber , streamNumber = decodeAddress (toAddress )[:3 ]
21832184 if status != 'success' :
@@ -2192,57 +2193,57 @@ def click_pushButtonSend(self):
21922193 "MainWindow" ,
21932194 "Error: Bitmessage addresses start with"
21942195 " BM- Please check the recipient address %1"
2195- ).arg (toAddress ))
2196+ ).arg (toAddress ))
21962197 elif status == 'checksumfailed' :
21972198 self .updateStatusBar (_translate (
21982199 "MainWindow" ,
21992200 "Error: The recipient address %1 is not"
22002201 " typed or copied correctly. Please check it."
2201- ).arg (toAddress ))
2202+ ).arg (toAddress ))
22022203 elif status == 'invalidcharacters' :
22032204 self .updateStatusBar (_translate (
22042205 "MainWindow" ,
22052206 "Error: The recipient address %1 contains"
22062207 " invalid characters. Please check it."
2207- ).arg (toAddress ))
2208+ ).arg (toAddress ))
22082209 elif status == 'versiontoohigh' :
22092210 self .updateStatusBar (_translate (
22102211 "MainWindow" ,
22112212 "Error: The version of the recipient address"
22122213 " %1 is too high. Either you need to upgrade"
22132214 " your Bitmessage software or your"
22142215 " acquaintance is being clever."
2215- ).arg (toAddress ))
2216+ ).arg (toAddress ))
22162217 elif status == 'ripetooshort' :
22172218 self .updateStatusBar (_translate (
22182219 "MainWindow" ,
22192220 "Error: Some data encoded in the recipient"
22202221 " address %1 is too short. There might be"
22212222 " something wrong with the software of"
22222223 " your acquaintance."
2223- ).arg (toAddress ))
2224+ ).arg (toAddress ))
22242225 elif status == 'ripetoolong' :
22252226 self .updateStatusBar (_translate (
22262227 "MainWindow" ,
22272228 "Error: Some data encoded in the recipient"
22282229 " address %1 is too long. There might be"
22292230 " something wrong with the software of"
22302231 " your acquaintance."
2231- ).arg (toAddress ))
2232+ ).arg (toAddress ))
22322233 elif status == 'varintmalformed' :
22332234 self .updateStatusBar (_translate (
22342235 "MainWindow" ,
22352236 "Error: Some data encoded in the recipient"
22362237 " address %1 is malformed. There might be"
22372238 " something wrong with the software of"
22382239 " your acquaintance."
2239- ).arg (toAddress ))
2240+ ).arg (toAddress ))
22402241 else :
22412242 self .updateStatusBar (_translate (
22422243 "MainWindow" ,
22432244 "Error: Something is wrong with the"
22442245 " recipient address %1."
2245- ).arg (toAddress ))
2246+ ).arg (toAddress ))
22462247 elif fromAddress == '' :
22472248 self .updateStatusBar (_translate (
22482249 "MainWindow" ,
@@ -2750,14 +2751,14 @@ def quit(self):
27502751 _translate (
27512752 "MainWindow" ,
27522753 "%n object(s) pending proof of work" , None ,
2753- QtCore .QCoreApplication .CodecForTr , powQueueSize ()
2754- ) + ", " +
2755- _translate (
2754+ QtCore .QCoreApplication .CodecForTr , powQueueSize ())
2755+ + ", "
2756+ + _translate (
27562757 "MainWindow" ,
27572758 "%n object(s) waiting to be distributed" , None ,
2758- QtCore .QCoreApplication .CodecForTr , pendingUpload ()
2759- ) + "\n \n " +
2760- _translate (
2759+ QtCore .QCoreApplication .CodecForTr , pendingUpload ())
2760+ + "\n \n "
2761+ + _translate (
27612762 "MainWindow" , "Wait until these tasks finish?" ),
27622763 QtGui .QMessageBox .Yes | QtGui .QMessageBox .No
27632764 | QtGui .QMessageBox .Cancel , QtGui .QMessageBox .Cancel )
@@ -2840,8 +2841,8 @@ def quit(self):
28402841 if curWorkerQueue > 0 :
28412842 self .updateStatusBar (_translate (
28422843 "MainWindow" , "Waiting for PoW to finish... %1%"
2843- ).arg (50 * (maxWorkerQueue - curWorkerQueue ) /
2844- maxWorkerQueue ))
2844+ ).arg (50 * (maxWorkerQueue - curWorkerQueue )
2845+ / maxWorkerQueue ))
28452846 time .sleep (0.5 )
28462847 QtCore .QCoreApplication .processEvents (
28472848 QtCore .QEventLoop .AllEvents , 1000
@@ -2947,10 +2948,10 @@ def on_action_InboxMessageForceHtml(self):
29472948 lines [i ])
29482949 elif lines [i ] == '------------------------------------------------------' :
29492950 lines [i ] = '<hr>'
2950- elif lines [i ] == '' and (i + 1 ) < totalLines and \
2951- lines [i + 1 ] != '------------------------------------------------------' :
2951+ elif lines [i ] == '' and (i + 1 ) < totalLines and \
2952+ lines [i + 1 ] != '------------------------------------------------------' :
29522953 lines [i ] = '<br><br>'
2953- content = ' ' .join (lines ) # To keep the whitespace between lines
2954+ content = ' ' .join (lines ) # To keep the whitespace between lines
29542955 content = shared .fixPotentiallyInvalidUTF8Data (content )
29552956 content = text_type (content , 'utf-8)' )
29562957 textEdit .setHtml (QtCore .QString (content ))
@@ -3007,7 +3008,8 @@ def quote_line(line):
30073008 # Wrap and quote lines/paragraphs new to this message.
30083009 else :
30093010 return quoteWrapper .fill (line )
3010- return '\n ' .join ([quote_line (l ) for l in message .splitlines ()]) + '\n \n '
3011+ return '\n ' .join ([quote_line (line )
3012+ for line in message .splitlines ()]) + '\n \n '
30113013
30123014 def setSendFromComboBox (self , address = None ):
30133015 if address is None :
@@ -3109,8 +3111,8 @@ def on_action_InboxReply(self, reply_type=None):
31093111 toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
31103112 if fromAddressAtCurrentInboxRow == \
31113113 tableWidget .item (currentInboxRow , column_from ).label or (
3112- isinstance (acct , GatewayAccount ) and
3113- fromAddressAtCurrentInboxRow == acct .relayAddress ):
3114+ isinstance (acct , GatewayAccount )
3115+ and fromAddressAtCurrentInboxRow == acct .relayAddress ):
31143116 self .ui .lineEditTo .setText (str (acct .fromAddress ))
31153117 else :
31163118 self .ui .lineEditTo .setText (
@@ -3239,8 +3241,8 @@ def on_action_InboxTrash(self):
32393241 idCount = len (inventoryHashesToTrash )
32403242 sqlExecuteChunked (
32413243 ("DELETE FROM inbox" if folder == "trash" or shifted else
3242- "UPDATE inbox SET folder='trash', read=1" ) +
3243- " WHERE msgid IN ({0})" , idCount , * inventoryHashesToTrash )
3244+ "UPDATE inbox SET folder='trash', read=1" )
3245+ + " WHERE msgid IN ({0})" , idCount , * inventoryHashesToTrash )
32443246 tableWidget .selectRow (0 if currentRow == 0 else currentRow - 1 )
32453247 tableWidget .setUpdatesEnabled (True )
32463248 self .propagateUnreadCount (folder )
@@ -3296,7 +3298,7 @@ def on_action_InboxSaveMessageAs(self):
32963298 defaultFilename = "" .join (x for x in subjectAtCurrentInboxRow if x .isalnum ()) + '.txt'
32973299 filename = QtGui .QFileDialog .getSaveFileName (
32983300 self ,
3299- _translate ("MainWindow" ,"Save As..." ),
3301+ _translate ("MainWindow" , "Save As..." ),
33003302 defaultFilename ,
33013303 "Text files (*.txt);;All files (*.*)" )
33023304 if filename == '' :
@@ -3755,8 +3757,8 @@ def on_action_ClipboardMessagelist(self):
37553757 otherAddress = tableWidget .item (currentRow , 1 ).data (QtCore .Qt .UserRole )
37563758 account = accountClass (myAddress )
37573759 if isinstance (account , GatewayAccount ) and otherAddress == account .relayAddress and (
3758- (currentColumn in [0 , 2 ] and self .getCurrentFolder () == "sent" ) or
3759- (currentColumn in [1 , 2 ] and self .getCurrentFolder () != "sent" )):
3760+ (currentColumn in [0 , 2 ] and self .getCurrentFolder () == "sent" )
3761+ or (currentColumn in [1 , 2 ] and self .getCurrentFolder () != "sent" )):
37603762 text = str (tableWidget .item (currentRow , currentColumn ).label )
37613763 else :
37623764 text = tableWidget .item (currentRow , currentColumn ).data (QtCore .Qt .UserRole )
0 commit comments