UI refactoring, part 2 #1394
|
@ -1272,11 +1272,7 @@ class MainWindow(Window):
|
||||||
self.retranslateUi(self)
|
self.retranslateUi(self)
|
||||||
self.init_inbox_popup_menu(False)
|
self.init_inbox_popup_menu(False)
|
||||||
self.init_identities_popup_menu(False)
|
self.init_identities_popup_menu(False)
|
||||||
self.init_chan_popup_menu(False)
|
self.blackwhitelist.init_blacklist_popup_menu()
|
||||||
self.init_addressbook_popup_menu(False)
|
|
||||||
self.init_subscriptions_popup_menu(False)
|
|
||||||
self.init_sent_popup_menu(False)
|
|
||||||
self.blackwhitelist.init_blacklist_popup_menu(False)
|
|
||||||
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:
|
||||||
|
|
|
@ -17,21 +17,11 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
super(Blacklist, self).__init__(parent)
|
super(Blacklist, self).__init__(parent)
|
||||||
widgets.load('blacklist.ui', self)
|
widgets.load('blacklist.ui', self)
|
||||||
|
|
||||||
QtCore.QObject.connect(self.radioButtonBlacklist, QtCore.SIGNAL(
|
self.blacklistContextMenuToolbar.setVisible(False)
|
||||||
"clicked()"), self.click_radioButtonBlacklist)
|
|
||||||
QtCore.QObject.connect(self.radioButtonWhitelist, QtCore.SIGNAL(
|
|
||||||
"clicked()"), self.click_radioButtonWhitelist)
|
|
||||||
QtCore.QObject.connect(self.pushButtonAddBlacklist, QtCore.SIGNAL(
|
|
||||||
"clicked()"), self.click_pushButtonAddBlacklist)
|
|
||||||
|
|
||||||
self.init_blacklist_popup_menu()
|
self.init_blacklist_popup_menu()
|
||||||
|
|
||||||
# Initialize blacklist
|
|
||||||
QtCore.QObject.connect(self.tableWidgetBlacklist, QtCore.SIGNAL(
|
|
||||||
"itemChanged(QTableWidgetItem *)"), self.tableWidgetBlacklistItemChanged)
|
|
||||||
|
|
||||||
# Set the icon sizes for the identicons
|
# Set the icon sizes for the identicons
|
||||||
identicon_size = 3*7
|
identicon_size = 3 * 7
|
||||||
self.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
||||||
|
|
||||||
self.UISignalThread = UISignaler.get()
|
self.UISignalThread = UISignaler.get()
|
||||||
|
@ -42,16 +32,12 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'white':
|
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'white':
|
||||||
BMConfigParser().set('bitmessagesettings', 'blackwhitelist', 'black')
|
BMConfigParser().set('bitmessagesettings', 'blackwhitelist', 'black')
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
# self.tableWidgetBlacklist.clearContents()
|
|
||||||
self.tableWidgetBlacklist.setRowCount(0)
|
|
||||||
self.rerenderBlackWhiteList()
|
self.rerenderBlackWhiteList()
|
||||||
|
|
||||||
def click_radioButtonWhitelist(self):
|
def click_radioButtonWhitelist(self):
|
||||||
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'black':
|
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'black':
|
||||||
BMConfigParser().set('bitmessagesettings', 'blackwhitelist', 'white')
|
BMConfigParser().set('bitmessagesettings', 'blackwhitelist', 'white')
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
# self.tableWidgetBlacklist.clearContents()
|
|
||||||
self.tableWidgetBlacklist.setRowCount(0)
|
|
||||||
self.rerenderBlackWhiteList()
|
self.rerenderBlackWhiteList()
|
||||||
|
|
||||||
def click_pushButtonAddBlacklist(self):
|
def click_pushButtonAddBlacklist(self):
|
||||||
|
@ -116,36 +102,8 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
sqlExecute('''UPDATE whitelist SET label=? WHERE address=?''',
|
sqlExecute('''UPDATE whitelist SET label=? WHERE address=?''',
|
||||||
str(item.text()), str(addressitem.text()))
|
str(item.text()), str(addressitem.text()))
|
||||||
|
|
||||||
def init_blacklist_popup_menu(self, connectSignal=True):
|
def init_blacklist_popup_menu(self):
|
||||||
# Popup menu for the Blacklist page
|
# Popup menu for the Blacklist page
|
||||||
self.blacklistContextMenuToolbar = QtGui.QToolBar()
|
|
||||||
# Actions
|
|
||||||
self.actionBlacklistNew = self.blacklistContextMenuToolbar.addAction(
|
|
||||||
_translate(
|
|
||||||
"MainWindow", "Add new entry"), self.on_action_BlacklistNew)
|
|
||||||
self.actionBlacklistDelete = self.blacklistContextMenuToolbar.addAction(
|
|
||||||
_translate(
|
|
||||||
"MainWindow", "Delete"), self.on_action_BlacklistDelete)
|
|
||||||
self.actionBlacklistClipboard = self.blacklistContextMenuToolbar.addAction(
|
|
||||||
_translate(
|
|
||||||
"MainWindow", "Copy address to clipboard"),
|
|
||||||
self.on_action_BlacklistClipboard)
|
|
||||||
self.actionBlacklistEnable = self.blacklistContextMenuToolbar.addAction(
|
|
||||||
_translate(
|
|
||||||
"MainWindow", "Enable"), self.on_action_BlacklistEnable)
|
|
||||||
self.actionBlacklistDisable = self.blacklistContextMenuToolbar.addAction(
|
|
||||||
_translate(
|
|
||||||
"MainWindow", "Disable"), self.on_action_BlacklistDisable)
|
|
||||||
self.actionBlacklistSetAvatar = self.blacklistContextMenuToolbar.addAction(
|
|
||||||
_translate(
|
|
||||||
"MainWindow", "Set avatar..."),
|
|
||||||
self.on_action_BlacklistSetAvatar)
|
|
||||||
self.tableWidgetBlacklist.setContextMenuPolicy(
|
|
||||||
QtCore.Qt.CustomContextMenu)
|
|
||||||
if connectSignal:
|
|
||||||
self.connect(self.tableWidgetBlacklist, QtCore.SIGNAL(
|
|
||||||
'customContextMenuRequested(const QPoint&)'),
|
|
||||||
self.on_context_menuBlacklist)
|
|
||||||
self.popMenuBlacklist = QtGui.QMenu(self)
|
self.popMenuBlacklist = QtGui.QMenu(self)
|
||||||
# self.popMenuBlacklist.addAction( self.actionBlacklistNew )
|
# self.popMenuBlacklist.addAction( self.actionBlacklistNew )
|
||||||
self.popMenuBlacklist.addAction(self.actionBlacklistDelete)
|
self.popMenuBlacklist.addAction(self.actionBlacklistDelete)
|
||||||
|
|
|
@ -10,6 +10,44 @@
|
||||||
<height>295</height>
|
<height>295</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QToolBar" name="blacklistContextMenuToolbar">
|
||||||
|
<action name="actionBlacklistNew">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add new entry</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionBlacklistDelete">
|
||||||
|
<property name="text">
|
||||||
|
<string>Delete</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionBlacklistClipboard">
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy address to clipboard</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionBlacklistEnable">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionBlacklistDisable">
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionBlacklistSetAvatar">
|
||||||
|
<property name="text">
|
||||||
|
<string>Set avatar...</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<addaction name="actionBlacklistNew"/>
|
||||||
|
<addaction name="actionBlacklistDelete"/>
|
||||||
|
<addaction name="actionBlacklistClipboard"/>
|
||||||
|
<addaction name="actionBlacklistEnable"/>
|
||||||
|
<addaction name="actionBlacklistDisable"/>
|
||||||
|
<addaction name="actionBlacklistSetAvatar"/>
|
||||||
|
</widget>
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QRadioButton" name="radioButtonBlacklist">
|
<widget class="QRadioButton" name="radioButtonBlacklist">
|
||||||
|
@ -62,6 +100,9 @@
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -104,5 +145,72 @@
|
||||||
<resources>
|
<resources>
|
||||||
<include location="bitmessage_icons.qrc"/>
|
<include location="bitmessage_icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>radioButtonBlacklist</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>click_radioButtonBlacklist</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radioButtonWhitelist</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>click_radioButtonWhitelist</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>pushButtonAddBlacklist</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>click_pushButtonAddBlacklist</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>tableWidgetBlacklist</sender>
|
||||||
|
<signal>itemChanged(QTableWidgetItem*)</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>tableWidgetBlacklistItemChanged</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>actionBlacklistNew</sender>
|
||||||
|
<signal>triggered()</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>on_action_BlacklistNew</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>actionBlacklistDelete</sender>
|
||||||
|
<signal>triggered()</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>on_action_BlacklistDelete</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>actionBlacklistClipboard</sender>
|
||||||
|
<signal>triggered()</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>on_action_BlacklistClipboard</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>actionBlacklistEnable</sender>
|
||||||
|
<signal>triggered()</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>on_action_BlacklistEnable</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>actionBlacklistDisable</sender>
|
||||||
|
<signal>triggered()</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>on_action_BlacklistDisable</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>actionBlacklistSetAvatar</sender>
|
||||||
|
<signal>triggered()</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>on_action_BlacklistSetAvatar</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>tableWidgetBlacklist</sender>
|
||||||
|
<signal>customContextMenuRequested(QPoint)</signal>
|
||||||
|
<receiver>blacklist</receiver>
|
||||||
|
<slot>on_context_menuBlacklist</slot>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Reference in New Issue
Block a user