From 8999ae614b5c68c692181e5e339c3537a9e866ec Mon Sep 17 00:00:00 2001 From: mirrorwish Date: Wed, 16 Mar 2016 18:04:18 +0100 Subject: [PATCH] Refactor status icon --- src/bitmessageqt/__init__.py | 20 +++++++++++++------- src/bitmessageqt/bitmessageui.py | 9 --------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 9118e0e9..3c768efd 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -153,8 +153,6 @@ class MyForm(settingsmixin.SMainWindow): "clicked()"), self.click_radioButtonBlacklist) QtCore.QObject.connect(self.ui.radioButtonWhitelist, QtCore.SIGNAL( "clicked()"), self.click_radioButtonWhitelist) - QtCore.QObject.connect(self.ui.pushButtonStatusIcon, QtCore.SIGNAL( - "clicked()"), self.click_pushButtonStatusIcon) QtCore.QObject.connect(self.ui.actionSettings, QtCore.SIGNAL( "triggered()"), self.click_actionSettings) QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL( @@ -731,9 +729,17 @@ class MyForm(settingsmixin.SMainWindow): "itemChanged(QTableWidgetItem *)"), self.tableWidgetBlacklistItemChanged) # Put the colored icon on the status bar - # self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png")) + # self.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png")) self.statusbar = self.statusBar() - self.statusbar.insertPermanentWidget(0, self.ui.pushButtonStatusIcon) + + self.pushButtonStatusIcon = QtGui.QPushButton(self) + self.pushButtonStatusIcon.setText('') + self.pushButtonStatusIcon.setIcon(QIcon(':/newPrefix/images/redicon.png')) + self.pushButtonStatusIcon.setFlat(True) + self.statusbar.insertPermanentWidget(0, self.pushButtonStatusIcon) + QtCore.QObject.connect(self.pushButtonStatusIcon, QtCore.SIGNAL( + "clicked()"), self.click_pushButtonStatusIcon) + self.ui.labelStartupTime.setText(_translate("MainWindow", "Since startup on %1").arg( l10n.formatTimestamp())) self.numberOfMessagesProcessed = 0 @@ -1815,7 +1821,7 @@ class MyForm(settingsmixin.SMainWindow): global withMessagingMenu # print 'setting status icon color' if color == 'red': - self.ui.pushButtonStatusIcon.setIcon( + self.pushButtonStatusIcon.setIcon( QIcon(":/newPrefix/images/redicon.png")) shared.statusIconColor = 'red' # if the connection is lost then show a notification @@ -1832,7 +1838,7 @@ class MyForm(settingsmixin.SMainWindow): 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.': self.statusBar().showMessage('') - self.ui.pushButtonStatusIcon.setIcon(QIcon( + self.pushButtonStatusIcon.setIcon(QIcon( ":/newPrefix/images/yellowicon.png")) shared.statusIconColor = 'yellow' # if a new connection has been established then show a notification @@ -1849,7 +1855,7 @@ class MyForm(settingsmixin.SMainWindow): 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.': self.statusBar().showMessage('') - self.ui.pushButtonStatusIcon.setIcon( + self.pushButtonStatusIcon.setIcon( QIcon(":/newPrefix/images/greenicon.png")) shared.statusIconColor = 'green' if not self.connected: diff --git a/src/bitmessageqt/bitmessageui.py b/src/bitmessageqt/bitmessageui.py index b50fd3fe..355cc51b 100644 --- a/src/bitmessageqt/bitmessageui.py +++ b/src/bitmessageqt/bitmessageui.py @@ -589,14 +589,6 @@ class Ui_MainWindow(object): self.tabWidget.addTab(self.blackwhitelist, icon9, _fromUtf8("")) self.networkstatus = QtGui.QWidget() self.networkstatus.setObjectName(_fromUtf8("networkstatus")) - self.pushButtonStatusIcon = QtGui.QPushButton(self.networkstatus) - self.pushButtonStatusIcon.setGeometry(QtCore.QRect(680, 440, 21, 23)) - self.pushButtonStatusIcon.setText(_fromUtf8("")) - icon10 = QtGui.QIcon() - icon10.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/redicon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.pushButtonStatusIcon.setIcon(icon10) - self.pushButtonStatusIcon.setFlat(True) - self.pushButtonStatusIcon.setObjectName(_fromUtf8("pushButtonStatusIcon")) self.tableWidgetConnectionCount = settingsmixin.STableWidget(self.networkstatus) self.tableWidgetConnectionCount.setGeometry(QtCore.QRect(20, 70, 241, 241)) palette = QtGui.QPalette() @@ -739,7 +731,6 @@ class Ui_MainWindow(object): MainWindow.setTabOrder(self.radioButtonWhitelist, self.pushButtonAddBlacklist) MainWindow.setTabOrder(self.pushButtonAddBlacklist, self.tableWidgetBlacklist) MainWindow.setTabOrder(self.tableWidgetBlacklist, self.tableWidgetConnectionCount) - MainWindow.setTabOrder(self.tableWidgetConnectionCount, self.pushButtonStatusIcon) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "Bitmessage", None))