def closeEvent(self, event): self.pywebview_window.closing.set() if self.confirm_close: reply = QMessageBox.question( self, self.title, localization["global.quitConfirmation"], QMessageBox.Yes, QMessageBox.No, ) if reply == QMessageBox.No: event.ignore() return event.accept() BrowserView.instances[self.uid].close() del BrowserView.instances[self.uid] if self.pywebview_window in windows: windows.remove(self.pywebview_window) self.pywebview_window.closed.set() if len(BrowserView.instances) == 0: self.hide() _app.exit()
def on_close(self, sender, args): def _shutdown(): CEF.shutdown() WinForms.Application.Exit() CEF.close_window(self.uid) del BrowserView.instances[self.uid] # during tests windows is empty for some reason. no idea why. if self.pywebview_window in windows: windows.remove(self.pywebview_window) self.closed.set() if len(BrowserView.instances) == 0: self.Invoke(Func[Type](_shutdown))
def close_window(self, *data): for res in self.js_results.values(): res["semaphore"].release() while gtk.events_pending(): gtk.main_iteration() self.window.destroy() del BrowserView.instances[self.uid] if self.pywebview_window in windows: windows.remove(self.pywebview_window) self.pywebview_window.closed.set() if BrowserView.instances == {}: gtk.main_quit()