quit_msg = "Are you sure you want to exit Bitmessage?" reply = QtGui.QMessageBox.question(self, 'Message', quit_msg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if reply is QtGui.QMessageBox.No: return
(self)
| 2679 | |
| 2680 | # Quit selected from menu or application indicator |
| 2681 | def quit(self): |
| 2682 | '''quit_msg = "Are you sure you want to exit Bitmessage?" |
| 2683 | reply = QtGui.QMessageBox.question(self, 'Message', |
| 2684 | quit_msg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) |
| 2685 | |
| 2686 | if reply is QtGui.QMessageBox.No: |
| 2687 | return |
| 2688 | ''' |
| 2689 | |
| 2690 | if self.quitAccepted: |
| 2691 | return |
| 2692 | |
| 2693 | self.show() |
| 2694 | self.raise_() |
| 2695 | self.activateWindow() |
| 2696 | |
| 2697 | waitForPow = True |
| 2698 | waitForConnection = False |
| 2699 | waitForSync = False |
| 2700 | |
| 2701 | # C PoW currently doesn't support interrupting and OpenCL is untested |
| 2702 | if getPowType() == "python" and (powQueueSize() > 0 or PendingUpload().len() > 0): |
| 2703 | reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Proof of work pending"), |
| 2704 | _translate("MainWindow", "%n object(s) pending proof of work", None, QtCore.QCoreApplication.CodecForTr, powQueueSize()) + ", " + |
| 2705 | _translate("MainWindow", "%n object(s) waiting to be distributed", None, QtCore.QCoreApplication.CodecForTr, PendingUpload().len()) + "\n\n" + |
| 2706 | _translate("MainWindow", "Wait until these tasks finish?"), |
| 2707 | QtGui.QMessageBox.Yes|QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) |
| 2708 | if reply == QtGui.QMessageBox.No: |
| 2709 | waitForPow = False |
| 2710 | elif reply == QtGui.QMessageBox.Cancel: |
| 2711 | return |
| 2712 | |
| 2713 | if PendingDownloadQueue.totalSize() > 0: |
| 2714 | reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Synchronisation pending"), |
| 2715 | _translate("MainWindow", "Bitmessage hasn't synchronised with the network, %n object(s) to be downloaded. If you quit now, it may cause delivery delays. Wait until the synchronisation finishes?", None, QtCore.QCoreApplication.CodecForTr, PendingDownloadQueue.totalSize()), |
| 2716 | QtGui.QMessageBox.Yes|QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) |
| 2717 | if reply == QtGui.QMessageBox.Yes: |
| 2718 | waitForSync = True |
| 2719 | elif reply == QtGui.QMessageBox.Cancel: |
| 2720 | return |
| 2721 | else: |
| 2722 | PendingDownloadQueue.stop() |
| 2723 | |
| 2724 | if shared.statusIconColor == 'red' and not BMConfigParser().safeGetBoolean( |
| 2725 | 'bitmessagesettings', 'dontconnect'): |
| 2726 | reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Not connected"), |
| 2727 | _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?"), |
| 2728 | QtGui.QMessageBox.Yes|QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) |
| 2729 | if reply == QtGui.QMessageBox.Yes: |
| 2730 | waitForConnection = True |
| 2731 | waitForSync = True |
| 2732 | elif reply == QtGui.QMessageBox.Cancel: |
| 2733 | return |
| 2734 | |
| 2735 | self.quitAccepted = True |
| 2736 | |
| 2737 | self.updateStatusBar(_translate( |
| 2738 | "MainWindow", "Shutting down PyBitmessage... %1%").arg(0)) |
no test coverage detected