UI refactoring (part 1) #1092

Merged
g1itch merged 20 commits from ui-refactoring into v0.6 2018-01-30 17:32:38 +01:00
24 changed files with 1263 additions and 1761 deletions

View File

@ -1,47 +1,31 @@
from debug import logger from debug import logger
import sys
try: try:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtNetwork import QLocalSocket, QLocalServer from PyQt4.QtNetwork import QLocalSocket, QLocalServer
except Exception as err: except Exception as err:
logmsg = 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download it from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\' (without quotes).' logmsg = 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download it from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\' (without quotes).'
logger.critical(logmsg, exc_info=True) logger.critical(logmsg, exc_info=True)
import sys
sys.exit() sys.exit()
try: from tr import _translate
_encoding = QtGui.QApplication.UnicodeUTF8 from addresses import decodeAddress, addBMIfNotPresent
except AttributeError:
logger.exception('QtGui.QApplication.UnicodeUTF8 error', exc_info=True)
from addresses import *
import shared import shared
from bitmessageui import * from bitmessageui import Ui_MainWindow
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
import defaults import defaults
from namecoin import namecoinConnection from namecoin import namecoinConnection
from newaddressdialog import *
from newaddresswizard import *
from messageview import MessageView from messageview import MessageView
from migrationwizard import * from migrationwizard import Ui_MigrationWizard
from foldertree import * from foldertree import (
from newsubscriptiondialog import * AccountMixin, Ui_FolderWidget, Ui_AddressWidget, Ui_SubscriptionWidget,
from regenerateaddresses import * MessageList_AddressWidget, MessageList_SubjectWidget,
from newchandialog import * Ui_AddressBookWidgetItemLabel, Ui_AddressBookWidgetItemAddress)
from safehtmlparser import * from settings import Ui_settingsDialog
from specialaddressbehavior import *
from emailgateway import *
from settings import *
import settingsmixin import settingsmixin
import support import support
from about import *
from help import *
from iconglossary import *
from connect import *
import locale import locale
import sys
import time import time
import os import os
import hashlib import hashlib
@ -51,18 +35,21 @@ import debug
import random import random
import string import string
from datetime import datetime, timedelta from datetime import datetime, timedelta
from helper_sql import *
from helper_ackPayload import genAckPayload from helper_ackPayload import genAckPayload
from helper_sql import sqlQuery, sqlExecute, sqlExecuteChunked, sqlStoredProcedure
import helper_search import helper_search
import l10n import l10n
import openclpow import openclpow
from utils import str_broadcast_subscribers, avatarize from utils import str_broadcast_subscribers, avatarize
from account import * from account import (
from dialogs import AddAddressDialog getSortedAccounts, getSortedSubscriptions, accountClass, BMAccount,
GatewayAccount, MailchuckAccount, AccountColor)
import dialogs
from helper_generic import powQueueSize from helper_generic import powQueueSize
from inventory import ( from inventory import (
Inventory, PendingDownloadQueue, PendingUpload, PendingDownloadQueue, PendingUpload,
PendingUploadDeadlineException) PendingUploadDeadlineException)
from uisignaler import UISignaler
import knownnodes import knownnodes
import paths import paths
from proofofwork import getPowType from proofofwork import getPowType
@ -71,21 +58,15 @@ import shutdown
import state import state
from statusbar import BMStatusBar from statusbar import BMStatusBar
from network.asyncore_pollchoose import set_rates from network.asyncore_pollchoose import set_rates
from version import softwareVersion
import sound import sound
try: try:
from plugins.plugin import get_plugin, get_plugins from plugins.plugin import get_plugin, get_plugins
except ImportError: except ImportError:
get_plugins = False get_plugins = False
def _translate(context, text, disambiguation = None, encoding = None, number = None):
if number is None:
return QtGui.QApplication.translate(context, text)
else:
return QtGui.QApplication.translate(context, text, None, QtCore.QCoreApplication.CodecForTr, number)
def change_translation(newlocale): def change_translation(newlocale):
global qmytranslator, qsystranslator global qmytranslator, qsystranslator
try: try:
@ -398,7 +379,8 @@ class MyForm(settingsmixin.SMainWindow):
# sort ascending when creating # sort ascending when creating
if treeWidget.topLevelItemCount() == 0: if treeWidget.topLevelItemCount() == 0:
treeWidget.header().setSortIndicator(0, Qt.AscendingOrder) treeWidget.header().setSortIndicator(
0, QtCore.Qt.AscendingOrder)
# init dictionary # init dictionary
db = getSortedSubscriptions(True) db = getSortedSubscriptions(True)
@ -483,7 +465,8 @@ class MyForm(settingsmixin.SMainWindow):
# sort ascending when creating # sort ascending when creating
if treeWidget.topLevelItemCount() == 0: if treeWidget.topLevelItemCount() == 0:
treeWidget.header().setSortIndicator(0, Qt.AscendingOrder) treeWidget.header().setSortIndicator(
0, QtCore.Qt.AscendingOrder)
# init dictionary # init dictionary
db = {} db = {}
enabled = {} enabled = {}
@ -711,7 +694,8 @@ class MyForm(settingsmixin.SMainWindow):
self.pushButtonStatusIcon = QtGui.QPushButton(self) self.pushButtonStatusIcon = QtGui.QPushButton(self)
self.pushButtonStatusIcon.setText('') self.pushButtonStatusIcon.setText('')
self.pushButtonStatusIcon.setIcon(QIcon(':/newPrefix/images/redicon.png')) self.pushButtonStatusIcon.setIcon(
QtGui.QIcon(':/newPrefix/images/redicon.png'))
self.pushButtonStatusIcon.setFlat(True) self.pushButtonStatusIcon.setFlat(True)
self.statusbar.insertPermanentWidget(0, self.pushButtonStatusIcon) self.statusbar.insertPermanentWidget(0, self.pushButtonStatusIcon)
QtCore.QObject.connect(self.pushButtonStatusIcon, QtCore.SIGNAL( QtCore.QObject.connect(self.pushButtonStatusIcon, QtCore.SIGNAL(
@ -889,7 +873,9 @@ class MyForm(settingsmixin.SMainWindow):
def appIndicatorInbox(self, item=None): def appIndicatorInbox(self, item=None):
self.appIndicatorShow() self.appIndicatorShow()
# select inbox # select inbox
self.ui.tabWidget.setCurrentIndex(0) self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.inbox)
)
self.ui.treeWidgetYourIdentities.setCurrentItem( self.ui.treeWidgetYourIdentities.setCurrentItem(
self.ui.treeWidgetYourIdentities.topLevelItem(0).child(0) self.ui.treeWidgetYourIdentities.topLevelItem(0).child(0)
) )
@ -903,17 +889,23 @@ class MyForm(settingsmixin.SMainWindow):
# Show the program window and select send tab # Show the program window and select send tab
def appIndicatorSend(self): def appIndicatorSend(self):
self.appIndicatorShow() self.appIndicatorShow()
self.ui.tabWidget.setCurrentIndex(1) self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send)
)
# Show the program window and select subscriptions tab # Show the program window and select subscriptions tab
def appIndicatorSubscribe(self): def appIndicatorSubscribe(self):
self.appIndicatorShow() self.appIndicatorShow()
self.ui.tabWidget.setCurrentIndex(2) self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.subscriptions)
)
# Show the program window and select channels tab # Show the program window and select channels tab
def appIndicatorChannel(self): def appIndicatorChannel(self):
self.appIndicatorShow() self.appIndicatorShow()
self.ui.tabWidget.setCurrentIndex(3) self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.chans)
)
def propagateUnreadCount(self, address = None, folder = "inbox", widget = None, type = 1): def propagateUnreadCount(self, address = None, folder = "inbox", widget = None, type = 1):
widgets = [self.ui.treeWidgetYourIdentities, self.ui.treeWidgetSubscriptions, self.ui.treeWidgetChans] widgets = [self.ui.treeWidgetYourIdentities, self.ui.treeWidgetSubscriptions, self.ui.treeWidgetChans]
@ -1033,7 +1025,7 @@ class MyForm(settingsmixin.SMainWindow):
l10n.formatTimestamp(lastactiontime)) l10n.formatTimestamp(lastactiontime))
newItem = myTableWidgetItem(statusText) newItem = myTableWidgetItem(statusText)
newItem.setToolTip(statusText) newItem.setToolTip(statusText)
newItem.setData(Qt.UserRole, QByteArray(ackdata)) newItem.setData(QtCore.Qt.UserRole, QtCore.QByteArray(ackdata))
newItem.setData(33, int(lastactiontime)) newItem.setData(33, int(lastactiontime))
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
@ -1042,7 +1034,7 @@ class MyForm(settingsmixin.SMainWindow):
return acct return acct
def addMessageListItemInbox(self, tableWidget, msgfolder, msgid, toAddress, fromAddress, subject, received, read): def addMessageListItemInbox(self, tableWidget, msgfolder, msgid, toAddress, fromAddress, subject, received, read):
font = QFont() font = QtGui.QFont()
font.setBold(True) font.setBold(True)
if toAddress == str_broadcast_subscribers: if toAddress == str_broadcast_subscribers:
acct = accountClass(fromAddress) acct = accountClass(fromAddress)
@ -1064,7 +1056,7 @@ class MyForm(settingsmixin.SMainWindow):
# time received # time received
time_item = myTableWidgetItem(l10n.formatTimestamp(received)) time_item = myTableWidgetItem(l10n.formatTimestamp(received))
time_item.setToolTip(l10n.formatTimestamp(received)) time_item.setToolTip(l10n.formatTimestamp(received))
time_item.setData(Qt.UserRole, QByteArray(msgid)) time_item.setData(QtCore.Qt.UserRole, QtCore.QByteArray(msgid))
time_item.setData(33, int(received)) time_item.setData(33, int(received))
time_item.setFlags( time_item.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
@ -1101,7 +1093,8 @@ class MyForm(settingsmixin.SMainWindow):
toAddress, fromAddress, subject, status, ackdata, lastactiontime = row toAddress, fromAddress, subject, status, ackdata, lastactiontime = row
self.addMessageListItemSent(tableWidget, toAddress, fromAddress, subject, status, ackdata, lastactiontime) self.addMessageListItemSent(tableWidget, toAddress, fromAddress, subject, status, ackdata, lastactiontime)
tableWidget.horizontalHeader().setSortIndicator(3, Qt.DescendingOrder) tableWidget.horizontalHeader().setSortIndicator(
3, QtCore.Qt.DescendingOrder)
tableWidget.setSortingEnabled(True) tableWidget.setSortingEnabled(True)
tableWidget.horizontalHeaderItem(3).setText(_translate("MainWindow", "Sent", None)) tableWidget.horizontalHeaderItem(3).setText(_translate("MainWindow", "Sent", None))
tableWidget.setUpdatesEnabled(True) tableWidget.setUpdatesEnabled(True)
@ -1133,7 +1126,8 @@ class MyForm(settingsmixin.SMainWindow):
msgfolder, msgid, toAddress, fromAddress, subject, received, read = row msgfolder, msgid, toAddress, fromAddress, subject, received, read = row
self.addMessageListItemInbox(tableWidget, msgfolder, msgid, toAddress, fromAddress, subject, received, read) self.addMessageListItemInbox(tableWidget, msgfolder, msgid, toAddress, fromAddress, subject, received, read)
tableWidget.horizontalHeader().setSortIndicator(3, Qt.DescendingOrder) tableWidget.horizontalHeader().setSortIndicator(
3, QtCore.Qt.DescendingOrder)
tableWidget.setSortingEnabled(True) tableWidget.setSortingEnabled(True)
tableWidget.selectRow(0) tableWidget.selectRow(0)
tableWidget.horizontalHeaderItem(3).setText(_translate("MainWindow", "Received", None)) tableWidget.horizontalHeaderItem(3).setText(_translate("MainWindow", "Received", None))
@ -1146,7 +1140,7 @@ class MyForm(settingsmixin.SMainWindow):
QtCore.QObject.connect(self.tray, QtCore.SIGNAL( QtCore.QObject.connect(self.tray, QtCore.SIGNAL(
traySignal), self.__icon_activated) traySignal), self.__icon_activated)
m = QMenu() m = QtGui.QMenu()
self.actionStatus = QtGui.QAction(_translate( self.actionStatus = QtGui.QAction(_translate(
"MainWindow", "Not Connected"), m, checkable=False) "MainWindow", "Not Connected"), m, checkable=False)
@ -1378,8 +1372,12 @@ class MyForm(settingsmixin.SMainWindow):
currentAddress = self.getCurrentAccount() currentAddress = self.getCurrentAccount()
if currentAddress: if currentAddress:
self.setSendFromComboBox(currentAddress) self.setSendFromComboBox(currentAddress)
self.ui.tabWidgetSend.setCurrentIndex(0) self.ui.tabWidgetSend.setCurrentIndex(
self.ui.tabWidget.setCurrentIndex(1) self.ui.tabWidgetSend.indexOf(self.ui.sendDirect)
)
self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send)
)
self.ui.lineEditTo.setFocus() self.ui.lineEditTo.setFocus()
event.ignore() event.ignore()
elif event.key() == QtCore.Qt.Key_F: elif event.key() == QtCore.Qt.Key_F:
@ -1405,11 +1403,11 @@ class MyForm(settingsmixin.SMainWindow):
# the same directory as this program. It is important that you # the same directory as this program. It is important that you
# back up this file.', QMessageBox.Ok) # back up this file.', QMessageBox.Ok)
reply = QtGui.QMessageBox.information(self, 'keys.dat?', _translate( reply = QtGui.QMessageBox.information(self, 'keys.dat?', _translate(
"MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file."), QMessageBox.Ok) "MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file."), QtGui.QMessageBox.Ok)
else: else:
QtGui.QMessageBox.information(self, 'keys.dat?', _translate( QtGui.QMessageBox.information(self, 'keys.dat?', _translate(
"MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file.").arg(state.appdata), QMessageBox.Ok) "MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file.").arg(state.appdata), QtGui.QMessageBox.Ok)
elif sys.platform == 'win32' or sys.platform == 'win64': elif sys.platform == 'win32' or sys.platform == 'win64':
if state.appdata == '': if state.appdata == '':
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Open keys.dat?"), _translate( reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Open keys.dat?"), _translate(
@ -1435,45 +1433,66 @@ class MyForm(settingsmixin.SMainWindow):
elif self.getCurrentFolder(self.ui.treeWidgetChans) == "trash": elif self.getCurrentFolder(self.ui.treeWidgetChans) == "trash":
self.loadMessagelist(self.ui.tableWidgetInboxChans, self.getCurrentAccount(self.ui.treeWidgetChans), "trash") self.loadMessagelist(self.ui.tableWidgetInboxChans, self.getCurrentAccount(self.ui.treeWidgetChans), "trash")
# menu button 'regenerate deterministic addresses'
# menu botton 'regenerate deterministic addresses'
def click_actionRegenerateDeterministicAddresses(self): def click_actionRegenerateDeterministicAddresses(self):
self.regenerateAddressesDialogInstance = regenerateAddressesDialog( dialog = dialogs.RegenerateAddressesDialog(self)
self) if dialog.exec_():
if self.regenerateAddressesDialogInstance.exec_(): if dialog.lineEditPassphrase.text() == "":
if self.regenerateAddressesDialogInstance.ui.lineEditPassphrase.text() == "": QtGui.QMessageBox.about(
QMessageBox.about(self, _translate("MainWindow", "bad passphrase"), _translate( self, _translate("MainWindow", "bad passphrase"),
"MainWindow", "You must type your passphrase. If you don\'t have one then this is not the form for you.")) _translate(
"MainWindow",
"You must type your passphrase. If you don\'t"
" have one then this is not the form for you."
))
return return
streamNumberForAddress = int( streamNumberForAddress = int(dialog.lineEditStreamNumber.text())
self.regenerateAddressesDialogInstance.ui.lineEditStreamNumber.text())
try: try:
addressVersionNumber = int( addressVersionNumber = int(
self.regenerateAddressesDialogInstance.ui.lineEditAddressVersionNumber.text()) dialog.lineEditAddressVersionNumber.text())
except: except:
QMessageBox.about(self, _translate("MainWindow", "Bad address version number"), _translate( QtGui.QMessageBox.about(
"MainWindow", "Your address version number must be a number: either 3 or 4.")) self,
_translate("MainWindow", "Bad address version number"),
_translate(
"MainWindow",
"Your address version number must be a number:"
" either 3 or 4."
))
return return
if addressVersionNumber < 3 or addressVersionNumber > 4: if addressVersionNumber < 3 or addressVersionNumber > 4:
QMessageBox.about(self, _translate("MainWindow", "Bad address version number"), _translate( QtGui.QMessageBox.about(
"MainWindow", "Your address version number must be either 3 or 4.")) self,
_translate("MainWindow", "Bad address version number"),
_translate(
"MainWindow",
"Your address version number must be either 3 or 4."
))
return return
queues.addressGeneratorQueue.put(('createDeterministicAddresses', addressVersionNumber, streamNumberForAddress, "regenerated deterministic address", self.regenerateAddressesDialogInstance.ui.spinBoxNumberOfAddressesToMake.value( queues.addressGeneratorQueue.put((
), self.regenerateAddressesDialogInstance.ui.lineEditPassphrase.text().toUtf8(), self.regenerateAddressesDialogInstance.ui.checkBoxEighteenByteRipe.isChecked())) 'createDeterministicAddresses',
self.ui.tabWidget.setCurrentIndex(3) addressVersionNumber, streamNumberForAddress,
"regenerated deterministic address",
dialog.spinBoxNumberOfAddressesToMake.value(),
dialog.lineEditPassphrase.text().toUtf8(),
dialog.checkBoxEighteenByteRipe.isChecked()
))
self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.chans)
)
# opens 'join chan' dialog # opens 'join chan' dialog
def click_actionJoinChan(self): def click_actionJoinChan(self):
NewChanDialog(self) dialogs.NewChanDialog(self)
def showConnectDialog(self): def showConnectDialog(self):
self.connectDialogInstance = connectDialog(self) dialog = dialogs.ConnectDialog(self)
if self.connectDialogInstance.exec_(): if dialog.exec_():
if self.connectDialogInstance.ui.radioButtonConnectNow.isChecked(): if dialog.radioButtonConnectNow.isChecked():
BMConfigParser().remove_option( BMConfigParser().remove_option(
'bitmessagesettings', 'dontconnect') 'bitmessagesettings', 'dontconnect')
BMConfigParser().save() BMConfigParser().save()
elif self.connectDialogInstance.ui.radioButtonConfigureNetwork.isChecked(): elif dialog.radioButtonConfigureNetwork.isChecked():
self.click_actionSettings() self.click_actionSettings()
def showMigrationWizard(self, level): def showMigrationWizard(self, level):
@ -1496,14 +1515,13 @@ class MyForm(settingsmixin.SMainWindow):
if event.type() == QtCore.QEvent.WindowStateChange: if event.type() == QtCore.QEvent.WindowStateChange:
if self.windowState() & QtCore.Qt.WindowMinimized: if self.windowState() & QtCore.Qt.WindowMinimized:
if BMConfigParser().getboolean('bitmessagesettings', 'minimizetotray') and not 'darwin' in sys.platform: if BMConfigParser().getboolean('bitmessagesettings', 'minimizetotray') and not 'darwin' in sys.platform:
QTimer.singleShot(0, self.appIndicatorHide) QtCore.QTimer.singleShot(0, self.appIndicatorHide)
elif event.oldState() & QtCore.Qt.WindowMinimized: elif event.oldState() & QtCore.Qt.WindowMinimized:
# The window state has just been changed to # The window state has just been changed to
# Normal/Maximised/FullScreen # Normal/Maximised/FullScreen
pass pass
# QtGui.QWidget.changeEvent(self, event) # QtGui.QWidget.changeEvent(self, event)
def __icon_activated(self, reason): def __icon_activated(self, reason):
if reason == QtGui.QSystemTrayIcon.Trigger: if reason == QtGui.QSystemTrayIcon.Trigger:
self.actionShow.setChecked(not self.actionShow.isChecked()) self.actionShow.setChecked(not self.actionShow.isChecked())
@ -1518,7 +1536,7 @@ class MyForm(settingsmixin.SMainWindow):
'bitmessagesettings', 'hidetrayconnectionnotifications') 'bitmessagesettings', 'hidetrayconnectionnotifications')
if color == 'red': if color == 'red':
self.pushButtonStatusIcon.setIcon( self.pushButtonStatusIcon.setIcon(
QIcon(":/newPrefix/images/redicon.png")) QtGui.QIcon(":/newPrefix/images/redicon.png"))
shared.statusIconColor = 'red' shared.statusIconColor = 'red'
# if the connection is lost then show a notification # if the connection is lost then show a notification
if self.connected and _notifications_enabled: if self.connected and _notifications_enabled:
@ -1528,8 +1546,12 @@ class MyForm(settingsmixin.SMainWindow):
sound.SOUND_DISCONNECTED) sound.SOUND_DISCONNECTED)
if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp') and \ if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp') and \
BMConfigParser().get('bitmessagesettings', 'socksproxytype') == "none": BMConfigParser().get('bitmessagesettings', 'socksproxytype') == "none":
self.statusBar().showMessage(_translate( self.updateStatusBar(
"MainWindow", "Problems connecting? Try enabling UPnP in the Network Settings"), 10000) _translate(
"MainWindow",
"Problems connecting? Try enabling UPnP in the Network"
" Settings"
))
self.connected = False self.connected = False
if self.actionStatus is not None: if self.actionStatus is not None:
@ -1537,10 +1559,10 @@ class MyForm(settingsmixin.SMainWindow):
"MainWindow", "Not Connected")) "MainWindow", "Not Connected"))
self.setTrayIconFile("can-icon-24px-red.png") self.setTrayIconFile("can-icon-24px-red.png")
if color == 'yellow': if color == 'yellow':
if self.statusBar().currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.': if self.statusbar.currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.':
self.statusBar().clearMessage() self.statusbar.clearMessage()
self.pushButtonStatusIcon.setIcon(QIcon( self.pushButtonStatusIcon.setIcon(
":/newPrefix/images/yellowicon.png")) QtGui.QIcon(":/newPrefix/images/yellowicon.png"))
shared.statusIconColor = 'yellow' shared.statusIconColor = 'yellow'
# if a new connection has been established then show a notification # if a new connection has been established then show a notification
if not self.connected and _notifications_enabled: if not self.connected and _notifications_enabled:
@ -1555,10 +1577,10 @@ class MyForm(settingsmixin.SMainWindow):
"MainWindow", "Connected")) "MainWindow", "Connected"))
self.setTrayIconFile("can-icon-24px-yellow.png") self.setTrayIconFile("can-icon-24px-yellow.png")
if color == 'green': if color == 'green':
if self.statusBar().currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.': if self.statusbar.currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.':
self.statusBar().clearMessage() self.statusbar.clearMessage()
self.pushButtonStatusIcon.setIcon( self.pushButtonStatusIcon.setIcon(
QIcon(":/newPrefix/images/greenicon.png")) QtGui.QIcon(":/newPrefix/images/greenicon.png"))
shared.statusIconColor = 'green' shared.statusIconColor = 'green'
if not self.connected and _notifications_enabled: if not self.connected and _notifications_enabled:
self.notifierShow( self.notifierShow(
@ -1574,7 +1596,7 @@ class MyForm(settingsmixin.SMainWindow):
def initTrayIcon(self, iconFileName, app): def initTrayIcon(self, iconFileName, app):
self.currentTrayIconFileName = iconFileName self.currentTrayIconFileName = iconFileName
self.tray = QSystemTrayIcon( self.tray = QtGui.QSystemTrayIcon(
self.calcTrayIcon(iconFileName, self.findInboxUnreadCount()), app) self.calcTrayIcon(iconFileName, self.findInboxUnreadCount()), app)
def setTrayIconFile(self, iconFileName): def setTrayIconFile(self, iconFileName):
@ -1603,9 +1625,10 @@ class MyForm(settingsmixin.SMainWindow):
fontMetrics = QtGui.QFontMetrics(font) fontMetrics = QtGui.QFontMetrics(font)
rect = fontMetrics.boundingRect(txt) rect = fontMetrics.boundingRect(txt)
# draw text # draw text
painter = QPainter() painter = QtGui.QPainter()
painter.begin(pixmap) painter.begin(pixmap)
painter.setPen(QtGui.QPen(QtGui.QColor(255, 0, 0), Qt.SolidPattern)) painter.setPen(
QtGui.QPen(QtGui.QColor(255, 0, 0), QtCore.Qt.SolidPattern))
painter.setFont(font) painter.setFont(font)
painter.drawText(24-rect.right()-marginX, -rect.top()+marginY, txt) painter.drawText(24-rect.right()-marginX, -rect.top()+marginY, txt)
painter.end() painter.end()
@ -1614,13 +1637,14 @@ class MyForm(settingsmixin.SMainWindow):
def drawTrayIcon(self, iconFileName, inboxUnreadCount): def drawTrayIcon(self, iconFileName, inboxUnreadCount):
self.tray.setIcon(self.calcTrayIcon(iconFileName, inboxUnreadCount)) self.tray.setIcon(self.calcTrayIcon(iconFileName, inboxUnreadCount))
def changedInboxUnread(self, row = None): def changedInboxUnread(self, row=None):
self.drawTrayIcon(self.currentTrayIconFileName, self.findInboxUnreadCount()) self.drawTrayIcon(
self.currentTrayIconFileName, self.findInboxUnreadCount())
self.rerenderTabTreeMessages() self.rerenderTabTreeMessages()
self.rerenderTabTreeSubscriptions() self.rerenderTabTreeSubscriptions()
self.rerenderTabTreeChans() self.rerenderTabTreeChans()
def findInboxUnreadCount(self, count = None): def findInboxUnreadCount(self, count=None):
if count is None: if count is None:
queryreturn = sqlQuery('''SELECT count(*) from inbox WHERE folder='inbox' and read=0''') queryreturn = sqlQuery('''SELECT count(*) from inbox WHERE folder='inbox' and read=0''')
cnt = 0 cnt = 0
@ -1640,8 +1664,7 @@ class MyForm(settingsmixin.SMainWindow):
continue continue
for i in range(sent.rowCount()): for i in range(sent.rowCount()):
rowAddress = sent.item( rowAddress = sent.item(i, 0).data(QtCore.Qt.UserRole)
i, 0).data(Qt.UserRole)
if toAddress == rowAddress: if toAddress == rowAddress:
sent.item(i, 3).setToolTip(textToDisplay) sent.item(i, 3).setToolTip(textToDisplay)
try: try:
@ -1661,9 +1684,9 @@ class MyForm(settingsmixin.SMainWindow):
continue continue
for i in range(sent.rowCount()): for i in range(sent.rowCount()):
toAddress = sent.item( toAddress = sent.item(
i, 0).data(Qt.UserRole) i, 0).data(QtCore.Qt.UserRole)
tableAckdata = sent.item( tableAckdata = sent.item(
i, 3).data(Qt.UserRole).toPyObject() i, 3).data(QtCore.Qt.UserRole).toPyObject()
status, addressVersionNumber, streamNumber, ripe = decodeAddress( status, addressVersionNumber, streamNumber, ripe = decodeAddress(
toAddress) toAddress)
if ackdata == tableAckdata: if ackdata == tableAckdata:
@ -1684,21 +1707,26 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.tableWidgetInboxSubscriptions, self.ui.tableWidgetInboxSubscriptions,
self.ui.tableWidgetInboxChans]): self.ui.tableWidgetInboxChans]):
for i in range(inbox.rowCount()): for i in range(inbox.rowCount()):
if msgid == str(inbox.item(i, 3).data(Qt.UserRole).toPyObject()): if msgid == str(inbox.item(i, 3).data(QtCore.Qt.UserRole).toPyObject()):
self.statusBar().showMessage(_translate( self.updateStatusBar(
"MainWindow", "Message trashed"), 10000) _translate("MainWindow", "Message trashed"))
treeWidget = self.widgetConvert(inbox) treeWidget = self.widgetConvert(inbox)
self.propagateUnreadCount(inbox.item(i, 1 if inbox.item(i, 1).type == AccountMixin.SUBSCRIPTION else 0).data(Qt.UserRole), self.getCurrentFolder(treeWidget), treeWidget, 0) self.propagateUnreadCount(inbox.item(i, 1 if inbox.item(i, 1).type == AccountMixin.SUBSCRIPTION else 0).data(QtCore.Qt.UserRole), self.getCurrentFolder(treeWidget), treeWidget, 0)
inbox.removeRow(i) inbox.removeRow(i)
break break
def newVersionAvailable(self, version): def newVersionAvailable(self, version):
self.notifiedNewVersion = ".".join(str(n) for n in version) self.notifiedNewVersion = ".".join(str(n) for n in version)
self.statusBar().showMessage(_translate("MainWindow", "New version of PyBitmessage is available: %1. Download it from https://github.com/Bitmessage/PyBitmessage/releases/latest").arg(self.notifiedNewVersion), 10000) self.updateStatusBar(_translate(
"MainWindow",
"New version of PyBitmessage is available: %1. Download it"
" from https://github.com/Bitmessage/PyBitmessage/releases/latest"
).arg(self.notifiedNewVersion)
)
def displayAlert(self, title, text, exitAfterUserClicksOk): def displayAlert(self, title, text, exitAfterUserClicksOk):
self.statusBar().showMessage(text) self.updateStatusBar(text)
QtGui.QMessageBox.critical(self, title, text, QMessageBox.Ok) QtGui.QMessageBox.critical(self, title, text, QtGui.QMessageBox.Ok)
if exitAfterUserClicksOk: if exitAfterUserClicksOk:
os._exit(0) os._exit(0)
@ -1726,7 +1754,7 @@ class MyForm(settingsmixin.SMainWindow):
oldRows[item.address] = [item.label, item.type, i] oldRows[item.address] = [item.label, item.type, i]
if self.ui.tableWidgetAddressBook.rowCount() == 0: if self.ui.tableWidgetAddressBook.rowCount() == 0:
self.ui.tableWidgetAddressBook.horizontalHeader().setSortIndicator(0, Qt.AscendingOrder) self.ui.tableWidgetAddressBook.horizontalHeader().setSortIndicator(0, QtCore.Qt.AscendingOrder)
if self.ui.tableWidgetAddressBook.isSortingEnabled(): if self.ui.tableWidgetAddressBook.isSortingEnabled():
self.ui.tableWidgetAddressBook.setSortingEnabled(False) self.ui.tableWidgetAddressBook.setSortingEnabled(False)
@ -1760,7 +1788,8 @@ class MyForm(settingsmixin.SMainWindow):
completerList.append(unicode(newRows[address][0], encoding="UTF-8") + " <" + address + ">") completerList.append(unicode(newRows[address][0], encoding="UTF-8") + " <" + address + ">")
# sort # sort
self.ui.tableWidgetAddressBook.sortByColumn(0, Qt.AscendingOrder) self.ui.tableWidgetAddressBook.sortByColumn(
0, QtCore.Qt.AscendingOrder)
self.ui.tableWidgetAddressBook.setSortingEnabled(True) self.ui.tableWidgetAddressBook.setSortingEnabled(True)
self.ui.lineEditTo.completer().model().setStringList(completerList) self.ui.lineEditTo.completer().model().setStringList(completerList)
@ -1773,19 +1802,20 @@ class MyForm(settingsmixin.SMainWindow):
"MainWindow", """The TTL, or Time-To-Live is the length of time that the network will hold the message. "MainWindow", """The TTL, or Time-To-Live is the length of time that the network will hold the message.
The recipient must get it during this time. If your Bitmessage client does not hear an acknowledgement, it The recipient must get it during this time. If your Bitmessage client does not hear an acknowledgement, it
will resend the message automatically. The longer the Time-To-Live, the will resend the message automatically. The longer the Time-To-Live, the
more work your computer must do to send the message. A Time-To-Live of four or five days is often appropriate."""), QMessageBox.Ok) more work your computer must do to send the message. A Time-To-Live of four or five days is often appropriate."""), QtGui.QMessageBox.Ok)
def click_pushButtonSend(self): def click_pushButtonSend(self):
encoding = 3 if QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier else 2 encoding = 3 if QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier else 2
self.statusBar().clearMessage() self.statusbar.clearMessage()
if self.ui.tabWidgetSend.currentIndex() == 0: if self.ui.tabWidgetSend.currentIndex() == \
self.ui.tabWidgetSend.indexOf(self.ui.sendDirect):
# message to specific people # message to specific people
sendMessageToPeople = True sendMessageToPeople = True
fromAddress = str(self.ui.comboBoxSendFrom.itemData( fromAddress = str(self.ui.comboBoxSendFrom.itemData(
self.ui.comboBoxSendFrom.currentIndex(), self.ui.comboBoxSendFrom.currentIndex(),
Qt.UserRole).toString()) QtCore.Qt.UserRole).toString())
toAddresses = str(self.ui.lineEditTo.text().toUtf8()) toAddresses = str(self.ui.lineEditTo.text().toUtf8())
subject = str(self.ui.lineEditSubject.text().toUtf8()) subject = str(self.ui.lineEditSubject.text().toUtf8())
message = str( message = str(
@ -1795,20 +1825,26 @@ class MyForm(settingsmixin.SMainWindow):
sendMessageToPeople = False sendMessageToPeople = False
fromAddress = str(self.ui.comboBoxSendFromBroadcast.itemData( fromAddress = str(self.ui.comboBoxSendFromBroadcast.itemData(
self.ui.comboBoxSendFromBroadcast.currentIndex(), self.ui.comboBoxSendFromBroadcast.currentIndex(),
Qt.UserRole).toString()) QtCore.Qt.UserRole).toString())
subject = str(self.ui.lineEditSubjectBroadcast.text().toUtf8()) subject = str(self.ui.lineEditSubjectBroadcast.text().toUtf8())
message = str( message = str(
self.ui.textEditMessageBroadcast.document().toPlainText().toUtf8()) self.ui.textEditMessageBroadcast.document().toPlainText().toUtf8())
""" """
The whole network message must fit in 2^18 bytes. Let's assume 500 The whole network message must fit in 2^18 bytes.
bytes of overhead. If someone wants to get that too an exact Let's assume 500 bytes of overhead. If someone wants to get that
number you are welcome to but I think that it would be a better too an exact number you are welcome to but I think that it would
use of time to support message continuation so that users can be a better use of time to support message continuation so that
send messages of any length. users can send messages of any length.
""" """
if len(message) > (2 ** 18 - 500): if len(message) > (2 ** 18 - 500):
QMessageBox.about(self, _translate("MainWindow", "Message too long"), _translate( QtGui.QMessageBox.about(
"MainWindow", "The message that you are trying to send is too long by %1 bytes. (The maximum is 261644 bytes). Please cut it down before sending.").arg(len(message) - (2 ** 18 - 500))) self, _translate("MainWindow", "Message too long"),
_translate(
"MainWindow",
"The message that you are trying to send is too long"
" by %1 bytes. (The maximum is 261644 bytes). Please"
" cut it down before sending."
).arg(len(message) - (2 ** 18 - 500)))
return return
acct = accountClass(fromAddress) acct = accountClass(fromAddress)
@ -1843,8 +1879,14 @@ class MyForm(settingsmixin.SMainWindow):
BMConfigParser().set(fromAddress, 'label', email) BMConfigParser().set(fromAddress, 'label', email)
BMConfigParser().set(fromAddress, 'gateway', 'mailchuck') BMConfigParser().set(fromAddress, 'gateway', 'mailchuck')
BMConfigParser().save() BMConfigParser().save()
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: Your account wasn't registered at an email gateway. Sending registration now as %1, please wait for the registration to be processed before retrying sending.").arg(email), 10000) "MainWindow",
"Error: Your account wasn't registered at"
" an email gateway. Sending registration"
" now as %1, please wait for the registration"
" to be processed before retrying sending."
).arg(email)
)
return return
status, addressVersionNumber, streamNumber, ripe = decodeAddress( status, addressVersionNumber, streamNumber, ripe = decodeAddress(
toAddress) toAddress)
@ -1856,48 +1898,90 @@ class MyForm(settingsmixin.SMainWindow):
logger.error('Error: Could not decode recipient address ' + toAddress + ':' + status) logger.error('Error: Could not decode recipient address ' + toAddress + ':' + status)
if status == 'missingbm': if status == 'missingbm':
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: Bitmessage addresses start with BM- Please check the recipient address %1").arg(toAddress), 10000) "MainWindow",
"Error: Bitmessage addresses start with"
" BM- Please check the recipient address %1"
).arg(toAddress))
elif status == 'checksumfailed': elif status == 'checksumfailed':
self.statusBar().showMessage(_translate( self.statusbar_message(_translate(
"MainWindow", "Error: The recipient address %1 is not typed or copied correctly. Please check it.").arg(toAddress), 10000) "MainWindow",
"Error: The recipient address %1 is not"
" typed or copied correctly. Please check it."
).arg(toAddress))
elif status == 'invalidcharacters': elif status == 'invalidcharacters':
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: The recipient address %1 contains invalid characters. Please check it.").arg(toAddress), 10000) "MainWindow",
"Error: The recipient address %1 contains"
" invalid characters. Please check it."
).arg(toAddress))
elif status == 'versiontoohigh': elif status == 'versiontoohigh':
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: The version of the recipient address %1 is too high. Either you need to upgrade your Bitmessage software or your acquaintance is being clever.").arg(toAddress), 10000) "MainWindow",
"Error: The version of the recipient address"
" %1 is too high. Either you need to upgrade"
" your Bitmessage software or your"
" acquaintance is being clever."
).arg(toAddress))
elif status == 'ripetooshort': elif status == 'ripetooshort':
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: Some data encoded in the recipient address %1 is too short. There might be something wrong with the software of your acquaintance.").arg(toAddress), 10000) "MainWindow",
"Error: Some data encoded in the recipient"
" address %1 is too short. There might be"
" something wrong with the software of"
" your acquaintance."
).arg(toAddress))
elif status == 'ripetoolong': elif status == 'ripetoolong':
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: Some data encoded in the recipient address %1 is too long. There might be something wrong with the software of your acquaintance.").arg(toAddress), 10000) "MainWindow",
"Error: Some data encoded in the recipient"
" address %1 is too long. There might be"
" something wrong with the software of"
" your acquaintance."
).arg(toAddress))
elif status == 'varintmalformed': elif status == 'varintmalformed':
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: Some data encoded in the recipient address %1 is malformed. There might be something wrong with the software of your acquaintance.").arg(toAddress), 10000) "MainWindow",
"Error: Some data encoded in the recipient"
" address %1 is malformed. There might be"
" something wrong with the software of"
" your acquaintance."
).arg(toAddress))
else: else:
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: Something is wrong with the recipient address %1.").arg(toAddress), 10000) "MainWindow",
"Error: Something is wrong with the"
" recipient address %1."
).arg(toAddress))
elif fromAddress == '': elif fromAddress == '':
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: You must specify a From address. If you don\'t have one, go to the \'Your Identities\' tab."), 10000) "MainWindow",
"Error: You must specify a From address. If you"
" don\'t have one, go to the"
" \'Your Identities\' tab.")
)
else: else:
toAddress = addBMIfNotPresent(toAddress) toAddress = addBMIfNotPresent(toAddress)
if addressVersionNumber > 4 or addressVersionNumber <= 1: if addressVersionNumber > 4 or addressVersionNumber <= 1:
QMessageBox.about(self, _translate("MainWindow", "Address version number"), _translate( QtGui.QMessageBox.about(self, _translate("MainWindow", "Address version number"), _translate(
"MainWindow", "Concerning the address %1, Bitmessage cannot understand address version numbers of %2. Perhaps upgrade Bitmessage to the latest version.").arg(toAddress).arg(str(addressVersionNumber))) "MainWindow", "Concerning the address %1, Bitmessage cannot understand address version numbers of %2. Perhaps upgrade Bitmessage to the latest version.").arg(toAddress).arg(str(addressVersionNumber)))
continue continue
if streamNumber > 1 or streamNumber == 0: if streamNumber > 1 or streamNumber == 0:
QMessageBox.about(self, _translate("MainWindow", "Stream number"), _translate( QtGui.QMessageBox.about(self, _translate("MainWindow", "Stream number"), _translate(
"MainWindow", "Concerning the address %1, Bitmessage cannot handle stream numbers of %2. Perhaps upgrade Bitmessage to the latest version.").arg(toAddress).arg(str(streamNumber))) "MainWindow", "Concerning the address %1, Bitmessage cannot handle stream numbers of %2. Perhaps upgrade Bitmessage to the latest version.").arg(toAddress).arg(str(streamNumber)))
continue continue
self.statusBar().clearMessage() self.statusbar.clearMessage()
if shared.statusIconColor == 'red': if shared.statusIconColor == 'red':
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.")) "MainWindow",
stealthLevel = BMConfigParser().safeGetInt('bitmessagesettings', 'ackstealthlevel') "Warning: You are currently not connected."
" Bitmessage will do the work necessary to"
" send the message but it won\'t send until"
" you connect.")
)
stealthLevel = BMConfigParser().safeGetInt(
'bitmessagesettings', 'ackstealthlevel')
ackdata = genAckPayload(streamNumber, stealthLevel) ackdata = genAckPayload(streamNumber, stealthLevel)
t = () t = ()
sqlExecute( sqlExecute(
@ -1937,18 +2021,21 @@ class MyForm(settingsmixin.SMainWindow):
if self.replyFromTab is not None: if self.replyFromTab is not None:
self.ui.tabWidget.setCurrentIndex(self.replyFromTab) self.ui.tabWidget.setCurrentIndex(self.replyFromTab)
self.replyFromTab = None self.replyFromTab = None
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Message queued."), 10000) "MainWindow", "Message queued."))
#self.ui.tableWidgetInbox.setCurrentCell(0, 0) # self.ui.tableWidgetInbox.setCurrentCell(0, 0)
else: else:
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Your \'To\' field is empty."), 10000) "MainWindow", "Your \'To\' field is empty."))
else: # User selected 'Broadcast' else: # User selected 'Broadcast'
if fromAddress == '': if fromAddress == '':
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: You must specify a From address. If you don\'t have one, go to the \'Your Identities\' tab."), 10000) "MainWindow",
"Error: You must specify a From address. If you don\'t"
" have one, go to the \'Your Identities\' tab."
))
else: else:
self.statusBar().clearMessage() self.statusbar.clearMessage()
# We don't actually need the ackdata for acknowledgement since # We don't actually need the ackdata for acknowledgement since
# this is a broadcast message, but we can use it to update the # this is a broadcast message, but we can use it to update the
# user interface when the POW is done generating. # user interface when the POW is done generating.
@ -1984,40 +2071,46 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0) self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0)
self.ui.lineEditSubjectBroadcast.setText('') self.ui.lineEditSubjectBroadcast.setText('')
self.ui.textEditMessageBroadcast.reset() self.ui.textEditMessageBroadcast.reset()
self.ui.tabWidget.setCurrentIndex(1) self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send)
)
self.ui.tableWidgetInboxSubscriptions.setCurrentCell(0, 0) self.ui.tableWidgetInboxSubscriptions.setCurrentCell(0, 0)
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Broadcast queued."), 10000) "MainWindow", "Broadcast queued."))
def click_pushButtonLoadFromAddressBook(self): def click_pushButtonLoadFromAddressBook(self):
self.ui.tabWidget.setCurrentIndex(5) self.ui.tabWidget.setCurrentIndex(5)
for i in range(4): for i in range(4):
time.sleep(0.1) time.sleep(0.1)
self.statusBar().clearMessage() self.statusbar.clearMessage()
time.sleep(0.1) time.sleep(0.1)
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Right click one or more entries in your address book and select \'Send message to this address\'."), 10000) "MainWindow",
"Right click one or more entries in your address book and"
" select \'Send message to this address\'."
))
def click_pushButtonFetchNamecoinID(self): def click_pushButtonFetchNamecoinID(self):
nc = namecoinConnection() nc = namecoinConnection()
identities = str(self.ui.lineEditTo.text().toUtf8()).split(";") identities = str(self.ui.lineEditTo.text().toUtf8()).split(";")
err, addr = nc.query(identities[-1].strip()) err, addr = nc.query(identities[-1].strip())
if err is not None: if err is not None:
self.statusBar().showMessage(_translate( self.statusbar_message("Error: %1", args=[err])
"MainWindow", "Error: %1").arg(err), 10000)
else: else:
identities[-1] = addr identities[-1] = addr
self.ui.lineEditTo.setText("; ".join(identities)) self.ui.lineEditTo.setText("; ".join(identities))
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Fetched address from namecoin identity."), 10000) "MainWindow", "Fetched address from namecoin identity."))
def setBroadcastEnablementDependingOnWhetherThisIsAMailingListAddress(self, address): def setBroadcastEnablementDependingOnWhetherThisIsAMailingListAddress(self, address):
# If this is a chan then don't let people broadcast because no one # If this is a chan then don't let people broadcast because no one
# should subscribe to chan addresses. # should subscribe to chan addresses.
if BMConfigParser().safeGetBoolean(str(address), 'mailinglist'): self.ui.tabWidgetSend.setCurrentIndex(
self.ui.tabWidgetSend.setCurrentIndex(1) self.ui.tabWidgetSend.indexOf(
else: self.ui.sendBroadcast
self.ui.tabWidgetSend.setCurrentIndex(0) if BMConfigParser().safeGetBoolean(str(address), 'mailinglist')
else self.ui.sendDirect
))
def rerenderComboBoxSendFrom(self): def rerenderComboBoxSendFrom(self):
self.ui.comboBoxSendFrom.clear() self.ui.comboBoxSendFrom.clear()
@ -2032,8 +2125,11 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.comboBoxSendFrom.addItem(avatarize(addressInKeysFile), label, addressInKeysFile) self.ui.comboBoxSendFrom.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
# self.ui.comboBoxSendFrom.model().sort(1, Qt.AscendingOrder) # self.ui.comboBoxSendFrom.model().sort(1, Qt.AscendingOrder)
for i in range(self.ui.comboBoxSendFrom.count()): for i in range(self.ui.comboBoxSendFrom.count()):
address = str(self.ui.comboBoxSendFrom.itemData(i, Qt.UserRole).toString()) address = str(self.ui.comboBoxSendFrom.itemData(
self.ui.comboBoxSendFrom.setItemData(i, AccountColor(address).accountColor(), Qt.ForegroundRole) i, QtCore.Qt.UserRole).toString())
self.ui.comboBoxSendFrom.setItemData(
i, AccountColor(address).accountColor(),
QtCore.Qt.ForegroundRole)
self.ui.comboBoxSendFrom.insertItem(0, '', '') self.ui.comboBoxSendFrom.insertItem(0, '', '')
if(self.ui.comboBoxSendFrom.count() == 2): if(self.ui.comboBoxSendFrom.count() == 2):
self.ui.comboBoxSendFrom.setCurrentIndex(1) self.ui.comboBoxSendFrom.setCurrentIndex(1)
@ -2052,8 +2148,11 @@ class MyForm(settingsmixin.SMainWindow):
label = addressInKeysFile label = addressInKeysFile
self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), label, addressInKeysFile) self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
for i in range(self.ui.comboBoxSendFromBroadcast.count()): for i in range(self.ui.comboBoxSendFromBroadcast.count()):
address = str(self.ui.comboBoxSendFromBroadcast.itemData(i, Qt.UserRole).toString()) address = str(self.ui.comboBoxSendFromBroadcast.itemData(
self.ui.comboBoxSendFromBroadcast.setItemData(i, AccountColor(address).accountColor(), Qt.ForegroundRole) i, QtCore.Qt.UserRole).toString())
self.ui.comboBoxSendFromBroadcast.setItemData(
i, AccountColor(address).accountColor(),
QtCore.Qt.ForegroundRole)
self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '') self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '')
if(self.ui.comboBoxSendFromBroadcast.count() == 2): if(self.ui.comboBoxSendFromBroadcast.count() == 2):
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(1) self.ui.comboBoxSendFromBroadcast.setCurrentIndex(1)
@ -2123,99 +2222,99 @@ class MyForm(settingsmixin.SMainWindow):
# whether it's in current message list or not # whether it's in current message list or not
self.indicatorUpdate(True, to_label=acct.toLabel) self.indicatorUpdate(True, to_label=acct.toLabel)
# cannot find item to pass here ): # cannot find item to pass here ):
if hasattr(acct, "feedback") and acct.feedback != GatewayAccount.ALL_OK: if hasattr(acct, "feedback") \
and acct.feedback != GatewayAccount.ALL_OK:
if acct.feedback == GatewayAccount.REGISTRATION_DENIED: if acct.feedback == GatewayAccount.REGISTRATION_DENIED:
self.dialog = EmailGatewayRegistrationDialog(self, _translate("EmailGatewayRegistrationDialog", "Registration failed:"), dialogs.EmailGatewayDialog(
_translate("EmailGatewayRegistrationDialog", "The requested email address is not available, please try a new one. Fill out the new desired email address (including @mailchuck.com) below:") self, BMConfigParser(), acct).exec_()
)
if self.dialog.exec_(): def click_pushButtonAddAddressBook(self, dialog=None):
email = str(self.dialog.ui.lineEditEmail.text().toUtf8()) if not dialog:
# register resets address variables dialog = dialogs.AddAddressDialog(self)
acct.register(email) dialog.exec_()
BMConfigParser().set(acct.fromAddress, 'label', email) try:
BMConfigParser().set(acct.fromAddress, 'gateway', 'mailchuck') address, label = dialog.data
BMConfigParser().save() except AttributeError:
self.statusBar().showMessage(_translate( return
"MainWindow", "Sending email gateway registration request"), 10000)
def click_pushButtonAddAddressBook(self):
self.AddAddressDialogInstance = AddAddressDialog(self)
if self.AddAddressDialogInstance.exec_():
if self.AddAddressDialogInstance.ui.labelAddressCheck.text() == _translate("MainWindow", "Address is valid."):
# First we must check to see if the address is already in the # First we must check to see if the address is already in the
# address book. The user cannot add it again or else it will # address book. The user cannot add it again or else it will
# cause problems when updating and deleting the entry. # cause problems when updating and deleting the entry.
address = addBMIfNotPresent(str( if shared.isAddressInMyAddressBook(address):
self.AddAddressDialogInstance.ui.lineEditAddress.text())) self.updateStatusBar(_translate(
label = self.AddAddressDialogInstance.ui.newAddressLabel.text().toUtf8() "MainWindow",
self.addEntryToAddressBook(address,label) "Error: You cannot add the same address to your"
else: " address book twice. Try renaming the existing one"
self.statusBar().showMessage(_translate( " if you want."
"MainWindow", "The address you entered was invalid. Ignoring it."), 10000) ))
return
def addEntryToAddressBook(self,address,label): self.addEntryToAddressBook(address, label)
queryreturn = sqlQuery('''select * from addressbook where address=?''', address)
if queryreturn == []: def addEntryToAddressBook(self, address, label):
sqlExecute('''INSERT INTO addressbook VALUES (?,?)''', str(label), address) if shared.isAddressInMyAddressBook(address):
return
sqlExecute('''INSERT INTO addressbook VALUES (?,?)''', label, address)
self.rerenderMessagelistFromLabels() self.rerenderMessagelistFromLabels()
self.rerenderMessagelistToLabels() self.rerenderMessagelistToLabels()
self.rerenderAddressBook() self.rerenderAddressBook()
else:
self.statusBar().showMessage(_translate(
"MainWindow", "Error: You cannot add the same address to your address book twice. Try renaming the existing one if you want."), 10000)
def addSubscription(self, address, label): def addSubscription(self, address, label):
address = addBMIfNotPresent(address) # This should be handled outside of this function, for error displaying
#This should be handled outside of this function, for error displaying and such, but it must also be checked here. # and such, but it must also be checked here.
if shared.isAddressInMySubscriptionsList(address): if shared.isAddressInMySubscriptionsList(address):
return return
#Add to database (perhaps this should be separated from the MyForm class) # Add to database (perhaps this should be separated from the MyForm class)
sqlExecute('''INSERT INTO subscriptions VALUES (?,?,?)''',str(label),address,True) sqlExecute(
'''INSERT INTO subscriptions VALUES (?,?,?)''',
label, address, True
)
self.rerenderMessagelistFromLabels() self.rerenderMessagelistFromLabels()
shared.reloadBroadcastSendersForWhichImWatching() shared.reloadBroadcastSendersForWhichImWatching()
self.rerenderAddressBook() self.rerenderAddressBook()
self.rerenderTabTreeSubscriptions() self.rerenderTabTreeSubscriptions()
def click_pushButtonAddSubscription(self): def click_pushButtonAddSubscription(self):
self.NewSubscriptionDialogInstance = NewSubscriptionDialog(self) dialog = dialogs.NewSubscriptionDialog(self)
if self.NewSubscriptionDialogInstance.exec_(): dialog.exec_()
if self.NewSubscriptionDialogInstance.ui.labelAddressCheck.text() != _translate("MainWindow", "Address is valid."): try:
self.statusBar().showMessage(_translate("MainWindow", "The address you entered was invalid. Ignoring it."), 10000) address, label = dialog.data
except AttributeError:
return return
address = addBMIfNotPresent(str(self.NewSubscriptionDialogInstance.ui.lineEditSubscriptionAddress.text()))
# We must check to see if the address is already in the subscriptions list. The user cannot add it again or else it will cause problems when updating and deleting the entry. # We must check to see if the address is already in the
# subscriptions list. The user cannot add it again or else it
# will cause problems when updating and deleting the entry.
if shared.isAddressInMySubscriptionsList(address): if shared.isAddressInMySubscriptionsList(address):
self.statusBar().showMessage(_translate("MainWindow", "Error: You cannot add the same address to your subscriptions twice. Perhaps rename the existing one if you want."), 10000) self.updateStatusBar(_translate(
"MainWindow",
"Error: You cannot add the same address to your"
" subscriptions twice. Perhaps rename the existing one"
" if you want."
))
return return
label = self.NewSubscriptionDialogInstance.ui.newsubscriptionlabel.text().toUtf8()
self.addSubscription(address, label) self.addSubscription(address, label)
# Now, if the user wants to display old broadcasts, let's get them out of the inventory and put them # Now, if the user wants to display old broadcasts, let's get
# in the objectProcessorQueue to be processed # them out of the inventory and put them
if self.NewSubscriptionDialogInstance.ui.checkBoxDisplayMessagesAlreadyInInventory.isChecked(): # to the objectProcessorQueue to be processed
status, addressVersion, streamNumber, ripe = decodeAddress(address) if dialog.checkBoxDisplayMessagesAlreadyInInventory.isChecked():
Inventory().flush() for value in dialog.recent:
doubleHashOfAddressData = hashlib.sha512(hashlib.sha512(encodeVarint( queues.objectProcessorQueue.put((
addressVersion) + encodeVarint(streamNumber) + ripe).digest()).digest() value.type, value.payload
tag = doubleHashOfAddressData[32:] ))
for value in Inventory().by_type_and_tag(3, tag):
queues.objectProcessorQueue.put((value.type, value.payload))
def click_pushButtonStatusIcon(self): def click_pushButtonStatusIcon(self):
logger.debug('click_pushButtonStatusIcon') dialogs.IconGlossaryDialog(self, config=BMConfigParser()).exec_()
self.iconGlossaryInstance = iconGlossaryDialog(self)
if self.iconGlossaryInstance.exec_():
pass
def click_actionHelp(self): def click_actionHelp(self):
self.helpDialogInstance = helpDialog(self) dialogs.HelpDialog(self).exec_()
self.helpDialogInstance.exec_()
def click_actionSupport(self): def click_actionSupport(self):
support.createSupportMessage(self) support.createSupportMessage(self)
def click_actionAbout(self): def click_actionAbout(self):
self.aboutDialogInstance = aboutDialog(self) dialogs.AboutDialog(self).exec_()
self.aboutDialogInstance.exec_()
def click_actionSettings(self): def click_actionSettings(self):
self.settingsDialogInstance = settingsDialog(self) self.settingsDialogInstance = settingsDialog(self)
@ -2250,7 +2349,7 @@ class MyForm(settingsmixin.SMainWindow):
if int(BMConfigParser().get('bitmessagesettings', 'port')) != int(self.settingsDialogInstance.ui.lineEditTCPPort.text()): if int(BMConfigParser().get('bitmessagesettings', 'port')) != int(self.settingsDialogInstance.ui.lineEditTCPPort.text()):
if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'dontconnect'): if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'dontconnect'):
QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( QtGui.QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(
"MainWindow", "You must restart Bitmessage for the port number change to take effect.")) "MainWindow", "You must restart Bitmessage for the port number change to take effect."))
BMConfigParser().set('bitmessagesettings', 'port', str( BMConfigParser().set('bitmessagesettings', 'port', str(
self.settingsDialogInstance.ui.lineEditTCPPort.text())) self.settingsDialogInstance.ui.lineEditTCPPort.text()))
@ -2264,10 +2363,10 @@ class MyForm(settingsmixin.SMainWindow):
#print 'self.settingsDialogInstance.ui.comboBoxProxyType.currentText())[0:5]', self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] #print 'self.settingsDialogInstance.ui.comboBoxProxyType.currentText())[0:5]', self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5]
if BMConfigParser().get('bitmessagesettings', 'socksproxytype') == 'none' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS': if BMConfigParser().get('bitmessagesettings', 'socksproxytype') == 'none' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS':
if shared.statusIconColor != 'red': if shared.statusIconColor != 'red':
QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( QtGui.QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(
"MainWindow", "Bitmessage will use your proxy from now on but you may want to manually restart Bitmessage now to close existing connections (if any).")) "MainWindow", "Bitmessage will use your proxy from now on but you may want to manually restart Bitmessage now to close existing connections (if any)."))
if BMConfigParser().get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] != 'SOCKS': if BMConfigParser().get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] != 'SOCKS':
self.statusBar().clearMessage() self.statusbar.clearMessage()
state.resetNetworkProtocolAvailability() # just in case we changed something in the network connectivity state.resetNetworkProtocolAvailability() # just in case we changed something in the network connectivity
if self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS': if self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS':
BMConfigParser().set('bitmessagesettings', 'socksproxytype', str( BMConfigParser().set('bitmessagesettings', 'socksproxytype', str(
@ -2293,7 +2392,7 @@ class MyForm(settingsmixin.SMainWindow):
BMConfigParser().set('bitmessagesettings', 'maxuploadrate', str( BMConfigParser().set('bitmessagesettings', 'maxuploadrate', str(
int(float(self.settingsDialogInstance.ui.lineEditMaxUploadRate.text())))) int(float(self.settingsDialogInstance.ui.lineEditMaxUploadRate.text()))))
except ValueError: except ValueError:
QMessageBox.about(self, _translate("MainWindow", "Number needed"), _translate( QtGui.QMessageBox.about(self, _translate("MainWindow", "Number needed"), _translate(
"MainWindow", "Your maximum download and upload rate must be numbers. Ignoring what you typed.")) "MainWindow", "Your maximum download and upload rate must be numbers. Ignoring what you typed."))
else: else:
set_rates(BMConfigParser().safeGetInt("bitmessagesettings", "maxdownloadrate"), set_rates(BMConfigParser().safeGetInt("bitmessagesettings", "maxdownloadrate"),
@ -2373,7 +2472,7 @@ class MyForm(settingsmixin.SMainWindow):
if (float(self.settingsDialogInstance.ui.lineEditDays.text()) >=0 and float(self.settingsDialogInstance.ui.lineEditMonths.text()) >=0): if (float(self.settingsDialogInstance.ui.lineEditDays.text()) >=0 and float(self.settingsDialogInstance.ui.lineEditMonths.text()) >=0):
shared.maximumLengthOfTimeToBotherResendingMessages = (float(str(self.settingsDialogInstance.ui.lineEditDays.text())) * 24 * 60 * 60) + (float(str(self.settingsDialogInstance.ui.lineEditMonths.text())) * (60 * 60 * 24 *365)/12) shared.maximumLengthOfTimeToBotherResendingMessages = (float(str(self.settingsDialogInstance.ui.lineEditDays.text())) * 24 * 60 * 60) + (float(str(self.settingsDialogInstance.ui.lineEditMonths.text())) * (60 * 60 * 24 *365)/12)
if shared.maximumLengthOfTimeToBotherResendingMessages < 432000: # If the time period is less than 5 hours, we give zero values to all fields. No message will be sent again. if shared.maximumLengthOfTimeToBotherResendingMessages < 432000: # If the time period is less than 5 hours, we give zero values to all fields. No message will be sent again.
QMessageBox.about(self, _translate("MainWindow", "Will not resend ever"), _translate( QtGui.QMessageBox.about(self, _translate("MainWindow", "Will not resend ever"), _translate(
"MainWindow", "Note that the time limit you entered is less than the amount of time Bitmessage waits for the first resend attempt therefore your messages will never be resent.")) "MainWindow", "Note that the time limit you entered is less than the amount of time Bitmessage waits for the first resend attempt therefore your messages will never be resent."))
BMConfigParser().set('bitmessagesettings', 'stopresendingafterxdays', '0') BMConfigParser().set('bitmessagesettings', 'stopresendingafterxdays', '0')
BMConfigParser().set('bitmessagesettings', 'stopresendingafterxmonths', '0') BMConfigParser().set('bitmessagesettings', 'stopresendingafterxmonths', '0')
@ -2438,79 +2537,37 @@ class MyForm(settingsmixin.SMainWindow):
pass pass
def on_action_SpecialAddressBehaviorDialog(self): def on_action_SpecialAddressBehaviorDialog(self):
self.dialog = SpecialAddressBehaviorDialog(self) dialogs.SpecialAddressBehaviorDialog(self, BMConfigParser())
# For Modal dialogs
if self.dialog.exec_():
addressAtCurrentRow = self.getCurrentAccount()
if BMConfigParser().safeGetBoolean(addressAtCurrentRow, 'chan'):
return
if self.dialog.ui.radioButtonBehaveNormalAddress.isChecked():
BMConfigParser().set(str(
addressAtCurrentRow), 'mailinglist', 'false')
# Set the color to either black or grey
if BMConfigParser().getboolean(addressAtCurrentRow, 'enabled'):
self.setCurrentItemColor(QApplication.palette()
.text().color())
else:
self.setCurrentItemColor(QtGui.QColor(128, 128, 128))
else:
BMConfigParser().set(str(
addressAtCurrentRow), 'mailinglist', 'true')
BMConfigParser().set(str(addressAtCurrentRow), 'mailinglistname', str(
self.dialog.ui.lineEditMailingListName.text().toUtf8()))
self.setCurrentItemColor(QtGui.QColor(137, 04, 177)) #magenta
self.rerenderComboBoxSendFrom()
self.rerenderComboBoxSendFromBroadcast()
BMConfigParser().save()
self.rerenderMessagelistToLabels()
def on_action_EmailGatewayDialog(self): def on_action_EmailGatewayDialog(self):
self.dialog = EmailGatewayDialog(self) dialog = dialogs.EmailGatewayDialog(self, config=BMConfigParser())
# For Modal dialogs # For Modal dialogs
if self.dialog.exec_(): dialog.exec_()
addressAtCurrentRow = self.getCurrentAccount() try:
acct = accountClass(addressAtCurrentRow) acct = dialog.data
# no chans / mailinglists except AttributeError:
if acct.type != AccountMixin.NORMAL:
return return
if self.dialog.ui.radioButtonUnregister.isChecked() and isinstance(acct, GatewayAccount):
acct.unregister() # Only settings remain here
BMConfigParser().remove_option(addressAtCurrentRow, 'gateway')
BMConfigParser().save()
self.statusBar().showMessage(_translate(
"MainWindow", "Sending email gateway unregistration request"), 10000)
elif self.dialog.ui.radioButtonStatus.isChecked() and isinstance(acct, GatewayAccount):
acct.status()
self.statusBar().showMessage(_translate(
"MainWindow", "Sending email gateway status request"), 10000)
elif self.dialog.ui.radioButtonSettings.isChecked() and isinstance(acct, GatewayAccount):
acct.settings() acct.settings()
listOfAddressesInComboBoxSendFrom = [str(self.ui.comboBoxSendFrom.itemData(i).toPyObject()) for i in range(self.ui.comboBoxSendFrom.count())] for i in range(self.ui.comboBoxSendFrom.count()):
if acct.fromAddress in listOfAddressesInComboBoxSendFrom: if str(self.ui.comboBoxSendFrom.itemData(i).toPyObject()) \
currentIndex = listOfAddressesInComboBoxSendFrom.index(acct.fromAddress) == acct.fromAddress:
self.ui.comboBoxSendFrom.setCurrentIndex(currentIndex) self.ui.comboBoxSendFrom.setCurrentIndex(i)
break
else: else:
self.ui.comboBoxSendFrom.setCurrentIndex(0) self.ui.comboBoxSendFrom.setCurrentIndex(0)
self.ui.lineEditTo.setText(acct.toAddress) self.ui.lineEditTo.setText(acct.toAddress)
self.ui.lineEditSubject.setText(acct.subject) self.ui.lineEditSubject.setText(acct.subject)
self.ui.textEditMessage.setText(acct.message) self.ui.textEditMessage.setText(acct.message)
self.ui.tabWidgetSend.setCurrentIndex(0) self.ui.tabWidgetSend.setCurrentIndex(
self.ui.tabWidget.setCurrentIndex(1) self.ui.tabWidgetSend.indexOf(self.ui.sendDirect)
)
self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send)
)
self.ui.textEditMessage.setFocus() self.ui.textEditMessage.setFocus()
elif self.dialog.ui.radioButtonRegister.isChecked():
email = str(self.dialog.ui.lineEditEmail.text().toUtf8())
acct = MailchuckAccount(addressAtCurrentRow)
acct.register(email)
BMConfigParser().set(addressAtCurrentRow, 'label', email)
BMConfigParser().set(addressAtCurrentRow, 'gateway', 'mailchuck')
BMConfigParser().save()
self.statusBar().showMessage(_translate(
"MainWindow", "Sending email gateway registration request"), 10000)
else:
pass
#print "well nothing"
# shared.writeKeysFile()
# self.rerenderInboxToLabels()
def on_action_MarkAllRead(self): def on_action_MarkAllRead(self):
if QtGui.QMessageBox.question( if QtGui.QMessageBox.question(
@ -2518,7 +2575,8 @@ class MyForm(settingsmixin.SMainWindow):
_translate( _translate(
"MainWindow", "MainWindow",
"Are you sure you would like to mark all messages read?" "Are you sure you would like to mark all messages read?"
), QMessageBox.Yes | QMessageBox.No) != QMessageBox.Yes: ), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
) != QtGui.QMessageBox.Yes:
return return
addressAtCurrentRow = self.getCurrentAccount() addressAtCurrentRow = self.getCurrentAccount()
tableWidget = self.getCurrentMessagelist() tableWidget = self.getCurrentMessagelist()
@ -2527,13 +2585,13 @@ class MyForm(settingsmixin.SMainWindow):
if idCount == 0: if idCount == 0:
return return
font = QFont() font = QtGui.QFont()
font.setBold(False) font.setBold(False)
msgids = [] msgids = []
for i in range(0, idCount): for i in range(0, idCount):
msgids.append(str(tableWidget.item( msgids.append(str(tableWidget.item(
i, 3).data(Qt.UserRole).toPyObject())) i, 3).data(QtCore.Qt.UserRole).toPyObject()))
tableWidget.item(i, 0).setUnread(False) tableWidget.item(i, 0).setUnread(False)
tableWidget.item(i, 1).setUnread(False) tableWidget.item(i, 1).setUnread(False)
tableWidget.item(i, 2).setUnread(False) tableWidget.item(i, 2).setUnread(False)
@ -2551,41 +2609,7 @@ class MyForm(settingsmixin.SMainWindow):
addressAtCurrentRow, self.getCurrentFolder(), None, 0) addressAtCurrentRow, self.getCurrentFolder(), None, 0)
def click_NewAddressDialog(self): def click_NewAddressDialog(self):
addresses = [] dialogs.NewAddressDialog(self)
for addressInKeysFile in getSortedAccounts():
addresses.append(addressInKeysFile)
# self.dialog = Ui_NewAddressWizard(addresses)
# self.dialog.exec_()
# print "Name: " + self.dialog.field("name").toString()
# print "Email: " + self.dialog.field("email").toString()
# return
self.dialog = NewAddressDialog(self)
# For Modal dialogs
if self.dialog.exec_():
# self.dialog.ui.buttonBox.enabled = False
if self.dialog.ui.radioButtonRandomAddress.isChecked():
if self.dialog.ui.radioButtonMostAvailable.isChecked():
streamNumberForAddress = 1
else:
# User selected 'Use the same stream as an existing
# address.'
streamNumberForAddress = decodeAddress(
self.dialog.ui.comboBoxExisting.currentText())[2]
queues.addressGeneratorQueue.put(('createRandomAddress', 4, streamNumberForAddress, str(
self.dialog.ui.newaddresslabel.text().toUtf8()), 1, "", self.dialog.ui.checkBoxEighteenByteRipe.isChecked()))
else:
if self.dialog.ui.lineEditPassphrase.text() != self.dialog.ui.lineEditPassphraseAgain.text():
QMessageBox.about(self, _translate("MainWindow", "Passphrase mismatch"), _translate(
"MainWindow", "The passphrase you entered twice doesn\'t match. Try again."))
elif self.dialog.ui.lineEditPassphrase.text() == "":
QMessageBox.about(self, _translate(
"MainWindow", "Choose a passphrase"), _translate("MainWindow", "You really do need a passphrase."))
else:
streamNumberForAddress = 1 # this will eventually have to be replaced by logic to determine the most available stream number.
queues.addressGeneratorQueue.put(('createDeterministicAddresses', 4, streamNumberForAddress, "unused deterministic address", self.dialog.ui.spinBoxNumberOfAddressesToMake.value(
), self.dialog.ui.lineEditPassphrase.text().toUtf8(), self.dialog.ui.checkBoxEighteenByteRipe.isChecked()))
else:
logger.debug('new address dialog box rejected')
def network_switch(self): def network_switch(self):
dontconnect_option = not BMConfigParser().safeGetBoolean( dontconnect_option = not BMConfigParser().safeGetBoolean(
@ -2651,23 +2675,27 @@ class MyForm(settingsmixin.SMainWindow):
self.quitAccepted = True self.quitAccepted = True
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Shutting down PyBitmessage... %1%").arg(str(0))) "MainWindow", "Shutting down PyBitmessage... %1%").arg(0))
if waitForConnection: if waitForConnection:
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Waiting for network connection...")) "MainWindow", "Waiting for network connection..."))
while shared.statusIconColor == 'red': while shared.statusIconColor == 'red':
time.sleep(0.5) time.sleep(0.5)
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000
)
# this probably will not work correctly, because there is a delay between the status icon turning red and inventory exchange, but it's better than nothing. # this probably will not work correctly, because there is a delay between the status icon turning red and inventory exchange, but it's better than nothing.
if waitForSync: if waitForSync:
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Waiting for finishing synchronisation...")) "MainWindow", "Waiting for finishing synchronisation..."))
while PendingDownloadQueue.totalSize() > 0: while PendingDownloadQueue.totalSize() > 0:
time.sleep(0.5) time.sleep(0.5)
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000
)
if waitForPow: if waitForPow:
# check if PoW queue empty # check if PoW queue empty
@ -2679,51 +2707,83 @@ class MyForm(settingsmixin.SMainWindow):
if curWorkerQueue > maxWorkerQueue: if curWorkerQueue > maxWorkerQueue:
maxWorkerQueue = curWorkerQueue maxWorkerQueue = curWorkerQueue
if curWorkerQueue > 0: if curWorkerQueue > 0:
self.statusBar().showMessage(_translate("MainWindow", "Waiting for PoW to finish... %1%").arg(str(50 * (maxWorkerQueue - curWorkerQueue) / maxWorkerQueue))) self.updateStatusBar(_translate(
"MainWindow", "Waiting for PoW to finish... %1%"
).arg(50 * (maxWorkerQueue - curWorkerQueue)
/ maxWorkerQueue)
)
time.sleep(0.5) time.sleep(0.5)
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000
)
self.statusBar().showMessage(_translate("MainWindow", "Shutting down Pybitmessage... %1%").arg(str(50))) self.updateStatusBar(_translate(
"MainWindow", "Shutting down Pybitmessage... %1%").arg(50))
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000
)
if maxWorkerQueue > 0: if maxWorkerQueue > 0:
time.sleep(0.5) # a bit of time so that the hashHolder is populated # a bit of time so that the hashHolder is populated
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) time.sleep(0.5)
QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000
)
# check if upload (of objects created locally) pending # check if upload (of objects created locally) pending
self.statusBar().showMessage(_translate("MainWindow", "Waiting for objects to be sent... %1%").arg(str(50))) self.updateStatusBar(_translate(
"MainWindow", "Waiting for objects to be sent... %1%").arg(50))
try: try:
while PendingUpload().progress() < 1: while PendingUpload().progress() < 1:
self.statusBar().showMessage(_translate("MainWindow", "Waiting for objects to be sent... %1%").arg(str(int(50 + 20 * PendingUpload().progress())))) self.updateStatusBar(_translate(
"MainWindow",
"Waiting for objects to be sent... %1%"
).arg(int(50 + 20 * PendingUpload().progress()))
)
time.sleep(0.5) time.sleep(0.5)
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000
)
except PendingUploadDeadlineException: except PendingUploadDeadlineException:
pass pass
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) QtCore.QCoreApplication.processEvents(
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) QtCore.QEventLoop.AllEvents, 1000
)
QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000
)
# save state and geometry self and all widgets # save state and geometry self and all widgets
self.statusBar().showMessage(_translate("MainWindow", "Saving settings... %1%").arg(str(70))) self.updateStatusBar(_translate(
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) "MainWindow", "Saving settings... %1%").arg(70))
QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000
)
self.saveSettings() self.saveSettings()
for attr, obj in self.ui.__dict__.iteritems(): for attr, obj in self.ui.__dict__.iteritems():
if hasattr(obj, "__class__") and isinstance(obj, settingsmixin.SettingsMixin): if hasattr(obj, "__class__") \
and isinstance(obj, settingsmixin.SettingsMixin):
saveMethod = getattr(obj, "saveSettings", None) saveMethod = getattr(obj, "saveSettings", None)
if callable (saveMethod): if callable(saveMethod):
obj.saveSettings() obj.saveSettings()
self.statusBar().showMessage(_translate("MainWindow", "Shutting down core... %1%").arg(str(80))) self.updateStatusBar(_translate(
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 1000) "MainWindow", "Shutting down core... %1%").arg(80))
QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000
)
shutdown.doCleanShutdown() shutdown.doCleanShutdown()
self.statusBar().showMessage(_translate("MainWindow", "Stopping notifications... %1%").arg(str(90))) self.updateStatusBar(_translate(
"MainWindow", "Stopping notifications... %1%").arg(90))
self.tray.hide() self.tray.hide()
self.statusBar().showMessage(_translate("MainWindow", "Shutdown imminent... %1%").arg(str(100))) self.updateStatusBar(_translate(
"MainWindow", "Shutdown imminent... %1%").arg(100))
shared.thisapp.cleanup() shared.thisapp.cleanup()
logger.info("Shutdown complete") logger.info("Shutdown complete")
super(MyForm, myapp).close() super(MyForm, myapp).close()
#return # return
os._exit(0) os._exit(0)
# window close event # window close event
@ -2778,14 +2838,14 @@ class MyForm(settingsmixin.SMainWindow):
tableWidget = self.getCurrentMessagelist() tableWidget = self.getCurrentMessagelist()
if not tableWidget: if not tableWidget:
return return
font = QFont() font = QtGui.QFont()
font.setBold(True) font.setBold(True)
inventoryHashesToMarkUnread = [] inventoryHashesToMarkUnread = []
modified = 0 modified = 0
for row in tableWidget.selectedIndexes(): for row in tableWidget.selectedIndexes():
currentRow = row.row() currentRow = row.row()
inventoryHashToMarkUnread = str(tableWidget.item( inventoryHashToMarkUnread = str(tableWidget.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
if inventoryHashToMarkUnread in inventoryHashesToMarkUnread: if inventoryHashToMarkUnread in inventoryHashesToMarkUnread:
# it returns columns as separate items, so we skip dupes # it returns columns as separate items, so we skip dupes
continue continue
@ -2805,9 +2865,9 @@ class MyForm(settingsmixin.SMainWindow):
if rowcount == 1: if rowcount == 1:
# performance optimisation # performance optimisation
self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(Qt.UserRole), self.getCurrentFolder()) self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(QtCore.Qt.UserRole), self.getCurrentFolder())
else: else:
self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(Qt.UserRole), self.getCurrentFolder(), self.getCurrentTreeWidget(), 0) self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(QtCore.Qt.UserRole), self.getCurrentFolder(), self.getCurrentTreeWidget(), 0)
# tableWidget.selectRow(currentRow + 1) # tableWidget.selectRow(currentRow + 1)
# This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary. # This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary.
# We could also select upwards, but then our problem would be with the topmost message. # We could also select upwards, but then our problem would be with the topmost message.
@ -2871,7 +2931,7 @@ class MyForm(settingsmixin.SMainWindow):
fromAddressAtCurrentInboxRow = tableWidget.item( fromAddressAtCurrentInboxRow = tableWidget.item(
currentInboxRow, 1).address currentInboxRow, 1).address
msgid = str(tableWidget.item( msgid = str(tableWidget.item(
currentInboxRow, 3).data(Qt.UserRole).toPyObject()) currentInboxRow, 3).data(QtCore.Qt.UserRole).toPyObject())
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select message from inbox where msgid=?''', msgid) '''select message from inbox where msgid=?''', msgid)
if queryreturn != []: if queryreturn != []:
@ -2884,23 +2944,28 @@ class MyForm(settingsmixin.SMainWindow):
'message': self.ui.textEditMessage 'message': self.ui.textEditMessage
} }
if toAddressAtCurrentInboxRow == str_broadcast_subscribers: if toAddressAtCurrentInboxRow == str_broadcast_subscribers:
self.ui.tabWidgetSend.setCurrentIndex(0) self.ui.tabWidgetSend.setCurrentIndex(
self.ui.tabWidgetSend.indexOf(self.ui.sendDirect)
)
# toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow # toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
elif not BMConfigParser().has_section(toAddressAtCurrentInboxRow): elif not BMConfigParser().has_section(toAddressAtCurrentInboxRow):
QtGui.QMessageBox.information(self, _translate("MainWindow", "Address is gone"), _translate( QtGui.QMessageBox.information(self, _translate("MainWindow", "Address is gone"), _translate(
"MainWindow", "Bitmessage cannot find your address %1. Perhaps you removed it?").arg(toAddressAtCurrentInboxRow), QMessageBox.Ok) "MainWindow", "Bitmessage cannot find your address %1. Perhaps you removed it?").arg(toAddressAtCurrentInboxRow), QtGui.QMessageBox.Ok)
elif not BMConfigParser().getboolean(toAddressAtCurrentInboxRow, 'enabled'): elif not BMConfigParser().getboolean(toAddressAtCurrentInboxRow, 'enabled'):
QtGui.QMessageBox.information(self, _translate("MainWindow", "Address disabled"), _translate( QtGui.QMessageBox.information(self, _translate("MainWindow", "Address disabled"), _translate(
"MainWindow", "Error: The address from which you are trying to send is disabled. You\'ll have to enable it on the \'Your Identities\' tab before using it."), QMessageBox.Ok) "MainWindow", "Error: The address from which you are trying to send is disabled. You\'ll have to enable it on the \'Your Identities\' tab before using it."), QtGui.QMessageBox.Ok)
else: else:
self.setBroadcastEnablementDependingOnWhetherThisIsAMailingListAddress(toAddressAtCurrentInboxRow) self.setBroadcastEnablementDependingOnWhetherThisIsAMailingListAddress(toAddressAtCurrentInboxRow)
if self.ui.tabWidgetSend.currentIndex() == 1: broadcast_tab_index = self.ui.tabWidgetSend.indexOf(
self.ui.sendBroadcast
)
if self.ui.tabWidgetSend.currentIndex() == broadcast_tab_index:
widget = { widget = {
'subject': self.ui.lineEditSubjectBroadcast, 'subject': self.ui.lineEditSubjectBroadcast,
'from': self.ui.comboBoxSendFromBroadcast, 'from': self.ui.comboBoxSendFromBroadcast,
'message': self.ui.textEditMessageBroadcast 'message': self.ui.textEditMessageBroadcast
} }
self.ui.tabWidgetSend.setCurrentIndex(1) self.ui.tabWidgetSend.setCurrentIndex(broadcast_tab_index)
toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
if fromAddressAtCurrentInboxRow == tableWidget.item(currentInboxRow, 1).label or ( if fromAddressAtCurrentInboxRow == tableWidget.item(currentInboxRow, 1).label or (
isinstance(acct, GatewayAccount) and fromAddressAtCurrentInboxRow == acct.relayAddress): isinstance(acct, GatewayAccount) and fromAddressAtCurrentInboxRow == acct.relayAddress):
@ -2924,7 +2989,9 @@ class MyForm(settingsmixin.SMainWindow):
widget['subject'].setText(tableWidget.item(currentInboxRow, 2).label) widget['subject'].setText(tableWidget.item(currentInboxRow, 2).label)
else: else:
widget['subject'].setText('Re: ' + tableWidget.item(currentInboxRow, 2).label) widget['subject'].setText('Re: ' + tableWidget.item(currentInboxRow, 2).label)
self.ui.tabWidget.setCurrentIndex(1) self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send)
)
widget['message'].setFocus() widget['message'].setFocus()
def on_action_InboxAddSenderToAddressBook(self): def on_action_InboxAddSenderToAddressBook(self):
@ -2934,20 +3001,12 @@ class MyForm(settingsmixin.SMainWindow):
currentInboxRow = tableWidget.currentRow() currentInboxRow = tableWidget.currentRow()
# tableWidget.item(currentRow,1).data(Qt.UserRole).toPyObject() # tableWidget.item(currentRow,1).data(Qt.UserRole).toPyObject()
addressAtCurrentInboxRow = tableWidget.item( addressAtCurrentInboxRow = tableWidget.item(
currentInboxRow, 1).data(Qt.UserRole) currentInboxRow, 1).data(QtCore.Qt.UserRole)
# Let's make sure that it isn't already in the address book self.ui.tabWidget.setCurrentIndex(
queryreturn = sqlQuery('''select * from addressbook where address=?''', self.ui.tabWidget.indexOf(self.ui.send)
addressAtCurrentInboxRow) )
if queryreturn == []: self.click_pushButtonAddAddressBook(
sqlExecute('''INSERT INTO addressbook VALUES (?,?)''', dialogs.AddAddressDialog(self, addressAtCurrentInboxRow))
'--New entry. Change label in Address Book.--',
addressAtCurrentInboxRow)
self.rerenderAddressBook()
self.statusBar().showMessage(_translate(
"MainWindow", "Entry added to the Address Book. Edit the label to your liking."), 10000)
else:
self.statusBar().showMessage(_translate(
"MainWindow", "Error: You cannot add the same address to your address book twice. Try renaming the existing one if you want."), 10000)
def on_action_InboxAddSenderToBlackList(self): def on_action_InboxAddSenderToBlackList(self):
tableWidget = self.getCurrentMessagelist() tableWidget = self.getCurrentMessagelist()
@ -2956,9 +3015,9 @@ class MyForm(settingsmixin.SMainWindow):
currentInboxRow = tableWidget.currentRow() currentInboxRow = tableWidget.currentRow()
# tableWidget.item(currentRow,1).data(Qt.UserRole).toPyObject() # tableWidget.item(currentRow,1).data(Qt.UserRole).toPyObject()
addressAtCurrentInboxRow = tableWidget.item( addressAtCurrentInboxRow = tableWidget.item(
currentInboxRow, 1).data(Qt.UserRole) currentInboxRow, 1).data(QtCore.Qt.UserRole)
recipientAddress = tableWidget.item( recipientAddress = tableWidget.item(
currentInboxRow, 0).data(Qt.UserRole) currentInboxRow, 0).data(QtCore.Qt.UserRole)
# Let's make sure that it isn't already in the address book # Let's make sure that it isn't already in the address book
queryreturn = sqlQuery('''select * from blacklist where address=?''', queryreturn = sqlQuery('''select * from blacklist where address=?''',
addressAtCurrentInboxRow) addressAtCurrentInboxRow)
@ -2968,11 +3027,15 @@ class MyForm(settingsmixin.SMainWindow):
label, label,
addressAtCurrentInboxRow, True) addressAtCurrentInboxRow, True)
self.ui.blackwhitelist.rerenderBlackWhiteList() self.ui.blackwhitelist.rerenderBlackWhiteList()
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Entry added to the blacklist. Edit the label to your liking."), 10000) "MainWindow",
"Entry added to the blacklist. Edit the label to your liking.")
)
else: else:
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Error: You cannot add the same address to your blacklist twice. Try renaming the existing one if you want."), 10000) "MainWindow",
"Error: You cannot add the same address to your blacklist"
" twice. Try renaming the existing one if you want."))
def deleteRowFromMessagelist(self, row = None, inventoryHash = None, ackData = None, messageLists = None): def deleteRowFromMessagelist(self, row = None, inventoryHash = None, ackData = None, messageLists = None):
if messageLists is None: if messageLists is None:
@ -2981,15 +3044,16 @@ class MyForm(settingsmixin.SMainWindow):
messageLists = (messageLists) messageLists = (messageLists)
for messageList in messageLists: for messageList in messageLists:
if row is not None: if row is not None:
inventoryHash = str(messageList.item(row, 3).data(Qt.UserRole).toPyObject()) inventoryHash = str(messageList.item(row, 3).data(
QtCore.Qt.UserRole).toPyObject())
messageList.removeRow(row) messageList.removeRow(row)
elif inventoryHash is not None: elif inventoryHash is not None:
for i in range(messageList.rowCount() - 1, -1, -1): for i in range(messageList.rowCount() - 1, -1, -1):
if messageList.item(i, 3).data(Qt.UserRole).toPyObject() == inventoryHash: if messageList.item(i, 3).data(QtCore.Qt.UserRole).toPyObject() == inventoryHash:
messageList.removeRow(i) messageList.removeRow(i)
elif ackData is not None: elif ackData is not None:
for i in range(messageList.rowCount() - 1, -1, -1): for i in range(messageList.rowCount() - 1, -1, -1):
if messageList.item(i, 3).data(Qt.UserRole).toPyObject() == ackData: if messageList.item(i, 3).data(QtCore.Qt.UserRole).toPyObject() == ackData:
messageList.removeRow(i) messageList.removeRow(i)
# Send item on the Inbox tab to trash # Send item on the Inbox tab to trash
@ -3023,8 +3087,8 @@ class MyForm(settingsmixin.SMainWindow):
tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1) tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1)
tableWidget.setUpdatesEnabled(True) tableWidget.setUpdatesEnabled(True)
self.propagateUnreadCount(self.getCurrentAccount, folder) self.propagateUnreadCount(self.getCurrentAccount, folder)
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Moved items to trash."), 10000) "MainWindow", "Moved items to trash."))
def on_action_TrashUndelete(self): def on_action_TrashUndelete(self):
tableWidget = self.getCurrentMessagelist() tableWidget = self.getCurrentMessagelist()
@ -3054,8 +3118,7 @@ class MyForm(settingsmixin.SMainWindow):
tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1) tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1)
tableWidget.setUpdatesEnabled(True) tableWidget.setUpdatesEnabled(True)
self.propagateUnreadCount(self.getCurrentAccount) self.propagateUnreadCount(self.getCurrentAccount)
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate("MainWindow", "Undeleted item."))
"MainWindow", "Undeleted items."), 10000)
def on_action_InboxSaveMessageAs(self): def on_action_InboxSaveMessageAs(self):
tableWidget = self.getCurrentMessagelist() tableWidget = self.getCurrentMessagelist()
@ -3063,13 +3126,14 @@ class MyForm(settingsmixin.SMainWindow):
return return
currentInboxRow = tableWidget.currentRow() currentInboxRow = tableWidget.currentRow()
try: try:
subjectAtCurrentInboxRow = str(tableWidget.item(currentInboxRow,2).data(Qt.UserRole)) subjectAtCurrentInboxRow = str(tableWidget.item(
currentInboxRow, 2).data(QtCore.Qt.UserRole))
except: except:
subjectAtCurrentInboxRow = '' subjectAtCurrentInboxRow = ''
# Retrieve the message data out of the SQL database # Retrieve the message data out of the SQL database
msgid = str(tableWidget.item( msgid = str(tableWidget.item(
currentInboxRow, 3).data(Qt.UserRole).toPyObject()) currentInboxRow, 3).data(QtCore.Qt.UserRole).toPyObject())
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select message from inbox where msgid=?''', msgid) '''select message from inbox where msgid=?''', msgid)
if queryreturn != []: if queryreturn != []:
@ -3077,16 +3141,16 @@ class MyForm(settingsmixin.SMainWindow):
message, = row message, = row
defaultFilename = "".join(x for x in subjectAtCurrentInboxRow if x.isalnum()) + '.txt' defaultFilename = "".join(x for x in subjectAtCurrentInboxRow if x.isalnum()) + '.txt'
filename = QFileDialog.getSaveFileName(self, _translate("MainWindow","Save As..."), defaultFilename, "Text files (*.txt);;All files (*.*)") filename = QtGui.QFileDialog.getSaveFileName(self, _translate("MainWindow","Save As..."), defaultFilename, "Text files (*.txt);;All files (*.*)")
if filename == '': if filename == '':
return return
try: try:
f = open(filename, 'w') f = open(filename, 'w')
f.write(message) f.write(message)
f.close() f.close()
except Exception, e: except Exception:
logger.exception('Message not saved', exc_info=True) logger.exception('Message not saved', exc_info=True)
self.statusBar().showMessage(_translate("MainWindow", "Write error."), 10000) self.updateStatusBar(_translate("MainWindow", "Write error."))
# Send item on the Sent tab to trash # Send item on the Sent tab to trash
def on_action_SentTrash(self): def on_action_SentTrash(self):
@ -3100,26 +3164,25 @@ class MyForm(settingsmixin.SMainWindow):
while tableWidget.selectedIndexes() != []: while tableWidget.selectedIndexes() != []:
currentRow = tableWidget.selectedIndexes()[0].row() currentRow = tableWidget.selectedIndexes()[0].row()
ackdataToTrash = str(tableWidget.item( ackdataToTrash = str(tableWidget.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
if folder == "trash" or shifted: if folder == "trash" or shifted:
sqlExecute('''DELETE FROM sent WHERE ackdata=?''', ackdataToTrash) sqlExecute('''DELETE FROM sent WHERE ackdata=?''', ackdataToTrash)
else: else:
sqlExecute('''UPDATE sent SET folder='trash' WHERE ackdata=?''', ackdataToTrash) sqlExecute('''UPDATE sent SET folder='trash' WHERE ackdata=?''', ackdataToTrash)
if tableWidget.item(currentRow, 0).unread: if tableWidget.item(currentRow, 0).unread:
self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(Qt.UserRole), folder, self.getCurrentTreeWidget(), -1) self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(QtCore.Qt.UserRole), folder, self.getCurrentTreeWidget(), -1)
self.getCurrentMessageTextedit().setPlainText("") self.getCurrentMessageTextedit().setPlainText("")
tableWidget.removeRow(currentRow) tableWidget.removeRow(currentRow)
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "Moved items to trash."), 10000) "MainWindow", "Moved items to trash."))
if currentRow == 0:
self.ui.tableWidgetInbox.selectRow(currentRow) self.ui.tableWidgetInbox.selectRow(
else: currentRow if currentRow == 0 else currentRow - 1)
self.ui.tableWidgetInbox.selectRow(currentRow - 1)
def on_action_ForceSend(self): def on_action_ForceSend(self):
currentRow = self.ui.tableWidgetInbox.currentRow() currentRow = self.ui.tableWidgetInbox.currentRow()
addressAtCurrentRow = self.ui.tableWidgetInbox.item( addressAtCurrentRow = self.ui.tableWidgetInbox.item(
currentRow, 0).data(Qt.UserRole) currentRow, 0).data(QtCore.Qt.UserRole)
toRipe = decodeAddress(addressAtCurrentRow)[3] toRipe = decodeAddress(addressAtCurrentRow)[3]
sqlExecute( sqlExecute(
'''UPDATE sent SET status='forcepow' WHERE toripe=? AND status='toodifficult' and folder='sent' ''', '''UPDATE sent SET status='forcepow' WHERE toripe=? AND status='toodifficult' and folder='sent' ''',
@ -3134,7 +3197,7 @@ class MyForm(settingsmixin.SMainWindow):
def on_action_SentClipboard(self): def on_action_SentClipboard(self):
currentRow = self.ui.tableWidgetInbox.currentRow() currentRow = self.ui.tableWidgetInbox.currentRow()
addressAtCurrentRow = self.ui.tableWidgetInbox.item( addressAtCurrentRow = self.ui.tableWidgetInbox.item(
currentRow, 0).data(Qt.UserRole) currentRow, 0).data(QtCore.Qt.UserRole)
clipboard = QtGui.QApplication.clipboard() clipboard = QtGui.QApplication.clipboard()
clipboard.setText(str(addressAtCurrentRow)) clipboard.setText(str(addressAtCurrentRow))
@ -3189,11 +3252,13 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.lineEditTo.setText(unicode( self.ui.lineEditTo.setText(unicode(
self.ui.lineEditTo.text().toUtf8(), encoding="UTF-8") + '; ' + stringToAdd) self.ui.lineEditTo.text().toUtf8(), encoding="UTF-8") + '; ' + stringToAdd)
if listOfSelectedRows == {}: if listOfSelectedRows == {}:
self.statusBar().showMessage(_translate( self.updateStatusBar(_translate(
"MainWindow", "No addresses selected."), 10000) "MainWindow", "No addresses selected."))
else: else:
self.statusBar().clearMessage() self.statusbar.clearMessage()
self.ui.tabWidget.setCurrentIndex(1) self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send)
)
def on_action_AddressBookSubscribe(self): def on_action_AddressBookSubscribe(self):
listOfSelectedRows = {} listOfSelectedRows = {}
@ -3203,11 +3268,17 @@ class MyForm(settingsmixin.SMainWindow):
addressAtCurrentRow = str(self.ui.tableWidgetAddressBook.item(currentRow,1).text()) addressAtCurrentRow = str(self.ui.tableWidgetAddressBook.item(currentRow,1).text())
# Then subscribe to it... provided it's not already in the address book # Then subscribe to it... provided it's not already in the address book
if shared.isAddressInMySubscriptionsList(addressAtCurrentRow): if shared.isAddressInMySubscriptionsList(addressAtCurrentRow):
self.statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Error: You cannot add the same address to your subscriptions twice. Perhaps rename the existing one if you want."), 10000) self.updateStatusBar(_translate(
"MainWindow",
"Error: You cannot add the same address to your"
" subscriptions twice. Perhaps rename the existing"
" one if you want."))
continue continue
labelAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,0).text().toUtf8() labelAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,0).text().toUtf8()
self.addSubscription(addressAtCurrentRow, labelAtCurrentRow) self.addSubscription(addressAtCurrentRow, labelAtCurrentRow)
self.ui.tabWidget.setCurrentIndex(2) self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.subscriptions)
)
def on_context_menuAddressBook(self, point): def on_context_menuAddressBook(self, point):
self.popMenuAddressBook = QtGui.QMenu(self) self.popMenuAddressBook = QtGui.QMenu(self)
@ -3236,7 +3307,19 @@ class MyForm(settingsmixin.SMainWindow):
self.click_pushButtonAddSubscription() self.click_pushButtonAddSubscription()
def on_action_SubscriptionsDelete(self): def on_action_SubscriptionsDelete(self):
if QtGui.QMessageBox.question(self, "Delete subscription?", _translate("MainWindow", "If you delete the subscription, messages that you already received will become inaccessible. Maybe you can consider disabling the subscription instead. Disabled subscriptions will not receive new messages, but you can still view messages you already received.\n\nAre you sure you want to delete the subscription?"), QMessageBox.Yes|QMessageBox.No) != QMessageBox.Yes: if QtGui.QMessageBox.question(
self, "Delete subscription?",
_translate(
"MainWindow",
"If you delete the subscription, messages that you"
" already received will become inaccessible. Maybe"
" you can consider disabling the subscription instead."
" Disabled subscriptions will not receive new"
" messages, but you can still view messages you"
" already received.\n\nAre you sure you want to"
" delete the subscription?"
), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
) != QtGui.QMessageBox.Yes:
return return
address = self.getCurrentAccount() address = self.getCurrentAccount()
sqlExecute('''DELETE FROM subscriptions WHERE address=?''', sqlExecute('''DELETE FROM subscriptions WHERE address=?''',
@ -3360,12 +3443,13 @@ class MyForm(settingsmixin.SMainWindow):
currentRow = messagelist.currentRow() currentRow = messagelist.currentRow()
if currentRow >= 0: if currentRow >= 0:
msgid = str(messagelist.item( msgid = str(messagelist.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) # data is saved at the 4. column of the table... currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
# data is saved at the 4. column of the table...
return msgid return msgid
return False return False
def getCurrentMessageTextedit(self): def getCurrentMessageTextedit(self):
currentIndex = self.ui.tabWidget.currentIndex(); currentIndex = self.ui.tabWidget.currentIndex()
messagelistList = [ messagelistList = [
self.ui.textEditInboxMessage, self.ui.textEditInboxMessage,
False, False,
@ -3388,9 +3472,9 @@ class MyForm(settingsmixin.SMainWindow):
except: except:
return self.ui.textEditInboxMessage return self.ui.textEditInboxMessage
def getCurrentSearchLine(self, currentIndex = None, retObj = False): def getCurrentSearchLine(self, currentIndex=None, retObj=False):
if currentIndex is None: if currentIndex is None:
currentIndex = self.ui.tabWidget.currentIndex(); currentIndex = self.ui.tabWidget.currentIndex()
messagelistList = [ messagelistList = [
self.ui.inboxSearchLineEdit, self.ui.inboxSearchLineEdit,
False, False,
@ -3405,9 +3489,9 @@ class MyForm(settingsmixin.SMainWindow):
else: else:
return None return None
def getCurrentSearchOption(self, currentIndex = None): def getCurrentSearchOption(self, currentIndex=None):
if currentIndex is None: if currentIndex is None:
currentIndex = self.ui.tabWidget.currentIndex(); currentIndex = self.ui.tabWidget.currentIndex()
messagelistList = [ messagelistList = [
self.ui.inboxSearchOption, self.ui.inboxSearchOption,
False, False,
@ -3420,7 +3504,7 @@ class MyForm(settingsmixin.SMainWindow):
return None return None
# Group of functions for the Your Identities dialog box # Group of functions for the Your Identities dialog box
def getCurrentItem(self, treeWidget = None): def getCurrentItem(self, treeWidget=None):
if treeWidget is None: if treeWidget is None:
treeWidget = self.getCurrentTreeWidget() treeWidget = self.getCurrentTreeWidget()
if treeWidget: if treeWidget:
@ -3429,7 +3513,7 @@ class MyForm(settingsmixin.SMainWindow):
return currentItem return currentItem
return False return False
def getCurrentAccount(self, treeWidget = None): def getCurrentAccount(self, treeWidget=None):
currentItem = self.getCurrentItem(treeWidget) currentItem = self.getCurrentItem(treeWidget)
if currentItem: if currentItem:
account = currentItem.address account = currentItem.address
@ -3438,7 +3522,7 @@ class MyForm(settingsmixin.SMainWindow):
# TODO need debug msg? # TODO need debug msg?
return False return False
def getCurrentFolder(self, treeWidget = None): def getCurrentFolder(self, treeWidget=None):
if treeWidget is None: if treeWidget is None:
treeWidget = self.getCurrentTreeWidget() treeWidget = self.getCurrentTreeWidget()
#treeWidget = self.ui.treeWidgetYourIdentities #treeWidget = self.ui.treeWidgetYourIdentities
@ -3466,7 +3550,19 @@ class MyForm(settingsmixin.SMainWindow):
if account.type == AccountMixin.NORMAL: if account.type == AccountMixin.NORMAL:
return # maybe in the future return # maybe in the future
elif account.type == AccountMixin.CHAN: elif account.type == AccountMixin.CHAN:
if QtGui.QMessageBox.question(self, "Delete channel?", _translate("MainWindow", "If you delete the channel, messages that you already received will become inaccessible. Maybe you can consider disabling the channel instead. Disabled channels will not receive new messages, but you can still view messages you already received.\n\nAre you sure you want to delete the channel?"), QMessageBox.Yes|QMessageBox.No) == QMessageBox.Yes: if QtGui.QMessageBox.question(
self, "Delete channel?",
_translate(
"MainWindow",
"If you delete the channel, messages that you"
" already received will become inaccessible."
" Maybe you can consider disabling the channel"
" instead. Disabled channels will not receive new"
" messages, but you can still view messages you"
" already received.\n\nAre you sure you want to"
" delete the channel?"
), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
) == QtGui.QMessageBox.Yes:
BMConfigParser().remove_section(str(account.address)) BMConfigParser().remove_section(str(account.address))
else: else:
return return
@ -3520,18 +3616,18 @@ class MyForm(settingsmixin.SMainWindow):
else: else:
currentColumn = 1 currentColumn = 1
if self.getCurrentFolder() == "sent": if self.getCurrentFolder() == "sent":
myAddress = tableWidget.item(currentRow, 1).data(Qt.UserRole) myAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole)
otherAddress = tableWidget.item(currentRow, 0).data(Qt.UserRole) otherAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole)
else: else:
myAddress = tableWidget.item(currentRow, 0).data(Qt.UserRole) myAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole)
otherAddress = tableWidget.item(currentRow, 1).data(Qt.UserRole) otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole)
account = accountClass(myAddress) account = accountClass(myAddress)
if isinstance(account, GatewayAccount) and otherAddress == account.relayAddress and ( if isinstance(account, GatewayAccount) and otherAddress == account.relayAddress and (
(currentColumn in [0, 2] and self.getCurrentFolder() == "sent") or (currentColumn in [0, 2] and self.getCurrentFolder() == "sent") or
(currentColumn in [1, 2] and self.getCurrentFolder() != "sent")): (currentColumn in [1, 2] and self.getCurrentFolder() != "sent")):
text = str(tableWidget.item(currentRow, currentColumn).label) text = str(tableWidget.item(currentRow, currentColumn).label)
else: else:
text = tableWidget.item(currentRow, currentColumn).data(Qt.UserRole) text = tableWidget.item(currentRow, currentColumn).data(QtCore.Qt.UserRole)
text = unicode(str(text), 'utf-8', 'ignore') text = unicode(str(text), 'utf-8', 'ignore')
clipboard = QtGui.QApplication.clipboard() clipboard = QtGui.QApplication.clipboard()
clipboard.setText(text) clipboard.setText(text)
@ -3574,7 +3670,10 @@ class MyForm(settingsmixin.SMainWindow):
current_files += [upper] current_files += [upper]
filters[0:0] = ['Image files (' + ' '.join(all_images_filter) + ')'] filters[0:0] = ['Image files (' + ' '.join(all_images_filter) + ')']
filters[1:1] = ['All files (*.*)'] filters[1:1] = ['All files (*.*)']
sourcefile = QFileDialog.getOpenFileName(self, _translate("MainWindow","Set avatar..."), filter = ';;'.join(filters)) sourcefile = QtGui.QFileDialog.getOpenFileName(
self, _translate("MainWindow", "Set avatar..."),
filter = ';;'.join(filters)
)
# determine the correct filename (note that avatars don't use the suffix) # determine the correct filename (note that avatars don't use the suffix)
destination = state.appdata + 'avatars/' + hash + '.' + sourcefile.split('.')[-1] destination = state.appdata + 'avatars/' + hash + '.' + sourcefile.split('.')[-1]
exists = QtCore.QFile.exists(destination) exists = QtCore.QFile.exists(destination)
@ -3724,7 +3823,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuInbox.addAction(self.actionMarkUnread) self.popMenuInbox.addAction(self.actionMarkUnread)
self.popMenuInbox.addSeparator() self.popMenuInbox.addSeparator()
address = tableWidget.item( address = tableWidget.item(
tableWidget.currentRow(), 0).data(Qt.UserRole) tableWidget.currentRow(), 0).data(QtCore.Qt.UserRole)
account = accountClass(address) account = accountClass(address)
if account.type == AccountMixin.CHAN: if account.type == AccountMixin.CHAN:
self.popMenuInbox.addAction(self.actionReplyChan) self.popMenuInbox.addAction(self.actionReplyChan)
@ -3756,7 +3855,7 @@ class MyForm(settingsmixin.SMainWindow):
currentRow = self.ui.tableWidgetInbox.currentRow() currentRow = self.ui.tableWidgetInbox.currentRow()
if currentRow >= 0: if currentRow >= 0:
ackData = str(self.ui.tableWidgetInbox.item( ackData = str(self.ui.tableWidgetInbox.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
queryreturn = sqlQuery('''SELECT status FROM sent where ackdata=?''', ackData) queryreturn = sqlQuery('''SELECT status FROM sent where ackdata=?''', ackData)
for row in queryreturn: for row in queryreturn:
status, = row status, = row
@ -3793,7 +3892,7 @@ class MyForm(settingsmixin.SMainWindow):
searchOption = self.getCurrentSearchOption() searchOption = self.getCurrentSearchOption()
messageTextedit = self.getCurrentMessageTextedit() messageTextedit = self.getCurrentMessageTextedit()
if messageTextedit: if messageTextedit:
messageTextedit.setPlainText(QString("")) messageTextedit.setPlainText(QtCore.QString(""))
messagelist = self.getCurrentMessagelist() messagelist = self.getCurrentMessagelist()
if messagelist: if messagelist:
account = self.getCurrentAccount() account = self.getCurrentAccount()
@ -3879,7 +3978,7 @@ class MyForm(settingsmixin.SMainWindow):
if refresh: if refresh:
if not tableWidget: if not tableWidget:
return return
font = QFont() font = QtGui.QFont()
font.setBold(False) font.setBold(False)
# inventoryHashesToMarkRead = [] # inventoryHashesToMarkRead = []
# inventoryHashToMarkRead = str(tableWidget.item( # inventoryHashToMarkRead = str(tableWidget.item(
@ -3890,7 +3989,7 @@ class MyForm(settingsmixin.SMainWindow):
tableWidget.item(currentRow, 2).setUnread(False) tableWidget.item(currentRow, 2).setUnread(False)
tableWidget.item(currentRow, 3).setFont(font) tableWidget.item(currentRow, 3).setFont(font)
if propagate: if propagate:
self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(Qt.UserRole), folder, self.getCurrentTreeWidget(), -1) self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(QtCore.Qt.UserRole), folder, self.getCurrentTreeWidget(), -1)
else: else:
data = self.getCurrentMessageId() data = self.getCurrentMessageId()
@ -3930,9 +4029,9 @@ class MyForm(settingsmixin.SMainWindow):
logger.info('Status bar: ' + message) logger.info('Status bar: ' + message)
if option == 1: if option == 1:
self.statusBar().addImportant(message) self.statusbar.addImportant(message)
else: else:
self.statusBar().showMessage(message, 10000) self.statusbar.showMessage(message, 10000)
def initSettings(self): def initSettings(self):
QtCore.QCoreApplication.setOrganizationName("PyBitmessage") QtCore.QCoreApplication.setOrganizationName("PyBitmessage")
@ -3940,51 +4039,13 @@ class MyForm(settingsmixin.SMainWindow):
QtCore.QCoreApplication.setApplicationName("pybitmessageqt") QtCore.QCoreApplication.setApplicationName("pybitmessageqt")
self.loadSettings() self.loadSettings()
for attr, obj in self.ui.__dict__.iteritems(): for attr, obj in self.ui.__dict__.iteritems():
if hasattr(obj, "__class__") and isinstance(obj, settingsmixin.SettingsMixin): if hasattr(obj, "__class__") and \
isinstance(obj, settingsmixin.SettingsMixin):
loadMethod = getattr(obj, "loadSettings", None) loadMethod = getattr(obj, "loadSettings", None)
if callable (loadMethod): if callable(loadMethod):
obj.loadSettings() obj.loadSettings()
class helpDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_helpDialog()
self.ui.setupUi(self)
self.parent = parent
self.ui.labelHelpURI.setOpenExternalLinks(True)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class connectDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_connectDialog()
self.ui.setupUi(self)
self.parent = parent
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class aboutDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_aboutDialog()
self.ui.setupUi(self)
self.parent = parent
self.ui.label.setText("PyBitmessage " + softwareVersion)
self.ui.labelVersion.setText(paths.lastCommit())
class regenerateAddressesDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_regenerateAddressesDialog()
self.ui.setupUi(self)
self.parent = parent
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class settingsDialog(QtGui.QDialog): class settingsDialog(QtGui.QDialog):
def __init__(self, parent): def __init__(self, parent):
@ -4218,175 +4279,20 @@ class settingsDialog(QtGui.QDialog):
self.parent.ui.pushButtonFetchNamecoinID.show() self.parent.ui.pushButtonFetchNamecoinID.show()
class SpecialAddressBehaviorDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_SpecialAddressBehaviorDialog()
self.ui.setupUi(self)
self.parent = parent
addressAtCurrentRow = parent.getCurrentAccount()
if not BMConfigParser().safeGetBoolean(addressAtCurrentRow, 'chan'):
if BMConfigParser().safeGetBoolean(addressAtCurrentRow, 'mailinglist'):
self.ui.radioButtonBehaviorMailingList.click()
else:
self.ui.radioButtonBehaveNormalAddress.click()
try:
mailingListName = BMConfigParser().get(
addressAtCurrentRow, 'mailinglistname')
except:
mailingListName = ''
self.ui.lineEditMailingListName.setText(
unicode(mailingListName, 'utf-8'))
else: # if addressAtCurrentRow is a chan address
self.ui.radioButtonBehaviorMailingList.setDisabled(True)
self.ui.lineEditMailingListName.setText(_translate(
"MainWindow", "This is a chan address. You cannot use it as a pseudo-mailing list."))
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class EmailGatewayDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_EmailGatewayDialog()
self.ui.setupUi(self)
self.parent = parent
addressAtCurrentRow = parent.getCurrentAccount()
acct = accountClass(addressAtCurrentRow)
if isinstance(acct, GatewayAccount):
self.ui.radioButtonUnregister.setEnabled(True)
self.ui.radioButtonStatus.setEnabled(True)
self.ui.radioButtonStatus.setChecked(True)
self.ui.radioButtonSettings.setEnabled(True)
else:
self.ui.radioButtonStatus.setEnabled(False)
self.ui.radioButtonSettings.setEnabled(False)
self.ui.radioButtonUnregister.setEnabled(False)
label = BMConfigParser().get(addressAtCurrentRow, 'label')
if label.find("@mailchuck.com") > -1:
self.ui.lineEditEmail.setText(label)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class EmailGatewayRegistrationDialog(QtGui.QDialog):
def __init__(self, parent, title, label):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_EmailGatewayRegistrationDialog()
self.ui.setupUi(self)
self.parent = parent
self.setWindowTitle(title)
self.ui.label.setText(label)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class NewSubscriptionDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_NewSubscriptionDialog()
self.ui.setupUi(self)
self.parent = parent
QtCore.QObject.connect(self.ui.lineEditSubscriptionAddress, QtCore.SIGNAL(
"textChanged(QString)"), self.addressChanged)
self.ui.checkBoxDisplayMessagesAlreadyInInventory.setText(
_translate("MainWindow", "Enter an address above."))
def addressChanged(self, QString):
self.ui.checkBoxDisplayMessagesAlreadyInInventory.setEnabled(False)
self.ui.checkBoxDisplayMessagesAlreadyInInventory.setChecked(False)
status, addressVersion, streamNumber, ripe = decodeAddress(str(QString))
if status == 'missingbm':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The address should start with ''BM-''"))
elif status == 'checksumfailed':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The address is not typed or copied correctly (the checksum failed)."))
elif status == 'versiontoohigh':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The version number of this address is higher than this software can support. Please upgrade Bitmessage."))
elif status == 'invalidcharacters':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The address contains invalid characters."))
elif status == 'ripetooshort':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is too short."))
elif status == 'ripetoolong':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is too long."))
elif status == 'varintmalformed':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is malformed."))
elif status == 'success':
self.ui.labelAddressCheck.setText(
_translate("MainWindow", "Address is valid."))
if addressVersion <= 3:
self.ui.checkBoxDisplayMessagesAlreadyInInventory.setText(
_translate("MainWindow", "Address is an old type. We cannot display its past broadcasts."))
else:
Inventory().flush()
doubleHashOfAddressData = hashlib.sha512(hashlib.sha512(encodeVarint(
addressVersion) + encodeVarint(streamNumber) + ripe).digest()).digest()
tag = doubleHashOfAddressData[32:]
count = len(Inventory().by_type_and_tag(3, tag))
if count == 0:
self.ui.checkBoxDisplayMessagesAlreadyInInventory.setText(
_translate("MainWindow", "There are no recent broadcasts from this address to display."))
else:
self.ui.checkBoxDisplayMessagesAlreadyInInventory.setEnabled(True)
self.ui.checkBoxDisplayMessagesAlreadyInInventory.setText(
_translate("MainWindow", "Display the %1 recent broadcast(s) from this address.").arg(count))
class NewAddressDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_NewAddressDialog()
self.ui.setupUi(self)
self.parent = parent
row = 1
# Let's fill out the 'existing address' combo box with addresses from
# the 'Your Identities' tab.
for addressInKeysFile in getSortedAccounts():
self.ui.radioButtonExisting.click()
self.ui.comboBoxExisting.addItem(
addressInKeysFile)
row += 1
self.ui.groupBoxDeterministic.setHidden(True)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class iconGlossaryDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_iconGlossaryDialog()
self.ui.setupUi(self)
self.parent = parent
self.ui.labelPortNumber.setText(_translate(
"MainWindow", "You are using TCP port %1. (This can be changed in the settings).").arg(str(BMConfigParser().getint('bitmessagesettings', 'port'))))
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
# In order for the time columns on the Inbox and Sent tabs to be sorted # In order for the time columns on the Inbox and Sent tabs to be sorted
# correctly (rather than alphabetically), we need to overload the < # correctly (rather than alphabetically), we need to overload the <
# operator and use this class instead of QTableWidgetItem. # operator and use this class instead of QTableWidgetItem.
class myTableWidgetItem(QTableWidgetItem): class myTableWidgetItem(QtGui.QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject()) return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject())
from uisignaler import UISignaler
app = None app = None
myapp = None myapp = None
class MySingleApplication(QApplication):
class MySingleApplication(QtGui.QApplication):
""" """
Listener to allow our Qt form to get focus when another instance of the Listener to allow our Qt form to get focus when another instance of the
application is open. application is open.
@ -4436,12 +4342,14 @@ class MySingleApplication(QApplication):
if myapp: if myapp:
myapp.appIndicatorShow() myapp.appIndicatorShow()
def init(): def init():
global app global app
if not app: if not app:
app = MySingleApplication(sys.argv) app = MySingleApplication(sys.argv)
return app return app
def run(): def run():
global myapp global myapp
app = init() app = init()

View File

@ -1,74 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'about.ui'
#
# Created: Tue Jan 21 22:29:38 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_aboutDialog(object):
def setupUi(self, aboutDialog):
aboutDialog.setObjectName(_fromUtf8("aboutDialog"))
aboutDialog.resize(360, 315)
self.buttonBox = QtGui.QDialogButtonBox(aboutDialog)
self.buttonBox.setGeometry(QtCore.QRect(20, 280, 311, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.label = QtGui.QLabel(aboutDialog)
self.label.setGeometry(QtCore.QRect(10, 106, 341, 20))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label.setFont(font)
self.label.setAlignment(QtCore.Qt.AlignCenter|QtCore.Qt.AlignVCenter)
self.label.setObjectName(_fromUtf8("label"))
self.labelVersion = QtGui.QLabel(aboutDialog)
self.labelVersion.setGeometry(QtCore.QRect(10, 116, 341, 41))
self.labelVersion.setObjectName(_fromUtf8("labelVersion"))
self.labelVersion.setAlignment(QtCore.Qt.AlignCenter|QtCore.Qt.AlignVCenter)
self.label_2 = QtGui.QLabel(aboutDialog)
self.label_2.setGeometry(QtCore.QRect(10, 150, 341, 41))
self.label_2.setAlignment(QtCore.Qt.AlignCenter)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.label_3 = QtGui.QLabel(aboutDialog)
self.label_3.setGeometry(QtCore.QRect(20, 200, 331, 71))
self.label_3.setWordWrap(True)
self.label_3.setOpenExternalLinks(True)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.label_5 = QtGui.QLabel(aboutDialog)
self.label_5.setGeometry(QtCore.QRect(10, 190, 341, 20))
self.label_5.setAlignment(QtCore.Qt.AlignCenter)
self.label_5.setObjectName(_fromUtf8("label_5"))
self.retranslateUi(aboutDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), aboutDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), aboutDialog.reject)
QtCore.QMetaObject.connectSlotsByName(aboutDialog)
def retranslateUi(self, aboutDialog):
aboutDialog.setWindowTitle(_translate("aboutDialog", "About", None))
self.label.setText(_translate("aboutDialog", "PyBitmessage", None))
self.labelVersion.setText(_translate("aboutDialog", "version ?", None))
self.label_2.setText(_translate("aboutDialog", "<html><head/><body><p>Copyright &copy; 2012-2016 Jonathan Warren<br/>Copyright &copy; 2013-2016 The Bitmessage Developers</p></body></html>", None))
self.label_3.setText(_translate("aboutDialog", "<html><head/><body><p>Distributed under the MIT/X11 software license; see <a href=\"http://www.opensource.org/licenses/mit-license.php\"><span style=\" text-decoration: underline; color:#0000ff;\">http://www.opensource.org/licenses/mit-license.php</span></a></p></body></html>", None))
self.label_5.setText(_translate("aboutDialog", "This is Beta software.", None))

View File

@ -6,38 +6,32 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>360</width> <width>430</width>
<height>315</height> <height>340</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>About</string> <string>About</string>
</property> </property>
<widget class="QDialogButtonBox" name="buttonBox"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="geometry"> <item alignment="Qt::AlignHCenter">
<rect> <widget class="QLabel" name="label_4">
<x>20</x> <property name="text">
<y>280</y> <string notr="true"/>
<width>311</width>
<height>32</height>
</rect>
</property> </property>
<property name="orientation"> <property name="pixmap">
<enum>Qt::Horizontal</enum> <pixmap resource="bitmessage_icons.qrc">:/newPrefix/images/can-icon-24px.png</pixmap>
</property> </property>
<property name="standardButtons"> <property name="scaledContents">
<set>QDialogButtonBox::Ok</set> <bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label"> </item>
<property name="geometry"> <item alignment="Qt::AlignHCenter">
<rect> <widget class="QLabel" name="labelVersion">
<x>70</x>
<y>126</y>
<width>111</width>
<height>20</height>
</rect>
</property>
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
@ -45,50 +39,35 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>PyBitmessage</string> <string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/Bitmessage/PyBitmessage/tree/:branch:&quot;&gt;&lt;span style=&quot;text-decoration:none; color:#0000ff;&quot;&gt;PyBitmessage :version:&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="labelVersion"> </item>
<property name="geometry"> <item alignment="Qt::AlignLeft">
<rect> <widget class="QLabel" name="label_2">
<x>190</x>
<y>126</y>
<width>161</width>
<height>20</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>version ?</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2012-2016 Jonathan Warren&lt;br/&gt;Copyright © 2013-2017 The Bitmessage Developers&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeft</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_2"> </item>
<property name="geometry"> <item>
<rect> <widget class="QLabel" name="label_5">
<x>10</x>
<y>150</y>
<width>341</width>
<height>41</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2012-2014 Jonathan Warren&lt;br/&gt;Copyright © 2013-2014 The Bitmessage Developers&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>This is Beta software.</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>20</x>
<y>200</y>
<width>331</width>
<height>71</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Distributed under the MIT/X11 software license; see &lt;a href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.opensource.org/licenses/mit-license.php&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Distributed under the MIT/X11 software license; see &lt;a href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.opensource.org/licenses/mit-license.php&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
@ -99,24 +78,22 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_5"> </item>
<property name="geometry"> <item>
<rect> <widget class="QDialogButtonBox" name="buttonBox">
<x>10</x> <property name="orientation">
<y>190</y> <enum>Qt::Horizontal</enum>
<width>341</width>
<height>20</height>
</rect>
</property> </property>
<property name="text"> <property name="standardButtons">
<string>This is Beta software.</string> <set>QDialogButtonBox::Ok</set>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item>
</layout>
</widget> </widget>
<resources/> <resources>
<include location="bitmessage_icons.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>

View File

@ -1,65 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'addaddressdialog.ui'
#
# Created: Sat Nov 30 20:35:38 2013
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_AddAddressDialog(object):
def setupUi(self, AddAddressDialog):
AddAddressDialog.setObjectName(_fromUtf8("AddAddressDialog"))
AddAddressDialog.resize(368, 162)
self.formLayout = QtGui.QFormLayout(AddAddressDialog)
self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.label_2 = QtGui.QLabel(AddAddressDialog)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.formLayout.setWidget(0, QtGui.QFormLayout.SpanningRole, self.label_2)
self.newAddressLabel = QtGui.QLineEdit(AddAddressDialog)
self.newAddressLabel.setObjectName(_fromUtf8("newAddressLabel"))
self.formLayout.setWidget(2, QtGui.QFormLayout.SpanningRole, self.newAddressLabel)
self.label = QtGui.QLabel(AddAddressDialog)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.label)
self.lineEditAddress = QtGui.QLineEdit(AddAddressDialog)
self.lineEditAddress.setObjectName(_fromUtf8("lineEditAddress"))
self.formLayout.setWidget(5, QtGui.QFormLayout.SpanningRole, self.lineEditAddress)
self.labelAddressCheck = QtGui.QLabel(AddAddressDialog)
self.labelAddressCheck.setText(_fromUtf8(""))
self.labelAddressCheck.setWordWrap(True)
self.labelAddressCheck.setObjectName(_fromUtf8("labelAddressCheck"))
self.formLayout.setWidget(6, QtGui.QFormLayout.SpanningRole, self.labelAddressCheck)
self.buttonBox = QtGui.QDialogButtonBox(AddAddressDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.formLayout.setWidget(7, QtGui.QFormLayout.FieldRole, self.buttonBox)
self.retranslateUi(AddAddressDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), AddAddressDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), AddAddressDialog.reject)
QtCore.QMetaObject.connectSlotsByName(AddAddressDialog)
def retranslateUi(self, AddAddressDialog):
AddAddressDialog.setWindowTitle(_translate("AddAddressDialog", "Add new entry", None))
self.label_2.setText(_translate("AddAddressDialog", "Label", None))
self.label.setText(_translate("AddAddressDialog", "Address", None))

View File

@ -7,9 +7,15 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>368</width> <width>368</width>
<height>162</height> <height>232</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>368</width>
<height>200</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Add new entry</string> <string>Add new entry</string>
</property> </property>
@ -25,7 +31,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QLineEdit" name="newAddressLabel"/> <widget class="QLineEdit" name="lineEditLabel"/>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
@ -47,7 +53,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="8" column="1">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -57,6 +63,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@ -0,0 +1,351 @@
from PyQt4 import QtCore, QtGui
from addresses import decodeAddress, encodeVarint, addBMIfNotPresent
from account import (
GatewayAccount, MailchuckAccount, AccountMixin, accountClass,
getSortedAccounts
)
from tr import _translate
from retranslateui import RetranslateMixin
import widgets
import queues
import hashlib
from inventory import Inventory
class AddressCheckMixin(object):
def __init__(self):
self.valid = False
QtCore.QObject.connect(self.lineEditAddress, QtCore.SIGNAL(
"textChanged(QString)"), self.addressChanged)
def _onSuccess(self, addressVersion, streamNumber, ripe):
pass
def addressChanged(self, QString):
status, addressVersion, streamNumber, ripe = decodeAddress(
str(QString))
self.valid = status == 'success'
if self.valid:
self.labelAddressCheck.setText(
_translate("MainWindow", "Address is valid."))
self._onSuccess(addressVersion, streamNumber, ripe)
elif status == 'missingbm':
self.labelAddressCheck.setText(_translate(
"MainWindow", # dialog name should be here
"The address should start with ''BM-''"
))
elif status == 'checksumfailed':
self.labelAddressCheck.setText(_translate(
"MainWindow",
"The address is not typed or copied correctly"
" (the checksum failed)."
))
elif status == 'versiontoohigh':
self.labelAddressCheck.setText(_translate(
"MainWindow",
"The version number of this address is higher than this"
" software can support. Please upgrade Bitmessage."
))
elif status == 'invalidcharacters':
self.labelAddressCheck.setText(_translate(
"MainWindow",
"The address contains invalid characters."
))
elif status == 'ripetooshort':
self.labelAddressCheck.setText(_translate(
"MainWindow",
"Some data encoded in the address is too short."
))
elif status == 'ripetoolong':
self.labelAddressCheck.setText(_translate(
"MainWindow",
"Some data encoded in the address is too long."
))
elif status == 'varintmalformed':
self.labelAddressCheck.setText(_translate(
"MainWindow",
"Some data encoded in the address is malformed."
))
class AddressDataDialog(QtGui.QDialog, AddressCheckMixin):
def __init__(self, parent):
super(AddressDataDialog, self).__init__(parent)
self.parent = parent
def accept(self):
if self.valid:
self.data = (
addBMIfNotPresent(str(self.lineEditAddress.text())),
str(self.lineEditLabel.text().toUtf8())
)
else:
queues.UISignalQueue.put(('updateStatusBar', _translate(
"MainWindow",
"The address you entered was invalid. Ignoring it."
)))
super(AddressDataDialog, self).accept()
class AddAddressDialog(AddressDataDialog, RetranslateMixin):
def __init__(self, parent=None, address=None):
super(AddAddressDialog, self).__init__(parent)
widgets.load('addaddressdialog.ui', self)
AddressCheckMixin.__init__(self)
if address:
self.lineEditAddress.setText(address)
class NewAddressDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None):
super(NewAddressDialog, self).__init__(parent)
widgets.load('newaddressdialog.ui', self)
# Let's fill out the 'existing address' combo box with addresses
# from the 'Your Identities' tab.
for address in getSortedAccounts():
self.radioButtonExisting.click()
self.comboBoxExisting.addItem(address)
self.groupBoxDeterministic.setHidden(True)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
self.show()
def accept(self):
self.hide()
# self.buttonBox.enabled = False
if self.radioButtonRandomAddress.isChecked():
if self.radioButtonMostAvailable.isChecked():
streamNumberForAddress = 1
else:
# User selected 'Use the same stream as an existing
# address.'
streamNumberForAddress = decodeAddress(
self.comboBoxExisting.currentText())[2]
queues.addressGeneratorQueue.put((
'createRandomAddress', 4, streamNumberForAddress,
str(self.newaddresslabel.text().toUtf8()), 1, "",
self.checkBoxEighteenByteRipe.isChecked()
))
else:
if self.lineEditPassphrase.text() != \
self.lineEditPassphraseAgain.text():
QtGui.QMessageBox.about(
self, _translate("MainWindow", "Passphrase mismatch"),
_translate(
"MainWindow",
"The passphrase you entered twice doesn\'t"
" match. Try again.")
)
elif self.lineEditPassphrase.text() == "":
QtGui.QMessageBox.about(
self, _translate("MainWindow", "Choose a passphrase"),
_translate(
"MainWindow", "You really do need a passphrase.")
)
else:
# this will eventually have to be replaced by logic
# to determine the most available stream number.
streamNumberForAddress = 1
queues.addressGeneratorQueue.put((
'createDeterministicAddresses', 4, streamNumberForAddress,
"unused deterministic address",
self.spinBoxNumberOfAddressesToMake.value(),
self.lineEditPassphrase.text().toUtf8(),
self.checkBoxEighteenByteRipe.isChecked()
))
class NewSubscriptionDialog(AddressDataDialog, RetranslateMixin):
def __init__(self, parent=None):
super(NewSubscriptionDialog, self).__init__(parent)
widgets.load('newsubscriptiondialog.ui', self)
AddressCheckMixin.__init__(self)
def _onSuccess(self, addressVersion, streamNumber, ripe):
if addressVersion <= 3:
self.checkBoxDisplayMessagesAlreadyInInventory.setText(_translate(
"MainWindow",
"Address is an old type. We cannot display its past"
" broadcasts."
))
else:
Inventory().flush()
doubleHashOfAddressData = hashlib.sha512(hashlib.sha512(
encodeVarint(addressVersion) +
encodeVarint(streamNumber) + ripe
).digest()).digest()
tag = doubleHashOfAddressData[32:]
self.recent = Inventory().by_type_and_tag(3, tag)
count = len(self.recent)
if count == 0:
self.checkBoxDisplayMessagesAlreadyInInventory.setText(
_translate(
"MainWindow",
"There are no recent broadcasts from this address"
" to display."
))
else:
self.checkBoxDisplayMessagesAlreadyInInventory.setEnabled(True)
self.checkBoxDisplayMessagesAlreadyInInventory.setText(
_translate(
"MainWindow",
"Display the %1 recent broadcast(s) from this address."
).arg(count))
class RegenerateAddressesDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None):
super(RegenerateAddressesDialog, self).__init__(parent)
widgets.load('regenerateaddresses.ui', self)
self.groupBox.setTitle('')
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None, config=None):
super(SpecialAddressBehaviorDialog, self).__init__(parent)
widgets.load('specialaddressbehavior.ui', self)
self.address = parent.getCurrentAccount()
self.parent = parent
self.config = config
try:
self.address_is_chan = config.safeGetBoolean(
self.address, 'chan'
)
except AttributeError:
pass
else:
if self.address_is_chan: # address is a chan address
self.radioButtonBehaviorMailingList.setDisabled(True)
self.lineEditMailingListName.setText(_translate(
"SpecialAddressBehaviorDialog",
"This is a chan address. You cannot use it as a"
" pseudo-mailing list."
))
else:
if config.safeGetBoolean(self.address, 'mailinglist'):
self.radioButtonBehaviorMailingList.click()
else:
self.radioButtonBehaveNormalAddress.click()
try:
mailingListName = config.get(
self.address, 'mailinglistname')
except:
mailingListName = ''
self.lineEditMailingListName.setText(
unicode(mailingListName, 'utf-8')
)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
self.show()
def accept(self):
self.hide()
if self.address_is_chan:
return
if self.radioButtonBehaveNormalAddress.isChecked():
self.config.set(str(self.address), 'mailinglist', 'false')
# Set the color to either black or grey
if self.config.getboolean(self.address, 'enabled'):
self.parent.setCurrentItemColor(
QtGui.QApplication.palette().text().color()
)
else:
self.parent.setCurrentItemColor(QtGui.QColor(128, 128, 128))
else:
self.config.set(str(self.address), 'mailinglist', 'true')
self.config.set(str(self.address), 'mailinglistname', str(
self.lineEditMailingListName.text().toUtf8()))
self.parent.setCurrentItemColor(
QtGui.QColor(137, 04, 177)) # magenta
self.parent.rerenderComboBoxSendFrom()
self.parent.rerenderComboBoxSendFromBroadcast()
self.config.save()
self.parent.rerenderMessagelistToLabels()
class EmailGatewayDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent, config=None, account=None):
super(EmailGatewayDialog, self).__init__(parent)
widgets.load('emailgateway.ui', self)
self.parent = parent
self.config = config
if account:
self.acct = account
self.setWindowTitle(_translate(
"EmailGatewayDialog", "Registration failed:"))
self.label.setText(_translate(
"EmailGatewayDialog",
"The requested email address is not available,"
" please try a new one."
))
self.radioButtonRegister.hide()
self.radioButtonStatus.hide()
self.radioButtonSettings.hide()
self.radioButtonUnregister.hide()
else:
address = parent.getCurrentAccount()
self.acct = accountClass(address)
try:
label = config.get(address, 'label')
except AttributeError:
pass
else:
if "@" in label:
self.lineEditEmail.setText(label)
if isinstance(self.acct, GatewayAccount):
self.radioButtonUnregister.setEnabled(True)
self.radioButtonStatus.setEnabled(True)
self.radioButtonStatus.setChecked(True)
self.radioButtonSettings.setEnabled(True)
self.lineEditEmail.setEnabled(False)
else:
self.acct = MailchuckAccount(address)
self.lineEditEmail.setFocus()
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
def accept(self):
self.hide()
# no chans / mailinglists
if self.acct.type != AccountMixin.NORMAL:
return
if not isinstance(self.acct, GatewayAccount):
return
if self.radioButtonRegister.isChecked() \
or self.radioButtonRegister.isHidden():
email = str(self.lineEditEmail.text().toUtf8())
self.acct.register(email)
self.config.set(self.acct.fromAddress, 'label', email)
self.config.set(self.acct.fromAddress, 'gateway', 'mailchuck')
self.config.save()
queues.UISignalQueue.put(('updateStatusBar', _translate(
"EmailGatewayDialog",
"Sending email gateway registration request"
)))
elif self.radioButtonUnregister.isChecked():
self.acct.unregister()
self.config.remove_option(self.acct.fromAddress, 'gateway')
self.config.save()
queues.UISignalQueue.put(('updateStatusBar', _translate(
"EmailGatewayDialog",
"Sending email gateway unregistration request"
)))
elif self.radioButtonStatus.isChecked():
self.acct.status()
queues.UISignalQueue.put(('updateStatusBar', _translate(
"EmailGatewayDialog",
"Sending email gateway status request"
)))
elif self.radioButtonSettings.isChecked():
self.data = self.acct
super(EmailGatewayDialog, self).accept()

