summaryrefslogtreecommitdiffstats
path: root/qml
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2020-08-14 09:00:47 +0200
committerPapoteur <papoteur@mageia.org>2020-08-14 12:00:20 +0200
commit3e988b964de78327150cbf5c45da62fa93b2213e (patch)
tree03cb85123f95bf946fafa32c592e43def4188b98 /qml
parent36944021daf02572357f391d7bf3d8a90359854f (diff)
downloadmageiawelcome-3e988b964de78327150cbf5c45da62fa93b2213e.tar
mageiawelcome-3e988b964de78327150cbf5c45da62fa93b2213e.tar.gz
mageiawelcome-3e988b964de78327150cbf5c45da62fa93b2213e.tar.bz2
mageiawelcome-3e988b964de78327150cbf5c45da62fa93b2213e.tar.xz
mageiawelcome-3e988b964de78327150cbf5c45da62fa93b2213e.zip
Check that command run properly, otherwise alert about about lacking command (mga#27070)
Diffstat (limited to 'qml')
-rw-r--r--qml/mageiawelcome.py10
-rw-r--r--qml/mw-ui.qml15
2 files changed, 23 insertions, 2 deletions
diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py
index 72be54e..4a38592 100644
--- a/qml/mageiawelcome.py
+++ b/qml/mageiawelcome.py
@@ -112,6 +112,7 @@ class Launcher(QObject):
installed = pyqtSignal()
tainted = pyqtSignal()
repo = pyqtSignal()
+ noprogram = pyqtSignal()
def __init__(self):
QObject.__init__(self)
@@ -132,7 +133,7 @@ class Launcher(QObject):
try:
active = subprocess.run(['urpmq','--list-media','active'], capture_output=True, text=True)
active.check_returncode()
- except subprocess.CallProcessError:
+ except subprocess.CalledProcessError:
print("Error with urpmq")
return
for line in active.stdout.splitlines():
@@ -160,7 +161,12 @@ class Launcher(QObject):
# Give the signal to reload the applist
self.installed.emit()
return
- proc = subprocess.Popen(cmd)
+ try:
+ proc = subprocess.run(cmd)
+ except:
+ print(f"Exception running {cmd[0]}" )
+ self.noprogram.emit()
+ return
class Norun(QObject):
def __init__(self):
diff --git a/qml/mw-ui.qml b/qml/mw-ui.qml
index 3adf1b1..e3707a9 100644
--- a/qml/mw-ui.qml
+++ b/qml/mw-ui.qml
@@ -463,6 +463,14 @@ Rectangle {
standardButtons: StandardButton.Close
}
+ MessageDialog {
+ id: no_program
+ icon: StandardIcon.Warning
+ title: qsTr("Launching command")
+ text: qsTr("This command is not installed")
+ standardButtons: StandardButton.Close
+ }
+
Connections {
target: launch
function onInstalled() {
@@ -476,10 +484,17 @@ Rectangle {
console.log("Core repository is not enabled")
no_core.visible = true
}
+
function onTainted() {
// get the signal that tainted repo is not enabled
console.log("Tainted is not enabled")
no_tainted.visible = true
}
+
+ function onNoprogram() {
+ // get the signal that the command doesn't exist'
+ console.log("The program is not installed")
+ no_program.visible = true
+ }
}
}