From 209a00e5e573d15745794b278a4229ca9a6e72f4 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sun, 29 Jan 2023 12:04:01 +0100 Subject: Add button to configure network before sources when network is offline. --- qml/mageiawelcome.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'qml/mageiawelcome.py') diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py index fa1ed46..1a181e0 100644 --- a/qml/mageiawelcome.py +++ b/qml/mageiawelcome.py @@ -28,6 +28,16 @@ from OpenGL import GL translate = QCoreApplication.translate +class Networkstate(QObject): + def __init__(self): + QObject.__init__(self) + + @pyqtSlot(result=bool) + def isOffLine(self): + # Search active network connections + net = QNetworkConfigurationManager() + return not net.isOnline() + class ConfList(QAbstractListModel): NameRole = Qt.UserRole + 1 @@ -310,6 +320,7 @@ if __name__ == "__main__": ins = Installable() cl = ConfList() nr = Norun() + ns = Networkstate() sc = nr.startupcheck() factor = cl.factor(app) screen = app.primaryScreen() @@ -332,6 +343,7 @@ if __name__ == "__main__": view.rootContext().setContextProperty("pyinstallable", ins) view.rootContext().setContextProperty("startupcheck", sc) view.rootContext().setContextProperty("norun", nr) + view.rootContext().setContextProperty("networkstate", ns) current_path = os.path.abspath(os.path.dirname(__file__)) qml_file = os.path.join(current_path, "mw-ui.qml") view.setSource(QUrl.fromLocalFile(qml_file)) -- cgit v1.2.1