如果用户与应用程序进行交互(例如,按下按钮),然后用户单击X按钮,则应用程序将继续运行,但窗口关闭。如何完全终止该应用程序。它是使用PyQt5构建的。
答案 0 :(得分:0)
这是我从Qt教程中复制的一个简单的“ Hello World”示例。它使用importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js');
workbox.setConfig({ debug: true });
workbox.core.setLogLevel(workbox.core.LOG_LEVELS.debug);
workbox.googleAnalytics.initialize();
if (workbox) {
console.log(`Yay! Workbox is loaded `);
} else {
console.log(`Boo! Workbox didn't load `);
}
workbox.precaching.precacheAndRoute([
{ url: '/', revision: '7' },
{ url: 'index.php', revision: '7' },
{ url: '/offline.html', revision: '7' },
{ url: '/404.html', revision: '7' },
{ url: 'templates/ostrainingbreeze/css/template.css', revision: '7' },
{ url: 'templates/system/css/general.css', revision: '7' },
{ url: 'templates/ostrainingbreeze/css/mobilemenu.css', revision: '7' },
{ url: 'media/jui/js/jquery.min.js', revision: '7' },
{ url: 'media/jui/js/jquery-noconflict.js', revision: '7' },
{ url: 'media/jui/js/jquery-migrate.min.js', revision: '7' },
{ url: 'media/jui/js/bootstrap.min.js', revision: '7' },
{ url: 'media/system/js/caption.js', revision: '7' },
{ url: 'media/system/js/core.js', revision: '7' },
{ url: 'media/system/js/keepalive.js', revision: '7' },
{ url: 'templates/ostrainingbreeze/js/template.js', revision: '7' },
{ url: 'templates/ostrainingbreeze/js/jquery.mobilemenu.js', revision: '7' },
{ url: 'templates/ostrainingbreeze/js/mobilemenu.js', revision: '7' },
{ url: 'templates/ostrainingbreeze/images/logo.png', revision: '7' },
{ url: 'templates/ostrainingbreeze/favicon.ico', revision: '7' },
{ url: 'media/system/css/system.css', revision: '7' },
]);
workbox.routing.registerRoute(
new RegExp('.*\.css'),
workbox.strategies.cacheFirst({
cacheName: 'css-cache',
plugins: [
new workbox.expiration.Plugin({
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60,
})
],
})
);
workbox.routing.registerRoute(
new RegExp('.*\.js'),
workbox.strategies.staleWhileRevalidate({
cacheName: 'js-cache',
})
);
workbox.routing.registerRoute(
new RegExp('.*\.png|jpg|jpeg|svg|gif|webp'),
workbox.strategies.cacheFirst({
cacheName: 'image-cache',
plugins: [
new workbox.expiration.Plugin({
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60,
})
],
})
);
workbox.routing.registerRoute(
new RegExp('.*\.php|html'),
workbox.strategies.staleWhileRevalidate({
})
);
workbox.routing.setDefaultHandler(
workbox.strategies.staleWhileRevalidate()
);
workbox.routing.setCatchHandler(({event}) => {
switch (event.request.destination) {
case 'document':
return caches.match('/offline.html');
break;
default:
return Response.error();
}
});
退出应用程序。
sys.exit(...)
答案 1 :(得分:0)
尝试一下:
network_security_config.xml content should be as follows
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>