View File

@ -634,8 +634,12 @@ class Ui_MainWindow(object):
self.menubar.addAction(self.menuHelp.menuAction()) self.menubar.addAction(self.menuHelp.menuAction())
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(0) self.tabWidget.setCurrentIndex(
self.tabWidgetSend.setCurrentIndex(0) self.tabWidget.indexOf(self.inbox)
)
self.tabWidgetSend.setCurrentIndex(
self.tabWidgetSend.indexOf(self.sendDirect)
)
QtCore.QMetaObject.connectSlotsByName(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage) MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage)
MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom) MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom)

View File

@ -1,64 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'connect.ui'
#
# Created: Wed Jul 24 12:42:01 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_connectDialog(object):
def setupUi(self, connectDialog):
connectDialog.setObjectName(_fromUtf8("connectDialog"))
connectDialog.resize(400, 124)
self.gridLayout = QtGui.QGridLayout(connectDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.label = QtGui.QLabel(connectDialog)
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout.addWidget(self.label, 0, 0, 1, 2)
self.radioButtonConnectNow = QtGui.QRadioButton(connectDialog)
self.radioButtonConnectNow.setChecked(True)
self.radioButtonConnectNow.setObjectName(_fromUtf8("radioButtonConnectNow"))
self.gridLayout.addWidget(self.radioButtonConnectNow, 1, 0, 1, 2)
self.radioButtonConfigureNetwork = QtGui.QRadioButton(connectDialog)
self.radioButtonConfigureNetwork.setObjectName(_fromUtf8("radioButtonConfigureNetwork"))
self.gridLayout.addWidget(self.radioButtonConfigureNetwork, 2, 0, 1, 2)
self.radioButtonWorkOffline = QtGui.QRadioButton(connectDialog)
self.radioButtonWorkOffline.setObjectName(_fromUtf8("radioButtonWorkOffline"))
self.gridLayout.addWidget(self.radioButtonWorkOffline, 3, 0, 1, 2)
spacerItem = QtGui.QSpacerItem(185, 24, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem, 4, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(connectDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 4, 1, 1, 1)
self.retranslateUi(connectDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), connectDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), connectDialog.reject)
QtCore.QMetaObject.connectSlotsByName(connectDialog)
def retranslateUi(self, connectDialog):
connectDialog.setWindowTitle(_translate("connectDialog", "Bitmessage", None))
self.label.setText(_translate("connectDialog", "Bitmessage won\'t connect to anyone until you let it. ", None))
self.radioButtonConnectNow.setText(_translate("connectDialog", "Connect now", None))
self.radioButtonConfigureNetwork.setText(_translate("connectDialog", "Let me configure special network settings first", None))
self.radioButtonWorkOffline.setText(_translate("connectDialog", "Work offline", None))

