summaryrefslogtreecommitdiffstats
path: root/qml/mageiawelcome.py
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2023-01-29 21:29:47 +0100
committerPapoteur <papoteur@mageia.org>2023-01-29 21:29:47 +0100
commitdc720dea7a0f3b76da7f43d89f70d70dc7e0edc8 (patch)
tree317224a7ea4d9c054d5a9d5b235b40543e3e337e /qml/mageiawelcome.py
parent209a00e5e573d15745794b278a4229ca9a6e72f4 (diff)
downloadmageiawelcome-dc720dea7a0f3b76da7f43d89f70d70dc7e0edc8.tar
mageiawelcome-dc720dea7a0f3b76da7f43d89f70d70dc7e0edc8.tar.gz
mageiawelcome-dc720dea7a0f3b76da7f43d89f70d70dc7e0edc8.tar.bz2
mageiawelcome-dc720dea7a0f3b76da7f43d89f70d70dc7e0edc8.tar.xz
mageiawelcome-dc720dea7a0f3b76da7f43d89f70d70dc7e0edc8.zip
Add install_and_launch function. Apply it to dnfdragora
Diffstat (limited to 'qml/mageiawelcome.py')
-rw-r--r--qml/mageiawelcome.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py
index 1a181e0..da3fec6 100644
--- a/qml/mageiawelcome.py
+++ b/qml/mageiawelcome.py
@@ -176,10 +176,13 @@ class Launcher(QObject):
cmd = []
for i in range(0, app.property("length").toInt()):
cmd.append(app.property(i).toString())
+ self._command(cmd[0])
+
+ def _command(self, cmd):
try:
subprocess.Popen(cmd)
except:
- print(f"Exception running {cmd[0]}")
+ print(f"Exception running {cmd}")
self.noprogram.emit()
return
@@ -249,6 +252,22 @@ class Launcher(QObject):
self.installed.emit()
return
+ @pyqtSlot(QVariant)
+ def install_and_launch(self, app):
+ """
+ app should be an array with the package name to install and then the command to launch
+ """
+ if app.isArray():
+ cmd = []
+ # app should contain package, repository
+ for i in range(0, app.property("length").toInt()):
+ cmd.append(app.property(i).toString())
+ print(cmd)
+ is_app_installed, inst_repo = is_installed(cmd[0])
+ if not is_app_installed:
+ proc = subprocess.Popen(["/usr/bin/gurpmi", cmd[0]])
+ proc.wait()
+ self._command(cmd[1])
class Norun(QObject):
def __init__(self):