summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2023-01-29 12:04:01 +0100
committerPapoteur <papoteur@mageia.org>2023-01-29 12:04:01 +0100
commit209a00e5e573d15745794b278a4229ca9a6e72f4 (patch)
tree443d221463a9d0bc696e655fa7e61df3addff973
parent231622db3a39a23757ab0d3a3861a52e740a9716 (diff)
downloadmageiawelcome-209a00e5e573d15745794b278a4229ca9a6e72f4.tar
mageiawelcome-209a00e5e573d15745794b278a4229ca9a6e72f4.tar.gz
mageiawelcome-209a00e5e573d15745794b278a4229ca9a6e72f4.tar.bz2
mageiawelcome-209a00e5e573d15745794b278a4229ca9a6e72f4.tar.xz
mageiawelcome-209a00e5e573d15745794b278a4229ca9a6e72f4.zip
Add button to configure network before sources when network is offline.
-rw-r--r--qml/Sources.qml8
-rw-r--r--qml/mageiawelcome.py12
2 files changed, 20 insertions, 0 deletions
diff --git a/qml/Sources.qml b/qml/Sources.qml
index fa54e1d..a43b6a4 100644
--- a/qml/Sources.qml
+++ b/qml/Sources.qml
@@ -191,6 +191,14 @@ If this computer will have access to the Internet, you can delete the <i>Local</
Layout.margins: 10
}
MButton {
+ visible: networkstate.isOffLine()
+ Layout.columnSpan: 2
+ Layout.alignment: Qt.AlignHCenter
+ objectName: "launch"
+ onMbuttonClicked: { launch.command(["/usr/bin/draknetcenter",])}
+ buttonText: qsTr("Configure network")
+ }
+ MButton {
Layout.columnSpan: 2
Layout.alignment: Qt.AlignHCenter
objectName: "launch"
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))