Browse Source

Merge pull request #3626 from SomberNight/qt_quit_after_last_window

fix #3217: make sure qt quits
3.1
ThomasV 7 years ago
committed by GitHub
parent
commit
deb5a262da
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      gui/qt/__init__.py

25
gui/qt/__init__.py

@ -240,6 +240,7 @@ class ElectrumGui:
except GoBack:
return
except:
import traceback
traceback.print_exc(file=sys.stdout)
return
self.timer.start()
@ -248,11 +249,23 @@ class ElectrumGui:
if not self.start_new_window(path, self.config.get('url')):
return
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
self.app.exec_()
# 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()
# on some platforms the exec_ call may not return, so use clean_up()

Loading…
Cancel
Save