View File

@ -38,7 +38,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0" colspan="2">
<widget class="QRadioButton" name="radioButtonWorkOffline">
<property name="text">
<string>Work offline</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -51,7 +58,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>

View File

@ -1,42 +1,76 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtGui
from addaddressdialog import Ui_AddAddressDialog
from addresses import decodeAddress
from tr import _translate from tr import _translate
from retranslateui import RetranslateMixin
import widgets
from newchandialog import NewChanDialog
from address_dialogs import (
AddAddressDialog, NewAddressDialog, NewSubscriptionDialog,
RegenerateAddressesDialog, SpecialAddressBehaviorDialog, EmailGatewayDialog
)
import paths
from version import softwareVersion
class AddAddressDialog(QtGui.QDialog): __all__ = [
"NewChanDialog", "AddAddressDialog", "NewAddressDialog",
"NewSubscriptionDialog", "RegenerateAddressesDialog",
"SpecialAddressBehaviorDialog", "EmailGatewayDialog"
]
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_AddAddressDialog()
self.ui.setupUi(self)
self.parent = parent
QtCore.QObject.connect(self.ui.lineEditAddress, QtCore.SIGNAL(
"textChanged(QString)"), self.addressChanged)
def addressChanged(self, QString): class AboutDialog(QtGui.QDialog, RetranslateMixin):
status, a, b, c = decodeAddress(str(QString)) def __init__(self, parent=None):
if status == 'missingbm': super(AboutDialog, self).__init__(parent)
self.ui.labelAddressCheck.setText(_translate( widgets.load('about.ui', self)
"MainWindow", "The address should start with ''BM-''")) last_commit = paths.lastCommit()
elif status == 'checksumfailed': version = softwareVersion
self.ui.labelAddressCheck.setText(_translate( commit = last_commit.get('commit')
"MainWindow", "The address is not typed or copied correctly (the checksum failed).")) if commit:
elif status == 'versiontoohigh': version += '-' + commit[:7]
self.ui.labelAddressCheck.setText(_translate( self.labelVersion.setText(
"MainWindow", "The version number of this address is higher than this software can support. Please upgrade Bitmessage.")) self.labelVersion.text().replace(
elif status == 'invalidcharacters': ':version:', version
self.ui.labelAddressCheck.setText(_translate( ).replace(':branch:', commit or 'v%s' % version)
"MainWindow", "The address contains invalid characters.")) )
elif status == 'ripetooshort': self.labelVersion.setOpenExternalLinks(True)
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is too short.")) try:
elif status == 'ripetoolong': self.label_2.setText(
self.ui.labelAddressCheck.setText(_translate( self.label_2.text().replace(
"MainWindow", "Some data encoded in the address is too long.")) '2017', str(last_commit.get('time').year)
elif status == 'varintmalformed': ))
self.ui.labelAddressCheck.setText(_translate( except AttributeError:
"MainWindow", "Some data encoded in the address is malformed.")) pass
elif status == 'success':
self.ui.labelAddressCheck.setText( QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
_translate("MainWindow", "Address is valid."))
class IconGlossaryDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None, config=None):
super(IconGlossaryDialog, self).__init__(parent)
widgets.load('iconglossary.ui', self)
# FIXME: check the window title visibility here
self.groupBox.setTitle('')
self.labelPortNumber.setText(_translate(
"iconGlossaryDialog",
"You are using TCP port %1. (This can be changed in the settings)."
).arg(config.getint('bitmessagesettings', 'port')))
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class HelpDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None):
super(HelpDialog, self).__init__(parent)
widgets.load('help.ui', self)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class ConnectDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None):
super(ConnectDialog, self).__init__(parent)
widgets.load('connect.ui', self)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))

