@ -55,7 +55,7 @@ donation_address_url = "https://bitcoinprivacy.me/joinmarket-donations"
#Version of this Qt script specifically
#Version of this Qt script specifically
JM_GUI_VERSION = ' 27dev '
JM_GUI_VERSION = ' 27dev '
from jmbase import get_log , stop_reactor
from jmbase import get_log , stop_reactor , set_custom_stop_reactor
from jmbase . support import EXIT_FAILURE , utxo_to_utxostr , \
from jmbase . support import EXIT_FAILURE , utxo_to_utxostr , \
hextobin , JM_CORE_VERSION
hextobin , JM_CORE_VERSION
import jmbitcoin as btc
import jmbitcoin as btc
@ -1623,9 +1623,20 @@ class JMMainWindow(QMainWindow):
self . reactor = reactor
self . reactor = reactor
self . initUI ( )
self . initUI ( )
# a flag to indicate that shutdown should not
# depend on user input
self . unconditional_shutdown = False
def closeEvent ( self , event ) :
def closeEvent ( self , event ) :
quit_msg = " Are you sure you want to quit? "
if self . unconditional_shutdown :
reply = JMQtMessageBox ( self , quit_msg , mbtype = ' question ' )
JMQtMessageBox ( self ,
" RPC connection is lost; shutting down. " ,
mbtype = ' crit ' ,
title = " Error " )
reply = QMessageBox . Yes
else :
quit_msg = " Are you sure you want to quit? "
reply = JMQtMessageBox ( self , quit_msg , mbtype = ' question ' )
if reply == QMessageBox . Yes :
if reply == QMessageBox . Yes :
event . accept ( )
event . accept ( )
if self . reactor . threadpool is not None :
if self . reactor . threadpool is not None :
@ -2413,6 +2424,18 @@ tabWidget.currentChanged.connect(onTabChange)
mainWindow . show ( )
mainWindow . show ( )
reactor . runReturn ( )
reactor . runReturn ( )
# Qt does not stop automatically when we stop the qt5reactor, and
# also we don't want to close without warning the user;
# patch our stop_reactor method to include the necessary cleanup:
def qt_shutdown ( ) :
# checking ensures we only fire the close
# event once even if stop_reactor is called
# multiple times (which it often is):
if mainWindow . isVisible ( ) :
mainWindow . unconditional_shutdown = True
mainWindow . close ( )
set_custom_stop_reactor ( qt_shutdown )
# Upon launching the app, ask the user to choose a wallet to open
# Upon launching the app, ask the user to choose a wallet to open
mainWindow . openWallet ( )
mainWindow . openWallet ( )