UI refactoring, part 2 #1394

Open
g1itch wants to merge 14 commits from g1itch/ui-refactoring into v0.6
3 changed files with 113 additions and 51 deletions
Showing only changes of commit fe9b2d7188 - Show all commits

View File

@ -1272,11 +1272,7 @@ class MainWindow(Window):
self.retranslateUi(self)
self.init_inbox_popup_menu(False)
self.init_identities_popup_menu(False)
self.init_chan_popup_menu(False)
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)
self.blackwhitelist.init_blacklist_popup_menu()
if event.type() == QtCore.QEvent.WindowStateChange:
if self.windowState() & QtCore.Qt.WindowMinimized:
if BMConfigParser().getboolean('bitmessagesettings', 'minimizetotray') and not 'darwin' in sys.platform:

View File

@ -17,19 +17,9 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
super(Blacklist, self).__init__(parent)
widgets.load('blacklist.ui', self)
QtCore.QObject.connect(self.radioButtonBlacklist, QtCore.SIGNAL(
"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.blacklistContextMenuToolbar.setVisible(False)
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
identicon_size = 3 * 7
self.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size))
@ -42,16 +32,12 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'white':
BMConfigParser().set('bitmessagesettings', 'blackwhitelist', 'black')
BMConfigParser().save()
# self.tableWidgetBlacklist.clearContents()
self.tableWidgetBlacklist.setRowCount(0)
self.rerenderBlackWhiteList()
def click_radioButtonWhitelist(self):
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'black':
BMConfigParser().set('bitmessagesettings', 'blackwhitelist', 'white')
BMConfigParser().save()
# self.tableWidgetBlacklist.clearContents()
self.tableWidgetBlacklist.setRowCount(0)
self.rerenderBlackWhiteList()
def click_pushButtonAddBlacklist(self):
@ -116,36 +102,8 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
sqlExecute('''UPDATE whitelist SET label=? WHERE address=?''',
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
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.addAction( self.actionBlacklistNew )
self.popMenuBlacklist.addAction(self.actionBlacklistDelete)

View File

@ -10,6 +10,44 @@
<height>295</height>
</rect>
</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">
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="radioButtonBlacklist">
@ -62,6 +100,9 @@
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
@ -104,5 +145,72 @@
<resources>
<include location="bitmessage_icons.qrc"/>
</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>