View File

@ -1,103 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'emailgateway.ui'
#
# Created: Fri Apr 26 17:43:31 2013
# by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_EmailGatewayDialog(object):
def setupUi(self, EmailGatewayDialog):
EmailGatewayDialog.setObjectName(_fromUtf8("EmailGatewayDialog"))
EmailGatewayDialog.resize(386, 172)
self.gridLayout = QtGui.QGridLayout(EmailGatewayDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.radioButtonRegister = QtGui.QRadioButton(EmailGatewayDialog)
self.radioButtonRegister.setChecked(True)
self.radioButtonRegister.setObjectName(_fromUtf8("radioButtonRegister"))
self.gridLayout.addWidget(self.radioButtonRegister, 1, 0, 1, 1)
self.radioButtonStatus = QtGui.QRadioButton(EmailGatewayDialog)
self.radioButtonStatus.setObjectName(_fromUtf8("radioButtonStatus"))
self.gridLayout.addWidget(self.radioButtonStatus, 4, 0, 1, 1)
self.radioButtonSettings = QtGui.QRadioButton(EmailGatewayDialog)
self.radioButtonSettings.setObjectName(_fromUtf8("radioButtonSettings"))
self.gridLayout.addWidget(self.radioButtonSettings, 5, 0, 1, 1)
self.radioButtonUnregister = QtGui.QRadioButton(EmailGatewayDialog)
self.radioButtonUnregister.setObjectName(_fromUtf8("radioButtonUnregister"))
self.gridLayout.addWidget(self.radioButtonUnregister, 6, 0, 1, 1)
self.label = QtGui.QLabel(EmailGatewayDialog)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.label_2 = QtGui.QLabel(EmailGatewayDialog)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
self.lineEditEmail = QtGui.QLineEdit(EmailGatewayDialog)
self.lineEditEmail.setEnabled(True)
self.lineEditEmail.setObjectName(_fromUtf8("lineEditEmail"))
self.gridLayout.addWidget(self.lineEditEmail, 3, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(EmailGatewayDialog)
self.buttonBox.setMinimumSize(QtCore.QSize(368, 0))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 7, 0, 1, 1)
self.retranslateUi(EmailGatewayDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), EmailGatewayDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), EmailGatewayDialog.reject)
QtCore.QObject.connect(self.radioButtonRegister, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setEnabled)
QtCore.QObject.connect(self.radioButtonStatus, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setDisabled)
QtCore.QObject.connect(self.radioButtonSettings, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setDisabled)
QtCore.QObject.connect(self.radioButtonUnregister, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setDisabled)
QtCore.QMetaObject.connectSlotsByName(EmailGatewayDialog)
EmailGatewayDialog.setTabOrder(self.radioButtonRegister, self.lineEditEmail)
EmailGatewayDialog.setTabOrder(self.lineEditEmail, self.radioButtonUnregister)
EmailGatewayDialog.setTabOrder(self.radioButtonUnregister, self.buttonBox)
def retranslateUi(self, EmailGatewayDialog):
EmailGatewayDialog.setWindowTitle(QtGui.QApplication.translate("EmailGatewayDialog", "Email gateway", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonRegister.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Register on email gateway", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonStatus.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Account status at email gateway", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonSettings.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Change account settings at email gateway", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonUnregister.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Unregister from email gateway", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Email gateway allows you to communicate with email users. Currently, only the Mailchuck email gateway (@mailchuck.com) is available.", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Desired email address (including @mailchuck.com):", None, QtGui.QApplication.UnicodeUTF8))
class Ui_EmailGatewayRegistrationDialog(object):
def setupUi(self, EmailGatewayRegistrationDialog):
EmailGatewayRegistrationDialog.setObjectName(_fromUtf8("EmailGatewayRegistrationDialog"))
EmailGatewayRegistrationDialog.resize(386, 172)
self.gridLayout = QtGui.QGridLayout(EmailGatewayRegistrationDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.label = QtGui.QLabel(EmailGatewayRegistrationDialog)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.lineEditEmail = QtGui.QLineEdit(EmailGatewayRegistrationDialog)
self.lineEditEmail.setObjectName(_fromUtf8("lineEditEmail"))
self.gridLayout.addWidget(self.lineEditEmail, 1, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(EmailGatewayRegistrationDialog)
self.buttonBox.setMinimumSize(QtCore.QSize(368, 0))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 7, 0, 1, 1)
self.retranslateUi(EmailGatewayRegistrationDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), EmailGatewayRegistrationDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), EmailGatewayRegistrationDialog.reject)
QtCore.QMetaObject.connectSlotsByName(EmailGatewayRegistrationDialog)
def retranslateUi(self, EmailGatewayRegistrationDialog):
EmailGatewayRegistrationDialog.setWindowTitle(QtGui.QApplication.translate("EmailGatewayRegistrationDialog", "Email gateway registration", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("EmailGatewayRegistrationDialog", "Email gateway allows you to communicate with email users. Currently, only the Mailchuck email gateway (@mailchuck.com) is available.\nPlease type the desired email address (including @mailchuck.com) below:", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -7,20 +7,20 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>386</width> <width>386</width>
<height>172</height> <height>240</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Email gateway</string> <string>Email gateway</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="4" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Desired email address (including @mailchuck.com)</string> <string>Desired email address (including @mailchuck.com):</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -50,28 +50,60 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="4" column="0">
<widget class="QLineEdit" name="lineEditEmailAddress"> <widget class="QLineEdit" name="lineEditEmail">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>@mailchuck.com</string> <string>@mailchuck.com</string>
</property> </property>
<property name="cursorPosition">
<number>0</number>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Email gateway alows you to communicate with email users. Currently, only the Mailchuck email gateway (@mailchuck.com) is available.</string> <string>Email gateway allows you to communicate with email users. Currently, only the Mailchuck email gateway (@mailchuck.com) is available.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QRadioButton" name="radioButtonStatus">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Account status at email gateway</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QRadioButton" name="radioButtonSettings">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Change account settings at email gateway</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="0"> <item row="7" column="0">
<widget class="QRadioButton" name="radioButtonUnregister"> <widget class="QRadioButton" name="radioButtonUnregister">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>Unregister from email gateway</string> <string>Unregister from email gateway</string>
</property> </property>
@ -84,7 +116,10 @@
</widget> </widget>
<tabstops> <tabstops>
<tabstop>radioButtonRegister</tabstop> <tabstop>radioButtonRegister</tabstop>
<tabstop>lineEditEmailAddress</tabstop> <tabstop>lineEditEmail</tabstop>
<tabstop>radioButtonStatus</tabstop>
<tabstop>radioButtonSettings</tabstop>
<tabstop>radioButtonUnregister</tabstop>
<tabstop>buttonBox</tabstop> <tabstop>buttonBox</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
@ -124,7 +159,7 @@
<connection> <connection>
<sender>radioButtonRegister</sender> <sender>radioButtonRegister</sender>
<signal>clicked(bool)</signal> <signal>clicked(bool)</signal>
<receiver>lineEditEmailAddress</receiver> <receiver>lineEditEmail</receiver>
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -140,7 +175,7 @@
<connection> <connection>
<sender>radioButtonUnregister</sender> <sender>radioButtonUnregister</sender>
<signal>clicked(bool)</signal> <signal>clicked(bool)</signal>
<receiver>lineEditEmailAddress</receiver> <receiver>lineEditEmail</receiver>
<slot>setDisabled(bool)</slot> <slot>setDisabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -153,5 +188,37 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>radioButtonStatus</sender>
<signal>clicked(bool)</signal>
<receiver>lineEditEmail</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioButtonSettings</sender>
<signal>clicked(bool)</signal>
<receiver>lineEditEmail</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
</connections> </connections>
</ui> </ui>

View File

@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'help.ui'
#
# Created: Wed Jan 14 22:42:39 2015
# by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_helpDialog(object):
def setupUi(self, helpDialog):
helpDialog.setObjectName(_fromUtf8("helpDialog"))
helpDialog.resize(335, 96)
self.formLayout = QtGui.QFormLayout(helpDialog)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.labelHelpURI = QtGui.QLabel(helpDialog)
self.labelHelpURI.setOpenExternalLinks(True)
self.labelHelpURI.setObjectName(_fromUtf8("labelHelpURI"))
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.labelHelpURI)
self.label = QtGui.QLabel(helpDialog)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout.setWidget(0, QtGui.QFormLayout.SpanningRole, self.label)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.formLayout.setItem(2, QtGui.QFormLayout.LabelRole, spacerItem)
self.buttonBox = QtGui.QDialogButtonBox(helpDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.buttonBox)
self.retranslateUi(helpDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), helpDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), helpDialog.reject)
QtCore.QMetaObject.connectSlotsByName(helpDialog)
def retranslateUi(self, helpDialog):
helpDialog.setWindowTitle(QtGui.QApplication.translate("helpDialog", "Help", None, QtGui.QApplication.UnicodeUTF8))
self.labelHelpURI.setText(QtGui.QApplication.translate("helpDialog", "<a href=\"https://bitmessage.org/wiki/PyBitmessage_Help\">https://bitmessage.org/wiki/PyBitmessage_Help</a>", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("helpDialog", "As Bitmessage is a collaborative project, help can be found online in the Bitmessage Wiki:", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -1,98 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'iconglossary.ui'
#
# Created: Thu Jun 13 20:15:48 2013
# by: PyQt4 UI code generator 4.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_iconGlossaryDialog(object):
def setupUi(self, iconGlossaryDialog):
iconGlossaryDialog.setObjectName(_fromUtf8("iconGlossaryDialog"))
iconGlossaryDialog.resize(424, 282)
self.gridLayout = QtGui.QGridLayout(iconGlossaryDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.groupBox = QtGui.QGroupBox(iconGlossaryDialog)
self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.gridLayout_2 = QtGui.QGridLayout(self.groupBox)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.label = QtGui.QLabel(self.groupBox)
self.label.setText(_fromUtf8(""))
self.label.setPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/redicon.png")))
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1)
self.label_2 = QtGui.QLabel(self.groupBox)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout_2.addWidget(self.label_2, 0, 1, 1, 1)
self.label_3 = QtGui.QLabel(self.groupBox)
self.label_3.setText(_fromUtf8(""))
self.label_3.setPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/yellowicon.png")))
self.label_3.setObjectName(_fromUtf8("label_3"))
self.gridLayout_2.addWidget(self.label_3, 1, 0, 1, 1)
self.label_4 = QtGui.QLabel(self.groupBox)
self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_4.setWordWrap(True)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.gridLayout_2.addWidget(self.label_4, 1, 1, 2, 1)
spacerItem = QtGui.QSpacerItem(20, 73, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem, 2, 0, 2, 1)
self.labelPortNumber = QtGui.QLabel(self.groupBox)
self.labelPortNumber.setObjectName(_fromUtf8("labelPortNumber"))
self.gridLayout_2.addWidget(self.labelPortNumber, 3, 1, 1, 1)
self.label_5 = QtGui.QLabel(self.groupBox)
self.label_5.setText(_fromUtf8(""))
self.label_5.setPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/greenicon.png")))
self.label_5.setObjectName(_fromUtf8("label_5"))
self.gridLayout_2.addWidget(self.label_5, 4, 0, 1, 1)
self.label_6 = QtGui.QLabel(self.groupBox)
self.label_6.setWordWrap(True)
self.label_6.setObjectName(_fromUtf8("label_6"))
self.gridLayout_2.addWidget(self.label_6, 4, 1, 1, 1)
self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(iconGlossaryDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)
self.retranslateUi(iconGlossaryDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), iconGlossaryDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), iconGlossaryDialog.reject)
QtCore.QMetaObject.connectSlotsByName(iconGlossaryDialog)
def retranslateUi(self, iconGlossaryDialog):
iconGlossaryDialog.setWindowTitle(_translate("iconGlossaryDialog", "Icon Glossary", None))
self.groupBox.setTitle(_translate("iconGlossaryDialog", "Icon Glossary", None))
self.label_2.setText(_translate("iconGlossaryDialog", "You have no connections with other peers. ", None))
self.label_4.setText(_translate("iconGlossaryDialog", "You have made at least one connection to a peer using an outgoing connection but you have not yet received any incoming connections. Your firewall or home router probably isn\'t configured to forward incoming TCP connections to your computer. Bitmessage will work just fine but it would help the Bitmessage network if you allowed for incoming connections and will help you be a better-connected node.", None))
self.labelPortNumber.setText(_translate("iconGlossaryDialog", "You are using TCP port ?. (This can be changed in the settings).", None))
self.label_6.setText(_translate("iconGlossaryDialog", "You do have connections with other peers and your firewall is correctly configured.", None))
import bitmessage_icons_rc
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
iconGlossaryDialog = QtGui.QDialog()
ui = Ui_iconGlossaryDialog()
ui.setupUi(iconGlossaryDialog)
iconGlossaryDialog.show()
sys.exit(app.exec_())

View File

@ -76,7 +76,7 @@
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLabel" name="labelPortNumber"> <widget class="QLabel" name="labelPortNumber">
<property name="text"> <property name="text">
<string>You are using TCP port ?. (This can be changed in the settings).</string> <string notr="true">You are using TCP port ?. (This can be changed in the settings).</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -53,15 +53,20 @@ class MessageView(QtGui.QTextBrowser):
def confirmURL(self, link): def confirmURL(self, link):
if link.scheme() == "mailto": if link.scheme() == "mailto":
QtGui.QApplication.activeWindow().ui.lineEditTo.setText(link.path()) window = QtGui.QApplication.activeWindow()
window.ui.lineEditTo.setText(link.path())
if link.hasQueryItem("subject"): if link.hasQueryItem("subject"):
QtGui.QApplication.activeWindow().ui.lineEditSubject.setText(link.queryItemValue("subject")) window.ui.lineEditSubject.setText(
link.queryItemValue("subject"))
if link.hasQueryItem("body"): if link.hasQueryItem("body"):
QtGui.QApplication.activeWindow().ui.textEditMessage.setText(link.queryItemValue("body")) window.ui.textEditMessage.setText(
QtGui.QApplication.activeWindow().setSendFromComboBox() link.queryItemValue("body"))
QtGui.QApplication.activeWindow().ui.tabWidgetSend.setCurrentIndex(0) window.setSendFromComboBox()
QtGui.QApplication.activeWindow().ui.tabWidget.setCurrentIndex(1) window.ui.tabWidgetSend.setCurrentIndex(0)
QtGui.QApplication.activeWindow().ui.textEditMessage.setFocus() window.ui.tabWidget.setCurrentIndex(
window.ui.tabWidget.indexOf(window.ui.send)
)
window.ui.textEditMessage.setFocus()
return return
reply = QtGui.QMessageBox.warning(self, reply = QtGui.QMessageBox.warning(self,
QtGui.QApplication.translate("MessageView", "Follow external link"), QtGui.QApplication.translate("MessageView", "Follow external link"),

View File

@ -1,193 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'newaddressdialog.ui'
#
# Created: Sun Sep 15 23:53:31 2013
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_NewAddressDialog(object):
def setupUi(self, NewAddressDialog):
NewAddressDialog.setObjectName(_fromUtf8("NewAddressDialog"))
NewAddressDialog.resize(723, 704)
self.formLayout = QtGui.QFormLayout(NewAddressDialog)
self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.label = QtGui.QLabel(NewAddressDialog)
self.label.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout.setWidget(0, QtGui.QFormLayout.SpanningRole, self.label)
self.label_5 = QtGui.QLabel(NewAddressDialog)
self.label_5.setWordWrap(True)
self.label_5.setObjectName(_fromUtf8("label_5"))
self.formLayout.setWidget(2, QtGui.QFormLayout.SpanningRole, self.label_5)
self.line = QtGui.QFrame(NewAddressDialog)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.line.sizePolicy().hasHeightForWidth())
self.line.setSizePolicy(sizePolicy)
self.line.setMinimumSize(QtCore.QSize(100, 2))
self.line.setFrameShape(QtGui.QFrame.HLine)
self.line.setFrameShadow(QtGui.QFrame.Sunken)
self.line.setObjectName(_fromUtf8("line"))
self.formLayout.setWidget(4, QtGui.QFormLayout.SpanningRole, self.line)
self.radioButtonRandomAddress = QtGui.QRadioButton(NewAddressDialog)
self.radioButtonRandomAddress.setChecked(True)
self.radioButtonRandomAddress.setObjectName(_fromUtf8("radioButtonRandomAddress"))
self.buttonGroup = QtGui.QButtonGroup(NewAddressDialog)
self.buttonGroup.setObjectName(_fromUtf8("buttonGroup"))
self.buttonGroup.addButton(self.radioButtonRandomAddress)
self.formLayout.setWidget(5, QtGui.QFormLayout.SpanningRole, self.radioButtonRandomAddress)
self.radioButtonDeterministicAddress = QtGui.QRadioButton(NewAddressDialog)
self.radioButtonDeterministicAddress.setObjectName(_fromUtf8("radioButtonDeterministicAddress"))
self.buttonGroup.addButton(self.radioButtonDeterministicAddress)
self.formLayout.setWidget(6, QtGui.QFormLayout.LabelRole, self.radioButtonDeterministicAddress)
self.checkBoxEighteenByteRipe = QtGui.QCheckBox(NewAddressDialog)
self.checkBoxEighteenByteRipe.setObjectName(_fromUtf8("checkBoxEighteenByteRipe"))
self.formLayout.setWidget(9, QtGui.QFormLayout.SpanningRole, self.checkBoxEighteenByteRipe)
self.groupBoxDeterministic = QtGui.QGroupBox(NewAddressDialog)
self.groupBoxDeterministic.setObjectName(_fromUtf8("groupBoxDeterministic"))
self.gridLayout = QtGui.QGridLayout(self.groupBoxDeterministic)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.label_9 = QtGui.QLabel(self.groupBoxDeterministic)
self.label_9.setObjectName(_fromUtf8("label_9"))
self.gridLayout.addWidget(self.label_9, 6, 0, 1, 1)
self.label_8 = QtGui.QLabel(self.groupBoxDeterministic)
self.label_8.setObjectName(_fromUtf8("label_8"))
self.gridLayout.addWidget(self.label_8, 5, 0, 1, 3)
self.spinBoxNumberOfAddressesToMake = QtGui.QSpinBox(self.groupBoxDeterministic)
self.spinBoxNumberOfAddressesToMake.setMinimum(1)
self.spinBoxNumberOfAddressesToMake.setProperty("value", 8)
self.spinBoxNumberOfAddressesToMake.setObjectName(_fromUtf8("spinBoxNumberOfAddressesToMake"))
self.gridLayout.addWidget(self.spinBoxNumberOfAddressesToMake, 4, 3, 1, 1)
self.label_6 = QtGui.QLabel(self.groupBoxDeterministic)
self.label_6.setObjectName(_fromUtf8("label_6"))
self.gridLayout.addWidget(self.label_6, 0, 0, 1, 1)
self.label_11 = QtGui.QLabel(self.groupBoxDeterministic)
self.label_11.setObjectName(_fromUtf8("label_11"))
self.gridLayout.addWidget(self.label_11, 4, 0, 1, 3)
spacerItem = QtGui.QSpacerItem(73, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem, 6, 1, 1, 1)
self.label_10 = QtGui.QLabel(self.groupBoxDeterministic)
self.label_10.setObjectName(_fromUtf8("label_10"))
self.gridLayout.addWidget(self.label_10, 6, 2, 1, 1)
spacerItem1 = QtGui.QSpacerItem(42, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem1, 6, 3, 1, 1)
self.label_7 = QtGui.QLabel(self.groupBoxDeterministic)
self.label_7.setObjectName(_fromUtf8("label_7"))
self.gridLayout.addWidget(self.label_7, 2, 0, 1, 1)
self.lineEditPassphraseAgain = QtGui.QLineEdit(self.groupBoxDeterministic)
self.lineEditPassphraseAgain.setEchoMode(QtGui.QLineEdit.Password)
self.lineEditPassphraseAgain.setObjectName(_fromUtf8("lineEditPassphraseAgain"))
self.gridLayout.addWidget(self.lineEditPassphraseAgain, 3, 0, 1, 4)
self.lineEditPassphrase = QtGui.QLineEdit(self.groupBoxDeterministic)
self.lineEditPassphrase.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText)
self.lineEditPassphrase.setEchoMode(QtGui.QLineEdit.Password)
self.lineEditPassphrase.setObjectName(_fromUtf8("lineEditPassphrase"))
self.gridLayout.addWidget(self.lineEditPassphrase, 1, 0, 1, 4)
self.formLayout.setWidget(8, QtGui.QFormLayout.LabelRole, self.groupBoxDeterministic)
self.groupBox = QtGui.QGroupBox(NewAddressDialog)
self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.gridLayout_2 = QtGui.QGridLayout(self.groupBox)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.label_2 = QtGui.QLabel(self.groupBox)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 2)
self.newaddresslabel = QtGui.QLineEdit(self.groupBox)
self.newaddresslabel.setObjectName(_fromUtf8("newaddresslabel"))
self.gridLayout_2.addWidget(self.newaddresslabel, 1, 0, 1, 2)
self.radioButtonMostAvailable = QtGui.QRadioButton(self.groupBox)
self.radioButtonMostAvailable.setChecked(True)
self.radioButtonMostAvailable.setObjectName(_fromUtf8("radioButtonMostAvailable"))
self.gridLayout_2.addWidget(self.radioButtonMostAvailable, 2, 0, 1, 2)
self.label_3 = QtGui.QLabel(self.groupBox)
self.label_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.gridLayout_2.addWidget(self.label_3, 3, 1, 1, 1)
self.radioButtonExisting = QtGui.QRadioButton(self.groupBox)
self.radioButtonExisting.setChecked(False)
self.radioButtonExisting.setObjectName(_fromUtf8("radioButtonExisting"))
self.gridLayout_2.addWidget(self.radioButtonExisting, 4, 0, 1, 2)
self.label_4 = QtGui.QLabel(self.groupBox)
self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.gridLayout_2.addWidget(self.label_4, 5, 1, 1, 1)
spacerItem2 = QtGui.QSpacerItem(13, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_2.addItem(spacerItem2, 6, 0, 1, 1)
self.comboBoxExisting = QtGui.QComboBox(self.groupBox)
self.comboBoxExisting.setEnabled(False)
self.comboBoxExisting.setEditable(True)
self.comboBoxExisting.setObjectName(_fromUtf8("comboBoxExisting"))
self.gridLayout_2.addWidget(self.comboBoxExisting, 6, 1, 1, 1)
self.formLayout.setWidget(7, QtGui.QFormLayout.LabelRole, self.groupBox)
self.buttonBox = QtGui.QDialogButtonBox(NewAddressDialog)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
self.buttonBox.setSizePolicy(sizePolicy)
self.buttonBox.setMinimumSize(QtCore.QSize(160, 0))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.formLayout.setWidget(10, QtGui.QFormLayout.SpanningRole, self.buttonBox)
self.retranslateUi(NewAddressDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), NewAddressDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), NewAddressDialog.reject)
QtCore.QObject.connect(self.radioButtonExisting, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.comboBoxExisting.setEnabled)
QtCore.QObject.connect(self.radioButtonDeterministicAddress, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.groupBoxDeterministic.setShown)
QtCore.QObject.connect(self.radioButtonRandomAddress, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.groupBox.setShown)
QtCore.QMetaObject.connectSlotsByName(NewAddressDialog)
NewAddressDialog.setTabOrder(self.radioButtonRandomAddress, self.radioButtonDeterministicAddress)
NewAddressDialog.setTabOrder(self.radioButtonDeterministicAddress, self.newaddresslabel)
NewAddressDialog.setTabOrder(self.newaddresslabel, self.radioButtonMostAvailable)
NewAddressDialog.setTabOrder(self.radioButtonMostAvailable, self.radioButtonExisting)
NewAddressDialog.setTabOrder(self.radioButtonExisting, self.comboBoxExisting)
NewAddressDialog.setTabOrder(self.comboBoxExisting, self.lineEditPassphrase)
NewAddressDialog.setTabOrder(self.lineEditPassphrase, self.lineEditPassphraseAgain)
NewAddressDialog.setTabOrder(self.lineEditPassphraseAgain, self.spinBoxNumberOfAddressesToMake)
NewAddressDialog.setTabOrder(self.spinBoxNumberOfAddressesToMake, self.checkBoxEighteenByteRipe)
NewAddressDialog.setTabOrder(self.checkBoxEighteenByteRipe, self.buttonBox)
def retranslateUi(self, NewAddressDialog):
NewAddressDialog.setWindowTitle(_translate("NewAddressDialog", "Create new Address", None))
self.label.setText(_translate("NewAddressDialog", "Here you may generate as many addresses as you like. Indeed, creating and abandoning addresses is encouraged. You may generate addresses by using either random numbers or by using a passphrase. If you use a passphrase, the address is called a \"deterministic\" address.\n"
"The \'Random Number\' option is selected by default but deterministic addresses have several pros and cons:", None))
self.label_5.setText(_translate("NewAddressDialog", "<html><head/><body><p><span style=\" font-weight:600;\">Pros:<br/></span>You can recreate your addresses on any computer from memory. <br/>You need-not worry about backing up your keys.dat file as long as you can remember your passphrase. <br/><span style=\" font-weight:600;\">Cons:<br/></span>You must remember (or write down) your passphrase if you expect to be able to recreate your keys if they are lost. <br/>You must remember the address version number and the stream number along with your passphrase. <br/>If you choose a weak passphrase and someone on the Internet can brute-force it, they can read your messages and send messages as you.</p></body></html>", None))
self.radioButtonRandomAddress.setText(_translate("NewAddressDialog", "Use a random number generator to make an address", None))
self.radioButtonDeterministicAddress.setText(_translate("NewAddressDialog", "Use a passphrase to make addresses", None))
self.checkBoxEighteenByteRipe.setText(_translate("NewAddressDialog", "Spend several minutes of extra computing time to make the address(es) 1 or 2 characters shorter", None))
self.groupBoxDeterministic.setTitle(_translate("NewAddressDialog", "Make deterministic addresses", None))
self.label_9.setText(_translate("NewAddressDialog", "Address version number: 4", None))
self.label_8.setText(_translate("NewAddressDialog", "In addition to your passphrase, you must remember these numbers:", None))
self.label_6.setText(_translate("NewAddressDialog", "Passphrase", None))
self.label_11.setText(_translate("NewAddressDialog", "Number of addresses to make based on your passphrase:", None))
self.label_10.setText(_translate("NewAddressDialog", "Stream number: 1", None))
self.label_7.setText(_translate("NewAddressDialog", "Retype passphrase", None))
self.groupBox.setTitle(_translate("NewAddressDialog", "Randomly generate address", None))
self.label_2.setText(_translate("NewAddressDialog", "Label (not shown to anyone except you)", None))
self.radioButtonMostAvailable.setText(_translate("NewAddressDialog", "Use the most available stream", None))
self.label_3.setText(_translate("NewAddressDialog", " (best if this is the first of many addresses you will create)", None))
self.radioButtonExisting.setText(_translate("NewAddressDialog", "Use the same stream as an existing address", None))
self.label_4.setText(_translate("NewAddressDialog", "(saves you some bandwidth and processing power)", None))

