<s> withMessagingMenu = False <EOL> try : <EOL> from gi . repository import MessagingMenu <EOL> from gi . repository import Notify <EOL> withMessagingMenu = True <EOL> except ImportError : <EOL> MessagingMenu = None <EOL> from addresses import * <EOL> import shared <EOL> from bitmessageui import * <EOL> from namecoin import namecoinConnection , ensureNamecoinOptions <EOL> from newaddressdialog import * <EOL> from addaddressdialog import * <EOL> from newsubscriptiondialog import * <EOL> from regenerateaddresses import * <EOL> from newchandialog import * <EOL> from specialaddressbehavior import * <EOL> from settings import * <EOL> from about import * <EOL> from help import * <EOL> from iconglossary import * <EOL> from connect import * <EOL> import sys <EOL> from time import strftime , localtime , gmtime <EOL> import time <EOL> import os <EOL> import hashlib <EOL> from pyelliptic . openssl import OpenSSL <EOL> import pickle <EOL> import platform <EOL> import textwrap <EOL> import debug <EOL> from debug import logger <EOL> import subprocess <EOL> import datetime <EOL> from helper_sql import * <EOL> import l10n <EOL> try : <EOL> from PyQt4 import QtCore , QtGui <EOL> from PyQt4 . QtCore import * <EOL> from PyQt4 . QtGui import * <EOL> except Exception as err : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , err <EOL> sys . exit ( ) <EOL> try : <EOL> _encoding = QtGui . QApplication . UnicodeUTF8 <EOL> except AttributeError : <EOL> print '<STR_LIT>' , err <EOL> def _translate ( context , text ) : <EOL> return QtGui . QApplication . translate ( context , text ) <EOL> def identiconize ( address ) : <EOL> size = <NUM_LIT> <EOL> try : <EOL> identicon_lib = shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> except : <EOL> identicon_lib = '<STR_LIT>' <EOL> identiconsuffix = shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if not shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> idcon = QtGui . QIcon ( ) <EOL> return idcon <EOL> if ( identicon_lib [ : len ( '<STR_LIT>' ) ] == '<STR_LIT>' ) : <EOL> import qidenticon <EOL> hash = hashlib . md5 ( addBMIfNotPresent ( address ) + identiconsuffix ) . hexdigest ( ) <EOL> use_two_colors = ( identicon_lib [ : len ( '<STR_LIT>' ) ] == '<STR_LIT>' ) <EOL> opacity = int ( not ( ( identicon_lib == '<STR_LIT>' ) | ( identicon_lib == '<STR_LIT>' ) | ( identicon_lib == '<STR_LIT>' ) | ( identicon_lib == '<STR_LIT>' ) ) ) * <NUM_LIT:255> <EOL> penwidth = <NUM_LIT:0> <EOL> image = qidenticon . render_identicon ( int ( hash , <NUM_LIT:16> ) , size , use_two_colors , opacity , penwidth ) <EOL> idcon = QtGui . QIcon ( ) <EOL> idcon . addPixmap ( image , QtGui . QIcon . Normal , QtGui . QIcon . Off ) <EOL> return idcon <EOL> elif identicon_lib == '<STR_LIT>' : <EOL> from pydenticon import Pydenticon <EOL> idcon_render = Pydenticon ( addBMIfNotPresent ( address ) + identiconsuffix , size * <NUM_LIT:3> ) <EOL> rendering = idcon_render . _render ( ) <EOL> data = rendering . convert ( "<STR_LIT>" ) . tostring ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> qim = QImage ( data , size , size , QImage . Format_ARGB32 ) <EOL> pix = QPixmap . fromImage ( qim ) <EOL> idcon = QtGui . QIcon ( ) <EOL> idcon . addPixmap ( pix , QtGui . QIcon . Normal , QtGui . QIcon . Off ) <EOL> return idcon <EOL> def avatarize ( address ) : <EOL> """<STR_LIT>""" <EOL> idcon = QtGui . QIcon ( ) <EOL> hash = hashlib . md5 ( addBMIfNotPresent ( address ) ) . hexdigest ( ) <EOL> str_broadcast_subscribers = '<STR_LIT>' <EOL> if address == str_broadcast_subscribers : <EOL> hash = address <EOL> extensions = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> for ext in extensions : <EOL> lower_hash = shared . appdata + '<STR_LIT>' + hash + '<STR_LIT:.>' + ext . lower ( ) <EOL> upper_hash = shared . appdata + '<STR_LIT>' + hash + '<STR_LIT:.>' + ext . upper ( ) <EOL> if os . path . isfile ( lower_hash ) : <EOL> idcon . addFile ( lower_hash ) <EOL> return idcon <EOL> elif os . path . isfile ( upper_hash ) : <EOL> idcon . addFile ( upper_hash ) <EOL> return idcon <EOL> for ext in extensions : <EOL> lower_default = shared . appdata + '<STR_LIT>' + '<STR_LIT>' + ext . lower ( ) <EOL> upper_default = shared . appdata + '<STR_LIT>' + '<STR_LIT>' + ext . upper ( ) <EOL> if os . path . isfile ( lower_default ) : <EOL> default = lower_default <EOL> idcon . addFile ( lower_default ) <EOL> return idcon <EOL> elif os . path . isfile ( upper_default ) : <EOL> default = upper_default <EOL> idcon . addFile ( upper_default ) <EOL> return idcon <EOL> return identiconize ( address ) <EOL> def change_translation ( locale ) : <EOL> global qtranslator <EOL> qtranslator = QtCore . QTranslator ( ) <EOL> translationpath = os . path . join ( <EOL> getattr ( sys , '<STR_LIT>' , sys . path [ <NUM_LIT:0> ] ) , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' + locale <EOL> ) <EOL> qtranslator . load ( translationpath ) <EOL> QtGui . QApplication . installTranslator ( qtranslator ) <EOL> class MyForm ( QtGui . QMainWindow ) : <EOL> SOUND_NONE = <NUM_LIT:0> <EOL> SOUND_KNOWN = <NUM_LIT:1> <EOL> SOUND_UNKNOWN = <NUM_LIT:2> <EOL> SOUND_CONNECTED = <NUM_LIT:3> <EOL> SOUND_DISCONNECTED = <NUM_LIT:4> <EOL> SOUND_CONNECTION_GREEN = <NUM_LIT:5> <EOL> lastSoundTime = datetime . datetime . now ( ) - datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> maxSoundFrequencySec = <NUM_LIT> <EOL> str_broadcast_subscribers = '<STR_LIT>' <EOL> str_chan = '<STR_LIT>' <EOL> def init_file_menu ( self ) : <EOL> QtCore . QObject . connect ( self . ui . actionExit , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . quit ) <EOL> QtCore . QObject . connect ( self . ui . actionManageKeys , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_actionManageKeys ) <EOL> QtCore . QObject . connect ( self . ui . actionDeleteAllTrashedMessages , <EOL> QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , <EOL> self . click_actionDeleteAllTrashedMessages ) <EOL> QtCore . QObject . connect ( self . ui . actionRegenerateDeterministicAddresses , <EOL> QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , <EOL> self . click_actionRegenerateDeterministicAddresses ) <EOL> QtCore . QObject . connect ( self . ui . actionJoinChan , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , <EOL> self . click_actionJoinChan ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonNewAddress , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_NewAddressDialog ) <EOL> QtCore . QObject . connect ( self . ui . comboBoxSendFrom , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . redrawLabelFrom ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonAddAddressBook , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_pushButtonAddAddressBook ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonAddSubscription , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_pushButtonAddSubscription ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonAddBlacklist , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_pushButtonAddBlacklist ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonTTL , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_pushButtonTTL ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonSend , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_pushButtonSend ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonLoadFromAddressBook , <EOL> QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , <EOL> self . click_pushButtonLoadFromAddressBook ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonFetchNamecoinID , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_pushButtonFetchNamecoinID ) <EOL> QtCore . QObject . connect ( self . ui . radioButtonBlacklist , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_radioButtonBlacklist ) <EOL> QtCore . QObject . connect ( self . ui . radioButtonWhitelist , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_radioButtonWhitelist ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonStatusIcon , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_pushButtonStatusIcon ) <EOL> QtCore . QObject . connect ( self . ui . actionSettings , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_actionSettings ) <EOL> QtCore . QObject . connect ( self . ui . actionAbout , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_actionAbout ) <EOL> QtCore . QObject . connect ( self . ui . actionHelp , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_actionHelp ) <EOL> def init_inbox_popup_menu ( self , connectSignal = True ) : <EOL> self . ui . inboxContextMenuToolbar = QtGui . QToolBar ( ) <EOL> self . actionReply = self . ui . inboxContextMenuToolbar . addAction ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_InboxReply ) <EOL> self . actionAddSenderToAddressBook = self . ui . inboxContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_InboxAddSenderToAddressBook ) <EOL> self . actionTrashInboxMessage = self . ui . inboxContextMenuToolbar . addAction ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_InboxTrash ) <EOL> self . actionForceHtml = self . ui . inboxContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_InboxMessageForceHtml ) <EOL> self . actionSaveMessageAs = self . ui . inboxContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_InboxSaveMessageAs ) <EOL> self . actionMarkUnread = self . ui . inboxContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_InboxMarkUnread ) <EOL> self . ui . tableWidgetInbox . setContextMenuPolicy ( <EOL> QtCore . Qt . CustomContextMenu ) <EOL> if connectSignal : <EOL> self . connect ( self . ui . tableWidgetInbox , QtCore . SIGNAL ( <EOL> '<STR_LIT>' ) , <EOL> self . on_context_menuInbox ) <EOL> self . popMenuInbox = QtGui . QMenu ( self ) <EOL> self . popMenuInbox . addAction ( self . actionForceHtml ) <EOL> self . popMenuInbox . addAction ( self . actionMarkUnread ) <EOL> self . popMenuInbox . addSeparator ( ) <EOL> self . popMenuInbox . addAction ( self . actionReply ) <EOL> self . popMenuInbox . addAction ( self . actionAddSenderToAddressBook ) <EOL> self . popMenuInbox . addSeparator ( ) <EOL> self . popMenuInbox . addAction ( self . actionSaveMessageAs ) <EOL> self . popMenuInbox . addAction ( self . actionTrashInboxMessage ) <EOL> def init_identities_popup_menu ( self , connectSignal = True ) : <EOL> self . ui . addressContextMenuToolbar = QtGui . QToolBar ( ) <EOL> self . actionNew = self . ui . addressContextMenuToolbar . addAction ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_YourIdentitiesNew ) <EOL> self . actionEnable = self . ui . addressContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_YourIdentitiesEnable ) <EOL> self . actionDisable = self . ui . addressContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_YourIdentitiesDisable ) <EOL> self . actionSetAvatar = self . ui . addressContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_YourIdentitiesSetAvatar ) <EOL> self . actionClipboard = self . ui . addressContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_YourIdentitiesClipboard ) <EOL> self . actionSpecialAddressBehavior = self . ui . addressContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_SpecialAddressBehaviorDialog ) <EOL> self . ui . tableWidgetYourIdentities . setContextMenuPolicy ( <EOL> QtCore . Qt . CustomContextMenu ) <EOL> if connectSignal : <EOL> self . connect ( self . ui . tableWidgetYourIdentities , QtCore . SIGNAL ( <EOL> '<STR_LIT>' ) , <EOL> self . on_context_menuYourIdentities ) <EOL> self . popMenu = QtGui . QMenu ( self ) <EOL> self . popMenu . addAction ( self . actionNew ) <EOL> self . popMenu . addSeparator ( ) <EOL> self . popMenu . addAction ( self . actionClipboard ) <EOL> self . popMenu . addSeparator ( ) <EOL> self . popMenu . addAction ( self . actionEnable ) <EOL> self . popMenu . addAction ( self . actionDisable ) <EOL> self . popMenu . addAction ( self . actionSetAvatar ) <EOL> self . popMenu . addAction ( self . actionSpecialAddressBehavior ) <EOL> def init_addressbook_popup_menu ( self , connectSignal = True ) : <EOL> self . ui . addressBookContextMenuToolbar = QtGui . QToolBar ( ) <EOL> self . actionAddressBookSend = self . ui . addressBookContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_AddressBookSend ) <EOL> self . actionAddressBookClipboard = self . ui . addressBookContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_AddressBookClipboard ) <EOL> self . actionAddressBookSubscribe = self . ui . addressBookContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_AddressBookSubscribe ) <EOL> self . actionAddressBookSetAvatar = self . ui . addressBookContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_AddressBookSetAvatar ) <EOL> self . actionAddressBookNew = self . ui . addressBookContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_AddressBookNew ) <EOL> self . actionAddressBookDelete = self . ui . addressBookContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_AddressBookDelete ) <EOL> self . ui . tableWidgetAddressBook . setContextMenuPolicy ( <EOL> QtCore . Qt . CustomContextMenu ) <EOL> if connectSignal : <EOL> self . connect ( self . ui . tableWidgetAddressBook , QtCore . SIGNAL ( <EOL> '<STR_LIT>' ) , <EOL> self . on_context_menuAddressBook ) <EOL> self . popMenuAddressBook = QtGui . QMenu ( self ) <EOL> self . popMenuAddressBook . addAction ( self . actionAddressBookSend ) <EOL> self . popMenuAddressBook . addAction ( self . actionAddressBookClipboard ) <EOL> self . popMenuAddressBook . addAction ( self . actionAddressBookSubscribe ) <EOL> self . popMenuAddressBook . addAction ( self . actionAddressBookSetAvatar ) <EOL> self . popMenuAddressBook . addSeparator ( ) <EOL> self . popMenuAddressBook . addAction ( self . actionAddressBookNew ) <EOL> self . popMenuAddressBook . addAction ( self . actionAddressBookDelete ) <EOL> def init_subscriptions_popup_menu ( self , connectSignal = True ) : <EOL> self . ui . subscriptionsContextMenuToolbar = QtGui . QToolBar ( ) <EOL> self . actionsubscriptionsNew = self . ui . subscriptionsContextMenuToolbar . addAction ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_SubscriptionsNew ) <EOL> self . actionsubscriptionsDelete = self . ui . subscriptionsContextMenuToolbar . addAction ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_SubscriptionsDelete ) <EOL> self . actionsubscriptionsClipboard = self . ui . subscriptionsContextMenuToolbar . addAction ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_SubscriptionsClipboard ) <EOL> self . actionsubscriptionsEnable = self . ui . subscriptionsContextMenuToolbar . addAction ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_SubscriptionsEnable ) <EOL> self . actionsubscriptionsDisable = self . ui . subscriptionsContextMenuToolbar . addAction ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_SubscriptionsDisable ) <EOL> self . actionsubscriptionsSetAvatar = self . ui . subscriptionsContextMenuToolbar . addAction ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_SubscriptionsSetAvatar ) <EOL> self . ui . tableWidgetSubscriptions . setContextMenuPolicy ( <EOL> QtCore . Qt . CustomContextMenu ) <EOL> if connectSignal : <EOL> self . connect ( self . ui . tableWidgetSubscriptions , QtCore . SIGNAL ( <EOL> '<STR_LIT>' ) , <EOL> self . on_context_menuSubscriptions ) <EOL> self . popMenuSubscriptions = QtGui . QMenu ( self ) <EOL> self . popMenuSubscriptions . addAction ( self . actionsubscriptionsNew ) <EOL> self . popMenuSubscriptions . addAction ( self . actionsubscriptionsDelete ) <EOL> self . popMenuSubscriptions . addSeparator ( ) <EOL> self . popMenuSubscriptions . addAction ( self . actionsubscriptionsEnable ) <EOL> self . popMenuSubscriptions . addAction ( self . actionsubscriptionsDisable ) <EOL> self . popMenuSubscriptions . addAction ( self . actionsubscriptionsSetAvatar ) <EOL> self . popMenuSubscriptions . addSeparator ( ) <EOL> self . popMenuSubscriptions . addAction ( self . actionsubscriptionsClipboard ) <EOL> def init_sent_popup_menu ( self , connectSignal = True ) : <EOL> self . ui . sentContextMenuToolbar = QtGui . QToolBar ( ) <EOL> self . actionTrashSentMessage = self . ui . sentContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_SentTrash ) <EOL> self . actionSentClipboard = self . ui . sentContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_SentClipboard ) <EOL> self . actionForceSend = self . ui . sentContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_ForceSend ) <EOL> self . ui . tableWidgetSent . setContextMenuPolicy ( <EOL> QtCore . Qt . CustomContextMenu ) <EOL> if connectSignal : <EOL> self . connect ( self . ui . tableWidgetSent , QtCore . SIGNAL ( <EOL> '<STR_LIT>' ) , <EOL> self . on_context_menuSent ) <EOL> def init_blacklist_popup_menu ( self , connectSignal = True ) : <EOL> self . ui . blacklistContextMenuToolbar = QtGui . QToolBar ( ) <EOL> self . actionBlacklistNew = self . ui . blacklistContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_BlacklistNew ) <EOL> self . actionBlacklistDelete = self . ui . blacklistContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_BlacklistDelete ) <EOL> self . actionBlacklistClipboard = self . ui . blacklistContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_BlacklistClipboard ) <EOL> self . actionBlacklistEnable = self . ui . blacklistContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_BlacklistEnable ) <EOL> self . actionBlacklistDisable = self . ui . blacklistContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . on_action_BlacklistDisable ) <EOL> self . actionBlacklistSetAvatar = self . ui . blacklistContextMenuToolbar . addAction ( <EOL> _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . on_action_BlacklistSetAvatar ) <EOL> self . ui . tableWidgetBlacklist . setContextMenuPolicy ( <EOL> QtCore . Qt . CustomContextMenu ) <EOL> if connectSignal : <EOL> self . connect ( self . ui . tableWidgetBlacklist , QtCore . SIGNAL ( <EOL> '<STR_LIT>' ) , <EOL> self . on_context_menuBlacklist ) <EOL> self . popMenuBlacklist = QtGui . QMenu ( self ) <EOL> self . popMenuBlacklist . addAction ( self . actionBlacklistDelete ) <EOL> self . popMenuBlacklist . addSeparator ( ) <EOL> self . popMenuBlacklist . addAction ( self . actionBlacklistClipboard ) <EOL> self . popMenuBlacklist . addSeparator ( ) <EOL> self . popMenuBlacklist . addAction ( self . actionBlacklistEnable ) <EOL> self . popMenuBlacklist . addAction ( self . actionBlacklistDisable ) <EOL> self . popMenuBlacklist . addAction ( self . actionBlacklistSetAvatar ) <EOL> def __init__ ( self , parent = None ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_MainWindow ( ) <EOL> self . ui . setupUi ( self ) <EOL> configSections = shared . config . sections ( ) <EOL> for addressInKeysFile in configSections : <EOL> if addressInKeysFile != '<STR_LIT>' : <EOL> status , addressVersionNumber , streamNumber , hash = decodeAddress ( <EOL> addressInKeysFile ) <EOL> if addressVersionNumber == <NUM_LIT:1> : <EOL> displayMsg = _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" <EOL> + "<STR_LIT>" ) . arg ( addressInKeysFile ) <EOL> reply = QtGui . QMessageBox . question ( <EOL> self , '<STR_LIT>' , displayMsg , QtGui . QMessageBox . Yes , QtGui . QMessageBox . No ) <EOL> if reply == QtGui . QMessageBox . Yes : <EOL> shared . config . remove_section ( addressInKeysFile ) <EOL> shared . writeKeysFile ( ) <EOL> if '<STR_LIT:win32>' in sys . platform or '<STR_LIT>' in sys . platform : <EOL> RUN_PATH = "<STR_LIT>" <EOL> self . settings = QSettings ( RUN_PATH , QSettings . NativeFormat ) <EOL> self . settings . remove ( <EOL> "<STR_LIT>" ) <EOL> if shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> self . settings . setValue ( "<STR_LIT>" , sys . argv [ <NUM_LIT:0> ] ) <EOL> elif '<STR_LIT>' in sys . platform : <EOL> pass <EOL> elif '<STR_LIT>' in sys . platform : <EOL> pass <EOL> self . totalNumberOfBytesReceived = <NUM_LIT:0> <EOL> self . totalNumberOfBytesSent = <NUM_LIT:0> <EOL> self . ui . labelSendBroadcastWarning . setVisible ( False ) <EOL> self . timer = QtCore . QTimer ( ) <EOL> self . timer . start ( <NUM_LIT> ) <EOL> QtCore . QObject . connect ( self . timer , QtCore . SIGNAL ( "<STR_LIT>" ) , self . runEveryTwoSeconds ) <EOL> self . init_file_menu ( ) <EOL> self . init_inbox_popup_menu ( ) <EOL> self . init_identities_popup_menu ( ) <EOL> self . init_addressbook_popup_menu ( ) <EOL> self . init_subscriptions_popup_menu ( ) <EOL> self . init_sent_popup_menu ( ) <EOL> self . init_blacklist_popup_menu ( ) <EOL> configSections = shared . config . sections ( ) <EOL> for addressInKeysFile in configSections : <EOL> if addressInKeysFile != '<STR_LIT>' : <EOL> isEnabled = shared . config . getboolean ( <EOL> addressInKeysFile , '<STR_LIT>' ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( <EOL> shared . config . get ( addressInKeysFile , '<STR_LIT:label>' ) , '<STR_LIT>' ) ) <EOL> if not isEnabled : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . ui . tableWidgetYourIdentities . insertRow ( <NUM_LIT:0> ) <EOL> newItem . setIcon ( avatarize ( addressInKeysFile ) ) <EOL> self . ui . tableWidgetYourIdentities . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( addressInKeysFile ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> if shared . safeConfigGetBoolean ( addressInKeysFile , '<STR_LIT>' ) : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> if not isEnabled : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> if shared . safeConfigGetBoolean ( addressInKeysFile , '<STR_LIT>' ) : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT> ) ) <EOL> self . ui . tableWidgetYourIdentities . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( str ( <EOL> decodeAddress ( addressInKeysFile ) [ <NUM_LIT:2> ] ) ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> if not isEnabled : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . ui . tableWidgetYourIdentities . setItem ( <NUM_LIT:0> , <NUM_LIT:2> , newItem ) <EOL> if isEnabled : <EOL> status , addressVersionNumber , streamNumber , hash = decodeAddress ( <EOL> addressInKeysFile ) <EOL> self . loadInbox ( ) <EOL> self . loadSent ( ) <EOL> self . rerenderAddressBook ( ) <EOL> self . rerenderSubscriptions ( ) <EOL> QtCore . QObject . connect ( self . ui . inboxSearchLineEdit , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . inboxSearchLineEditPressed ) <EOL> QtCore . QObject . connect ( self . ui . sentSearchLineEdit , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . sentSearchLineEditPressed ) <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT>' : <EOL> self . ui . tabWidget . setTabText ( <NUM_LIT:6> , '<STR_LIT>' ) <EOL> self . ui . radioButtonWhitelist . click ( ) <EOL> self . rerenderBlackWhiteList ( ) <EOL> QtCore . QObject . connect ( self . ui . tableWidgetYourIdentities , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . tableWidgetYourIdentitiesItemChanged ) <EOL> QtCore . QObject . connect ( self . ui . tableWidgetAddressBook , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . tableWidgetAddressBookItemChanged ) <EOL> QtCore . QObject . connect ( self . ui . tableWidgetSubscriptions , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . tableWidgetSubscriptionsItemChanged ) <EOL> QtCore . QObject . connect ( self . ui . tableWidgetInbox , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . tableWidgetInboxItemClicked ) <EOL> QtCore . QObject . connect ( self . ui . tableWidgetSent , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . tableWidgetSentItemClicked ) <EOL> self . statusbar = self . statusBar ( ) <EOL> self . statusbar . insertPermanentWidget ( <NUM_LIT:0> , self . ui . pushButtonStatusIcon ) <EOL> self . ui . labelStartupTime . setText ( _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( <EOL> l10n . formatTimestamp ( ) ) ) <EOL> self . numberOfMessagesProcessed = <NUM_LIT:0> <EOL> self . numberOfBroadcastsProcessed = <NUM_LIT:0> <EOL> self . numberOfPubkeysProcessed = <NUM_LIT:0> <EOL> identicon_size = <NUM_LIT:3> * <NUM_LIT:7> <EOL> self . ui . tableWidgetInbox . setIconSize ( QtCore . QSize ( identicon_size , identicon_size ) ) <EOL> self . ui . tableWidgetSent . setIconSize ( QtCore . QSize ( identicon_size , identicon_size ) ) <EOL> self . ui . tableWidgetYourIdentities . setIconSize ( QtCore . QSize ( identicon_size , identicon_size ) ) <EOL> self . ui . tableWidgetSubscriptions . setIconSize ( QtCore . QSize ( identicon_size , identicon_size ) ) <EOL> self . ui . tableWidgetAddressBook . setIconSize ( QtCore . QSize ( identicon_size , identicon_size ) ) <EOL> self . ui . tableWidgetBlacklist . setIconSize ( QtCore . QSize ( identicon_size , identicon_size ) ) <EOL> self . UISignalThread = UISignaler ( ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . writeNewAddressToTable ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . updateStatusBar ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . updateSentItemStatusByToAddress ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . updateSentItemStatusByAckdata ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . displayNewInboxMessage ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . displayNewSentMessage ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . updateNetworkStatusTab ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . updateNumberOfMessagesProcessed ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . updateNumberOfPubkeysProcessed ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . updateNumberOfBroadcastsProcessed ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . setStatusIcon ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . changedInboxUnread ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . rerenderInboxFromLabels ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . rerenderSentToLabels ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . rerenderAddressBook ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . rerenderSubscriptions ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . rerenderBlackWhiteList ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . removeInboxRowByMsgid ) <EOL> QtCore . QObject . connect ( self . UISignalThread , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . displayAlert ) <EOL> self . UISignalThread . start ( ) <EOL> self . rerenderComboBoxSendFrom ( ) <EOL> TTL = shared . config . getint ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if TTL < <NUM_LIT> : <EOL> TTL = <NUM_LIT> <EOL> elif TTL > <NUM_LIT> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> : <EOL> TTL = <NUM_LIT> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> <EOL> self . ui . horizontalSliderTTL . setSliderPosition ( ( TTL - <NUM_LIT> ) ** ( <NUM_LIT:1> / <NUM_LIT> ) ) <EOL> self . updateHumanFriendlyTTLDescription ( TTL ) <EOL> QtCore . QObject . connect ( self . ui . horizontalSliderTTL , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . updateTTL ) <EOL> try : <EOL> options = { } <EOL> options [ "<STR_LIT:type>" ] = shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> options [ "<STR_LIT:host>" ] = shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> options [ "<STR_LIT:port>" ] = shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> options [ "<STR_LIT:user>" ] = shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> options [ "<STR_LIT:password>" ] = shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> nc = namecoinConnection ( options ) <EOL> if nc . test ( ) [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> self . ui . pushButtonFetchNamecoinID . hide ( ) <EOL> except : <EOL> print '<STR_LIT>' <EOL> self . ui . pushButtonFetchNamecoinID . hide ( ) <EOL> def updateTTL ( self , sliderPosition ) : <EOL> TTL = int ( sliderPosition ** <NUM_LIT> + <NUM_LIT> ) <EOL> self . updateHumanFriendlyTTLDescription ( TTL ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( TTL ) ) <EOL> shared . writeKeysFile ( ) <EOL> def updateHumanFriendlyTTLDescription ( self , TTL ) : <EOL> numberOfHours = int ( round ( TTL / ( <NUM_LIT> * <NUM_LIT> ) ) ) <EOL> if numberOfHours < <NUM_LIT> : <EOL> if numberOfHours == <NUM_LIT:1> : <EOL> self . ui . labelHumanFriendlyTTLDescription . setText ( _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> self . ui . labelHumanFriendlyTTLDescription . setText ( _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( numberOfHours ) ) <EOL> else : <EOL> numberOfDays = int ( round ( TTL / ( <NUM_LIT> * <NUM_LIT> * <NUM_LIT> ) ) ) <EOL> self . ui . labelHumanFriendlyTTLDescription . setText ( _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( numberOfDays ) ) <EOL> def appIndicatorShowOrHideWindow ( self ) : <EOL> if not self . actionShow . isChecked ( ) : <EOL> self . hide ( ) <EOL> else : <EOL> if sys . platform [ <NUM_LIT:0> : <NUM_LIT:3> ] == '<STR_LIT>' : <EOL> self . setWindowFlags ( Qt . Window ) <EOL> self . show ( ) <EOL> self . setWindowState ( <EOL> self . windowState ( ) & ~ QtCore . Qt . WindowMinimized | QtCore . Qt . WindowActive ) <EOL> self . activateWindow ( ) <EOL> newMessageItem = None <EOL> newBroadcastItem = None <EOL> def appIndicatorShow ( self ) : <EOL> if self . actionShow is None : <EOL> return <EOL> if not self . actionShow . isChecked ( ) : <EOL> self . actionShow . setChecked ( True ) <EOL> self . appIndicatorShowOrHideWindow ( ) <EOL> def appIndicatorHide ( self ) : <EOL> if self . actionShow is None : <EOL> return <EOL> if self . actionShow . isChecked ( ) : <EOL> self . actionShow . setChecked ( False ) <EOL> self . appIndicatorShowOrHideWindow ( ) <EOL> """<STR_LIT>""" <EOL> def appIndicatorInbox ( self , mm_app , source_id ) : <EOL> self . appIndicatorShow ( ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:0> ) <EOL> selectedItem = None <EOL> if source_id == '<STR_LIT>' : <EOL> if self . newBroadcastItem is not None : <EOL> selectedItem = self . newBroadcastItem <EOL> self . newBroadcastItem = None <EOL> else : <EOL> if self . newMessageItem is not None : <EOL> selectedItem = self . newMessageItem <EOL> self . newMessageItem = None <EOL> if selectedItem is not None : <EOL> try : <EOL> self . ui . tableWidgetInbox . setCurrentItem ( selectedItem ) <EOL> except Exception : <EOL> self . ui . tableWidgetInbox . setCurrentCell ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> self . tableWidgetInboxItemClicked ( ) <EOL> else : <EOL> self . ui . tableWidgetInbox . setCurrentCell ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> self . tableWidgetInboxItemClicked ( ) <EOL> def appIndicatorSend ( self ) : <EOL> self . appIndicatorShow ( ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:1> ) <EOL> def appIndicatorSubscribe ( self ) : <EOL> self . appIndicatorShow ( ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:4> ) <EOL> def appIndicatorAddressBook ( self ) : <EOL> self . appIndicatorShow ( ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:5> ) <EOL> def loadSent ( self , where = "<STR_LIT>" , what = "<STR_LIT>" ) : <EOL> what = "<STR_LIT:%>" + what + "<STR_LIT:%>" <EOL> if where == "<STR_LIT>" : <EOL> where = "<STR_LIT>" <EOL> elif where == "<STR_LIT>" : <EOL> where = "<STR_LIT>" <EOL> elif where == "<STR_LIT>" : <EOL> where = "<STR_LIT>" <EOL> elif where == "<STR_LIT>" : <EOL> where = "<STR_LIT:message>" <EOL> else : <EOL> where = "<STR_LIT>" <EOL> sqlStatement = '''<STR_LIT>''' % ( where , ) <EOL> while self . ui . tableWidgetSent . rowCount ( ) > <NUM_LIT:0> : <EOL> self . ui . tableWidgetSent . removeRow ( <NUM_LIT:0> ) <EOL> queryreturn = sqlQuery ( sqlStatement , what ) <EOL> for row in queryreturn : <EOL> toAddress , fromAddress , subject , status , ackdata , lastactiontime = row <EOL> subject = shared . fixPotentiallyInvalidUTF8Data ( subject ) <EOL> if shared . config . has_section ( fromAddress ) : <EOL> fromLabel = shared . config . get ( fromAddress , '<STR_LIT:label>' ) <EOL> else : <EOL> fromLabel = fromAddress <EOL> toLabel = '<STR_LIT>' <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , toAddress ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> toLabel , = row <EOL> if toLabel == '<STR_LIT>' : <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , toAddress ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> toLabel , = row <EOL> if toLabel == '<STR_LIT>' : <EOL> if shared . config . has_section ( toAddress ) : <EOL> toLabel = shared . config . get ( toAddress , '<STR_LIT:label>' ) <EOL> if toLabel == '<STR_LIT>' : <EOL> toLabel = toAddress <EOL> self . ui . tableWidgetSent . insertRow ( <NUM_LIT:0> ) <EOL> toAddressItem = QtGui . QTableWidgetItem ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> toAddressItem . setToolTip ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> toAddressItem . setIcon ( avatarize ( toAddress ) ) <EOL> toAddressItem . setData ( Qt . UserRole , str ( toAddress ) ) <EOL> toAddressItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetSent . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , toAddressItem ) <EOL> if fromLabel == '<STR_LIT>' : <EOL> fromLabel = fromAddress <EOL> fromAddressItem = QtGui . QTableWidgetItem ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> fromAddressItem . setToolTip ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> fromAddressItem . setIcon ( avatarize ( fromAddress ) ) <EOL> fromAddressItem . setData ( Qt . UserRole , str ( fromAddress ) ) <EOL> fromAddressItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetSent . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , fromAddressItem ) <EOL> subjectItem = QtGui . QTableWidgetItem ( unicode ( subject , '<STR_LIT:utf-8>' ) ) <EOL> subjectItem . setToolTip ( unicode ( subject , '<STR_LIT:utf-8>' ) ) <EOL> subjectItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetSent . setItem ( <NUM_LIT:0> , <NUM_LIT:2> , subjectItem ) <EOL> if status == '<STR_LIT>' : <EOL> statusText = _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( <EOL> l10n . formatTimestamp ( lastactiontime ) ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( <EOL> l10n . formatTimestamp ( lastactiontime ) ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( <EOL> l10n . formatTimestamp ( lastactiontime ) ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( <EOL> l10n . formatTimestamp ( lastactiontime ) ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( <EOL> l10n . formatTimestamp ( lastactiontime ) ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( <EOL> l10n . formatTimestamp ( lastactiontime ) ) <EOL> elif status == '<STR_LIT>' : <EOL> statusText = _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) <EOL> else : <EOL> statusText = _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( status ) . arg ( <EOL> l10n . formatTimestamp ( lastactiontime ) ) <EOL> newItem = myTableWidgetItem ( statusText ) <EOL> newItem . setToolTip ( statusText ) <EOL> newItem . setData ( Qt . UserRole , QByteArray ( ackdata ) ) <EOL> newItem . setData ( <NUM_LIT> , int ( lastactiontime ) ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetSent . setItem ( <NUM_LIT:0> , <NUM_LIT:3> , newItem ) <EOL> self . ui . tableWidgetSent . sortItems ( <NUM_LIT:3> , Qt . DescendingOrder ) <EOL> self . ui . tableWidgetSent . keyPressEvent = self . tableWidgetSentKeyPressEvent <EOL> def loadInbox ( self , where = "<STR_LIT>" , what = "<STR_LIT>" ) : <EOL> what = "<STR_LIT:%>" + what + "<STR_LIT:%>" <EOL> if where == "<STR_LIT>" : <EOL> where = "<STR_LIT>" <EOL> elif where == "<STR_LIT>" : <EOL> where = "<STR_LIT>" <EOL> elif where == "<STR_LIT>" : <EOL> where = "<STR_LIT>" <EOL> elif where == "<STR_LIT>" : <EOL> where = "<STR_LIT:message>" <EOL> else : <EOL> where = "<STR_LIT>" <EOL> sqlStatement = '''<STR_LIT>''' % ( where , ) <EOL> while self . ui . tableWidgetInbox . rowCount ( ) > <NUM_LIT:0> : <EOL> self . ui . tableWidgetInbox . removeRow ( <NUM_LIT:0> ) <EOL> font = QFont ( ) <EOL> font . setBold ( True ) <EOL> queryreturn = sqlQuery ( sqlStatement , what ) <EOL> for row in queryreturn : <EOL> msgid , toAddress , fromAddress , subject , received , read = row <EOL> subject = shared . fixPotentiallyInvalidUTF8Data ( subject ) <EOL> try : <EOL> if toAddress == self . str_broadcast_subscribers : <EOL> toLabel = self . str_broadcast_subscribers <EOL> else : <EOL> toLabel = shared . config . get ( toAddress , '<STR_LIT:label>' ) <EOL> except : <EOL> toLabel = '<STR_LIT>' <EOL> if toLabel == '<STR_LIT>' : <EOL> toLabel = toAddress <EOL> fromLabel = '<STR_LIT>' <EOL> if shared . config . has_section ( fromAddress ) : <EOL> fromLabel = shared . config . get ( fromAddress , '<STR_LIT:label>' ) <EOL> if fromLabel == '<STR_LIT>' : <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , fromAddress ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> fromLabel , = row <EOL> if fromLabel == '<STR_LIT>' : <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , fromAddress ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> fromLabel , = row <EOL> if fromLabel == '<STR_LIT>' : <EOL> fromLabel = fromAddress <EOL> self . ui . tableWidgetInbox . insertRow ( <NUM_LIT:0> ) <EOL> to_item = QtGui . QTableWidgetItem ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> to_item . setToolTip ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> to_item . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> if not read : <EOL> to_item . setFont ( font ) <EOL> to_item . setData ( Qt . UserRole , str ( toAddress ) ) <EOL> if shared . safeConfigGetBoolean ( toAddress , '<STR_LIT>' ) : <EOL> to_item . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT> ) ) <EOL> if shared . safeConfigGetBoolean ( str ( toAddress ) , '<STR_LIT>' ) : <EOL> to_item . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> to_item . setIcon ( avatarize ( toAddress ) ) <EOL> self . ui . tableWidgetInbox . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , to_item ) <EOL> from_item = QtGui . QTableWidgetItem ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> from_item . setToolTip ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> from_item . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> if not read : <EOL> from_item . setFont ( font ) <EOL> from_item . setData ( Qt . UserRole , str ( fromAddress ) ) <EOL> if shared . safeConfigGetBoolean ( str ( fromAddress ) , '<STR_LIT>' ) : <EOL> from_item . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> from_item . setIcon ( avatarize ( fromAddress ) ) <EOL> self . ui . tableWidgetInbox . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , from_item ) <EOL> subject_item = QtGui . QTableWidgetItem ( unicode ( subject , '<STR_LIT:utf-8>' ) ) <EOL> subject_item . setToolTip ( unicode ( subject , '<STR_LIT:utf-8>' ) ) <EOL> subject_item . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> if not read : <EOL> subject_item . setFont ( font ) <EOL> self . ui . tableWidgetInbox . setItem ( <NUM_LIT:0> , <NUM_LIT:2> , subject_item ) <EOL> time_item = myTableWidgetItem ( l10n . formatTimestamp ( received ) ) <EOL> time_item . setToolTip ( l10n . formatTimestamp ( received ) ) <EOL> time_item . setData ( Qt . UserRole , QByteArray ( msgid ) ) <EOL> time_item . setData ( <NUM_LIT> , int ( received ) ) <EOL> time_item . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> if not read : <EOL> time_item . setFont ( font ) <EOL> self . ui . tableWidgetInbox . setItem ( <NUM_LIT:0> , <NUM_LIT:3> , time_item ) <EOL> self . ui . tableWidgetInbox . sortItems ( <NUM_LIT:3> , Qt . DescendingOrder ) <EOL> self . ui . tableWidgetInbox . keyPressEvent = self . tableWidgetInboxKeyPressEvent <EOL> def appIndicatorInit ( self , app ) : <EOL> self . initTrayIcon ( "<STR_LIT>" , app ) <EOL> traySignal = "<STR_LIT>" <EOL> QtCore . QObject . connect ( self . tray , QtCore . SIGNAL ( <EOL> traySignal ) , self . __icon_activated ) <EOL> m = QMenu ( ) <EOL> self . actionStatus = QtGui . QAction ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , m , checkable = False ) <EOL> m . addAction ( self . actionStatus ) <EOL> actionSeparator = QtGui . QAction ( '<STR_LIT>' , m , checkable = False ) <EOL> actionSeparator . setSeparator ( True ) <EOL> m . addAction ( actionSeparator ) <EOL> self . actionShow = QtGui . QAction ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , m , checkable = True ) <EOL> self . actionShow . setChecked ( not shared . config . getboolean ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . actionShow . triggered . connect ( self . appIndicatorShowOrHideWindow ) <EOL> if not sys . platform [ <NUM_LIT:0> : <NUM_LIT:3> ] == '<STR_LIT>' : <EOL> m . addAction ( self . actionShow ) <EOL> actionSend = QtGui . QAction ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , m , checkable = False ) <EOL> actionSend . triggered . connect ( self . appIndicatorSend ) <EOL> m . addAction ( actionSend ) <EOL> actionSubscribe = QtGui . QAction ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , m , checkable = False ) <EOL> actionSubscribe . triggered . connect ( self . appIndicatorSubscribe ) <EOL> m . addAction ( actionSubscribe ) <EOL> actionAddressBook = QtGui . QAction ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , m , checkable = False ) <EOL> actionAddressBook . triggered . connect ( self . appIndicatorAddressBook ) <EOL> m . addAction ( actionAddressBook ) <EOL> actionSeparator = QtGui . QAction ( '<STR_LIT>' , m , checkable = False ) <EOL> actionSeparator . setSeparator ( True ) <EOL> m . addAction ( actionSeparator ) <EOL> m . addAction ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , self . quit ) <EOL> self . tray . setContextMenu ( m ) <EOL> self . tray . show ( ) <EOL> mmapp = None <EOL> def isUbuntu ( self ) : <EOL> for entry in platform . uname ( ) : <EOL> if "<STR_LIT>" in entry : <EOL> return True <EOL> return False <EOL> def ubuntuMessagingMenuClear ( self , inventoryHash ) : <EOL> global withMessagingMenu <EOL> if not self . isUbuntu ( ) : <EOL> return <EOL> if not withMessagingMenu : <EOL> return <EOL> if not ( self . mmapp . has_source ( "<STR_LIT>" ) or self . mmapp . has_source ( "<STR_LIT>" ) ) : <EOL> return <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , inventoryHash ) <EOL> for row in queryreturn : <EOL> toAddress , read = row <EOL> if not read : <EOL> if toAddress == self . str_broadcast_subscribers : <EOL> if self . mmapp . has_source ( "<STR_LIT>" ) : <EOL> self . mmapp . remove_source ( "<STR_LIT>" ) <EOL> else : <EOL> if self . mmapp . has_source ( "<STR_LIT>" ) : <EOL> self . mmapp . remove_source ( "<STR_LIT>" ) <EOL> def getUnread ( self ) : <EOL> unreadMessages = <NUM_LIT:0> <EOL> unreadSubscriptions = <NUM_LIT:0> <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' ) <EOL> for row in queryreturn : <EOL> msgid , toAddress , read = row <EOL> try : <EOL> if toAddress == self . str_broadcast_subscribers : <EOL> toLabel = self . str_broadcast_subscribers <EOL> else : <EOL> toLabel = shared . config . get ( toAddress , '<STR_LIT:label>' ) <EOL> except : <EOL> toLabel = '<STR_LIT>' <EOL> if toLabel == '<STR_LIT>' : <EOL> toLabel = toAddress <EOL> if not read : <EOL> if toLabel == self . str_broadcast_subscribers : <EOL> unreadSubscriptions = unreadSubscriptions + <NUM_LIT:1> <EOL> else : <EOL> unreadMessages = unreadMessages + <NUM_LIT:1> <EOL> return unreadMessages , unreadSubscriptions <EOL> def ubuntuMessagingMenuUnread ( self , drawAttention ) : <EOL> unreadMessages , unreadSubscriptions = self . getUnread ( ) <EOL> if unreadMessages > <NUM_LIT:0> : <EOL> self . mmapp . append_source ( <EOL> "<STR_LIT>" , None , "<STR_LIT>" + str ( unreadMessages ) + "<STR_LIT:)>" ) <EOL> if drawAttention : <EOL> self . mmapp . draw_attention ( "<STR_LIT>" ) <EOL> if unreadSubscriptions > <NUM_LIT:0> : <EOL> self . mmapp . append_source ( "<STR_LIT>" , None , "<STR_LIT>" + str ( <EOL> unreadSubscriptions ) + "<STR_LIT:)>" ) <EOL> if drawAttention : <EOL> self . mmapp . draw_attention ( "<STR_LIT>" ) <EOL> def ubuntuMessagingMenuInit ( self ) : <EOL> global withMessagingMenu <EOL> if not self . isUbuntu ( ) : <EOL> return <EOL> if not withMessagingMenu : <EOL> print '<STR_LIT>' <EOL> return <EOL> if withMessagingMenu : <EOL> try : <EOL> self . mmapp = MessagingMenu . App ( <EOL> desktop_id = '<STR_LIT>' ) <EOL> self . mmapp . register ( ) <EOL> self . mmapp . connect ( '<STR_LIT>' , self . appIndicatorInbox ) <EOL> self . ubuntuMessagingMenuUnread ( True ) <EOL> except Exception : <EOL> withMessagingMenu = False <EOL> print '<STR_LIT>' <EOL> def ubuntuMessagingMenuUpdate ( self , drawAttention , newItem , toLabel ) : <EOL> global withMessagingMenu <EOL> if not self . isUbuntu ( ) : <EOL> return <EOL> if not withMessagingMenu : <EOL> print '<STR_LIT>' <EOL> return <EOL> if toLabel == self . str_broadcast_subscribers : <EOL> self . newBroadcastItem = newItem <EOL> else : <EOL> self . newMessageItem = newItem <EOL> if self . mmapp . has_source ( "<STR_LIT>" ) : <EOL> self . mmapp . remove_source ( "<STR_LIT>" ) <EOL> if self . mmapp . has_source ( "<STR_LIT>" ) : <EOL> self . mmapp . remove_source ( "<STR_LIT>" ) <EOL> self . ubuntuMessagingMenuUnread ( drawAttention ) <EOL> def isConnectionSound ( self , category ) : <EOL> if ( category is self . SOUND_CONNECTED or <EOL> category is self . SOUND_DISCONNECTED or <EOL> category is self . SOUND_CONNECTION_GREEN ) : <EOL> return True <EOL> return False <EOL> def playSound ( self , category , label ) : <EOL> soundFilename = None <EOL> play = True <EOL> if label is not None : <EOL> if ( os . path . isfile ( shared . appdata + '<STR_LIT>' + label + '<STR_LIT>' ) or <EOL> os . path . isfile ( shared . appdata + '<STR_LIT>' + label + '<STR_LIT>' ) ) : <EOL> soundFilename = shared . appdata + '<STR_LIT>' + label <EOL> if ( soundFilename is None and <EOL> not self . isConnectionSound ( category ) ) : <EOL> dt = datetime . datetime . now ( ) - self . lastSoundTime <EOL> if dt . total_seconds ( ) < self . maxSoundFrequencySec : <EOL> play = False <EOL> if soundFilename is None : <EOL> if category is self . SOUND_KNOWN : <EOL> soundFilename = shared . appdata + '<STR_LIT>' <EOL> elif category is self . SOUND_UNKNOWN : <EOL> soundFilename = shared . appdata + '<STR_LIT>' <EOL> elif category is self . SOUND_CONNECTED : <EOL> soundFilename = shared . appdata + '<STR_LIT>' <EOL> elif category is self . SOUND_DISCONNECTED : <EOL> soundFilename = shared . appdata + '<STR_LIT>' <EOL> elif category is self . SOUND_CONNECTION_GREEN : <EOL> soundFilename = shared . appdata + '<STR_LIT>' <EOL> if soundFilename is not None and play is True : <EOL> if not self . isConnectionSound ( category ) : <EOL> self . lastSoundTime = datetime . datetime . now ( ) <EOL> if not os . path . isfile ( soundFilename + '<STR_LIT>' ) : <EOL> soundFilename = soundFilename + '<STR_LIT>' <EOL> else : <EOL> soundFilename = soundFilename + '<STR_LIT>' <EOL> if os . path . isfile ( soundFilename ) : <EOL> if '<STR_LIT>' in sys . platform : <EOL> if '<STR_LIT>' in soundFilename : <EOL> gst_available = False <EOL> try : <EOL> subprocess . call ( [ "<STR_LIT>" , soundFilename ] , <EOL> stdin = subprocess . PIPE , <EOL> stdout = subprocess . PIPE ) <EOL> gst_available = True <EOL> except : <EOL> print "<STR_LIT>" <EOL> if not gst_available : <EOL> try : <EOL> subprocess . call ( [ "<STR_LIT>" , soundFilename ] , <EOL> stdin = subprocess . PIPE , <EOL> stdout = subprocess . PIPE ) <EOL> gst_available = True <EOL> except : <EOL> print "<STR_LIT>" <EOL> else : <EOL> try : <EOL> subprocess . call ( [ "<STR_LIT>" , soundFilename ] , <EOL> stdin = subprocess . PIPE , <EOL> stdout = subprocess . PIPE ) <EOL> except : <EOL> print "<STR_LIT>" <EOL> elif sys . platform [ <NUM_LIT:0> : <NUM_LIT:3> ] == '<STR_LIT>' : <EOL> import winsound <EOL> winsound . PlaySound ( soundFilename , winsound . SND_FILENAME ) <EOL> def notifierInit ( self ) : <EOL> global withMessagingMenu <EOL> if withMessagingMenu : <EOL> Notify . init ( '<STR_LIT>' ) <EOL> def notifierShow ( self , title , subtitle , fromCategory , label ) : <EOL> global withMessagingMenu <EOL> self . playSound ( fromCategory , label ) <EOL> if withMessagingMenu : <EOL> n = Notify . Notification . new ( <EOL> title , subtitle , '<STR_LIT>' ) <EOL> try : <EOL> n . show ( ) <EOL> except : <EOL> pass <EOL> return <EOL> else : <EOL> self . tray . showMessage ( title , subtitle , <NUM_LIT:1> , <NUM_LIT> ) <EOL> def tableWidgetInboxKeyPressEvent ( self , event ) : <EOL> if event . key ( ) == QtCore . Qt . Key_Delete : <EOL> self . on_action_InboxTrash ( ) <EOL> return QtGui . QTableWidget . keyPressEvent ( self . ui . tableWidgetInbox , event ) <EOL> def tableWidgetSentKeyPressEvent ( self , event ) : <EOL> if event . key ( ) == QtCore . Qt . Key_Delete : <EOL> self . on_action_SentTrash ( ) <EOL> return QtGui . QTableWidget . keyPressEvent ( self . ui . tableWidgetSent , event ) <EOL> def click_actionManageKeys ( self ) : <EOL> if '<STR_LIT>' in sys . platform or '<STR_LIT>' in sys . platform : <EOL> if shared . appdata == '<STR_LIT>' : <EOL> reply = QtGui . QMessageBox . information ( self , '<STR_LIT>' , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , QMessageBox . Ok ) <EOL> else : <EOL> QtGui . QMessageBox . information ( self , '<STR_LIT>' , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( shared . appdata ) , QMessageBox . Ok ) <EOL> elif sys . platform == '<STR_LIT:win32>' or sys . platform == '<STR_LIT>' : <EOL> if shared . appdata == '<STR_LIT>' : <EOL> reply = QtGui . QMessageBox . question ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , QtGui . QMessageBox . Yes , QtGui . QMessageBox . No ) <EOL> else : <EOL> reply = QtGui . QMessageBox . question ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( shared . appdata ) , QtGui . QMessageBox . Yes , QtGui . QMessageBox . No ) <EOL> if reply == QtGui . QMessageBox . Yes : <EOL> shared . openKeysFile ( ) <EOL> def click_actionDeleteAllTrashedMessages ( self ) : <EOL> if QtGui . QMessageBox . question ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , QtGui . QMessageBox . Yes , QtGui . QMessageBox . No ) == QtGui . QMessageBox . No : <EOL> return <EOL> sqlStoredProcedure ( '<STR_LIT>' ) <EOL> def click_actionRegenerateDeterministicAddresses ( self ) : <EOL> self . regenerateAddressesDialogInstance = regenerateAddressesDialog ( <EOL> self ) <EOL> if self . regenerateAddressesDialogInstance . exec_ ( ) : <EOL> if self . regenerateAddressesDialogInstance . ui . lineEditPassphrase . text ( ) == "<STR_LIT>" : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> streamNumberForAddress = int ( <EOL> self . regenerateAddressesDialogInstance . ui . lineEditStreamNumber . text ( ) ) <EOL> try : <EOL> addressVersionNumber = int ( <EOL> self . regenerateAddressesDialogInstance . ui . lineEditAddressVersionNumber . text ( ) ) <EOL> except : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> if addressVersionNumber < <NUM_LIT:3> or addressVersionNumber > <NUM_LIT:4> : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> shared . addressGeneratorQueue . put ( ( '<STR_LIT>' , addressVersionNumber , streamNumberForAddress , "<STR_LIT>" , self . regenerateAddressesDialogInstance . ui . spinBoxNumberOfAddressesToMake . value ( <EOL> ) , self . regenerateAddressesDialogInstance . ui . lineEditPassphrase . text ( ) . toUtf8 ( ) , self . regenerateAddressesDialogInstance . ui . checkBoxEighteenByteRipe . isChecked ( ) ) ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:3> ) <EOL> def click_actionJoinChan ( self ) : <EOL> self . newChanDialogInstance = newChanDialog ( self ) <EOL> if self . newChanDialogInstance . exec_ ( ) : <EOL> if self . newChanDialogInstance . ui . radioButtonCreateChan . isChecked ( ) : <EOL> if self . newChanDialogInstance . ui . lineEditChanNameCreate . text ( ) == "<STR_LIT>" : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> shared . apiAddressGeneratorReturnQueue . queue . clear ( ) <EOL> shared . addressGeneratorQueue . put ( ( '<STR_LIT>' , <NUM_LIT:4> , <NUM_LIT:1> , self . str_chan + '<STR_LIT:U+0020>' + str ( self . newChanDialogInstance . ui . lineEditChanNameCreate . text ( ) . toUtf8 ( ) ) , self . newChanDialogInstance . ui . lineEditChanNameCreate . text ( ) . toUtf8 ( ) ) ) <EOL> addressGeneratorReturnValue = shared . apiAddressGeneratorReturnQueue . get ( ) <EOL> print '<STR_LIT>' , addressGeneratorReturnValue <EOL> if len ( addressGeneratorReturnValue ) == <NUM_LIT:0> : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> createdAddress = addressGeneratorReturnValue [ <NUM_LIT:0> ] <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( createdAddress ) ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:3> ) <EOL> elif self . newChanDialogInstance . ui . radioButtonJoinChan . isChecked ( ) : <EOL> if self . newChanDialogInstance . ui . lineEditChanNameJoin . text ( ) == "<STR_LIT>" : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> if decodeAddress ( self . newChanDialogInstance . ui . lineEditChanBitmessageAddress . text ( ) ) [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> if decodeAddress ( self . newChanDialogInstance . ui . lineEditChanBitmessageAddress . text ( ) ) [ <NUM_LIT:0> ] != '<STR_LIT:success>' : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> shared . apiAddressGeneratorReturnQueue . queue . clear ( ) <EOL> shared . addressGeneratorQueue . put ( ( '<STR_LIT>' , addBMIfNotPresent ( self . newChanDialogInstance . ui . lineEditChanBitmessageAddress . text ( ) ) , self . str_chan + '<STR_LIT:U+0020>' + str ( self . newChanDialogInstance . ui . lineEditChanNameJoin . text ( ) . toUtf8 ( ) ) , self . newChanDialogInstance . ui . lineEditChanNameJoin . text ( ) . toUtf8 ( ) ) ) <EOL> addressGeneratorReturnValue = shared . apiAddressGeneratorReturnQueue . get ( ) <EOL> print '<STR_LIT>' , addressGeneratorReturnValue <EOL> if addressGeneratorReturnValue == '<STR_LIT>' : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> if len ( addressGeneratorReturnValue ) == <NUM_LIT:0> : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> createdAddress = addressGeneratorReturnValue [ <NUM_LIT:0> ] <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:3> ) <EOL> def showConnectDialog ( self ) : <EOL> self . connectDialogInstance = connectDialog ( self ) <EOL> if self . connectDialogInstance . exec_ ( ) : <EOL> if self . connectDialogInstance . ui . radioButtonConnectNow . isChecked ( ) : <EOL> shared . config . remove_option ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . writeKeysFile ( ) <EOL> else : <EOL> self . click_actionSettings ( ) <EOL> def changeEvent ( self , event ) : <EOL> if event . type ( ) == QtCore . QEvent . LanguageChange : <EOL> self . ui . retranslateUi ( self ) <EOL> self . init_inbox_popup_menu ( False ) <EOL> self . init_identities_popup_menu ( False ) <EOL> self . init_addressbook_popup_menu ( False ) <EOL> self . init_subscriptions_popup_menu ( False ) <EOL> self . init_sent_popup_menu ( False ) <EOL> self . init_blacklist_popup_menu ( False ) <EOL> if event . type ( ) == QtCore . QEvent . WindowStateChange : <EOL> if self . windowState ( ) & QtCore . Qt . WindowMinimized : <EOL> if shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) and not '<STR_LIT>' in sys . platform : <EOL> self . appIndicatorHide ( ) <EOL> if '<STR_LIT:win32>' in sys . platform or '<STR_LIT>' in sys . platform : <EOL> self . setWindowFlags ( Qt . ToolTip ) <EOL> elif event . oldState ( ) & QtCore . Qt . WindowMinimized : <EOL> pass <EOL> def __icon_activated ( self , reason ) : <EOL> if reason == QtGui . QSystemTrayIcon . Trigger : <EOL> self . actionShow . setChecked ( not self . actionShow . isChecked ( ) ) <EOL> self . appIndicatorShowOrHideWindow ( ) <EOL> def updateNumberOfMessagesProcessed ( self ) : <EOL> self . ui . labelMessageCount . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( str ( shared . numberOfMessagesProcessed ) ) ) <EOL> def updateNumberOfBroadcastsProcessed ( self ) : <EOL> self . ui . labelBroadcastCount . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( str ( shared . numberOfBroadcastsProcessed ) ) ) <EOL> def updateNumberOfPubkeysProcessed ( self ) : <EOL> self . ui . labelPubkeyCount . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( str ( shared . numberOfPubkeysProcessed ) ) ) <EOL> def formatBytes ( self , num ) : <EOL> for x in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> if num < <NUM_LIT> : <EOL> return "<STR_LIT>" % ( num , x ) <EOL> num /= <NUM_LIT> <EOL> return "<STR_LIT>" % ( num , '<STR_LIT>' ) <EOL> def formatByteRate ( self , num ) : <EOL> num /= <NUM_LIT:1000> <EOL> return "<STR_LIT>" % num <EOL> def updateNumberOfBytes ( self ) : <EOL> """<STR_LIT>""" <EOL> self . ui . labelBytesRecvCount . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( self . formatByteRate ( shared . numberOfBytesReceived / <NUM_LIT:2> ) , self . formatBytes ( self . totalNumberOfBytesReceived ) ) ) <EOL> self . ui . labelBytesSentCount . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( self . formatByteRate ( shared . numberOfBytesSent / <NUM_LIT:2> ) , self . formatBytes ( self . totalNumberOfBytesSent ) ) ) <EOL> self . totalNumberOfBytesReceived += shared . numberOfBytesReceived <EOL> self . totalNumberOfBytesSent += shared . numberOfBytesSent <EOL> shared . numberOfBytesReceived = <NUM_LIT:0> <EOL> shared . numberOfBytesSent = <NUM_LIT:0> <EOL> def updateNetworkStatusTab ( self ) : <EOL> totalNumberOfConnectionsFromAllStreams = <NUM_LIT:0> <EOL> streamNumberTotals = { } <EOL> for host , streamNumber in shared . connectedHostsList . items ( ) : <EOL> if not streamNumber in streamNumberTotals : <EOL> streamNumberTotals [ streamNumber ] = <NUM_LIT:1> <EOL> else : <EOL> streamNumberTotals [ streamNumber ] += <NUM_LIT:1> <EOL> while self . ui . tableWidgetConnectionCount . rowCount ( ) > <NUM_LIT:0> : <EOL> self . ui . tableWidgetConnectionCount . removeRow ( <NUM_LIT:0> ) <EOL> for streamNumber , connectionCount in streamNumberTotals . items ( ) : <EOL> self . ui . tableWidgetConnectionCount . insertRow ( <NUM_LIT:0> ) <EOL> if streamNumber == <NUM_LIT:0> : <EOL> newItem = QtGui . QTableWidgetItem ( "<STR_LIT:?>" ) <EOL> else : <EOL> newItem = QtGui . QTableWidgetItem ( str ( streamNumber ) ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetConnectionCount . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( str ( connectionCount ) ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetConnectionCount . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> """<STR_LIT>""" <EOL> self . ui . labelTotalConnections . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( str ( len ( shared . connectedHostsList ) ) ) ) <EOL> if len ( shared . connectedHostsList ) > <NUM_LIT:0> and shared . statusIconColor == '<STR_LIT>' : <EOL> self . setStatusIcon ( '<STR_LIT>' ) <EOL> elif len ( shared . connectedHostsList ) == <NUM_LIT:0> : <EOL> self . setStatusIcon ( '<STR_LIT>' ) <EOL> def runEveryTwoSeconds ( self ) : <EOL> self . ui . labelLookupsPerSecond . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( str ( shared . numberOfInventoryLookupsPerformed / <NUM_LIT:2> ) ) ) <EOL> shared . numberOfInventoryLookupsPerformed = <NUM_LIT:0> <EOL> self . updateNumberOfBytes ( ) <EOL> connected = False <EOL> def setStatusIcon ( self , color ) : <EOL> global withMessagingMenu <EOL> if color == '<STR_LIT>' : <EOL> self . ui . pushButtonStatusIcon . setIcon ( <EOL> QIcon ( "<STR_LIT>" ) ) <EOL> shared . statusIconColor = '<STR_LIT>' <EOL> if self . connected : <EOL> self . notifierShow ( '<STR_LIT>' , unicode ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . toUtf8 ( ) , '<STR_LIT:utf-8>' ) , <EOL> self . SOUND_DISCONNECTED , None ) <EOL> self . connected = False <EOL> if self . actionStatus is not None : <EOL> self . actionStatus . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . setTrayIconFile ( "<STR_LIT>" ) <EOL> if color == '<STR_LIT>' : <EOL> if self . statusBar ( ) . currentMessage ( ) == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( '<STR_LIT>' ) <EOL> self . ui . pushButtonStatusIcon . setIcon ( QIcon ( <EOL> "<STR_LIT>" ) ) <EOL> shared . statusIconColor = '<STR_LIT>' <EOL> if not self . connected : <EOL> self . notifierShow ( '<STR_LIT>' , unicode ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . toUtf8 ( ) , '<STR_LIT:utf-8>' ) , <EOL> self . SOUND_CONNECTED , None ) <EOL> self . connected = True <EOL> if self . actionStatus is not None : <EOL> self . actionStatus . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . setTrayIconFile ( "<STR_LIT>" ) <EOL> if color == '<STR_LIT>' : <EOL> if self . statusBar ( ) . currentMessage ( ) == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( '<STR_LIT>' ) <EOL> self . ui . pushButtonStatusIcon . setIcon ( <EOL> QIcon ( "<STR_LIT>" ) ) <EOL> shared . statusIconColor = '<STR_LIT>' <EOL> if not self . connected : <EOL> self . notifierShow ( '<STR_LIT>' , unicode ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . toUtf8 ( ) , '<STR_LIT:utf-8>' ) , <EOL> self . SOUND_CONNECTION_GREEN , None ) <EOL> self . connected = True <EOL> if self . actionStatus is not None : <EOL> self . actionStatus . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . setTrayIconFile ( "<STR_LIT>" ) <EOL> def initTrayIcon ( self , iconFileName , app ) : <EOL> self . currentTrayIconFileName = iconFileName <EOL> self . tray = QSystemTrayIcon ( <EOL> self . calcTrayIcon ( iconFileName , self . findInboxUnreadCount ( ) ) , app ) <EOL> def setTrayIconFile ( self , iconFileName ) : <EOL> self . currentTrayIconFileName = iconFileName <EOL> self . drawTrayIcon ( iconFileName , self . findInboxUnreadCount ( ) ) <EOL> def calcTrayIcon ( self , iconFileName , inboxUnreadCount ) : <EOL> pixmap = QtGui . QPixmap ( "<STR_LIT>" + iconFileName ) <EOL> if inboxUnreadCount > <NUM_LIT:0> : <EOL> fontName = "<STR_LIT>" <EOL> fontSize = <NUM_LIT:10> <EOL> font = QtGui . QFont ( fontName , fontSize , QtGui . QFont . Bold ) <EOL> fontMetrics = QtGui . QFontMetrics ( font ) <EOL> txt = str ( inboxUnreadCount ) <EOL> rect = fontMetrics . boundingRect ( txt ) <EOL> marginX = <NUM_LIT:2> <EOL> marginY = <NUM_LIT:0> <EOL> if rect . width ( ) > <NUM_LIT:20> : <EOL> txt = "<STR_LIT:+>" <EOL> fontSize = <NUM_LIT:15> <EOL> font = QtGui . QFont ( fontName , fontSize , QtGui . QFont . Bold ) <EOL> fontMetrics = QtGui . QFontMetrics ( font ) <EOL> rect = fontMetrics . boundingRect ( txt ) <EOL> painter = QPainter ( ) <EOL> painter . begin ( pixmap ) <EOL> painter . setPen ( QtGui . QPen ( QtGui . QColor ( <NUM_LIT:255> , <NUM_LIT:0> , <NUM_LIT:0> ) , Qt . SolidPattern ) ) <EOL> painter . setFont ( font ) <EOL> painter . drawText ( <NUM_LIT> - rect . right ( ) - marginX , - rect . top ( ) + marginY , txt ) <EOL> painter . end ( ) <EOL> return QtGui . QIcon ( pixmap ) <EOL> def drawTrayIcon ( self , iconFileName , inboxUnreadCount ) : <EOL> self . tray . setIcon ( self . calcTrayIcon ( iconFileName , inboxUnreadCount ) ) <EOL> def changedInboxUnread ( self ) : <EOL> self . drawTrayIcon ( self . currentTrayIconFileName , self . findInboxUnreadCount ( ) ) <EOL> def findInboxUnreadCount ( self ) : <EOL> queryreturn = sqlQuery ( '''<STR_LIT>''' ) <EOL> cnt = <NUM_LIT:0> <EOL> for row in queryreturn : <EOL> cnt , = row <EOL> return int ( cnt ) <EOL> def updateSentItemStatusByToAddress ( self , toAddress , textToDisplay ) : <EOL> for i in range ( self . ui . tableWidgetSent . rowCount ( ) ) : <EOL> rowAddress = str ( self . ui . tableWidgetSent . item ( <EOL> i , <NUM_LIT:0> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> if toAddress == rowAddress : <EOL> self . ui . tableWidgetSent . item ( i , <NUM_LIT:3> ) . setToolTip ( textToDisplay ) <EOL> try : <EOL> newlinePosition = textToDisplay . indexOf ( '<STR_LIT:\n>' ) <EOL> except : <EOL> newlinePosition = <NUM_LIT:0> <EOL> if newlinePosition > <NUM_LIT:1> : <EOL> self . ui . tableWidgetSent . item ( i , <NUM_LIT:3> ) . setText ( <EOL> textToDisplay [ : newlinePosition ] ) <EOL> else : <EOL> self . ui . tableWidgetSent . item ( i , <NUM_LIT:3> ) . setText ( textToDisplay ) <EOL> def updateSentItemStatusByAckdata ( self , ackdata , textToDisplay ) : <EOL> for i in range ( self . ui . tableWidgetSent . rowCount ( ) ) : <EOL> toAddress = str ( self . ui . tableWidgetSent . item ( <EOL> i , <NUM_LIT:0> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> tableAckdata = self . ui . tableWidgetSent . item ( <EOL> i , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) <EOL> status , addressVersionNumber , streamNumber , ripe = decodeAddress ( <EOL> toAddress ) <EOL> if ackdata == tableAckdata : <EOL> self . ui . tableWidgetSent . item ( i , <NUM_LIT:3> ) . setToolTip ( textToDisplay ) <EOL> try : <EOL> newlinePosition = textToDisplay . indexOf ( '<STR_LIT:\n>' ) <EOL> except : <EOL> newlinePosition = <NUM_LIT:0> <EOL> if newlinePosition > <NUM_LIT:1> : <EOL> self . ui . tableWidgetSent . item ( i , <NUM_LIT:3> ) . setText ( <EOL> textToDisplay [ : newlinePosition ] ) <EOL> else : <EOL> self . ui . tableWidgetSent . item ( i , <NUM_LIT:3> ) . setText ( textToDisplay ) <EOL> def removeInboxRowByMsgid ( self , msgid ) : <EOL> for i in range ( self . ui . tableWidgetInbox . rowCount ( ) ) : <EOL> if msgid == str ( self . ui . tableWidgetInbox . item ( i , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . ui . tableWidgetInbox . removeRow ( i ) <EOL> break <EOL> self . changedInboxUnread ( ) <EOL> def displayAlert ( self , title , text , exitAfterUserClicksOk ) : <EOL> self . statusBar ( ) . showMessage ( text ) <EOL> QtGui . QMessageBox . critical ( self , title , text , QMessageBox . Ok ) <EOL> if exitAfterUserClicksOk : <EOL> os . _exit ( <NUM_LIT:0> ) <EOL> def rerenderInboxFromLabels ( self ) : <EOL> for i in range ( self . ui . tableWidgetInbox . rowCount ( ) ) : <EOL> addressToLookup = str ( self . ui . tableWidgetInbox . item ( <EOL> i , <NUM_LIT:1> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> fromLabel = '<STR_LIT>' <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , addressToLookup ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> fromLabel , = row <EOL> if fromLabel == '<STR_LIT>' : <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , addressToLookup ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> fromLabel , = row <EOL> if fromLabel == '<STR_LIT>' : <EOL> if shared . config . has_section ( addressToLookup ) : <EOL> fromLabel = shared . config . get ( addressToLookup , '<STR_LIT:label>' ) <EOL> if fromLabel == '<STR_LIT>' : <EOL> fromLabel = addressToLookup <EOL> self . ui . tableWidgetInbox . item ( <EOL> i , <NUM_LIT:1> ) . setText ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> self . ui . tableWidgetInbox . item ( <EOL> i , <NUM_LIT:1> ) . setIcon ( avatarize ( addressToLookup ) ) <EOL> if shared . safeConfigGetBoolean ( addressToLookup , '<STR_LIT>' ) : <EOL> self . ui . tableWidgetInbox . item ( i , <NUM_LIT:1> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> else : <EOL> self . ui . tableWidgetInbox . item ( <EOL> i , <NUM_LIT:1> ) . setTextColor ( QApplication . palette ( ) . text ( ) . color ( ) ) <EOL> def rerenderInboxToLabels ( self ) : <EOL> for i in range ( self . ui . tableWidgetInbox . rowCount ( ) ) : <EOL> toAddress = str ( self . ui . tableWidgetInbox . item ( <EOL> i , <NUM_LIT:0> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> if shared . config . has_section ( toAddress ) : <EOL> toLabel = shared . config . get ( toAddress , '<STR_LIT:label>' ) <EOL> else : <EOL> toLabel = toAddress <EOL> self . ui . tableWidgetInbox . item ( <EOL> i , <NUM_LIT:0> ) . setText ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> self . ui . tableWidgetInbox . item ( <EOL> i , <NUM_LIT:0> ) . setIcon ( avatarize ( toAddress ) ) <EOL> if shared . safeConfigGetBoolean ( toAddress , '<STR_LIT>' ) : <EOL> self . ui . tableWidgetInbox . item ( i , <NUM_LIT:0> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> elif shared . safeConfigGetBoolean ( toAddress , '<STR_LIT>' ) : <EOL> self . ui . tableWidgetInbox . item ( i , <NUM_LIT:0> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT> ) ) <EOL> else : <EOL> self . ui . tableWidgetInbox . item ( <EOL> i , <NUM_LIT:0> ) . setTextColor ( QApplication . palette ( ) . text ( ) . color ( ) ) <EOL> def rerenderSentFromLabels ( self ) : <EOL> for i in range ( self . ui . tableWidgetSent . rowCount ( ) ) : <EOL> fromAddress = str ( self . ui . tableWidgetSent . item ( <EOL> i , <NUM_LIT:1> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> if shared . config . has_section ( fromAddress ) : <EOL> fromLabel = shared . config . get ( fromAddress , '<STR_LIT:label>' ) <EOL> else : <EOL> fromLabel = fromAddress <EOL> self . ui . tableWidgetSent . item ( <EOL> i , <NUM_LIT:1> ) . setText ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> self . ui . tableWidgetSent . item ( <EOL> i , <NUM_LIT:1> ) . setIcon ( avatarize ( fromAddress ) ) <EOL> def rerenderSentToLabels ( self ) : <EOL> for i in range ( self . ui . tableWidgetSent . rowCount ( ) ) : <EOL> addressToLookup = str ( self . ui . tableWidgetSent . item ( <EOL> i , <NUM_LIT:0> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> toLabel = '<STR_LIT>' <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , addressToLookup ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> toLabel , = row <EOL> if toLabel == '<STR_LIT>' : <EOL> if shared . config . has_section ( addressToLookup ) : <EOL> toLabel = shared . config . get ( addressToLookup , '<STR_LIT:label>' ) <EOL> if toLabel == '<STR_LIT>' : <EOL> toLabel = addressToLookup <EOL> self . ui . tableWidgetSent . item ( <EOL> i , <NUM_LIT:0> ) . setText ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> def rerenderAddressBook ( self ) : <EOL> self . ui . tableWidgetAddressBook . setRowCount ( <NUM_LIT:0> ) <EOL> queryreturn = sqlQuery ( '<STR_LIT>' ) <EOL> for row in queryreturn : <EOL> label , address = row <EOL> self . ui . tableWidgetAddressBook . insertRow ( <NUM_LIT:0> ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( label , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setIcon ( avatarize ( address ) ) <EOL> self . ui . tableWidgetAddressBook . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( address ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetAddressBook . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> def rerenderSubscriptions ( self ) : <EOL> self . ui . tableWidgetSubscriptions . setRowCount ( <NUM_LIT:0> ) <EOL> queryreturn = sqlQuery ( '<STR_LIT>' ) <EOL> for row in queryreturn : <EOL> label , address , enabled = row <EOL> self . ui . tableWidgetSubscriptions . insertRow ( <NUM_LIT:0> ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( label , '<STR_LIT:utf-8>' ) ) <EOL> if not enabled : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> newItem . setIcon ( avatarize ( address ) ) <EOL> self . ui . tableWidgetSubscriptions . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( address ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> if not enabled : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . ui . tableWidgetSubscriptions . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> def rerenderBlackWhiteList ( self ) : <EOL> self . ui . tableWidgetBlacklist . setRowCount ( <NUM_LIT:0> ) <EOL> listType = shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if listType == '<STR_LIT>' : <EOL> queryreturn = sqlQuery ( '''<STR_LIT>''' ) <EOL> else : <EOL> queryreturn = sqlQuery ( '''<STR_LIT>''' ) <EOL> for row in queryreturn : <EOL> label , address , enabled = row <EOL> self . ui . tableWidgetBlacklist . insertRow ( <NUM_LIT:0> ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( label , '<STR_LIT:utf-8>' ) ) <EOL> if not enabled : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> newItem . setIcon ( avatarize ( address ) ) <EOL> self . ui . tableWidgetBlacklist . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( address ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> if not enabled : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . ui . tableWidgetBlacklist . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> def click_pushButtonTTL ( self ) : <EOL> QtGui . QMessageBox . information ( self , '<STR_LIT>' , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , QMessageBox . Ok ) <EOL> def click_pushButtonSend ( self ) : <EOL> self . statusBar ( ) . showMessage ( '<STR_LIT>' ) <EOL> toAddresses = str ( self . ui . lineEditTo . text ( ) ) <EOL> fromAddress = str ( self . ui . labelFrom . text ( ) ) <EOL> subject = str ( self . ui . lineEditSubject . text ( ) . toUtf8 ( ) ) <EOL> message = str ( <EOL> self . ui . textEditMessage . document ( ) . toPlainText ( ) . toUtf8 ( ) ) <EOL> """<STR_LIT>""" <EOL> if len ( message ) > ( <NUM_LIT:2> ** <NUM_LIT> - <NUM_LIT> ) : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( len ( message ) - ( <NUM_LIT:2> ** <NUM_LIT> - <NUM_LIT> ) ) ) <EOL> return <EOL> if self . ui . radioButtonSpecific . isChecked ( ) : <EOL> toAddressesList = [ s . strip ( ) <EOL> for s in toAddresses . replace ( '<STR_LIT:U+002C>' , '<STR_LIT:;>' ) . split ( '<STR_LIT:;>' ) ] <EOL> toAddressesList = list ( set ( <EOL> toAddressesList ) ) <EOL> for toAddress in toAddressesList : <EOL> if toAddress != '<STR_LIT>' : <EOL> status , addressVersionNumber , streamNumber , ripe = decodeAddress ( <EOL> toAddress ) <EOL> if status != '<STR_LIT:success>' : <EOL> with shared . printLock : <EOL> print '<STR_LIT>' , toAddress , '<STR_LIT::>' , status <EOL> if status == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) ) <EOL> else : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) ) <EOL> elif fromAddress == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> toAddress = addBMIfNotPresent ( toAddress ) <EOL> if addressVersionNumber > <NUM_LIT:4> or addressVersionNumber <= <NUM_LIT:1> : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) . arg ( str ( addressVersionNumber ) ) ) <EOL> continue <EOL> if streamNumber > <NUM_LIT:1> or streamNumber == <NUM_LIT:0> : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddress ) . arg ( str ( streamNumber ) ) ) <EOL> continue <EOL> self . statusBar ( ) . showMessage ( '<STR_LIT>' ) <EOL> if shared . statusIconColor == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> ackdata = OpenSSL . rand ( <NUM_LIT:32> ) <EOL> t = ( ) <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , <EOL> '<STR_LIT>' , <EOL> toAddress , <EOL> ripe , <EOL> fromAddress , <EOL> subject , <EOL> message , <EOL> ackdata , <EOL> int ( time . time ( ) ) , <EOL> int ( time . time ( ) ) , <EOL> <NUM_LIT:0> , <EOL> '<STR_LIT>' , <EOL> <NUM_LIT:0> , <EOL> '<STR_LIT>' , <EOL> <NUM_LIT:2> , <EOL> shared . config . getint ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ) <EOL> toLabel = '<STR_LIT>' <EOL> queryreturn = sqlQuery ( '''<STR_LIT>''' , <EOL> toAddress ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> toLabel , = row <EOL> self . displayNewSentMessage ( <EOL> toAddress , toLabel , fromAddress , subject , message , ackdata ) <EOL> shared . workerQueue . put ( ( '<STR_LIT>' , toAddress ) ) <EOL> self . ui . comboBoxSendFrom . setCurrentIndex ( <NUM_LIT:0> ) <EOL> self . ui . labelFrom . setText ( '<STR_LIT>' ) <EOL> self . ui . lineEditTo . setText ( '<STR_LIT>' ) <EOL> self . ui . lineEditSubject . setText ( '<STR_LIT>' ) <EOL> self . ui . textEditMessage . setText ( '<STR_LIT>' ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:2> ) <EOL> self . ui . tableWidgetSent . setCurrentCell ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> else : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> if fromAddress == '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> self . statusBar ( ) . showMessage ( '<STR_LIT>' ) <EOL> ackdata = OpenSSL . rand ( <NUM_LIT:32> ) <EOL> toAddress = self . str_broadcast_subscribers <EOL> ripe = '<STR_LIT>' <EOL> t = ( '<STR_LIT>' , <EOL> toAddress , <EOL> ripe , <EOL> fromAddress , <EOL> subject , <EOL> message , <EOL> ackdata , <EOL> int ( time . time ( ) ) , <EOL> int ( time . time ( ) ) , <EOL> <NUM_LIT:0> , <EOL> '<STR_LIT>' , <EOL> <NUM_LIT:0> , <EOL> '<STR_LIT>' , <EOL> <NUM_LIT:2> , <EOL> shared . config . getint ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ) <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , * t ) <EOL> toLabel = self . str_broadcast_subscribers <EOL> self . displayNewSentMessage ( <EOL> toAddress , toLabel , fromAddress , subject , message , ackdata ) <EOL> shared . workerQueue . put ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . ui . comboBoxSendFrom . setCurrentIndex ( <NUM_LIT:0> ) <EOL> self . ui . labelFrom . setText ( '<STR_LIT>' ) <EOL> self . ui . lineEditTo . setText ( '<STR_LIT>' ) <EOL> self . ui . lineEditSubject . setText ( '<STR_LIT>' ) <EOL> self . ui . textEditMessage . setText ( '<STR_LIT>' ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:2> ) <EOL> self . ui . tableWidgetSent . setCurrentCell ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> def click_pushButtonLoadFromAddressBook ( self ) : <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:5> ) <EOL> for i in range ( <NUM_LIT:4> ) : <EOL> time . sleep ( <NUM_LIT:0.1> ) <EOL> self . statusBar ( ) . showMessage ( '<STR_LIT>' ) <EOL> time . sleep ( <NUM_LIT:0.1> ) <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def click_pushButtonFetchNamecoinID ( self ) : <EOL> nc = namecoinConnection ( ) <EOL> err , addr = nc . query ( str ( self . ui . lineEditTo . text ( ) ) ) <EOL> if err is not None : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" + err ) ) <EOL> else : <EOL> self . ui . lineEditTo . setText ( addr ) <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def redrawLabelFrom ( self , index ) : <EOL> self . ui . labelFrom . setText ( <EOL> self . ui . comboBoxSendFrom . itemData ( index ) . toPyObject ( ) ) <EOL> self . setBroadcastEnablementDependingOnWhetherThisIsAChanAddress ( self . ui . comboBoxSendFrom . itemData ( index ) . toPyObject ( ) ) <EOL> def setBroadcastEnablementDependingOnWhetherThisIsAChanAddress ( self , address ) : <EOL> if shared . safeConfigGetBoolean ( str ( address ) , '<STR_LIT>' ) : <EOL> self . ui . radioButtonSpecific . click ( ) <EOL> self . ui . radioButtonBroadcast . setEnabled ( False ) <EOL> else : <EOL> self . ui . radioButtonBroadcast . setEnabled ( True ) <EOL> def rerenderComboBoxSendFrom ( self ) : <EOL> self . ui . comboBoxSendFrom . clear ( ) <EOL> self . ui . labelFrom . setText ( '<STR_LIT>' ) <EOL> configSections = shared . config . sections ( ) <EOL> for addressInKeysFile in configSections : <EOL> if addressInKeysFile != '<STR_LIT>' : <EOL> isEnabled = shared . config . getboolean ( <EOL> addressInKeysFile , '<STR_LIT>' ) <EOL> if isEnabled : <EOL> self . ui . comboBoxSendFrom . insertItem ( <NUM_LIT:0> , avatarize ( addressInKeysFile ) , unicode ( shared . config . get ( <EOL> addressInKeysFile , '<STR_LIT:label>' ) , '<STR_LIT:utf-8>' ) , addressInKeysFile ) <EOL> self . ui . comboBoxSendFrom . insertItem ( <NUM_LIT:0> , '<STR_LIT>' , '<STR_LIT>' ) <EOL> if ( self . ui . comboBoxSendFrom . count ( ) == <NUM_LIT:2> ) : <EOL> self . ui . comboBoxSendFrom . setCurrentIndex ( <NUM_LIT:1> ) <EOL> self . redrawLabelFrom ( self . ui . comboBoxSendFrom . currentIndex ( ) ) <EOL> else : <EOL> self . ui . comboBoxSendFrom . setCurrentIndex ( <NUM_LIT:0> ) <EOL> def displayNewSentMessage ( self , toAddress , toLabel , fromAddress , subject , message , ackdata ) : <EOL> subject = shared . fixPotentiallyInvalidUTF8Data ( subject ) <EOL> message = shared . fixPotentiallyInvalidUTF8Data ( message ) <EOL> try : <EOL> fromLabel = shared . config . get ( fromAddress , '<STR_LIT:label>' ) <EOL> except : <EOL> fromLabel = '<STR_LIT>' <EOL> if fromLabel == '<STR_LIT>' : <EOL> fromLabel = fromAddress <EOL> self . ui . tableWidgetSent . setSortingEnabled ( False ) <EOL> self . ui . tableWidgetSent . insertRow ( <NUM_LIT:0> ) <EOL> if toLabel == '<STR_LIT>' : <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( toAddress , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setToolTip ( unicode ( toAddress , '<STR_LIT:utf-8>' ) ) <EOL> else : <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setToolTip ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setData ( Qt . UserRole , str ( toAddress ) ) <EOL> newItem . setIcon ( avatarize ( toAddress ) ) <EOL> self . ui . tableWidgetSent . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> if fromLabel == '<STR_LIT>' : <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( fromAddress , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setToolTip ( unicode ( fromAddress , '<STR_LIT:utf-8>' ) ) <EOL> else : <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setToolTip ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setData ( Qt . UserRole , str ( fromAddress ) ) <EOL> newItem . setIcon ( avatarize ( fromAddress ) ) <EOL> self . ui . tableWidgetSent . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( subject , '<STR_LIT>' ) ) <EOL> newItem . setToolTip ( unicode ( subject , '<STR_LIT>' ) ) <EOL> self . ui . tableWidgetSent . setItem ( <NUM_LIT:0> , <NUM_LIT:2> , newItem ) <EOL> newItem = myTableWidgetItem ( _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( l10n . formatTimestamp ( ) ) ) <EOL> newItem . setToolTip ( _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( l10n . formatTimestamp ( ) ) ) <EOL> newItem . setData ( Qt . UserRole , QByteArray ( ackdata ) ) <EOL> newItem . setData ( <NUM_LIT> , int ( time . time ( ) ) ) <EOL> self . ui . tableWidgetSent . setItem ( <NUM_LIT:0> , <NUM_LIT:3> , newItem ) <EOL> self . ui . textEditSentMessage . setPlainText ( unicode ( message , '<STR_LIT>' ) ) <EOL> self . ui . tableWidgetSent . setSortingEnabled ( True ) <EOL> def displayNewInboxMessage ( self , inventoryHash , toAddress , fromAddress , subject , message ) : <EOL> subject = shared . fixPotentiallyInvalidUTF8Data ( subject ) <EOL> fromLabel = '<STR_LIT>' <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , fromAddress ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> fromLabel , = row <EOL> else : <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , fromAddress ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> fromLabel , = row <EOL> try : <EOL> if toAddress == self . str_broadcast_subscribers : <EOL> toLabel = self . str_broadcast_subscribers <EOL> else : <EOL> toLabel = shared . config . get ( toAddress , '<STR_LIT:label>' ) <EOL> except : <EOL> toLabel = '<STR_LIT>' <EOL> if toLabel == '<STR_LIT>' : <EOL> toLabel = toAddress <EOL> font = QFont ( ) <EOL> font . setBold ( True ) <EOL> self . ui . tableWidgetInbox . setSortingEnabled ( False ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setToolTip ( unicode ( toLabel , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setFont ( font ) <EOL> newItem . setData ( Qt . UserRole , str ( toAddress ) ) <EOL> if shared . safeConfigGetBoolean ( str ( toAddress ) , '<STR_LIT>' ) : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT> ) ) <EOL> if shared . safeConfigGetBoolean ( str ( toAddress ) , '<STR_LIT>' ) : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> self . ui . tableWidgetInbox . insertRow ( <NUM_LIT:0> ) <EOL> newItem . setIcon ( avatarize ( toAddress ) ) <EOL> self . ui . tableWidgetInbox . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> if fromLabel == '<STR_LIT>' : <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( fromAddress , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setToolTip ( unicode ( fromAddress , '<STR_LIT:utf-8>' ) ) <EOL> if shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> self . notifierShow ( unicode ( _translate ( "<STR_LIT>" , '<STR_LIT>' ) . toUtf8 ( ) , '<STR_LIT:utf-8>' ) , unicode ( _translate ( "<STR_LIT>" , '<STR_LIT>' ) . toUtf8 ( ) , '<STR_LIT:utf-8>' ) + unicode ( fromAddress , '<STR_LIT:utf-8>' ) , self . SOUND_UNKNOWN , None ) <EOL> else : <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setToolTip ( unicode ( unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) ) <EOL> if shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> self . notifierShow ( unicode ( _translate ( "<STR_LIT>" , '<STR_LIT>' ) . toUtf8 ( ) , '<STR_LIT:utf-8>' ) , unicode ( _translate ( "<STR_LIT>" , '<STR_LIT>' ) . toUtf8 ( ) , '<STR_LIT:utf-8>' ) + unicode ( fromLabel , '<STR_LIT:utf-8>' ) , self . SOUND_KNOWN , unicode ( fromLabel , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setData ( Qt . UserRole , str ( fromAddress ) ) <EOL> newItem . setFont ( font ) <EOL> newItem . setIcon ( avatarize ( fromAddress ) ) <EOL> self . ui . tableWidgetInbox . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( subject , '<STR_LIT>' ) ) <EOL> newItem . setToolTip ( unicode ( subject , '<STR_LIT>' ) ) <EOL> newItem . setFont ( font ) <EOL> self . ui . tableWidgetInbox . setItem ( <NUM_LIT:0> , <NUM_LIT:2> , newItem ) <EOL> newItem = myTableWidgetItem ( l10n . formatTimestamp ( ) ) <EOL> newItem . setToolTip ( l10n . formatTimestamp ( ) ) <EOL> newItem . setData ( Qt . UserRole , QByteArray ( inventoryHash ) ) <EOL> newItem . setData ( <NUM_LIT> , int ( time . time ( ) ) ) <EOL> newItem . setFont ( font ) <EOL> self . ui . tableWidgetInbox . setItem ( <NUM_LIT:0> , <NUM_LIT:3> , newItem ) <EOL> self . ui . tableWidgetInbox . setSortingEnabled ( True ) <EOL> self . ubuntuMessagingMenuUpdate ( True , newItem , toLabel ) <EOL> def click_pushButtonAddAddressBook ( self ) : <EOL> self . AddAddressDialogInstance = AddAddressDialog ( self ) <EOL> if self . AddAddressDialogInstance . exec_ ( ) : <EOL> if self . AddAddressDialogInstance . ui . labelAddressCheck . text ( ) == _translate ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> address = addBMIfNotPresent ( str ( <EOL> self . AddAddressDialogInstance . ui . lineEditAddress . text ( ) ) ) <EOL> label = self . AddAddressDialogInstance . ui . newAddressLabel . text ( ) . toUtf8 ( ) <EOL> self . addEntryToAddressBook ( address , label ) <EOL> else : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def addEntryToAddressBook ( self , address , label ) : <EOL> queryreturn = sqlQuery ( '''<STR_LIT>''' , address ) <EOL> if queryreturn == [ ] : <EOL> self . ui . tableWidgetAddressBook . setSortingEnabled ( False ) <EOL> self . ui . tableWidgetAddressBook . insertRow ( <NUM_LIT:0> ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( label , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setIcon ( avatarize ( address ) ) <EOL> self . ui . tableWidgetAddressBook . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( address ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetAddressBook . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> self . ui . tableWidgetAddressBook . setSortingEnabled ( True ) <EOL> sqlExecute ( '''<STR_LIT>''' , str ( label ) , address ) <EOL> self . rerenderInboxFromLabels ( ) <EOL> self . rerenderSentToLabels ( ) <EOL> else : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def addSubscription ( self , address , label ) : <EOL> address = addBMIfNotPresent ( address ) <EOL> if shared . isAddressInMySubscriptionsList ( address ) : <EOL> return <EOL> self . ui . tableWidgetSubscriptions . setSortingEnabled ( False ) <EOL> self . ui . tableWidgetSubscriptions . insertRow ( <NUM_LIT:0> ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( label , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setIcon ( avatarize ( address ) ) <EOL> self . ui . tableWidgetSubscriptions . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( address ) <EOL> newItem . setFlags ( QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetSubscriptions . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> self . ui . tableWidgetSubscriptions . setSortingEnabled ( True ) <EOL> sqlExecute ( '''<STR_LIT>''' , str ( label ) , address , True ) <EOL> self . rerenderInboxFromLabels ( ) <EOL> shared . reloadBroadcastSendersForWhichImWatching ( ) <EOL> def click_pushButtonAddSubscription ( self ) : <EOL> self . NewSubscriptionDialogInstance = NewSubscriptionDialog ( self ) <EOL> if self . NewSubscriptionDialogInstance . exec_ ( ) : <EOL> if self . NewSubscriptionDialogInstance . ui . labelAddressCheck . text ( ) != _translate ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> self . statusBar ( ) . showMessage ( _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> address = addBMIfNotPresent ( str ( self . NewSubscriptionDialogInstance . ui . lineEditSubscriptionAddress . text ( ) ) ) <EOL> if shared . isAddressInMySubscriptionsList ( address ) : <EOL> self . statusBar ( ) . showMessage ( _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> return <EOL> label = self . NewSubscriptionDialogInstance . ui . newsubscriptionlabel . text ( ) . toUtf8 ( ) <EOL> self . addSubscription ( address , label ) <EOL> if self . NewSubscriptionDialogInstance . ui . checkBoxDisplayMessagesAlreadyInInventory . isChecked ( ) : <EOL> status , addressVersion , streamNumber , ripe = decodeAddress ( address ) <EOL> shared . flushInventory ( ) <EOL> doubleHashOfAddressData = hashlib . sha512 ( hashlib . sha512 ( encodeVarint ( <EOL> addressVersion ) + encodeVarint ( streamNumber ) + ripe ) . digest ( ) ) . digest ( ) <EOL> tag = doubleHashOfAddressData [ <NUM_LIT:32> : ] <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , tag ) <EOL> for row in queryreturn : <EOL> payload , = row <EOL> objectType = <NUM_LIT:3> <EOL> with shared . objectProcessorQueueSizeLock : <EOL> shared . objectProcessorQueueSize += len ( payload ) <EOL> shared . objectProcessorQueue . put ( ( objectType , payload ) ) <EOL> def click_pushButtonStatusIcon ( self ) : <EOL> print '<STR_LIT>' <EOL> self . iconGlossaryInstance = iconGlossaryDialog ( self ) <EOL> if self . iconGlossaryInstance . exec_ ( ) : <EOL> pass <EOL> def click_actionHelp ( self ) : <EOL> self . helpDialogInstance = helpDialog ( self ) <EOL> self . helpDialogInstance . exec_ ( ) <EOL> def click_actionAbout ( self ) : <EOL> self . aboutDialogInstance = aboutDialog ( self ) <EOL> self . aboutDialogInstance . exec_ ( ) <EOL> def click_actionSettings ( self ) : <EOL> self . settingsDialogInstance = settingsDialog ( self ) <EOL> if self . settingsDialogInstance . exec_ ( ) : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . checkBoxStartOnLogon . isChecked ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . checkBoxMinimizeToTray . isChecked ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . checkBoxShowTrayNotifications . isChecked ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . checkBoxStartInTray . isChecked ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . checkBoxWillinglySendToMobile . isChecked ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . checkBoxUseIdenticons . isChecked ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . checkBoxReplyBelow . isChecked ( ) ) ) <EOL> lang_ind = int ( self . settingsDialogInstance . ui . languageComboBox . currentIndex ( ) ) <EOL> if not languages [ lang_ind ] == '<STR_LIT>' : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , languages [ lang_ind ] ) <EOL> change_translation ( languages [ lang_ind ] ) <EOL> if int ( shared . config . get ( '<STR_LIT>' , '<STR_LIT:port>' ) ) != int ( self . settingsDialogInstance . ui . lineEditTCPPort . text ( ) ) : <EOL> if not shared . safeConfigGetBoolean ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT:port>' , str ( <EOL> self . settingsDialogInstance . ui . lineEditTCPPort . text ( ) ) ) <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT:none>' and self . settingsDialogInstance . ui . comboBoxProxyType . currentText ( ) [ <NUM_LIT:0> : <NUM_LIT:5> ] == '<STR_LIT>' : <EOL> if shared . statusIconColor != '<STR_LIT>' : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) [ <NUM_LIT:0> : <NUM_LIT:5> ] == '<STR_LIT>' and self . settingsDialogInstance . ui . comboBoxProxyType . currentText ( ) [ <NUM_LIT:0> : <NUM_LIT:5> ] != '<STR_LIT>' : <EOL> self . statusBar ( ) . showMessage ( '<STR_LIT>' ) <EOL> if self . settingsDialogInstance . ui . comboBoxProxyType . currentText ( ) [ <NUM_LIT:0> : <NUM_LIT:5> ] == '<STR_LIT>' : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . comboBoxProxyType . currentText ( ) ) ) <EOL> else : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:none>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . checkBoxAuthentication . isChecked ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . lineEditSocksHostname . text ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . lineEditSocksPort . text ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . lineEditSocksUsername . text ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . lineEditSocksPassword . text ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . checkBoxSocksListen . isChecked ( ) ) ) <EOL> try : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> int ( float ( self . settingsDialogInstance . ui . lineEditMaxDownloadRate . text ( ) ) ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> int ( float ( self . settingsDialogInstance . ui . lineEditMaxUploadRate . text ( ) ) ) ) ) <EOL> except : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , <EOL> self . settingsDialogInstance . getNamecoinType ( ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . lineEditNamecoinHost . text ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . lineEditNamecoinPort . text ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . lineEditNamecoinUser . text ( ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> self . settingsDialogInstance . ui . lineEditNamecoinPassword . text ( ) ) ) <EOL> if float ( self . settingsDialogInstance . ui . lineEditTotalDifficulty . text ( ) ) >= <NUM_LIT:1> : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( int ( float ( <EOL> self . settingsDialogInstance . ui . lineEditTotalDifficulty . text ( ) ) * shared . networkDefaultProofOfWorkNonceTrialsPerByte ) ) ) <EOL> if float ( self . settingsDialogInstance . ui . lineEditSmallMessageDifficulty . text ( ) ) >= <NUM_LIT:1> : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( int ( float ( <EOL> self . settingsDialogInstance . ui . lineEditSmallMessageDifficulty . text ( ) ) * shared . networkDefaultPayloadLengthExtraBytes ) ) ) <EOL> acceptableDifficultyChanged = False <EOL> if float ( self . settingsDialogInstance . ui . lineEditMaxAcceptableTotalDifficulty . text ( ) ) >= <NUM_LIT:1> or float ( self . settingsDialogInstance . ui . lineEditMaxAcceptableTotalDifficulty . text ( ) ) == <NUM_LIT:0> : <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) != str ( int ( float ( <EOL> self . settingsDialogInstance . ui . lineEditMaxAcceptableTotalDifficulty . text ( ) ) * shared . networkDefaultProofOfWorkNonceTrialsPerByte ) ) : <EOL> acceptableDifficultyChanged = True <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( int ( float ( <EOL> self . settingsDialogInstance . ui . lineEditMaxAcceptableTotalDifficulty . text ( ) ) * shared . networkDefaultProofOfWorkNonceTrialsPerByte ) ) ) <EOL> if float ( self . settingsDialogInstance . ui . lineEditMaxAcceptableSmallMessageDifficulty . text ( ) ) >= <NUM_LIT:1> or float ( self . settingsDialogInstance . ui . lineEditMaxAcceptableSmallMessageDifficulty . text ( ) ) == <NUM_LIT:0> : <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) != str ( int ( float ( <EOL> self . settingsDialogInstance . ui . lineEditMaxAcceptableSmallMessageDifficulty . text ( ) ) * shared . networkDefaultPayloadLengthExtraBytes ) ) : <EOL> acceptableDifficultyChanged = True <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( int ( float ( <EOL> self . settingsDialogInstance . ui . lineEditMaxAcceptableSmallMessageDifficulty . text ( ) ) * shared . networkDefaultPayloadLengthExtraBytes ) ) ) <EOL> if acceptableDifficultyChanged : <EOL> sqlExecute ( '''<STR_LIT>''' ) <EOL> shared . workerQueue . put ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> if ( ( self . settingsDialogInstance . ui . lineEditDays . text ( ) == '<STR_LIT>' ) and ( self . settingsDialogInstance . ui . lineEditMonths . text ( ) == '<STR_LIT>' ) ) : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . maximumLengthOfTimeToBotherResendingMessages = float ( '<STR_LIT>' ) <EOL> try : <EOL> float ( self . settingsDialogInstance . ui . lineEditDays . text ( ) ) <EOL> lineEditDaysIsValidFloat = True <EOL> except : <EOL> lineEditDaysIsValidFloat = False <EOL> try : <EOL> float ( self . settingsDialogInstance . ui . lineEditMonths . text ( ) ) <EOL> lineEditMonthsIsValidFloat = True <EOL> except : <EOL> lineEditMonthsIsValidFloat = False <EOL> if lineEditDaysIsValidFloat and not lineEditMonthsIsValidFloat : <EOL> self . settingsDialogInstance . ui . lineEditMonths . setText ( "<STR_LIT:0>" ) <EOL> if lineEditMonthsIsValidFloat and not lineEditDaysIsValidFloat : <EOL> self . settingsDialogInstance . ui . lineEditDays . setText ( "<STR_LIT:0>" ) <EOL> if lineEditDaysIsValidFloat or lineEditMonthsIsValidFloat : <EOL> if ( float ( self . settingsDialogInstance . ui . lineEditDays . text ( ) ) >= <NUM_LIT:0> and float ( self . settingsDialogInstance . ui . lineEditMonths . text ( ) ) >= <NUM_LIT:0> ) : <EOL> shared . maximumLengthOfTimeToBotherResendingMessages = ( float ( str ( self . settingsDialogInstance . ui . lineEditDays . text ( ) ) ) * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> ) + ( float ( str ( self . settingsDialogInstance . ui . lineEditMonths . text ( ) ) ) * ( <NUM_LIT> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> ) / <NUM_LIT:12> ) <EOL> if shared . maximumLengthOfTimeToBotherResendingMessages < <NUM_LIT> : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:0>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:0>' ) <EOL> shared . maximumLengthOfTimeToBotherResendingMessages = <NUM_LIT:0> <EOL> else : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( float ( <EOL> self . settingsDialogInstance . ui . lineEditDays . text ( ) ) ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( float ( <EOL> self . settingsDialogInstance . ui . lineEditMonths . text ( ) ) ) ) <EOL> shared . writeKeysFile ( ) <EOL> if '<STR_LIT:win32>' in sys . platform or '<STR_LIT>' in sys . platform : <EOL> RUN_PATH = "<STR_LIT>" <EOL> self . settings = QSettings ( RUN_PATH , QSettings . NativeFormat ) <EOL> if shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> self . settings . setValue ( "<STR_LIT>" , sys . argv [ <NUM_LIT:0> ] ) <EOL> else : <EOL> self . settings . remove ( "<STR_LIT>" ) <EOL> elif '<STR_LIT>' in sys . platform : <EOL> pass <EOL> elif '<STR_LIT>' in sys . platform : <EOL> pass <EOL> if shared . appdata != '<STR_LIT>' and self . settingsDialogInstance . ui . checkBoxPortableMode . isChecked ( ) : <EOL> sqlStoredProcedure ( '<STR_LIT>' ) <EOL> with open ( '<STR_LIT>' , '<STR_LIT:wb>' ) as configfile : <EOL> shared . config . write ( configfile ) <EOL> shared . knownNodesLock . acquire ( ) <EOL> output = open ( '<STR_LIT>' , '<STR_LIT:wb>' ) <EOL> pickle . dump ( shared . knownNodes , output ) <EOL> output . close ( ) <EOL> shared . knownNodesLock . release ( ) <EOL> os . remove ( shared . appdata + '<STR_LIT>' ) <EOL> os . remove ( shared . appdata + '<STR_LIT>' ) <EOL> previousAppdataLocation = shared . appdata <EOL> shared . appdata = '<STR_LIT>' <EOL> debug . restartLoggingInUpdatedAppdataLocation ( ) <EOL> try : <EOL> os . remove ( previousAppdataLocation + '<STR_LIT>' ) <EOL> os . remove ( previousAppdataLocation + '<STR_LIT>' ) <EOL> except : <EOL> pass <EOL> if shared . appdata == '<STR_LIT>' and not self . settingsDialogInstance . ui . checkBoxPortableMode . isChecked ( ) : <EOL> shared . appdata = shared . lookupAppdataFolder ( ) <EOL> if not os . path . exists ( shared . appdata ) : <EOL> os . makedirs ( shared . appdata ) <EOL> sqlStoredProcedure ( '<STR_LIT>' ) <EOL> shared . writeKeysFile ( ) <EOL> shared . knownNodesLock . acquire ( ) <EOL> output = open ( shared . appdata + '<STR_LIT>' , '<STR_LIT:wb>' ) <EOL> pickle . dump ( shared . knownNodes , output ) <EOL> output . close ( ) <EOL> shared . knownNodesLock . release ( ) <EOL> os . remove ( '<STR_LIT>' ) <EOL> os . remove ( '<STR_LIT>' ) <EOL> debug . restartLoggingInUpdatedAppdataLocation ( ) <EOL> try : <EOL> os . remove ( '<STR_LIT>' ) <EOL> os . remove ( '<STR_LIT>' ) <EOL> except : <EOL> pass <EOL> def click_radioButtonBlacklist ( self ) : <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT>' : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . writeKeysFile ( ) <EOL> self . ui . tableWidgetBlacklist . setRowCount ( <NUM_LIT:0> ) <EOL> self . rerenderBlackWhiteList ( ) <EOL> self . ui . tabWidget . setTabText ( <NUM_LIT:6> , '<STR_LIT>' ) <EOL> def click_radioButtonWhitelist ( self ) : <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT>' : <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . writeKeysFile ( ) <EOL> self . ui . tableWidgetBlacklist . setRowCount ( <NUM_LIT:0> ) <EOL> self . rerenderBlackWhiteList ( ) <EOL> self . ui . tabWidget . setTabText ( <NUM_LIT:6> , '<STR_LIT>' ) <EOL> def click_pushButtonAddBlacklist ( self ) : <EOL> self . NewBlacklistDialogInstance = AddAddressDialog ( self ) <EOL> if self . NewBlacklistDialogInstance . exec_ ( ) : <EOL> if self . NewBlacklistDialogInstance . ui . labelAddressCheck . text ( ) == _translate ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> address = addBMIfNotPresent ( str ( <EOL> self . NewBlacklistDialogInstance . ui . lineEditAddress . text ( ) ) ) <EOL> t = ( address , ) <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT>' : <EOL> sql = '''<STR_LIT>''' <EOL> else : <EOL> sql = '''<STR_LIT>''' <EOL> queryreturn = sqlQuery ( sql , * t ) <EOL> if queryreturn == [ ] : <EOL> self . ui . tableWidgetBlacklist . setSortingEnabled ( False ) <EOL> self . ui . tableWidgetBlacklist . insertRow ( <NUM_LIT:0> ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( <EOL> self . NewBlacklistDialogInstance . ui . newAddressLabel . text ( ) . toUtf8 ( ) , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setIcon ( avatarize ( address ) ) <EOL> self . ui . tableWidgetBlacklist . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( address ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetBlacklist . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> self . ui . tableWidgetBlacklist . setSortingEnabled ( True ) <EOL> t = ( str ( self . NewBlacklistDialogInstance . ui . newAddressLabel . text ( ) . toUtf8 ( ) ) , address , True ) <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT>' : <EOL> sql = '''<STR_LIT>''' <EOL> else : <EOL> sql = '''<STR_LIT>''' <EOL> sqlExecute ( sql , * t ) <EOL> else : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def on_action_SpecialAddressBehaviorDialog ( self ) : <EOL> self . dialog = SpecialAddressBehaviorDialog ( self ) <EOL> if self . dialog . exec_ ( ) : <EOL> currentRow = self . ui . tableWidgetYourIdentities . currentRow ( ) <EOL> addressAtCurrentRow = str ( <EOL> self . ui . tableWidgetYourIdentities . item ( currentRow , <NUM_LIT:1> ) . text ( ) ) <EOL> if shared . safeConfigGetBoolean ( addressAtCurrentRow , '<STR_LIT>' ) : <EOL> return <EOL> if self . dialog . ui . radioButtonBehaveNormalAddress . isChecked ( ) : <EOL> shared . config . set ( str ( <EOL> addressAtCurrentRow ) , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> if shared . config . getboolean ( addressAtCurrentRow , '<STR_LIT>' ) : <EOL> self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:1> ) . setTextColor ( QApplication . palette ( ) <EOL> . text ( ) . color ( ) ) <EOL> else : <EOL> self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:1> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> else : <EOL> shared . config . set ( str ( <EOL> addressAtCurrentRow ) , '<STR_LIT>' , '<STR_LIT:true>' ) <EOL> shared . config . set ( str ( addressAtCurrentRow ) , '<STR_LIT>' , str ( <EOL> self . dialog . ui . lineEditMailingListName . text ( ) . toUtf8 ( ) ) ) <EOL> self . ui . tableWidgetYourIdentities . item ( currentRow , <NUM_LIT:1> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT> ) ) <EOL> shared . writeKeysFile ( ) <EOL> self . rerenderInboxToLabels ( ) <EOL> def click_NewAddressDialog ( self ) : <EOL> self . dialog = NewAddressDialog ( self ) <EOL> if self . dialog . exec_ ( ) : <EOL> if self . dialog . ui . radioButtonRandomAddress . isChecked ( ) : <EOL> if self . dialog . ui . radioButtonMostAvailable . isChecked ( ) : <EOL> streamNumberForAddress = <NUM_LIT:1> <EOL> else : <EOL> streamNumberForAddress = decodeAddress ( <EOL> self . dialog . ui . comboBoxExisting . currentText ( ) ) [ <NUM_LIT:2> ] <EOL> shared . addressGeneratorQueue . put ( ( '<STR_LIT>' , <NUM_LIT:4> , streamNumberForAddress , str ( <EOL> self . dialog . ui . newaddresslabel . text ( ) . toUtf8 ( ) ) , <NUM_LIT:1> , "<STR_LIT>" , self . dialog . ui . checkBoxEighteenByteRipe . isChecked ( ) ) ) <EOL> else : <EOL> if self . dialog . ui . lineEditPassphrase . text ( ) != self . dialog . ui . lineEditPassphraseAgain . text ( ) : <EOL> QMessageBox . about ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif self . dialog . ui . lineEditPassphrase . text ( ) == "<STR_LIT>" : <EOL> QMessageBox . about ( self , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> streamNumberForAddress = <NUM_LIT:1> <EOL> shared . addressGeneratorQueue . put ( ( '<STR_LIT>' , <NUM_LIT:4> , streamNumberForAddress , "<STR_LIT>" , self . dialog . ui . spinBoxNumberOfAddressesToMake . value ( <EOL> ) , self . dialog . ui . lineEditPassphrase . text ( ) . toUtf8 ( ) , self . dialog . ui . checkBoxEighteenByteRipe . isChecked ( ) ) ) <EOL> else : <EOL> print '<STR_LIT>' <EOL> def quit ( self ) : <EOL> '''<STR_LIT>''' <EOL> shared . doCleanShutdown ( ) <EOL> self . tray . hide ( ) <EOL> if self . mmapp is not None : <EOL> self . mmapp . unregister ( ) <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> os . _exit ( <NUM_LIT:0> ) <EOL> def closeEvent ( self , event ) : <EOL> self . appIndicatorHide ( ) <EOL> minimizeonclose = False <EOL> try : <EOL> minimizeonclose = shared . config . getboolean ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> except Exception : <EOL> pass <EOL> if minimizeonclose : <EOL> event . ignore ( ) <EOL> else : <EOL> event . accept ( ) <EOL> self . quit ( ) <EOL> def on_action_InboxMessageForceHtml ( self ) : <EOL> currentInboxRow = self . ui . tableWidgetInbox . currentRow ( ) <EOL> msgid = str ( self . ui . tableWidgetInbox . item ( <EOL> currentInboxRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , msgid ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> messageText , = row <EOL> lines = messageText . split ( '<STR_LIT:\n>' ) <EOL> totalLines = len ( lines ) <EOL> for i in xrange ( totalLines ) : <EOL> if '<STR_LIT>' in lines [ i ] : <EOL> lines [ i ] = '<STR_LIT>' % ( <EOL> lines [ i ] ) <EOL> elif lines [ i ] == '<STR_LIT>' : <EOL> lines [ i ] = '<STR_LIT>' <EOL> elif lines [ i ] == '<STR_LIT>' and ( i + <NUM_LIT:1> ) < totalLines and lines [ i + <NUM_LIT:1> ] != '<STR_LIT>' : <EOL> lines [ i ] = '<STR_LIT>' <EOL> content = '<STR_LIT:U+0020>' . join ( lines ) <EOL> content = shared . fixPotentiallyInvalidUTF8Data ( content ) <EOL> content = unicode ( content , '<STR_LIT>' ) <EOL> self . ui . textEditInboxMessage . setHtml ( QtCore . QString ( content ) ) <EOL> def on_action_InboxMarkUnread ( self ) : <EOL> font = QFont ( ) <EOL> font . setBold ( True ) <EOL> inventoryHashesToMarkUnread = [ ] <EOL> for row in self . ui . tableWidgetInbox . selectedIndexes ( ) : <EOL> currentRow = row . row ( ) <EOL> inventoryHashToMarkUnread = str ( self . ui . tableWidgetInbox . item ( <EOL> currentRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> inventoryHashesToMarkUnread . append ( inventoryHashToMarkUnread ) <EOL> self . ui . tableWidgetInbox . item ( currentRow , <NUM_LIT:0> ) . setFont ( font ) <EOL> self . ui . tableWidgetInbox . item ( currentRow , <NUM_LIT:1> ) . setFont ( font ) <EOL> self . ui . tableWidgetInbox . item ( currentRow , <NUM_LIT:2> ) . setFont ( font ) <EOL> self . ui . tableWidgetInbox . item ( currentRow , <NUM_LIT:3> ) . setFont ( font ) <EOL> sqlExecute ( '''<STR_LIT>''' % ( <EOL> "<STR_LIT>" * len ( inventoryHashesToMarkUnread ) ) [ : - <NUM_LIT:1> ] , * inventoryHashesToMarkUnread ) <EOL> self . changedInboxUnread ( ) <EOL> def quoted_text ( self , message ) : <EOL> if not shared . safeConfigGetBoolean ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> return '<STR_LIT>' + message <EOL> quoteWrapper = textwrap . TextWrapper ( replace_whitespace = False , <EOL> initial_indent = '<STR_LIT>' , <EOL> subsequent_indent = '<STR_LIT>' , <EOL> break_long_words = False , <EOL> break_on_hyphens = False ) <EOL> def quote_line ( line ) : <EOL> if line == '<STR_LIT>' or line . isspace ( ) : <EOL> return '<STR_LIT>' <EOL> elif line [ <NUM_LIT:0> : <NUM_LIT:2> ] == '<STR_LIT>' : <EOL> return '<STR_LIT>' + line <EOL> else : <EOL> return quoteWrapper . fill ( line ) <EOL> return '<STR_LIT:\n>' . join ( [ quote_line ( l ) for l in message . splitlines ( ) ] ) + '<STR_LIT>' <EOL> def on_action_InboxReply ( self ) : <EOL> currentInboxRow = self . ui . tableWidgetInbox . currentRow ( ) <EOL> toAddressAtCurrentInboxRow = str ( self . ui . tableWidgetInbox . item ( <EOL> currentInboxRow , <NUM_LIT:0> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> fromAddressAtCurrentInboxRow = str ( self . ui . tableWidgetInbox . item ( <EOL> currentInboxRow , <NUM_LIT:1> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> msgid = str ( self . ui . tableWidgetInbox . item ( <EOL> currentInboxRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , msgid ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> messageAtCurrentInboxRow , = row <EOL> if toAddressAtCurrentInboxRow == self . str_broadcast_subscribers : <EOL> self . ui . labelFrom . setText ( '<STR_LIT>' ) <EOL> elif not shared . config . has_section ( toAddressAtCurrentInboxRow ) : <EOL> QtGui . QMessageBox . information ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( toAddressAtCurrentInboxRow ) , QMessageBox . Ok ) <EOL> self . ui . labelFrom . setText ( '<STR_LIT>' ) <EOL> elif not shared . config . getboolean ( toAddressAtCurrentInboxRow , '<STR_LIT>' ) : <EOL> QtGui . QMessageBox . information ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) , QMessageBox . Ok ) <EOL> self . ui . labelFrom . setText ( '<STR_LIT>' ) <EOL> else : <EOL> self . ui . labelFrom . setText ( toAddressAtCurrentInboxRow ) <EOL> self . setBroadcastEnablementDependingOnWhetherThisIsAChanAddress ( toAddressAtCurrentInboxRow ) <EOL> self . ui . lineEditTo . setText ( str ( fromAddressAtCurrentInboxRow ) ) <EOL> if shared . config . has_section ( toAddressAtCurrentInboxRow ) : <EOL> if shared . safeConfigGetBoolean ( toAddressAtCurrentInboxRow , '<STR_LIT>' ) : <EOL> print '<STR_LIT>' <EOL> self . ui . lineEditTo . setText ( str ( toAddressAtCurrentInboxRow ) ) <EOL> listOfAddressesInComboBoxSendFrom = [ str ( self . ui . comboBoxSendFrom . itemData ( i ) . toPyObject ( ) ) for i in range ( self . ui . comboBoxSendFrom . count ( ) ) ] <EOL> if toAddressAtCurrentInboxRow in listOfAddressesInComboBoxSendFrom : <EOL> currentIndex = listOfAddressesInComboBoxSendFrom . index ( toAddressAtCurrentInboxRow ) <EOL> self . ui . comboBoxSendFrom . setCurrentIndex ( currentIndex ) <EOL> else : <EOL> self . ui . comboBoxSendFrom . setCurrentIndex ( <NUM_LIT:0> ) <EOL> quotedText = self . quoted_text ( unicode ( messageAtCurrentInboxRow , '<STR_LIT:utf-8>' ) ) <EOL> self . ui . textEditMessage . setText ( quotedText ) <EOL> if self . ui . tableWidgetInbox . item ( currentInboxRow , <NUM_LIT:2> ) . text ( ) [ <NUM_LIT:0> : <NUM_LIT:3> ] in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> self . ui . lineEditSubject . setText ( <EOL> self . ui . tableWidgetInbox . item ( currentInboxRow , <NUM_LIT:2> ) . text ( ) ) <EOL> else : <EOL> self . ui . lineEditSubject . setText ( <EOL> '<STR_LIT>' + self . ui . tableWidgetInbox . item ( currentInboxRow , <NUM_LIT:2> ) . text ( ) ) <EOL> self . ui . radioButtonSpecific . setChecked ( True ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:1> ) <EOL> def on_action_InboxAddSenderToAddressBook ( self ) : <EOL> currentInboxRow = self . ui . tableWidgetInbox . currentRow ( ) <EOL> addressAtCurrentInboxRow = str ( self . ui . tableWidgetInbox . item ( <EOL> currentInboxRow , <NUM_LIT:1> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> queryreturn = sqlQuery ( '''<STR_LIT>''' , <EOL> addressAtCurrentInboxRow ) <EOL> if queryreturn == [ ] : <EOL> self . ui . tableWidgetAddressBook . insertRow ( <NUM_LIT:0> ) <EOL> newItem = QtGui . QTableWidgetItem ( <EOL> '<STR_LIT>' ) <EOL> self . ui . tableWidgetAddressBook . setItem ( <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem . setIcon ( avatarize ( addressAtCurrentInboxRow ) ) <EOL> newItem = QtGui . QTableWidgetItem ( addressAtCurrentInboxRow ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetAddressBook . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> sqlExecute ( '''<STR_LIT>''' , <EOL> '<STR_LIT>' , <EOL> addressAtCurrentInboxRow ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:5> ) <EOL> self . ui . tableWidgetAddressBook . setCurrentCell ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def on_action_InboxTrash ( self ) : <EOL> while self . ui . tableWidgetInbox . selectedIndexes ( ) != [ ] : <EOL> currentRow = self . ui . tableWidgetInbox . selectedIndexes ( ) [ <NUM_LIT:0> ] . row ( ) <EOL> inventoryHashToTrash = str ( self . ui . tableWidgetInbox . item ( <EOL> currentRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> sqlExecute ( '''<STR_LIT>''' , inventoryHashToTrash ) <EOL> self . ui . textEditInboxMessage . setText ( "<STR_LIT>" ) <EOL> self . ui . tableWidgetInbox . removeRow ( currentRow ) <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> if currentRow == <NUM_LIT:0> : <EOL> self . ui . tableWidgetInbox . selectRow ( currentRow ) <EOL> else : <EOL> self . ui . tableWidgetInbox . selectRow ( currentRow - <NUM_LIT:1> ) <EOL> def on_action_InboxSaveMessageAs ( self ) : <EOL> currentInboxRow = self . ui . tableWidgetInbox . currentRow ( ) <EOL> try : <EOL> subjectAtCurrentInboxRow = str ( self . ui . tableWidgetInbox . item ( currentInboxRow , <NUM_LIT:2> ) . text ( ) ) <EOL> except : <EOL> subjectAtCurrentInboxRow = '<STR_LIT>' <EOL> msgid = str ( self . ui . tableWidgetInbox . item ( <EOL> currentInboxRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , msgid ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> message , = row <EOL> defaultFilename = "<STR_LIT>" . join ( x for x in subjectAtCurrentInboxRow if x . isalnum ( ) ) + '<STR_LIT>' <EOL> filename = QFileDialog . getSaveFileName ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , defaultFilename , "<STR_LIT>" ) <EOL> if filename == '<STR_LIT>' : <EOL> return <EOL> try : <EOL> f = open ( filename , '<STR_LIT:w>' ) <EOL> f . write ( message ) <EOL> f . close ( ) <EOL> except Exception , e : <EOL> sys . stderr . write ( '<STR_LIT>' + e ) <EOL> self . statusBar ( ) . showMessage ( _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def on_action_SentTrash ( self ) : <EOL> while self . ui . tableWidgetSent . selectedIndexes ( ) != [ ] : <EOL> currentRow = self . ui . tableWidgetSent . selectedIndexes ( ) [ <NUM_LIT:0> ] . row ( ) <EOL> ackdataToTrash = str ( self . ui . tableWidgetSent . item ( <EOL> currentRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> sqlExecute ( '''<STR_LIT>''' , ackdataToTrash ) <EOL> self . ui . textEditSentMessage . setPlainText ( "<STR_LIT>" ) <EOL> self . ui . tableWidgetSent . removeRow ( currentRow ) <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> if currentRow == <NUM_LIT:0> : <EOL> self . ui . tableWidgetSent . selectRow ( currentRow ) <EOL> else : <EOL> self . ui . tableWidgetSent . selectRow ( currentRow - <NUM_LIT:1> ) <EOL> def on_action_ForceSend ( self ) : <EOL> currentRow = self . ui . tableWidgetSent . currentRow ( ) <EOL> addressAtCurrentRow = str ( self . ui . tableWidgetSent . item ( <EOL> currentRow , <NUM_LIT:0> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> toRipe = decodeAddress ( addressAtCurrentRow ) [ <NUM_LIT:3> ] <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , <EOL> toRipe ) <EOL> queryreturn = sqlQuery ( '''<STR_LIT>''' ) <EOL> for row in queryreturn : <EOL> ackdata , = row <EOL> shared . UISignalQueue . put ( ( '<STR_LIT>' , ( <EOL> ackdata , '<STR_LIT>' ) ) ) <EOL> shared . workerQueue . put ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def on_action_SentClipboard ( self ) : <EOL> currentRow = self . ui . tableWidgetSent . currentRow ( ) <EOL> addressAtCurrentRow = str ( self . ui . tableWidgetSent . item ( <EOL> currentRow , <NUM_LIT:0> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> clipboard = QtGui . QApplication . clipboard ( ) <EOL> clipboard . setText ( str ( addressAtCurrentRow ) ) <EOL> def on_action_AddressBookNew ( self ) : <EOL> self . click_pushButtonAddAddressBook ( ) <EOL> def on_action_AddressBookDelete ( self ) : <EOL> while self . ui . tableWidgetAddressBook . selectedIndexes ( ) != [ ] : <EOL> currentRow = self . ui . tableWidgetAddressBook . selectedIndexes ( ) [ <EOL> <NUM_LIT:0> ] . row ( ) <EOL> labelAtCurrentRow = self . ui . tableWidgetAddressBook . item ( <EOL> currentRow , <NUM_LIT:0> ) . text ( ) . toUtf8 ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetAddressBook . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> sqlExecute ( '''<STR_LIT>''' , <EOL> str ( labelAtCurrentRow ) , str ( addressAtCurrentRow ) ) <EOL> self . ui . tableWidgetAddressBook . removeRow ( currentRow ) <EOL> self . rerenderInboxFromLabels ( ) <EOL> self . rerenderSentToLabels ( ) <EOL> def on_action_AddressBookClipboard ( self ) : <EOL> fullStringOfAddresses = '<STR_LIT>' <EOL> listOfSelectedRows = { } <EOL> for i in range ( len ( self . ui . tableWidgetAddressBook . selectedIndexes ( ) ) ) : <EOL> listOfSelectedRows [ <EOL> self . ui . tableWidgetAddressBook . selectedIndexes ( ) [ i ] . row ( ) ] = <NUM_LIT:0> <EOL> for currentRow in listOfSelectedRows : <EOL> addressAtCurrentRow = self . ui . tableWidgetAddressBook . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> if fullStringOfAddresses == '<STR_LIT>' : <EOL> fullStringOfAddresses = addressAtCurrentRow <EOL> else : <EOL> fullStringOfAddresses += '<STR_LIT:U+002CU+0020>' + str ( addressAtCurrentRow ) <EOL> clipboard = QtGui . QApplication . clipboard ( ) <EOL> clipboard . setText ( fullStringOfAddresses ) <EOL> def on_action_AddressBookSend ( self ) : <EOL> listOfSelectedRows = { } <EOL> for i in range ( len ( self . ui . tableWidgetAddressBook . selectedIndexes ( ) ) ) : <EOL> listOfSelectedRows [ <EOL> self . ui . tableWidgetAddressBook . selectedIndexes ( ) [ i ] . row ( ) ] = <NUM_LIT:0> <EOL> for currentRow in listOfSelectedRows : <EOL> addressAtCurrentRow = self . ui . tableWidgetAddressBook . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> if self . ui . lineEditTo . text ( ) == '<STR_LIT>' : <EOL> self . ui . lineEditTo . setText ( str ( addressAtCurrentRow ) ) <EOL> else : <EOL> self . ui . lineEditTo . setText ( str ( <EOL> self . ui . lineEditTo . text ( ) ) + '<STR_LIT>' + str ( addressAtCurrentRow ) ) <EOL> if listOfSelectedRows == { } : <EOL> self . statusBar ( ) . showMessage ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> self . statusBar ( ) . showMessage ( '<STR_LIT>' ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:1> ) <EOL> def on_action_AddressBookSubscribe ( self ) : <EOL> listOfSelectedRows = { } <EOL> for i in range ( len ( self . ui . tableWidgetAddressBook . selectedIndexes ( ) ) ) : <EOL> listOfSelectedRows [ self . ui . tableWidgetAddressBook . selectedIndexes ( ) [ i ] . row ( ) ] = <NUM_LIT:0> <EOL> for currentRow in listOfSelectedRows : <EOL> addressAtCurrentRow = str ( self . ui . tableWidgetAddressBook . item ( currentRow , <NUM_LIT:1> ) . text ( ) ) <EOL> if shared . isAddressInMySubscriptionsList ( addressAtCurrentRow ) : <EOL> self . statusBar ( ) . showMessage ( QtGui . QApplication . translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> continue <EOL> labelAtCurrentRow = self . ui . tableWidgetAddressBook . item ( currentRow , <NUM_LIT:0> ) . text ( ) . toUtf8 ( ) <EOL> self . addSubscription ( addressAtCurrentRow , labelAtCurrentRow ) <EOL> self . ui . tabWidget . setCurrentIndex ( <NUM_LIT:4> ) <EOL> def on_context_menuAddressBook ( self , point ) : <EOL> self . popMenuAddressBook . exec_ ( <EOL> self . ui . tableWidgetAddressBook . mapToGlobal ( point ) ) <EOL> def on_action_SubscriptionsNew ( self ) : <EOL> self . click_pushButtonAddSubscription ( ) <EOL> def on_action_SubscriptionsDelete ( self ) : <EOL> print '<STR_LIT>' <EOL> currentRow = self . ui . tableWidgetSubscriptions . currentRow ( ) <EOL> labelAtCurrentRow = self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:0> ) . text ( ) . toUtf8 ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> sqlExecute ( '''<STR_LIT>''' , <EOL> str ( labelAtCurrentRow ) , str ( addressAtCurrentRow ) ) <EOL> self . ui . tableWidgetSubscriptions . removeRow ( currentRow ) <EOL> self . rerenderInboxFromLabels ( ) <EOL> shared . reloadBroadcastSendersForWhichImWatching ( ) <EOL> def on_action_SubscriptionsClipboard ( self ) : <EOL> currentRow = self . ui . tableWidgetSubscriptions . currentRow ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> clipboard = QtGui . QApplication . clipboard ( ) <EOL> clipboard . setText ( str ( addressAtCurrentRow ) ) <EOL> def on_action_SubscriptionsEnable ( self ) : <EOL> currentRow = self . ui . tableWidgetSubscriptions . currentRow ( ) <EOL> labelAtCurrentRow = self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:0> ) . text ( ) . toUtf8 ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , <EOL> str ( labelAtCurrentRow ) , str ( addressAtCurrentRow ) ) <EOL> self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:0> ) . setTextColor ( QApplication . palette ( ) . text ( ) . color ( ) ) <EOL> self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:1> ) . setTextColor ( QApplication . palette ( ) . text ( ) . color ( ) ) <EOL> shared . reloadBroadcastSendersForWhichImWatching ( ) <EOL> def on_action_SubscriptionsDisable ( self ) : <EOL> currentRow = self . ui . tableWidgetSubscriptions . currentRow ( ) <EOL> labelAtCurrentRow = self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:0> ) . text ( ) . toUtf8 ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , <EOL> str ( labelAtCurrentRow ) , str ( addressAtCurrentRow ) ) <EOL> self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:0> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:1> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> shared . reloadBroadcastSendersForWhichImWatching ( ) <EOL> def on_context_menuSubscriptions ( self , point ) : <EOL> self . popMenuSubscriptions . exec_ ( <EOL> self . ui . tableWidgetSubscriptions . mapToGlobal ( point ) ) <EOL> def on_action_BlacklistNew ( self ) : <EOL> self . click_pushButtonAddBlacklist ( ) <EOL> def on_action_BlacklistDelete ( self ) : <EOL> currentRow = self . ui . tableWidgetBlacklist . currentRow ( ) <EOL> labelAtCurrentRow = self . ui . tableWidgetBlacklist . item ( <EOL> currentRow , <NUM_LIT:0> ) . text ( ) . toUtf8 ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetBlacklist . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT>' : <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , <EOL> str ( labelAtCurrentRow ) , str ( addressAtCurrentRow ) ) <EOL> else : <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , <EOL> str ( labelAtCurrentRow ) , str ( addressAtCurrentRow ) ) <EOL> self . ui . tableWidgetBlacklist . removeRow ( currentRow ) <EOL> def on_action_BlacklistClipboard ( self ) : <EOL> currentRow = self . ui . tableWidgetBlacklist . currentRow ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetBlacklist . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> clipboard = QtGui . QApplication . clipboard ( ) <EOL> clipboard . setText ( str ( addressAtCurrentRow ) ) <EOL> def on_context_menuBlacklist ( self , point ) : <EOL> self . popMenuBlacklist . exec_ ( <EOL> self . ui . tableWidgetBlacklist . mapToGlobal ( point ) ) <EOL> def on_action_BlacklistEnable ( self ) : <EOL> currentRow = self . ui . tableWidgetBlacklist . currentRow ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetBlacklist . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> self . ui . tableWidgetBlacklist . item ( <EOL> currentRow , <NUM_LIT:0> ) . setTextColor ( QApplication . palette ( ) . text ( ) . color ( ) ) <EOL> self . ui . tableWidgetBlacklist . item ( <EOL> currentRow , <NUM_LIT:1> ) . setTextColor ( QApplication . palette ( ) . text ( ) . color ( ) ) <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT>' : <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , <EOL> str ( addressAtCurrentRow ) ) <EOL> else : <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , <EOL> str ( addressAtCurrentRow ) ) <EOL> def on_action_BlacklistDisable ( self ) : <EOL> currentRow = self . ui . tableWidgetBlacklist . currentRow ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetBlacklist . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> self . ui . tableWidgetBlacklist . item ( <EOL> currentRow , <NUM_LIT:0> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . ui . tableWidgetBlacklist . item ( <EOL> currentRow , <NUM_LIT:1> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> if shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT>' : <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , str ( addressAtCurrentRow ) ) <EOL> else : <EOL> sqlExecute ( <EOL> '''<STR_LIT>''' , str ( addressAtCurrentRow ) ) <EOL> def on_action_YourIdentitiesNew ( self ) : <EOL> self . click_NewAddressDialog ( ) <EOL> def on_action_YourIdentitiesEnable ( self ) : <EOL> currentRow = self . ui . tableWidgetYourIdentities . currentRow ( ) <EOL> addressAtCurrentRow = str ( <EOL> self . ui . tableWidgetYourIdentities . item ( currentRow , <NUM_LIT:1> ) . text ( ) ) <EOL> shared . config . set ( addressAtCurrentRow , '<STR_LIT>' , '<STR_LIT:true>' ) <EOL> shared . writeKeysFile ( ) <EOL> self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:0> ) . setTextColor ( QApplication . palette ( ) . text ( ) . color ( ) ) <EOL> self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:1> ) . setTextColor ( QApplication . palette ( ) . text ( ) . color ( ) ) <EOL> self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:2> ) . setTextColor ( QApplication . palette ( ) . text ( ) . color ( ) ) <EOL> if shared . safeConfigGetBoolean ( addressAtCurrentRow , '<STR_LIT>' ) : <EOL> self . ui . tableWidgetYourIdentities . item ( currentRow , <NUM_LIT:1> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT> ) ) <EOL> if shared . safeConfigGetBoolean ( addressAtCurrentRow , '<STR_LIT>' ) : <EOL> self . ui . tableWidgetYourIdentities . item ( currentRow , <NUM_LIT:1> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> shared . reloadMyAddressHashes ( ) <EOL> def on_action_YourIdentitiesDisable ( self ) : <EOL> currentRow = self . ui . tableWidgetYourIdentities . currentRow ( ) <EOL> addressAtCurrentRow = str ( <EOL> self . ui . tableWidgetYourIdentities . item ( currentRow , <NUM_LIT:1> ) . text ( ) ) <EOL> shared . config . set ( str ( addressAtCurrentRow ) , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:0> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:1> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:2> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> if shared . safeConfigGetBoolean ( addressAtCurrentRow , '<STR_LIT>' ) : <EOL> self . ui . tableWidgetYourIdentities . item ( currentRow , <NUM_LIT:1> ) . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT> ) ) <EOL> shared . writeKeysFile ( ) <EOL> shared . reloadMyAddressHashes ( ) <EOL> def on_action_YourIdentitiesClipboard ( self ) : <EOL> currentRow = self . ui . tableWidgetYourIdentities . currentRow ( ) <EOL> addressAtCurrentRow = self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> clipboard = QtGui . QApplication . clipboard ( ) <EOL> clipboard . setText ( str ( addressAtCurrentRow ) ) <EOL> def on_action_YourIdentitiesSetAvatar ( self ) : <EOL> self . on_action_SetAvatar ( self . ui . tableWidgetYourIdentities ) <EOL> def on_action_AddressBookSetAvatar ( self ) : <EOL> self . on_action_SetAvatar ( self . ui . tableWidgetAddressBook ) <EOL> def on_action_SubscriptionsSetAvatar ( self ) : <EOL> self . on_action_SetAvatar ( self . ui . tableWidgetSubscriptions ) <EOL> def on_action_BlacklistSetAvatar ( self ) : <EOL> self . on_action_SetAvatar ( self . ui . tableWidgetBlacklist ) <EOL> def on_action_SetAvatar ( self , thisTableWidget ) : <EOL> if not os . path . exists ( shared . appdata + '<STR_LIT>' ) : <EOL> os . makedirs ( shared . appdata + '<STR_LIT>' ) <EOL> currentRow = thisTableWidget . currentRow ( ) <EOL> addressAtCurrentRow = thisTableWidget . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> hash = hashlib . md5 ( addBMIfNotPresent ( addressAtCurrentRow ) ) . hexdigest ( ) <EOL> extensions = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> names = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> filters = [ ] <EOL> all_images_filter = [ ] <EOL> current_files = [ ] <EOL> for ext in extensions : <EOL> filters += [ names [ ext ] + '<STR_LIT>' + ext . lower ( ) + '<STR_LIT:)>' ] <EOL> all_images_filter += [ '<STR_LIT>' + ext . lower ( ) ] <EOL> upper = shared . appdata + '<STR_LIT>' + hash + '<STR_LIT:.>' + ext . upper ( ) <EOL> lower = shared . appdata + '<STR_LIT>' + hash + '<STR_LIT:.>' + ext . lower ( ) <EOL> if os . path . isfile ( lower ) : <EOL> current_files += [ lower ] <EOL> elif os . path . isfile ( upper ) : <EOL> current_files += [ upper ] <EOL> filters [ <NUM_LIT:0> : <NUM_LIT:0> ] = [ '<STR_LIT>' + '<STR_LIT:U+0020>' . join ( all_images_filter ) + '<STR_LIT:)>' ] <EOL> filters [ <NUM_LIT:1> : <NUM_LIT:1> ] = [ '<STR_LIT>' ] <EOL> sourcefile = QFileDialog . getOpenFileName ( self , _translate ( "<STR_LIT>" , "<STR_LIT>" ) , filter = '<STR_LIT>' . join ( filters ) ) <EOL> destination = shared . appdata + '<STR_LIT>' + hash + '<STR_LIT:.>' + sourcefile . split ( '<STR_LIT:.>' ) [ - <NUM_LIT:1> ] <EOL> exists = QtCore . QFile . exists ( destination ) <EOL> if sourcefile == '<STR_LIT>' : <EOL> if exists | ( len ( current_files ) > <NUM_LIT:0> ) : <EOL> displayMsg = _translate ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> overwrite = QtGui . QMessageBox . question ( <EOL> self , '<STR_LIT>' , displayMsg , QtGui . QMessageBox . Yes , QtGui . QMessageBox . No ) <EOL> else : <EOL> overwrite = QtGui . QMessageBox . No <EOL> else : <EOL> if exists | ( len ( current_files ) > <NUM_LIT:0> ) : <EOL> displayMsg = _translate ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> overwrite = QtGui . QMessageBox . question ( <EOL> self , '<STR_LIT>' , displayMsg , QtGui . QMessageBox . Yes , QtGui . QMessageBox . No ) <EOL> else : <EOL> overwrite = QtGui . QMessageBox . No <EOL> if ( not exists ) | ( overwrite == QtGui . QMessageBox . Yes ) : <EOL> if overwrite == QtGui . QMessageBox . Yes : <EOL> for file in current_files : <EOL> QtCore . QFile . remove ( file ) <EOL> QtCore . QFile . remove ( destination ) <EOL> if sourcefile != '<STR_LIT>' : <EOL> copied = QtCore . QFile . copy ( sourcefile , destination ) <EOL> if not copied : <EOL> print '<STR_LIT>' <EOL> return False <EOL> thisTableWidget . item ( <EOL> currentRow , <NUM_LIT:0> ) . setIcon ( avatarize ( addressAtCurrentRow ) ) <EOL> self . rerenderSubscriptions ( ) <EOL> self . rerenderComboBoxSendFrom ( ) <EOL> self . rerenderInboxFromLabels ( ) <EOL> self . rerenderInboxToLabels ( ) <EOL> self . rerenderSentFromLabels ( ) <EOL> self . rerenderSentToLabels ( ) <EOL> self . rerenderBlackWhiteList ( ) <EOL> def on_context_menuYourIdentities ( self , point ) : <EOL> self . popMenu . exec_ ( <EOL> self . ui . tableWidgetYourIdentities . mapToGlobal ( point ) ) <EOL> def on_context_menuInbox ( self , point ) : <EOL> self . popMenuInbox . exec_ ( self . ui . tableWidgetInbox . mapToGlobal ( point ) ) <EOL> def on_context_menuSent ( self , point ) : <EOL> self . popMenuSent = QtGui . QMenu ( self ) <EOL> self . popMenuSent . addAction ( self . actionSentClipboard ) <EOL> self . popMenuSent . addAction ( self . actionTrashSentMessage ) <EOL> currentRow = self . ui . tableWidgetSent . currentRow ( ) <EOL> ackData = str ( self . ui . tableWidgetSent . item ( <EOL> currentRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> queryreturn = sqlQuery ( '''<STR_LIT>''' , ackData ) <EOL> for row in queryreturn : <EOL> status , = row <EOL> if status == '<STR_LIT>' : <EOL> self . popMenuSent . addAction ( self . actionForceSend ) <EOL> self . popMenuSent . exec_ ( self . ui . tableWidgetSent . mapToGlobal ( point ) ) <EOL> def inboxSearchLineEditPressed ( self ) : <EOL> searchKeyword = self . ui . inboxSearchLineEdit . text ( ) . toUtf8 ( ) . data ( ) <EOL> searchOption = self . ui . inboxSearchOptionCB . currentText ( ) . toUtf8 ( ) . data ( ) <EOL> self . ui . inboxSearchLineEdit . setText ( QString ( "<STR_LIT>" ) ) <EOL> self . ui . textEditInboxMessage . setPlainText ( QString ( "<STR_LIT>" ) ) <EOL> self . loadInbox ( searchOption , searchKeyword ) <EOL> def sentSearchLineEditPressed ( self ) : <EOL> searchKeyword = self . ui . sentSearchLineEdit . text ( ) . toUtf8 ( ) . data ( ) <EOL> searchOption = self . ui . sentSearchOptionCB . currentText ( ) . toUtf8 ( ) . data ( ) <EOL> self . ui . sentSearchLineEdit . setText ( QString ( "<STR_LIT>" ) ) <EOL> self . ui . textEditInboxMessage . setPlainText ( QString ( "<STR_LIT>" ) ) <EOL> self . loadSent ( searchOption , searchKeyword ) <EOL> def tableWidgetInboxItemClicked ( self ) : <EOL> currentRow = self . ui . tableWidgetInbox . currentRow ( ) <EOL> if currentRow >= <NUM_LIT:0> : <EOL> font = QFont ( ) <EOL> font . setBold ( False ) <EOL> self . ui . textEditInboxMessage . setCurrentFont ( font ) <EOL> fromAddress = str ( self . ui . tableWidgetInbox . item ( <EOL> currentRow , <NUM_LIT:1> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> msgid = str ( self . ui . tableWidgetInbox . item ( <EOL> currentRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , msgid ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> messageText , = row <EOL> messageText = shared . fixPotentiallyInvalidUTF8Data ( messageText ) <EOL> messageText = unicode ( messageText , '<STR_LIT>' ) <EOL> if len ( messageText ) > <NUM_LIT> : <EOL> messageText = ( <EOL> messageText [ : <NUM_LIT> ] + '<STR_LIT:\n>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> if decodeAddress ( fromAddress ) [ <NUM_LIT:3> ] in shared . broadcastSendersForWhichImWatching or shared . isAddressInMyAddressBook ( fromAddress ) : <EOL> self . ui . textEditInboxMessage . setText ( messageText ) <EOL> else : <EOL> self . ui . textEditInboxMessage . setPlainText ( messageText ) <EOL> self . ui . tableWidgetInbox . item ( currentRow , <NUM_LIT:0> ) . setFont ( font ) <EOL> self . ui . tableWidgetInbox . item ( currentRow , <NUM_LIT:1> ) . setFont ( font ) <EOL> self . ui . tableWidgetInbox . item ( currentRow , <NUM_LIT:2> ) . setFont ( font ) <EOL> self . ui . tableWidgetInbox . item ( currentRow , <NUM_LIT:3> ) . setFont ( font ) <EOL> inventoryHash = str ( self . ui . tableWidgetInbox . item ( <EOL> currentRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> self . ubuntuMessagingMenuClear ( inventoryHash ) <EOL> sqlExecute ( '''<STR_LIT>''' , inventoryHash ) <EOL> self . changedInboxUnread ( ) <EOL> def tableWidgetSentItemClicked ( self ) : <EOL> currentRow = self . ui . tableWidgetSent . currentRow ( ) <EOL> if currentRow >= <NUM_LIT:0> : <EOL> ackdata = str ( self . ui . tableWidgetSent . item ( <EOL> currentRow , <NUM_LIT:3> ) . data ( Qt . UserRole ) . toPyObject ( ) ) <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , ackdata ) <EOL> if queryreturn != [ ] : <EOL> for row in queryreturn : <EOL> message , = row <EOL> else : <EOL> message = "<STR_LIT>" <EOL> message = unicode ( message , '<STR_LIT>' ) <EOL> self . ui . textEditSentMessage . setPlainText ( message ) <EOL> def tableWidgetYourIdentitiesItemChanged ( self ) : <EOL> currentRow = self . ui . tableWidgetYourIdentities . currentRow ( ) <EOL> if currentRow >= <NUM_LIT:0> : <EOL> addressAtCurrentRow = self . ui . tableWidgetYourIdentities . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> shared . config . set ( str ( addressAtCurrentRow ) , '<STR_LIT:label>' , str ( <EOL> self . ui . tableWidgetYourIdentities . item ( currentRow , <NUM_LIT:0> ) . text ( ) . toUtf8 ( ) ) ) <EOL> shared . writeKeysFile ( ) <EOL> self . rerenderComboBoxSendFrom ( ) <EOL> self . rerenderInboxToLabels ( ) <EOL> self . rerenderSentFromLabels ( ) <EOL> def tableWidgetAddressBookItemChanged ( self ) : <EOL> currentRow = self . ui . tableWidgetAddressBook . currentRow ( ) <EOL> if currentRow >= <NUM_LIT:0> : <EOL> addressAtCurrentRow = self . ui . tableWidgetAddressBook . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> sqlExecute ( '''<STR_LIT>''' , <EOL> str ( self . ui . tableWidgetAddressBook . item ( currentRow , <NUM_LIT:0> ) . text ( ) . toUtf8 ( ) ) , <EOL> str ( addressAtCurrentRow ) ) <EOL> self . rerenderInboxFromLabels ( ) <EOL> self . rerenderSentToLabels ( ) <EOL> def tableWidgetSubscriptionsItemChanged ( self ) : <EOL> currentRow = self . ui . tableWidgetSubscriptions . currentRow ( ) <EOL> if currentRow >= <NUM_LIT:0> : <EOL> addressAtCurrentRow = self . ui . tableWidgetSubscriptions . item ( <EOL> currentRow , <NUM_LIT:1> ) . text ( ) <EOL> sqlExecute ( '''<STR_LIT>''' , <EOL> str ( self . ui . tableWidgetSubscriptions . item ( currentRow , <NUM_LIT:0> ) . text ( ) . toUtf8 ( ) ) , <EOL> str ( addressAtCurrentRow ) ) <EOL> self . rerenderInboxFromLabels ( ) <EOL> self . rerenderSentToLabels ( ) <EOL> def writeNewAddressToTable ( self , label , address , streamNumber ) : <EOL> self . ui . tableWidgetYourIdentities . setSortingEnabled ( False ) <EOL> self . ui . tableWidgetYourIdentities . insertRow ( <NUM_LIT:0> ) <EOL> newItem = QtGui . QTableWidgetItem ( unicode ( label , '<STR_LIT:utf-8>' ) ) <EOL> newItem . setIcon ( avatarize ( address ) ) <EOL> self . ui . tableWidgetYourIdentities . setItem ( <EOL> <NUM_LIT:0> , <NUM_LIT:0> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( address ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> if shared . safeConfigGetBoolean ( address , '<STR_LIT>' ) : <EOL> newItem . setTextColor ( QtGui . QColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> self . ui . tableWidgetYourIdentities . setItem ( <NUM_LIT:0> , <NUM_LIT:1> , newItem ) <EOL> newItem = QtGui . QTableWidgetItem ( streamNumber ) <EOL> newItem . setFlags ( <EOL> QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled ) <EOL> self . ui . tableWidgetYourIdentities . setItem ( <NUM_LIT:0> , <NUM_LIT:2> , newItem ) <EOL> self . rerenderComboBoxSendFrom ( ) <EOL> def updateStatusBar ( self , data ) : <EOL> if data != "<STR_LIT>" : <EOL> with shared . printLock : <EOL> print '<STR_LIT>' , data <EOL> self . statusBar ( ) . showMessage ( data ) <EOL> class helpDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_helpDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> self . ui . labelHelpURI . setOpenExternalLinks ( True ) <EOL> QtGui . QWidget . resize ( self , QtGui . QWidget . sizeHint ( self ) ) <EOL> class connectDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_connectDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> QtGui . QWidget . resize ( self , QtGui . QWidget . sizeHint ( self ) ) <EOL> class aboutDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_aboutDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> self . ui . labelVersion . setText ( '<STR_LIT>' + shared . softwareVersion ) <EOL> class regenerateAddressesDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_regenerateAddressesDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> QtGui . QWidget . resize ( self , QtGui . QWidget . sizeHint ( self ) ) <EOL> class settingsDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_settingsDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> self . ui . checkBoxStartOnLogon . setChecked ( <EOL> shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . ui . checkBoxMinimizeToTray . setChecked ( <EOL> shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . ui . checkBoxShowTrayNotifications . setChecked ( <EOL> shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . ui . checkBoxStartInTray . setChecked ( <EOL> shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . ui . checkBoxWillinglySendToMobile . setChecked ( <EOL> shared . safeConfigGetBoolean ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . ui . checkBoxUseIdenticons . setChecked ( <EOL> shared . safeConfigGetBoolean ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . ui . checkBoxReplyBelow . setChecked ( <EOL> shared . safeConfigGetBoolean ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> global languages <EOL> languages = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> user_countrycode = str ( shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> if user_countrycode in languages : <EOL> curr_index = languages . index ( user_countrycode ) <EOL> else : <EOL> curr_index = languages . index ( '<STR_LIT>' ) <EOL> self . ui . languageComboBox . setCurrentIndex ( curr_index ) <EOL> if shared . appdata == '<STR_LIT>' : <EOL> self . ui . checkBoxPortableMode . setChecked ( True ) <EOL> if '<STR_LIT>' in sys . platform : <EOL> self . ui . checkBoxStartOnLogon . setDisabled ( True ) <EOL> self . ui . checkBoxStartOnLogon . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . ui . checkBoxMinimizeToTray . setDisabled ( True ) <EOL> self . ui . checkBoxMinimizeToTray . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . ui . checkBoxShowTrayNotifications . setDisabled ( True ) <EOL> self . ui . checkBoxShowTrayNotifications . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif '<STR_LIT>' in sys . platform : <EOL> self . ui . checkBoxStartOnLogon . setDisabled ( True ) <EOL> self . ui . checkBoxStartOnLogon . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . ui . lineEditTCPPort . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT:port>' ) ) ) <EOL> self . ui . checkBoxAuthentication . setChecked ( shared . config . getboolean ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . ui . checkBoxSocksListen . setChecked ( shared . config . getboolean ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> if str ( shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) == '<STR_LIT:none>' : <EOL> self . ui . comboBoxProxyType . setCurrentIndex ( <NUM_LIT:0> ) <EOL> self . ui . lineEditSocksHostname . setEnabled ( False ) <EOL> self . ui . lineEditSocksPort . setEnabled ( False ) <EOL> self . ui . lineEditSocksUsername . setEnabled ( False ) <EOL> self . ui . lineEditSocksPassword . setEnabled ( False ) <EOL> self . ui . checkBoxAuthentication . setEnabled ( False ) <EOL> self . ui . checkBoxSocksListen . setEnabled ( False ) <EOL> elif str ( shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) == '<STR_LIT>' : <EOL> self . ui . comboBoxProxyType . setCurrentIndex ( <NUM_LIT:1> ) <EOL> self . ui . lineEditTCPPort . setEnabled ( False ) <EOL> elif str ( shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) == '<STR_LIT>' : <EOL> self . ui . comboBoxProxyType . setCurrentIndex ( <NUM_LIT:2> ) <EOL> self . ui . lineEditTCPPort . setEnabled ( False ) <EOL> self . ui . lineEditSocksHostname . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> self . ui . lineEditSocksPort . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> self . ui . lineEditSocksUsername . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> self . ui . lineEditSocksPassword . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> QtCore . QObject . connect ( self . ui . comboBoxProxyType , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . comboBoxProxyTypeChanged ) <EOL> self . ui . lineEditMaxDownloadRate . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> self . ui . lineEditMaxUploadRate . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> self . ui . lineEditTotalDifficulty . setText ( str ( ( float ( shared . config . getint ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) ) / shared . networkDefaultProofOfWorkNonceTrialsPerByte ) ) ) <EOL> self . ui . lineEditSmallMessageDifficulty . setText ( str ( ( float ( shared . config . getint ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) ) / shared . networkDefaultPayloadLengthExtraBytes ) ) ) <EOL> self . ui . lineEditMaxAcceptableTotalDifficulty . setText ( str ( ( float ( shared . config . getint ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) ) / shared . networkDefaultProofOfWorkNonceTrialsPerByte ) ) ) <EOL> self . ui . lineEditMaxAcceptableSmallMessageDifficulty . setText ( str ( ( float ( shared . config . getint ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) ) / shared . networkDefaultPayloadLengthExtraBytes ) ) ) <EOL> nmctype = shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . ui . lineEditNamecoinHost . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> self . ui . lineEditNamecoinPort . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> self . ui . lineEditNamecoinUser . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> self . ui . lineEditNamecoinPassword . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> if nmctype == "<STR_LIT>" : <EOL> self . ui . radioButtonNamecoinNamecoind . setChecked ( True ) <EOL> elif nmctype == "<STR_LIT>" : <EOL> self . ui . radioButtonNamecoinNmcontrol . setChecked ( True ) <EOL> self . ui . lineEditNamecoinUser . setEnabled ( False ) <EOL> self . ui . labelNamecoinUser . setEnabled ( False ) <EOL> self . ui . lineEditNamecoinPassword . setEnabled ( False ) <EOL> self . ui . labelNamecoinPassword . setEnabled ( False ) <EOL> else : <EOL> assert False <EOL> QtCore . QObject . connect ( self . ui . radioButtonNamecoinNamecoind , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . namecoinTypeChanged ) <EOL> QtCore . QObject . connect ( self . ui . radioButtonNamecoinNmcontrol , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . namecoinTypeChanged ) <EOL> QtCore . QObject . connect ( self . ui . pushButtonNamecoinTest , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . click_pushButtonNamecoinTest ) <EOL> self . ui . lineEditDays . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> self . ui . lineEditMonths . setText ( str ( <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> """<STR_LIT>""" <EOL> QtGui . QWidget . resize ( self , QtGui . QWidget . sizeHint ( self ) ) <EOL> def comboBoxProxyTypeChanged ( self , comboBoxIndex ) : <EOL> if comboBoxIndex == <NUM_LIT:0> : <EOL> self . ui . lineEditSocksHostname . setEnabled ( False ) <EOL> self . ui . lineEditSocksPort . setEnabled ( False ) <EOL> self . ui . lineEditSocksUsername . setEnabled ( False ) <EOL> self . ui . lineEditSocksPassword . setEnabled ( False ) <EOL> self . ui . checkBoxAuthentication . setEnabled ( False ) <EOL> self . ui . checkBoxSocksListen . setEnabled ( False ) <EOL> self . ui . lineEditTCPPort . setEnabled ( True ) <EOL> elif comboBoxIndex == <NUM_LIT:1> or comboBoxIndex == <NUM_LIT:2> : <EOL> self . ui . lineEditSocksHostname . setEnabled ( True ) <EOL> self . ui . lineEditSocksPort . setEnabled ( True ) <EOL> self . ui . checkBoxAuthentication . setEnabled ( True ) <EOL> self . ui . checkBoxSocksListen . setEnabled ( True ) <EOL> if self . ui . checkBoxAuthentication . isChecked ( ) : <EOL> self . ui . lineEditSocksUsername . setEnabled ( True ) <EOL> self . ui . lineEditSocksPassword . setEnabled ( True ) <EOL> self . ui . lineEditTCPPort . setEnabled ( False ) <EOL> def getNamecoinType ( self ) : <EOL> if self . ui . radioButtonNamecoinNamecoind . isChecked ( ) : <EOL> return "<STR_LIT>" <EOL> if self . ui . radioButtonNamecoinNmcontrol . isChecked ( ) : <EOL> return "<STR_LIT>" <EOL> assert False <EOL> def namecoinTypeChanged ( self , checked ) : <EOL> nmctype = self . getNamecoinType ( ) <EOL> assert nmctype == "<STR_LIT>" or nmctype == "<STR_LIT>" <EOL> isNamecoind = ( nmctype == "<STR_LIT>" ) <EOL> self . ui . lineEditNamecoinUser . setEnabled ( isNamecoind ) <EOL> self . ui . labelNamecoinUser . setEnabled ( isNamecoind ) <EOL> self . ui . lineEditNamecoinPassword . setEnabled ( isNamecoind ) <EOL> self . ui . labelNamecoinPassword . setEnabled ( isNamecoind ) <EOL> if isNamecoind : <EOL> self . ui . lineEditNamecoinPort . setText ( shared . namecoinDefaultRpcPort ) <EOL> else : <EOL> self . ui . lineEditNamecoinPort . setText ( "<STR_LIT>" ) <EOL> def click_pushButtonNamecoinTest ( self ) : <EOL> self . ui . labelNamecoinTestResult . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> options = { } <EOL> options [ "<STR_LIT:type>" ] = self . getNamecoinType ( ) <EOL> options [ "<STR_LIT:host>" ] = self . ui . lineEditNamecoinHost . text ( ) <EOL> options [ "<STR_LIT:port>" ] = self . ui . lineEditNamecoinPort . text ( ) <EOL> options [ "<STR_LIT:user>" ] = self . ui . lineEditNamecoinUser . text ( ) <EOL> options [ "<STR_LIT:password>" ] = self . ui . lineEditNamecoinPassword . text ( ) <EOL> nc = namecoinConnection ( options ) <EOL> response = nc . test ( ) <EOL> responseStatus = response [ <NUM_LIT:0> ] <EOL> responseText = response [ <NUM_LIT:1> ] <EOL> self . ui . labelNamecoinTestResult . setText ( responseText ) <EOL> if responseStatus == '<STR_LIT:success>' : <EOL> self . parent . ui . pushButtonFetchNamecoinID . show ( ) <EOL> class SpecialAddressBehaviorDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_SpecialAddressBehaviorDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> currentRow = parent . ui . tableWidgetYourIdentities . currentRow ( ) <EOL> addressAtCurrentRow = str ( <EOL> parent . ui . tableWidgetYourIdentities . item ( currentRow , <NUM_LIT:1> ) . text ( ) ) <EOL> if not shared . safeConfigGetBoolean ( addressAtCurrentRow , '<STR_LIT>' ) : <EOL> if shared . safeConfigGetBoolean ( addressAtCurrentRow , '<STR_LIT>' ) : <EOL> self . ui . radioButtonBehaviorMailingList . click ( ) <EOL> else : <EOL> self . ui . radioButtonBehaveNormalAddress . click ( ) <EOL> try : <EOL> mailingListName = shared . config . get ( <EOL> addressAtCurrentRow , '<STR_LIT>' ) <EOL> except : <EOL> mailingListName = '<STR_LIT>' <EOL> self . ui . lineEditMailingListName . setText ( <EOL> unicode ( mailingListName , '<STR_LIT:utf-8>' ) ) <EOL> else : <EOL> self . ui . radioButtonBehaviorMailingList . setDisabled ( True ) <EOL> self . ui . lineEditMailingListName . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> QtGui . QWidget . resize ( self , QtGui . QWidget . sizeHint ( self ) ) <EOL> class AddAddressDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_AddAddressDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> QtCore . QObject . connect ( self . ui . lineEditAddress , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . addressChanged ) <EOL> def addressChanged ( self , QString ) : <EOL> status , a , b , c = decodeAddress ( str ( QString ) ) <EOL> if status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT:success>' : <EOL> self . ui . labelAddressCheck . setText ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> class NewSubscriptionDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_NewSubscriptionDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> QtCore . QObject . connect ( self . ui . lineEditSubscriptionAddress , QtCore . SIGNAL ( <EOL> "<STR_LIT>" ) , self . addressChanged ) <EOL> self . ui . checkBoxDisplayMessagesAlreadyInInventory . setText ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def addressChanged ( self , QString ) : <EOL> self . ui . checkBoxDisplayMessagesAlreadyInInventory . setEnabled ( False ) <EOL> self . ui . checkBoxDisplayMessagesAlreadyInInventory . setChecked ( False ) <EOL> status , addressVersion , streamNumber , ripe = decodeAddress ( str ( QString ) ) <EOL> if status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT>' : <EOL> self . ui . labelAddressCheck . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif status == '<STR_LIT:success>' : <EOL> self . ui . labelAddressCheck . setText ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> if addressVersion <= <NUM_LIT:3> : <EOL> self . ui . checkBoxDisplayMessagesAlreadyInInventory . setText ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> shared . flushInventory ( ) <EOL> doubleHashOfAddressData = hashlib . sha512 ( hashlib . sha512 ( encodeVarint ( <EOL> addressVersion ) + encodeVarint ( streamNumber ) + ripe ) . digest ( ) ) . digest ( ) <EOL> tag = doubleHashOfAddressData [ <NUM_LIT:32> : ] <EOL> queryreturn = sqlQuery ( <EOL> '''<STR_LIT>''' , tag ) <EOL> if len ( queryreturn ) == <NUM_LIT:0> : <EOL> self . ui . checkBoxDisplayMessagesAlreadyInInventory . setText ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif len ( queryreturn ) == <NUM_LIT:1> : <EOL> self . ui . checkBoxDisplayMessagesAlreadyInInventory . setEnabled ( True ) <EOL> self . ui . checkBoxDisplayMessagesAlreadyInInventory . setText ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( str ( len ( queryreturn ) ) ) ) <EOL> else : <EOL> self . ui . checkBoxDisplayMessagesAlreadyInInventory . setEnabled ( True ) <EOL> self . ui . checkBoxDisplayMessagesAlreadyInInventory . setText ( <EOL> _translate ( "<STR_LIT>" , "<STR_LIT>" ) . arg ( str ( len ( queryreturn ) ) ) ) <EOL> class NewAddressDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_NewAddressDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> row = <NUM_LIT:1> <EOL> while self . parent . ui . tableWidgetYourIdentities . item ( row - <NUM_LIT:1> , <NUM_LIT:1> ) : <EOL> self . ui . radioButtonExisting . click ( ) <EOL> self . ui . comboBoxExisting . addItem ( <EOL> self . parent . ui . tableWidgetYourIdentities . item ( row - <NUM_LIT:1> , <NUM_LIT:1> ) . text ( ) ) <EOL> row += <NUM_LIT:1> <EOL> self . ui . groupBoxDeterministic . setHidden ( True ) <EOL> QtGui . QWidget . resize ( self , QtGui . QWidget . sizeHint ( self ) ) <EOL> class newChanDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_newChanDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> self . ui . groupBoxCreateChan . setHidden ( True ) <EOL> QtGui . QWidget . resize ( self , QtGui . QWidget . sizeHint ( self ) ) <EOL> class iconGlossaryDialog ( QtGui . QDialog ) : <EOL> def __init__ ( self , parent ) : <EOL> QtGui . QWidget . __init__ ( self , parent ) <EOL> self . ui = Ui_iconGlossaryDialog ( ) <EOL> self . ui . setupUi ( self ) <EOL> self . parent = parent <EOL> self . ui . labelPortNumber . setText ( _translate ( <EOL> "<STR_LIT>" , "<STR_LIT>" ) . arg ( str ( shared . config . getint ( '<STR_LIT>' , '<STR_LIT:port>' ) ) ) ) <EOL> QtGui . QWidget . resize ( self , QtGui . QWidget . sizeHint ( self ) ) <EOL> class myTableWidgetItem ( QTableWidgetItem ) : <EOL> def __lt__ ( self , other ) : <EOL> return int ( self . data ( <NUM_LIT> ) . toPyObject ( ) ) < int ( other . data ( <NUM_LIT> ) . toPyObject ( ) ) <EOL> class UISignaler ( QThread ) : <EOL> def __init__ ( self , parent = None ) : <EOL> QThread . __init__ ( self , parent ) <EOL> def run ( self ) : <EOL> while True : <EOL> command , data = shared . UISignalQueue . get ( ) <EOL> if command == '<STR_LIT>' : <EOL> label , address , streamNumber = data <EOL> self . emit ( SIGNAL ( <EOL> "<STR_LIT>" ) , label , address , str ( streamNumber ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) , data ) <EOL> elif command == '<STR_LIT>' : <EOL> toAddress , message = data <EOL> self . emit ( SIGNAL ( <EOL> "<STR_LIT>" ) , toAddress , message ) <EOL> elif command == '<STR_LIT>' : <EOL> ackData , message = data <EOL> self . emit ( SIGNAL ( <EOL> "<STR_LIT>" ) , ackData , message ) <EOL> elif command == '<STR_LIT>' : <EOL> inventoryHash , toAddress , fromAddress , subject , body = data <EOL> self . emit ( SIGNAL ( <EOL> "<STR_LIT>" ) , <EOL> inventoryHash , toAddress , fromAddress , subject , body ) <EOL> elif command == '<STR_LIT>' : <EOL> toAddress , fromLabel , fromAddress , subject , message , ackdata = data <EOL> self . emit ( SIGNAL ( <EOL> "<STR_LIT>" ) , <EOL> toAddress , fromLabel , fromAddress , subject , message , ackdata ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) , data ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) , data ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) ) <EOL> elif command == '<STR_LIT>' : <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) , data ) <EOL> elif command == '<STR_LIT>' : <EOL> title , text , exitAfterUserClicksOk = data <EOL> self . emit ( SIGNAL ( "<STR_LIT>" ) , title , text , exitAfterUserClicksOk ) <EOL> else : <EOL> sys . stderr . write ( <EOL> '<STR_LIT>' % command ) <EOL> def run ( ) : <EOL> app = QtGui . QApplication ( sys . argv ) <EOL> change_translation ( l10n . getTranslationLanguage ( ) ) <EOL> app . setStyleSheet ( "<STR_LIT>" ) <EOL> myapp = MyForm ( ) <EOL> if not shared . config . getboolean ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> myapp . show ( ) <EOL> myapp . appIndicatorInit ( app ) <EOL> myapp . ubuntuMessagingMenuInit ( ) <EOL> myapp . notifierInit ( ) <EOL> if shared . safeConfigGetBoolean ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> myapp . showConnectDialog ( ) <EOL> sys . exit ( app . exec_ ( ) ) </s>
