From 32b24d22e1c20b2c56fe2bb853cf767a8a5b408b Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sun, 23 Dec 2018 08:32:40 +0100 Subject: Add info on network connection --- qml/mageiawelcome.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'qml/mageiawelcome.py') diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py index c21f930..0870f6b 100644 --- a/qml/mageiawelcome.py +++ b/qml/mageiawelcome.py @@ -4,6 +4,7 @@ from PyQt5.QtGui import QGuiApplication from PyQt5.QtQuick import QQuickView from PyQt5.QtCore import QUrl, QLocale, QTranslator, QLibraryInfo, QVariant, QAbstractListModel, \ QModelIndex, Qt, QObject, pyqtSlot +from PyQt5.QtNetwork import QNetworkConfigurationManager, QNetworkConfiguration import sys import os import subprocess @@ -40,6 +41,14 @@ class ConfList(QAbstractListModel): if desktop == 'unknown': desktop = os.getenv("XDG_CURRENT_DESKTOP") + # Search active network connections + net = QNetworkConfigurationManager() + netconfs = "" + if net.isOnline(): + confs = net.allConfigurations(QNetworkConfiguration.Active) + for conf in confs: + netconfs += ", " + conf.name() + self.configuration = [ {'name': self.tr("Congratulations!
You have completed the installation of {}").format(release)}, {'name': self.tr("You are using linux kernel: {}").format(kernel)}, @@ -47,6 +56,11 @@ class ConfList(QAbstractListModel): {'name': self.tr("You are now using the Desktop: {}").format(desktop)}, {'name': self.tr("Your user id is: {}").format(os.getuid())}, ] + if net.isOnline(): + self.configuration.append({'name': self.tr("You are connected to a network through {}").format(netconfs)}) + else: + self.configuration.append({'name': self.tr("You have no network connection")}) + def data(self, index, role=Qt.DisplayRole): row = index.row() -- cgit v1.2.1