View File

@ -36,7 +36,9 @@ class NewChanDialog(QtGui.QDialog, RetranslateMixin):
addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True) addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True)
if len(addressGeneratorReturnValue) > 0 and addressGeneratorReturnValue[0] != 'chan name does not match address': if len(addressGeneratorReturnValue) > 0 and addressGeneratorReturnValue[0] != 'chan name does not match address':
UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Successfully created / joined chan %1").arg(unicode(self.chanPassPhrase.text())))) UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Successfully created / joined chan %1").arg(unicode(self.chanPassPhrase.text()))))
self.parent.ui.tabWidget.setCurrentIndex(3) self.parent.ui.tabWidget.setCurrentIndex(
self.parent.ui.tabWidget.indexOf(self.parent.ui.chans)
)
self.done(QtGui.QDialog.Accepted) self.done(QtGui.QDialog.Accepted)
else: else:
UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining failed"))) UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining failed")))

View File

@ -1,69 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'newsubscriptiondialog.ui'
#
# Created: Sat Nov 30 21:53:38 2013
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_NewSubscriptionDialog(object):
def setupUi(self, NewSubscriptionDialog):
NewSubscriptionDialog.setObjectName(_fromUtf8("NewSubscriptionDialog"))
NewSubscriptionDialog.resize(368, 173)
self.formLayout = QtGui.QFormLayout(NewSubscriptionDialog)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.label_2 = QtGui.QLabel(NewSubscriptionDialog)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_2)
self.newsubscriptionlabel = QtGui.QLineEdit(NewSubscriptionDialog)
self.newsubscriptionlabel.setObjectName(_fromUtf8("newsubscriptionlabel"))
self.formLayout.setWidget(1, QtGui.QFormLayout.SpanningRole, self.newsubscriptionlabel)
self.label = QtGui.QLabel(NewSubscriptionDialog)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label)
self.lineEditSubscriptionAddress = QtGui.QLineEdit(NewSubscriptionDialog)
self.lineEditSubscriptionAddress.setObjectName(_fromUtf8("lineEditSubscriptionAddress"))
self.formLayout.setWidget(3, QtGui.QFormLayout.SpanningRole, self.lineEditSubscriptionAddress)
self.labelAddressCheck = QtGui.QLabel(NewSubscriptionDialog)
self.labelAddressCheck.setText(_fromUtf8(""))
self.labelAddressCheck.setWordWrap(True)
self.labelAddressCheck.setObjectName(_fromUtf8("labelAddressCheck"))
self.formLayout.setWidget(4, QtGui.QFormLayout.SpanningRole, self.labelAddressCheck)
self.checkBoxDisplayMessagesAlreadyInInventory = QtGui.QCheckBox(NewSubscriptionDialog)
self.checkBoxDisplayMessagesAlreadyInInventory.setEnabled(False)
self.checkBoxDisplayMessagesAlreadyInInventory.setObjectName(_fromUtf8("checkBoxDisplayMessagesAlreadyInInventory"))
self.formLayout.setWidget(5, QtGui.QFormLayout.SpanningRole, self.checkBoxDisplayMessagesAlreadyInInventory)
self.buttonBox = QtGui.QDialogButtonBox(NewSubscriptionDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.formLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.buttonBox)
self.retranslateUi(NewSubscriptionDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), NewSubscriptionDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), NewSubscriptionDialog.reject)
QtCore.QMetaObject.connectSlotsByName(NewSubscriptionDialog)
def retranslateUi(self, NewSubscriptionDialog):
NewSubscriptionDialog.setWindowTitle(_translate("NewSubscriptionDialog", "Add new entry", None))
self.label_2.setText(_translate("NewSubscriptionDialog", "Label", None))
self.label.setText(_translate("NewSubscriptionDialog", "Address", None))
self.checkBoxDisplayMessagesAlreadyInInventory.setText(_translate("NewSubscriptionDialog", "Enter an address above.", None))

