changed app close popup UI and added progress bar

This commit is contained in:
navjot 2020-10-26 23:24:55 +05:30
parent 69c7d9d89e
commit 65a1ade08a
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C

View File

@ -2607,6 +2607,18 @@ class MyForm(settingsmixin.SMainWindow):
dontconnect_option or self.namecoin.test()[0] == 'failed' 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 # Quit selected from menu or application indicator
def quit(self): def quit(self):
"""Quit the bitmessageqt application""" """Quit the bitmessageqt application"""
@ -2623,8 +2635,12 @@ class MyForm(settingsmixin.SMainWindow):
# C PoW currently doesn't support interrupting and OpenCL is untested # C PoW currently doesn't support interrupting and OpenCL is untested
if getPowType() == "python" and (powQueueSize() > 0 or pendingUpload() > 0): if getPowType() == "python" and (powQueueSize() > 0 or pendingUpload() > 0):
reply = QtGui.QMessageBox.question( self.progress = QtGui.QProgressBar(self)
self, _translate("MainWindow", "Proof of work pending"), self.progress.setGeometry(550, 555, 250, 20)
self.progress.show()
messagebox = QtGui.QMessageBox(
QtGui.QMessageBox.Question,
_translate("MainWindow", "Proof of work pending"),
_translate( _translate(
"MainWindow", "MainWindow",
"%n object(s) pending proof of work", None, "%n object(s) pending proof of work", None,
@ -2636,17 +2652,28 @@ class MyForm(settingsmixin.SMainWindow):
QtCore.QCoreApplication.CodecForTr, pendingUpload() QtCore.QCoreApplication.CodecForTr, pendingUpload()
) + "\n\n" + ) + "\n\n" +
_translate( _translate(
"MainWindow", "Wait until these tasks finish?"), "MainWindow", "Wait until these tasks finish?"), parent=self)
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No messagebox.setStandardButtons(
| QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) 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: if reply == QtGui.QMessageBox.No:
waitForPow = False waitForPow = False
elif reply == QtGui.QMessageBox.Cancel: elif reply == QtGui.QMessageBox.Cancel:
return return
if pendingDownload() > 0: if pendingDownload() > 0:
reply = QtGui.QMessageBox.question( self.progress = QtGui.QProgressBar(self)
self, _translate("MainWindow", "Synchronisation pending"), self.progress.setGeometry(550, 555, 250, 20)
self.progress.show()
messagebox = QtGui.QMessageBox(
QtGui.QMessageBox.Question,
_translate("MainWindow", "Synchronisation pending"),
_translate( _translate(
"MainWindow", "MainWindow",
"Bitmessage hasn't synchronised with the network," "Bitmessage hasn't synchronised with the network,"
@ -2654,9 +2681,16 @@ class MyForm(settingsmixin.SMainWindow):
" it may cause delivery delays. Wait until the" " it may cause delivery delays. Wait until the"
" synchronisation finishes?", None, " synchronisation finishes?", None,
QtCore.QCoreApplication.CodecForTr, pendingDownload() QtCore.QCoreApplication.CodecForTr, pendingDownload()
), ), parent=self)
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No messagebox.setStandardButtons(
| QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) 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: if reply == QtGui.QMessageBox.Yes:
self.wait = waitForSync = True self.wait = waitForSync = True
elif reply == QtGui.QMessageBox.Cancel: elif reply == QtGui.QMessageBox.Cancel:
@ -2664,16 +2698,27 @@ class MyForm(settingsmixin.SMainWindow):
if state.statusIconColor == 'red' and not BMConfigParser().safeGetBoolean( if state.statusIconColor == 'red' and not BMConfigParser().safeGetBoolean(
'bitmessagesettings', 'dontconnect'): 'bitmessagesettings', 'dontconnect'):
reply = QtGui.QMessageBox.question( self.progress = QtGui.QProgressBar(self)
self, _translate("MainWindow", "Not connected"), self.progress.setGeometry(550, 555, 250, 20)
self.progress.show()
messagebox = QtGui.QMessageBox(
QtGui.QMessageBox.Question,
_translate("MainWindow", "Not connected"),
_translate( _translate(
"MainWindow", "MainWindow",
"Bitmessage isn't connected to the network. If you" "Bitmessage isn't connected to the network. If you"
" quit now, it may cause delivery delays. Wait until" " quit now, it may cause delivery delays. Wait until"
" connected and the synchronisation finishes?" " connected and the synchronisation finishes?"
), ), parent=self)
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No messagebox.setStandardButtons(
| QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) 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: if reply == QtGui.QMessageBox.Yes:
waitForConnection = True waitForConnection = True
self.wait = waitForSync = True self.wait = waitForSync = True