From 5754fbb2d5f4f89737b8a30f8f3be9fd6c2754be Mon Sep 17 00:00:00 2001 From: navjot Date: Fri, 18 Sep 2020 18:22:11 +0530 Subject: [PATCH 1/6] fixed the app closing issue on the press of quit button --- src/bitmessageqt/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 34fee6d3..98dfb88d 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2684,11 +2684,10 @@ class MyForm(settingsmixin.SMainWindow): self.updateStatusBar(_translate( "MainWindow", "Shutting down PyBitmessage... %1%").arg(0)) - if waitForConnection: self.updateStatusBar(_translate( "MainWindow", "Waiting for network connection...")) - while state.statusIconColor == 'red': + while state.statusIconColor == 'red' and not self.quitAccepted: time.sleep(0.5) QtCore.QCoreApplication.processEvents( QtCore.QEventLoop.AllEvents, 1000 @@ -2700,7 +2699,7 @@ class MyForm(settingsmixin.SMainWindow): if waitForSync: self.updateStatusBar(_translate( "MainWindow", "Waiting for finishing synchronisation...")) - while pendingDownload() > 0: + while pendingDownload() > 0 and not self.quitAccepted: time.sleep(0.5) QtCore.QCoreApplication.processEvents( QtCore.QEventLoop.AllEvents, 1000 @@ -2715,7 +2714,7 @@ class MyForm(settingsmixin.SMainWindow): curWorkerQueue = powQueueSize() if curWorkerQueue > maxWorkerQueue: maxWorkerQueue = curWorkerQueue - if curWorkerQueue > 0: + if curWorkerQueue > 0 and not self.quitAccepted: self.updateStatusBar(_translate( "MainWindow", "Waiting for PoW to finish... %1%" ).arg(50 * (maxWorkerQueue - curWorkerQueue) / -- 2.47.2 From 69c7d9d89e2ad0b0115ef8fd9b8158c297104063 Mon Sep 17 00:00:00 2001 From: navjot Date: Sat, 17 Oct 2020 15:52:34 +0530 Subject: [PATCH 2/6] fixed hanging issue on press of quit --- src/bitmessageqt/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 98dfb88d..da9ff7ed 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2803,6 +2803,7 @@ class MyForm(settingsmixin.SMainWindow): self.appIndicatorHide() else: # custom quit method + self.wait = False self.quit() def on_action_InboxMessageForceHtml(self): -- 2.47.2 From 65a1ade08ac27fd95ea3263468e6cd4c5877daed Mon Sep 17 00:00:00 2001 From: navjot Date: Mon, 26 Oct 2020 23:24:55 +0530 Subject: [PATCH 3/6] changed app close popup UI and added progress bar --- src/bitmessageqt/__init__.py | 75 ++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 15 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index da9ff7ed..6cb6a748 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2607,6 +2607,18 @@ class MyForm(settingsmixin.SMainWindow): dontconnect_option or self.namecoin.test()[0] == 'failed' ) + def processing(self): + """Processing progress bar""" + self.completed = 0 + + while self.completed < 100: + self.completed += 0.1 + self.progress.setValue(self.completed) + + def hideprogressBar(self): + """Hide progress bar""" + self.progress.hide() + # Quit selected from menu or application indicator def quit(self): """Quit the bitmessageqt application""" @@ -2623,8 +2635,12 @@ class MyForm(settingsmixin.SMainWindow): # C PoW currently doesn't support interrupting and OpenCL is untested if getPowType() == "python" and (powQueueSize() > 0 or pendingUpload() > 0): - reply = QtGui.QMessageBox.question( - self, _translate("MainWindow", "Proof of work pending"), + self.progress = QtGui.QProgressBar(self) + self.progress.setGeometry(550, 555, 250, 20) + self.progress.show() + messagebox = QtGui.QMessageBox( + QtGui.QMessageBox.Question, + _translate("MainWindow", "Proof of work pending"), _translate( "MainWindow", "%n object(s) pending proof of work", None, @@ -2636,17 +2652,28 @@ class MyForm(settingsmixin.SMainWindow): QtCore.QCoreApplication.CodecForTr, pendingUpload() ) + "\n\n" + _translate( - "MainWindow", "Wait until these tasks finish?"), - QtGui.QMessageBox.Yes | QtGui.QMessageBox.No - | QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) + "MainWindow", "Wait until these tasks finish?"), parent=self) + messagebox.setStandardButtons( + QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel) + btnN = messagebox.button(QtGui.QMessageBox.No) + btnN.setText("Quit") + btnN.clicked.connect(self.processing) + btnC = messagebox.button(QtGui.QMessageBox.Cancel) + btnC.setText("Don't Quit") + btnC.clicked.connect(self.hideprogressBar) + reply = messagebox.exec_() if reply == QtGui.QMessageBox.No: waitForPow = False elif reply == QtGui.QMessageBox.Cancel: return if pendingDownload() > 0: - reply = QtGui.QMessageBox.question( - self, _translate("MainWindow", "Synchronisation pending"), + self.progress = QtGui.QProgressBar(self) + self.progress.setGeometry(550, 555, 250, 20) + self.progress.show() + messagebox = QtGui.QMessageBox( + QtGui.QMessageBox.Question, + _translate("MainWindow", "Synchronisation pending"), _translate( "MainWindow", "Bitmessage hasn't synchronised with the network," @@ -2654,9 +2681,16 @@ class MyForm(settingsmixin.SMainWindow): " it may cause delivery delays. Wait until the" " synchronisation finishes?", None, QtCore.QCoreApplication.CodecForTr, pendingDownload() - ), - QtGui.QMessageBox.Yes | QtGui.QMessageBox.No - | QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) + ), parent=self) + messagebox.setStandardButtons( + QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel) + btnN = messagebox.button(QtGui.QMessageBox.No) + btnN.setText("Quit") + btnN.clicked.connect(self.processing) + btnC = messagebox.button(QtGui.QMessageBox.Cancel) + btnC.setText("Don't Quit") + btnC.clicked.connect(self.hideprogressBar) + reply = messagebox.exec_() if reply == QtGui.QMessageBox.Yes: self.wait = waitForSync = True elif reply == QtGui.QMessageBox.Cancel: @@ -2664,16 +2698,27 @@ class MyForm(settingsmixin.SMainWindow): if state.statusIconColor == 'red' and not BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'dontconnect'): - reply = QtGui.QMessageBox.question( - self, _translate("MainWindow", "Not connected"), + self.progress = QtGui.QProgressBar(self) + self.progress.setGeometry(550, 555, 250, 20) + self.progress.show() + messagebox = QtGui.QMessageBox( + QtGui.QMessageBox.Question, + _translate("MainWindow", "Not connected"), _translate( "MainWindow", "Bitmessage isn't connected to the network. If you" " quit now, it may cause delivery delays. Wait until" " connected and the synchronisation finishes?" - ), - QtGui.QMessageBox.Yes | QtGui.QMessageBox.No - | QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) + ), parent=self) + messagebox.setStandardButtons( + QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel) + btnN = messagebox.button(QtGui.QMessageBox.No) + btnN.setText("Quit") + btnN.clicked.connect(self.processing) + btnC = messagebox.button(QtGui.QMessageBox.Cancel) + btnC.setText("Don't Quit") + btnC.clicked.connect(self.hideprogressBar) + reply = messagebox.exec_() if reply == QtGui.QMessageBox.Yes: waitForConnection = True self.wait = waitForSync = True -- 2.47.2 From cfc448db7bb78c69f265199f512776fdfa2de8c4 Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 28 Oct 2020 00:42:23 +0530 Subject: [PATCH 4/6] Fixed CQ for bitmessageqt.__init__ module --- src/bitmessageqt/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 6cb6a748..95432826 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2609,11 +2609,11 @@ class MyForm(settingsmixin.SMainWindow): def processing(self): """Processing progress bar""" - self.completed = 0 + completed = 0 - while self.completed < 100: - self.completed += 0.1 - self.progress.setValue(self.completed) + while completed < 100: + completed += 0.1 + self.progress.setValue(completed) def hideprogressBar(self): """Hide progress bar""" @@ -2654,7 +2654,7 @@ class MyForm(settingsmixin.SMainWindow): _translate( "MainWindow", "Wait until these tasks finish?"), parent=self) messagebox.setStandardButtons( - QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel) + QtGui.QMessageBox.No | QtGui.QMessageBox.Cancel) btnN = messagebox.button(QtGui.QMessageBox.No) btnN.setText("Quit") btnN.clicked.connect(self.processing) @@ -2683,7 +2683,7 @@ class MyForm(settingsmixin.SMainWindow): QtCore.QCoreApplication.CodecForTr, pendingDownload() ), parent=self) messagebox.setStandardButtons( - QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel) + QtGui.QMessageBox.No | QtGui.QMessageBox.Cancel) btnN = messagebox.button(QtGui.QMessageBox.No) btnN.setText("Quit") btnN.clicked.connect(self.processing) @@ -2711,7 +2711,7 @@ class MyForm(settingsmixin.SMainWindow): " connected and the synchronisation finishes?" ), parent=self) messagebox.setStandardButtons( - QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel) + QtGui.QMessageBox.No | QtGui.QMessageBox.Cancel) btnN = messagebox.button(QtGui.QMessageBox.No) btnN.setText("Quit") btnN.clicked.connect(self.processing) -- 2.47.2 From cbe7756bb9cd43333c5ac3cf1fa6ac4802531d30 Mon Sep 17 00:00:00 2001 From: navjot Date: Fri, 25 Dec 2020 01:35:21 +0530 Subject: [PATCH 5/6] showing progress bar on click on quit button --- src/bitmessageqt/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 95432826..14229a93 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2610,8 +2610,8 @@ class MyForm(settingsmixin.SMainWindow): def processing(self): """Processing progress bar""" completed = 0 - - while completed < 100: + self.progress.show() + while completed < 80: completed += 0.1 self.progress.setValue(completed) @@ -2637,7 +2637,7 @@ class MyForm(settingsmixin.SMainWindow): if getPowType() == "python" and (powQueueSize() > 0 or pendingUpload() > 0): self.progress = QtGui.QProgressBar(self) self.progress.setGeometry(550, 555, 250, 20) - self.progress.show() + # self.progress.show() messagebox = QtGui.QMessageBox( QtGui.QMessageBox.Question, _translate("MainWindow", "Proof of work pending"), @@ -2670,7 +2670,7 @@ class MyForm(settingsmixin.SMainWindow): if pendingDownload() > 0: self.progress = QtGui.QProgressBar(self) self.progress.setGeometry(550, 555, 250, 20) - self.progress.show() + # self.progress.show() messagebox = QtGui.QMessageBox( QtGui.QMessageBox.Question, _translate("MainWindow", "Synchronisation pending"), @@ -2700,7 +2700,7 @@ class MyForm(settingsmixin.SMainWindow): 'bitmessagesettings', 'dontconnect'): self.progress = QtGui.QProgressBar(self) self.progress.setGeometry(550, 555, 250, 20) - self.progress.show() + # self.progress.show() messagebox = QtGui.QMessageBox( QtGui.QMessageBox.Question, _translate("MainWindow", "Not connected"), -- 2.47.2 From 9c66f784465791ef85f9ad5b4c34b5abbf688e64 Mon Sep 17 00:00:00 2001 From: navjot Date: Fri, 25 Dec 2020 13:09:51 +0530 Subject: [PATCH 6/6] Fixed pylint CQ issue for bitmessageqt.__init__ module --- src/bitmessageqt/__init__.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 14229a93..7b974326 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -832,6 +832,9 @@ class MyForm(settingsmixin.SMainWindow): 'bitmessagesettings', 'dontconnect') self._contact_selected = None + self.progress = QtGui.QProgressBar(self) + self.progress.setGeometry(550, 555, 250, 20) + self.progress.hide() def getContactSelected(self): """Returns last selected contact once""" @@ -2635,9 +2638,6 @@ class MyForm(settingsmixin.SMainWindow): # C PoW currently doesn't support interrupting and OpenCL is untested if getPowType() == "python" and (powQueueSize() > 0 or pendingUpload() > 0): - self.progress = QtGui.QProgressBar(self) - self.progress.setGeometry(550, 555, 250, 20) - # self.progress.show() messagebox = QtGui.QMessageBox( QtGui.QMessageBox.Question, _translate("MainWindow", "Proof of work pending"), @@ -2668,9 +2668,6 @@ class MyForm(settingsmixin.SMainWindow): return if pendingDownload() > 0: - self.progress = QtGui.QProgressBar(self) - self.progress.setGeometry(550, 555, 250, 20) - # self.progress.show() messagebox = QtGui.QMessageBox( QtGui.QMessageBox.Question, _translate("MainWindow", "Synchronisation pending"), @@ -2698,9 +2695,6 @@ class MyForm(settingsmixin.SMainWindow): if state.statusIconColor == 'red' and not BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'dontconnect'): - self.progress = QtGui.QProgressBar(self) - self.progress.setGeometry(550, 555, 250, 20) - # self.progress.show() messagebox = QtGui.QMessageBox( QtGui.QMessageBox.Question, _translate("MainWindow", "Not connected"), -- 2.47.2