From 744c8a7cb9c0e57c6f9ce8edb92c109ad4af1ecf Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sat, 3 Apr 2021 22:50:24 +0200 Subject: Give a message that some repositories have to be active for installation of application add a special case for Steam which needs 32bit repositories (mga#28328). --- qml/AppList.qml | 2 +- qml/mageiawelcome.py | 27 ++++++++++++++++++++++----- qml/mw-ui.qml | 38 ++++++++++++++++++++++++++++++++------ 3 files changed, 55 insertions(+), 12 deletions(-) (limited to 'qml') diff --git a/qml/AppList.qml b/qml/AppList.qml index 2dcf553..ab8a26b 100644 --- a/qml/AppList.qml +++ b/qml/AppList.qml @@ -6,7 +6,7 @@ ListModel { ListElement { group: "audio featured";description: qsTr("Various Audio Codecs"); title: "Audio Codecs";name: "task-codec-audio";command: "";repo: "tainted";icon: "img/codecs-audio.png";} ListElement { group: "video featured";description: qsTr("Various Video Codecs"); title: "Video Codecs";name: "task-codec-video";command: "";repo: "";icon: "img/codecs-video.png";} ListElement { group: "video featured";description: qsTr("Various Video Codecs"); title: "Video Codecs";name: "task-codec-video";command: "";repo: "tainted";icon: "img/codecs-video.png";} - ListElement { group: "games";description: qsTr("Steam Client (This needs 32bits repositories enabled, see Media Sources tab)"); title: "Steam";name: "steam";command: "steam";repo: "non-free";icon: "img/steam.png";} + ListElement { group: "games";description: qsTr("Steam Client (This needs 32bits repositories enabled, see Media Sources tab)"); title: "Steam";name: "steam";command: "steam";repo: "steam";icon: "img/steam.png";} ListElement { group: "games";description: qsTr("3D Real Time Strategy"); title: "Megaglest";name: "megaglest";command: "megaglest";repo: "";icon: "img/megaglest.png";} ListElement { group: "games";description: qsTr("Single/Multi-player first person shooter game"); title: "Sauerbraten";name: "sauerbraten";command: "sauerbraten";repo: "non-free";icon: "img/sauerbraten.png";} ListElement { group: "games";description: qsTr("Classic 2d jump 'n run sidescroller with Tux "); title: "Supertux";name: "supertux";command: "supertux2";repo: "";icon: "img/supertux.png";} diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py index 4a38592..c4079a8 100644 --- a/qml/mageiawelcome.py +++ b/qml/mageiawelcome.py @@ -110,7 +110,7 @@ class Callbrowser(QObject): class Launcher(QObject): installed = pyqtSignal() - tainted = pyqtSignal() + needed = pyqtSignal(str, arguments=['repo']) repo = pyqtSignal() noprogram = pyqtSignal() @@ -130,6 +130,10 @@ class Launcher(QObject): updates = False tainted = False t_updates = False + nonfree = False + nf_updates = False + core32 = False + core32_updates = False try: active = subprocess.run(['urpmq','--list-media','active'], capture_output=True, text=True) active.check_returncode() @@ -145,15 +149,28 @@ class Launcher(QObject): tainted = True if line.startswith('Tainted Updates'): t_updates = True + if line.startswith('Nonfree Release'): + nonfree = True + if line.startswith('Nonfree Updates'): + nf_updates = True + if line.startswith('Core 32bit Release'): + core32 = True + if line.startswith('Core 32bit Updates'): + core32_updates = True if repo == 'tainted' and not (tainted and t_updates) : + # repo tainted not enabled + self.needed.emit(repo) + return + if repo == 'non-free' and not (nonfree and nf_updates) : + # repo nonfree not enabled + self.needed.emit(repo) + return + if repo == 'steam' and not (core32 and core32_updates and nonfree and nf_updates) : # repo not enabled - # print("Tainted not active") - self.tainted.emit() + self.needed.emit(repo) return - if repo == '' and not (core and updates) : # repo not enabled - # print("Core not active") self.repo.emit() return proc = subprocess.Popen(['gurpmi',cmd[1]]) diff --git a/qml/mw-ui.qml b/qml/mw-ui.qml index 0d6d8ef..957923c 100644 --- a/qml/mw-ui.qml +++ b/qml/mw-ui.qml @@ -470,6 +470,15 @@ Rectangle { standardButtons: StandardButton.Close } + MessageDialog { + id: no_nonfree + icon: StandardIcon.Warning + title: qsTr("Application installation") + //: %1 will be replaced with the 'Media sources' translation + text: qsTr("Nonfree repositories are not enabled. See the '%1' tab.").arg(qsTr("Media sources")) + standardButtons: StandardButton.Close + } + MessageDialog { id: no_program icon: StandardIcon.Warning @@ -478,27 +487,44 @@ Rectangle { standardButtons: StandardButton.Close } + MessageDialog { + id: no_steam + icon: StandardIcon.Warning + title: qsTr("Application installation") + //: %1 will be replaced with the 'Media sources' translation + text: qsTr("Steam needs that Nonfree and Core 32bit repositories are enabled. See the '%1' tab.").arg(qsTr("Media sources")) + standardButtons: StandardButton.Close + } + Connections { target: launch - function onInstalled() { + onInstalled: { // get the signal to reload the applist console.log("Reload applications list") itemModel.update_list(categoriesList.currentItem.myGroup) } - function onRepo() { + onRepo: { // get the signal that core repo is not enabled console.log("Core repository is not enabled") no_core.visible = true } - function onTainted() { + onNeeded: { // get the signal that tainted repo is not enabled - console.log("Tainted is not enabled") - no_tainted.visible = true + console.log("%1 is not enabled".arg(repo)) + if (repo == "non-free") { + no_nonfree.visible = true + } + if (repo == "tainted") { + no_tainted.visible = true + } + if (repo == "steam") { + no_steam.visible = true + } } - function onNoprogram() { + onNoprogram: { // get the signal that the command doesn't exist' console.log("The program is not installed") no_program.visible = true -- cgit v1.2.1