View File

@ -7,9 +7,15 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>368</width> <width>368</width>
<height>173</height> <height>254</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>368</width>
<height>200</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Add new entry</string> <string>Add new entry</string>
</property> </property>
@ -22,7 +28,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="QLineEdit" name="newsubscriptionlabel"/> <widget class="QLineEdit" name="lineEditLabel"/>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
@ -32,7 +38,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<widget class="QLineEdit" name="lineEditSubscriptionAddress"/> <widget class="QLineEdit" name="lineEditAddress"/>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QLabel" name="labelAddressCheck"> <widget class="QLabel" name="labelAddressCheck">
@ -44,17 +50,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxDisplayMessagesAlreadyInInventory"> <widget class="QCheckBox" name="checkBoxDisplayMessagesAlreadyInInventory">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>CheckBox</string> <string>Enter an address above.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="7" column="1">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -64,6 +70,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@ -1,124 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'regenerateaddresses.ui'
#
# Created: Sun Sep 15 23:50:23 2013
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_regenerateAddressesDialog(object):
def setupUi(self, regenerateAddressesDialog):
regenerateAddressesDialog.setObjectName(_fromUtf8("regenerateAddressesDialog"))
regenerateAddressesDialog.resize(532, 332)
self.gridLayout_2 = QtGui.QGridLayout(regenerateAddressesDialog)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.buttonBox = QtGui.QDialogButtonBox(regenerateAddressesDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout_2.addWidget(self.buttonBox, 1, 0, 1, 1)
self.groupBox = QtGui.QGroupBox(regenerateAddressesDialog)
self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.gridLayout = QtGui.QGridLayout(self.groupBox)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.label_6 = QtGui.QLabel(self.groupBox)
self.label_6.setObjectName(_fromUtf8("label_6"))
self.gridLayout.addWidget(self.label_6, 1, 0, 1, 1)
self.lineEditPassphrase = QtGui.QLineEdit(self.groupBox)
self.lineEditPassphrase.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText)
self.lineEditPassphrase.setEchoMode(QtGui.QLineEdit.Password)
self.lineEditPassphrase.setObjectName(_fromUtf8("lineEditPassphrase"))
self.gridLayout.addWidget(self.lineEditPassphrase, 2, 0, 1, 5)
self.label_11 = QtGui.QLabel(self.groupBox)
self.label_11.setObjectName(_fromUtf8("label_11"))
self.gridLayout.addWidget(self.label_11, 3, 0, 1, 3)
self.spinBoxNumberOfAddressesToMake = QtGui.QSpinBox(self.groupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.spinBoxNumberOfAddressesToMake.sizePolicy().hasHeightForWidth())
self.spinBoxNumberOfAddressesToMake.setSizePolicy(sizePolicy)
self.spinBoxNumberOfAddressesToMake.setMinimum(1)
self.spinBoxNumberOfAddressesToMake.setProperty("value", 8)
self.spinBoxNumberOfAddressesToMake.setObjectName(_fromUtf8("spinBoxNumberOfAddressesToMake"))
self.gridLayout.addWidget(self.spinBoxNumberOfAddressesToMake, 3, 3, 1, 1)
spacerItem = QtGui.QSpacerItem(132, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem, 3, 4, 1, 1)
self.label_2 = QtGui.QLabel(self.groupBox)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout.addWidget(self.label_2, 4, 0, 1, 1)
self.lineEditAddressVersionNumber = QtGui.QLineEdit(self.groupBox)
self.lineEditAddressVersionNumber.setEnabled(True)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.lineEditAddressVersionNumber.sizePolicy().hasHeightForWidth())
self.lineEditAddressVersionNumber.setSizePolicy(sizePolicy)
self.lineEditAddressVersionNumber.setMaximumSize(QtCore.QSize(31, 16777215))
self.lineEditAddressVersionNumber.setText(_fromUtf8(""))
self.lineEditAddressVersionNumber.setObjectName(_fromUtf8("lineEditAddressVersionNumber"))
self.gridLayout.addWidget(self.lineEditAddressVersionNumber, 4, 1, 1, 1)
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem1, 4, 2, 1, 1)
self.label_3 = QtGui.QLabel(self.groupBox)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.gridLayout.addWidget(self.label_3, 5, 0, 1, 1)
self.lineEditStreamNumber = QtGui.QLineEdit(self.groupBox)
self.lineEditStreamNumber.setEnabled(False)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.lineEditStreamNumber.sizePolicy().hasHeightForWidth())
self.lineEditStreamNumber.setSizePolicy(sizePolicy)
self.lineEditStreamNumber.setMaximumSize(QtCore.QSize(31, 16777215))
self.lineEditStreamNumber.setObjectName(_fromUtf8("lineEditStreamNumber"))
self.gridLayout.addWidget(self.lineEditStreamNumber, 5, 1, 1, 1)
spacerItem2 = QtGui.QSpacerItem(325, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem2, 5, 2, 1, 3)
self.checkBoxEighteenByteRipe = QtGui.QCheckBox(self.groupBox)
self.checkBoxEighteenByteRipe.setObjectName(_fromUtf8("checkBoxEighteenByteRipe"))
self.gridLayout.addWidget(self.checkBoxEighteenByteRipe, 6, 0, 1, 5)
self.label_4 = QtGui.QLabel(self.groupBox)
self.label_4.setWordWrap(True)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.gridLayout.addWidget(self.label_4, 7, 0, 1, 5)
self.label = QtGui.QLabel(self.groupBox)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout.addWidget(self.label, 0, 0, 1, 5)
self.gridLayout_2.addWidget(self.groupBox, 0, 0, 1, 1)
self.retranslateUi(regenerateAddressesDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), regenerateAddressesDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), regenerateAddressesDialog.reject)
QtCore.QMetaObject.connectSlotsByName(regenerateAddressesDialog)
def retranslateUi(self, regenerateAddressesDialog):
regenerateAddressesDialog.setWindowTitle(_translate("regenerateAddressesDialog", "Regenerate Existing Addresses", None))
self.groupBox.setTitle(_translate("regenerateAddressesDialog", "Regenerate existing addresses", None))
self.label_6.setText(_translate("regenerateAddressesDialog", "Passphrase", None))
self.label_11.setText(_translate("regenerateAddressesDialog", "Number of addresses to make based on your passphrase:", None))
self.label_2.setText(_translate("regenerateAddressesDialog", "Address version number:", None))
self.label_3.setText(_translate("regenerateAddressesDialog", "Stream number:", None))
self.lineEditStreamNumber.setText(_translate("regenerateAddressesDialog", "1", None))
self.checkBoxEighteenByteRipe.setText(_translate("regenerateAddressesDialog", "Spend several minutes of extra computing time to make the address(es) 1 or 2 characters shorter", None))
self.label_4.setText(_translate("regenerateAddressesDialog", "You must check (or not check) this box just like you did (or didn\'t) when you made your addresses the first time.", None))
self.label.setText(_translate("regenerateAddressesDialog", "If you have previously made deterministic addresses but lost them due to an accident (like hard drive failure), you can regenerate them here. If you used the random number generator to make your addresses then this form will be of no use to you.", None))

