mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-27 07:23:25 +00:00
Merge pull request #3626 from SomberNight/qt_quit_after_last_window
fix #3217: make sure qt quits
This commit is contained in:
commit
deb5a262da
1 changed files with 19 additions and 6 deletions
|
@ -240,6 +240,7 @@ class ElectrumGui:
|
||||||
except GoBack:
|
except GoBack:
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
|
import traceback
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
return
|
return
|
||||||
self.timer.start()
|
self.timer.start()
|
||||||
|
@ -248,11 +249,23 @@ class ElectrumGui:
|
||||||
if not self.start_new_window(path, self.config.get('url')):
|
if not self.start_new_window(path, self.config.get('url')):
|
||||||
return
|
return
|
||||||
signal.signal(signal.SIGINT, lambda *args: self.app.quit())
|
signal.signal(signal.SIGINT, lambda *args: self.app.quit())
|
||||||
|
|
||||||
|
def quit_after_last_window():
|
||||||
|
# on some platforms, not only does exec_ not return but not even
|
||||||
|
# aboutToQuit is emitted (but following this, it should be emitted)
|
||||||
|
if self.app.quitOnLastWindowClosed():
|
||||||
|
self.app.quit()
|
||||||
|
self.app.lastWindowClosed.connect(quit_after_last_window)
|
||||||
|
|
||||||
|
def clean_up():
|
||||||
|
# Shut down the timer cleanly
|
||||||
|
self.timer.stop()
|
||||||
|
# clipboard persistence. see http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg17328.html
|
||||||
|
event = QtCore.QEvent(QtCore.QEvent.Clipboard)
|
||||||
|
self.app.sendEvent(self.app.clipboard(), event)
|
||||||
|
self.tray.hide()
|
||||||
|
self.app.aboutToQuit.connect(clean_up)
|
||||||
|
|
||||||
# main loop
|
# main loop
|
||||||
self.app.exec_()
|
self.app.exec_()
|
||||||
# Shut down the timer cleanly
|
# on some platforms the exec_ call may not return, so use clean_up()
|
||||||
self.timer.stop()
|
|
||||||
# clipboard persistence. see http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg17328.html
|
|
||||||
event = QtCore.QEvent(QtCore.QEvent.Clipboard)
|
|
||||||
self.app.sendEvent(self.app.clipboard(), event)
|
|
||||||
self.tray.hide()
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue