In identities tab:

- batch identities enabling/disabling
- send to this chan(s) context menu
This commit is contained in:
sendiulo 2013-09-04 15:52:29 +02:00
parent a36c696f9d
commit 9bbcb16deb
4 changed files with 87 additions and 32 deletions

View File

@ -197,6 +197,8 @@ class MyForm(QtGui.QMainWindow):
"MainWindow", "Disable"), self.on_action_YourIdentitiesDisable)
self.actionClipboard = self.ui.addressContextMenuToolbar.addAction(_translate(
"MainWindow", "Copy address to clipboard"), self.on_action_YourIdentitiesClipboard)
self.actionSendToChan = self.ui.addressContextMenuToolbar.addAction(_translate(
"MainWindow", "Send message to this chan"), self.on_action_YourIdentitiesSendToChan)
self.actionSpecialAddressBehavior = self.ui.addressContextMenuToolbar.addAction(_translate(
"MainWindow", "Special address behavior..."), self.on_action_SpecialAddressBehaviorDialog)
self.ui.tableWidgetYourIdentities.setContextMenuPolicy(
@ -207,6 +209,7 @@ class MyForm(QtGui.QMainWindow):
self.popMenu.addAction(self.actionNew)
self.popMenu.addSeparator()
self.popMenu.addAction(self.actionClipboard)
self.popMenu.addAction(self.actionSendToChan)
self.popMenu.addSeparator()
self.popMenu.addAction(self.actionEnable)
self.popMenu.addAction(self.actionDisable)
@ -2780,37 +2783,47 @@ class MyForm(QtGui.QMainWindow):
self.click_NewAddressDialog()
def on_action_YourIdentitiesEnable(self):
currentRow = self.ui.tableWidgetYourIdentities.currentRow()
addressAtCurrentRow = str(
self.ui.tableWidgetYourIdentities.item(currentRow, 1).text())
shared.config.set(addressAtCurrentRow, 'enabled', 'true')
listOfSelectedRows = {}
for i in range(len(self.ui.tableWidgetYourIdentities.selectedIndexes())):
listOfSelectedRows[
self.ui.tableWidgetYourIdentities.selectedIndexes()[i].row()] = 0
for currentRow in listOfSelectedRows:
addressAtCurrentRow = str(
self.ui.tableWidgetYourIdentities.item(currentRow, 1).text())
shared.config.set(addressAtCurrentRow, 'enabled', 'true')
self.ui.tableWidgetYourIdentities.item(
currentRow, 0).setTextColor(QApplication.palette().text().color())
self.ui.tableWidgetYourIdentities.item(
currentRow, 1).setTextColor(QApplication.palette().text().color())
self.ui.tableWidgetYourIdentities.item(
currentRow, 2).setTextColor(QApplication.palette().text().color())
if shared.safeConfigGetBoolean(addressAtCurrentRow, 'mailinglist'):
self.ui.tableWidgetYourIdentities.item(currentRow, 1).setTextColor(QtGui.QColor(137, 04, 177)) # purple
if shared.safeConfigGetBoolean(addressAtCurrentRow, 'chan'):
self.ui.tableWidgetYourIdentities.item(currentRow, 1).setTextColor(QtGui.QColor(216, 119, 0)) # orange
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile)
self.ui.tableWidgetYourIdentities.item(
currentRow, 0).setTextColor(QApplication.palette().text().color())
self.ui.tableWidgetYourIdentities.item(
currentRow, 1).setTextColor(QApplication.palette().text().color())
self.ui.tableWidgetYourIdentities.item(
currentRow, 2).setTextColor(QApplication.palette().text().color())
if shared.safeConfigGetBoolean(addressAtCurrentRow, 'mailinglist'):
self.ui.tableWidgetYourIdentities.item(currentRow, 1).setTextColor(QtGui.QColor(137, 04, 177))
if shared.safeConfigGetBoolean(addressAtCurrentRow, 'chan'):
self.ui.tableWidgetYourIdentities.item(currentRow, 1).setTextColor(QtGui.QColor(216, 119, 0)) # orange
shared.reloadMyAddressHashes()
def on_action_YourIdentitiesDisable(self):
currentRow = self.ui.tableWidgetYourIdentities.currentRow()
addressAtCurrentRow = str(
self.ui.tableWidgetYourIdentities.item(currentRow, 1).text())
shared.config.set(str(addressAtCurrentRow), 'enabled', 'false')
self.ui.tableWidgetYourIdentities.item(
currentRow, 0).setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetYourIdentities.item(
currentRow, 1).setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetYourIdentities.item(
currentRow, 2).setTextColor(QtGui.QColor(128, 128, 128))
if shared.safeConfigGetBoolean(addressAtCurrentRow, 'mailinglist'):
self.ui.tableWidgetYourIdentities.item(currentRow, 1).setTextColor(QtGui.QColor(137, 04, 177))
listOfSelectedRows = {}
for i in range(len(self.ui.tableWidgetYourIdentities.selectedIndexes())):
listOfSelectedRows[
self.ui.tableWidgetYourIdentities.selectedIndexes()[i].row()] = 0
for currentRow in listOfSelectedRows:
addressAtCurrentRow = str(
self.ui.tableWidgetYourIdentities.item(currentRow, 1).text())
shared.config.set(str(addressAtCurrentRow), 'enabled', 'false')
self.ui.tableWidgetYourIdentities.item(
currentRow, 0).setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetYourIdentities.item(
currentRow, 1).setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetYourIdentities.item(
currentRow, 2).setTextColor(QtGui.QColor(128, 128, 128))
if shared.safeConfigGetBoolean(addressAtCurrentRow, 'mailinglist'):
self.ui.tableWidgetYourIdentities.item(currentRow, 1).setTextColor(QtGui.QColor(137, 04, 177)) # purple
if shared.safeConfigGetBoolean(addressAtCurrentRow, 'chan'):
self.ui.tableWidgetYourIdentities.item(currentRow, 1).setTextColor(QtGui.QColor(216, 119, 0)) # orange
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile)
shared.reloadMyAddressHashes()
@ -2822,6 +2835,38 @@ class MyForm(QtGui.QMainWindow):
clipboard = QtGui.QApplication.clipboard()
clipboard.setText(str(addressAtCurrentRow))
def on_action_YourIdentitiesSendToChan(self):
###
listOfSelectedRows = {}
for i in range(len(self.ui.tableWidgetYourIdentities.selectedIndexes())):
listOfSelectedRows[
self.ui.tableWidgetYourIdentities.selectedIndexes()[i].row()] = 0
count = 0
for currentRow in listOfSelectedRows:
addressAtCurrentRow = self.ui.tableWidgetYourIdentities.item(
currentRow, 1).text()
if shared.safeConfigGetBoolean(str(addressAtCurrentRow), 'chan'):
if self.ui.lineEditTo.text() == '':
self.ui.lineEditTo.setText(str(addressAtCurrentRow))
else:
self.ui.lineEditTo.setText(str(
self.ui.lineEditTo.text()) + '; ' + str(addressAtCurrentRow))
else:
count += 1
if listOfSelectedRows == {}:
self.statusBar().showMessage(_translate(
"MainWindow", "No addresses selected."))
elif count == len(listOfSelectedRows):
self.statusBar().showMessage(_translate(
"MainWindow", "%1 addresses were no chans and therefore not added as recipient, because the client cannot handle messages to yourself.").arg(str(count)))
else:
if count > 0:
self.statusBar().showMessage(_translate(
"MainWindow", "%1 addresses were no chans and therefore not added as recipient, because the client cannot handle messages to yourself.").arg(str(count)))
else:
self.statusBar().showMessage('')
self.ui.tabWidget.setCurrentIndex(1)
def on_context_menuYourIdentities(self, point):
self.popMenu.exec_(
self.ui.tableWidgetYourIdentities.mapToGlobal(point))

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'bitmessageui.ui'
#
# Created: Mon Aug 12 00:08:20 2013
# Created: Wed Sep 04 14:20:25 2013
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
@ -237,7 +237,7 @@ class Ui_MainWindow(object):
self.tableWidgetYourIdentities.setFrameShadow(QtGui.QFrame.Sunken)
self.tableWidgetYourIdentities.setLineWidth(1)
self.tableWidgetYourIdentities.setAlternatingRowColors(True)
self.tableWidgetYourIdentities.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.tableWidgetYourIdentities.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.tableWidgetYourIdentities.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.tableWidgetYourIdentities.setObjectName(_fromUtf8("tableWidgetYourIdentities"))
self.tableWidgetYourIdentities.setColumnCount(3)
@ -490,7 +490,7 @@ class Ui_MainWindow(object):
self.menubar.addAction(self.menuHelp.menuAction())
self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(0)
self.tabWidget.setCurrentIndex(3)
QtCore.QObject.connect(self.radioButtonSpecific, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.lineEditTo.setEnabled)
QtCore.QObject.connect(self.radioButtonSpecific, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.labelSendBroadcastWarning.hide)
QtCore.QObject.connect(self.radioButtonBroadcast, QtCore.SIGNAL(_fromUtf8("clicked()")), self.labelSendBroadcastWarning.show)
@ -630,3 +630,13 @@ class Ui_MainWindow(object):
self.actionJoinChan.setText(_translate("MainWindow", "Join / Create chan", None))
import bitmessage_icons_rc
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())

View File

@ -57,7 +57,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="inbox">
<attribute name="icon">
@ -517,7 +517,7 @@ p, li { white-space: pre-wrap; }
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'settings.ui'
#
# Created: Sat Aug 24 09:19:58 2013
# Created: Wed Sep 04 14:20:27 2013
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!