View File

@ -1,64 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'specialaddressbehavior.ui'
#
# Created: Fri Apr 26 17:43:31 2013
# by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_SpecialAddressBehaviorDialog(object):
def setupUi(self, SpecialAddressBehaviorDialog):
SpecialAddressBehaviorDialog.setObjectName(_fromUtf8("SpecialAddressBehaviorDialog"))
SpecialAddressBehaviorDialog.resize(386, 172)
self.gridLayout = QtGui.QGridLayout(SpecialAddressBehaviorDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.radioButtonBehaveNormalAddress = QtGui.QRadioButton(SpecialAddressBehaviorDialog)
self.radioButtonBehaveNormalAddress.setChecked(True)
self.radioButtonBehaveNormalAddress.setObjectName(_fromUtf8("radioButtonBehaveNormalAddress"))
self.gridLayout.addWidget(self.radioButtonBehaveNormalAddress, 0, 0, 1, 1)
self.radioButtonBehaviorMailingList = QtGui.QRadioButton(SpecialAddressBehaviorDialog)
self.radioButtonBehaviorMailingList.setObjectName(_fromUtf8("radioButtonBehaviorMailingList"))
self.gridLayout.addWidget(self.radioButtonBehaviorMailingList, 1, 0, 1, 1)
self.label = QtGui.QLabel(SpecialAddressBehaviorDialog)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout.addWidget(self.label, 2, 0, 1, 1)
self.label_2 = QtGui.QLabel(SpecialAddressBehaviorDialog)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1)
self.lineEditMailingListName = QtGui.QLineEdit(SpecialAddressBehaviorDialog)
self.lineEditMailingListName.setEnabled(False)
self.lineEditMailingListName.setObjectName(_fromUtf8("lineEditMailingListName"))
self.gridLayout.addWidget(self.lineEditMailingListName, 4, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(SpecialAddressBehaviorDialog)
self.buttonBox.setMinimumSize(QtCore.QSize(368, 0))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1)
self.retranslateUi(SpecialAddressBehaviorDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), SpecialAddressBehaviorDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), SpecialAddressBehaviorDialog.reject)
QtCore.QObject.connect(self.radioButtonBehaviorMailingList, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditMailingListName.setEnabled)
QtCore.QObject.connect(self.radioButtonBehaveNormalAddress, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditMailingListName.setDisabled)
QtCore.QMetaObject.connectSlotsByName(SpecialAddressBehaviorDialog)
SpecialAddressBehaviorDialog.setTabOrder(self.radioButtonBehaveNormalAddress, self.radioButtonBehaviorMailingList)
SpecialAddressBehaviorDialog.setTabOrder(self.radioButtonBehaviorMailingList, self.lineEditMailingListName)
SpecialAddressBehaviorDialog.setTabOrder(self.lineEditMailingListName, self.buttonBox)
def retranslateUi(self, SpecialAddressBehaviorDialog):
SpecialAddressBehaviorDialog.setWindowTitle(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Special Address Behavior", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonBehaveNormalAddress.setText(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Behave as a normal address", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonBehaviorMailingList.setText(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Behave as a pseudo-mailing-list address", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Mail received to a pseudo-mailing-list address will be automatically broadcast to subscribers (and thus will be public).", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Name of the pseudo-mailing-list:", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -87,7 +87,7 @@ def createSupportMessage(myapp):
myapp.ui.lineEditTo.setText(SUPPORT_ADDRESS) myapp.ui.lineEditTo.setText(SUPPORT_ADDRESS)
version = softwareVersion version = softwareVersion
commit = paths.lastCommit() commit = paths.lastCommit().get('commit')
if commit: if commit:
version += " GIT " + commit version += " GIT " + commit
@ -129,6 +129,10 @@ def createSupportMessage(myapp):
myapp.ui.textEditMessage.setText(str(QtGui.QApplication.translate("Support", SUPPORT_MESSAGE)).format(version, os, architecture, pythonversion, opensslversion, frozen, portablemode, cpow, openclpow, locale, socks, upnp, connectedhosts)) myapp.ui.textEditMessage.setText(str(QtGui.QApplication.translate("Support", SUPPORT_MESSAGE)).format(version, os, architecture, pythonversion, opensslversion, frozen, portablemode, cpow, openclpow, locale, socks, upnp, connectedhosts))
# single msg tab # single msg tab
myapp.ui.tabWidgetSend.setCurrentIndex(0) myapp.ui.tabWidgetSend.setCurrentIndex(
myapp.ui.tabWidgetSend.indexOf(myapp.ui.sendDirect)
)
# send tab # send tab
myapp.ui.tabWidget.setCurrentIndex(1) myapp.ui.tabWidget.setCurrentIndex(
myapp.ui.tabWidget.indexOf(myapp.ui.send)
)

View File

@ -1,5 +1,7 @@
from os import environ, path from os import environ, path
import sys import sys
import re
from datetime import datetime
# When using py2exe or py2app, the variable frozen is added to the sys # When using py2exe or py2app, the variable frozen is added to the sys
# namespace. This can be used to setup a different code path for # namespace. This can be used to setup a different code path for
@ -95,13 +97,18 @@ def tail(f, lines=20):
all_read_text = ''.join(reversed(blocks)) all_read_text = ''.join(reversed(blocks))
return '\n'.join(all_read_text.splitlines()[-total_lines_wanted:]) return '\n'.join(all_read_text.splitlines()[-total_lines_wanted:])
def lastCommit(): def lastCommit():
githeadfile = path.join(codePath(), '..', '.git', 'logs', 'HEAD') githeadfile = path.join(codePath(), '..', '.git', 'logs', 'HEAD')
version = "" result = {}
if (path.isfile(githeadfile)): if path.isfile(githeadfile):
try: try:
with open(githeadfile, 'rt') as githead: with open(githeadfile, 'rt') as githead:
version = tail(githead, 1).split()[1] line = tail(githead, 1)
except IOError: result['commit'] = line.split()[1]
result['time'] = datetime.fromtimestamp(
float(re.search(r'>\s*(.*?)\s', line).group(1))
)
except (IOError, AttributeError, TypeError):
pass pass
return version return result