diff options
-rw-r--r-- | qml/mageiawelcome.py | 25 | ||||
-rw-r--r-- | qml/mw-ui.qml | 2 |
2 files changed, 17 insertions, 10 deletions
diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py index d831dc5..29d0358 100644 --- a/qml/mageiawelcome.py +++ b/qml/mageiawelcome.py @@ -123,8 +123,21 @@ class Launcher(QObject): cmd = [] for i in range(0,app.property("length").toInt()): cmd.append(app.property(i).toString()) - if cmd[0] == "gurpmi": - repo = cmd[2] + try: + subprocess.Popen(cmd) + except: + print(f"Exception running {cmd[0]}" ) + self.noprogram.emit() + return + + @pyqtSlot(QVariant) + def install(self, app): + if app.isArray(): + cmd = [] + # app should contain package, repository + for i in range(0,app.property("length").toInt()): + cmd.append(app.property(i).toString()) + repo = cmd[1] # Check if repositories are enabled core = False updates = False @@ -173,17 +186,11 @@ class Launcher(QObject): # repo not enabled self.repo.emit() return - proc = subprocess.Popen(['gurpmi',cmd[1]]) + proc = subprocess.Popen(['/usr/bin/gurpmi',cmd[0]]) proc.wait() # Give the signal to reload the applist self.installed.emit() return - try: - subprocess.Popen(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 685ed5f..ed6cecf 100644 --- a/qml/mw-ui.qml +++ b/qml/mw-ui.qml @@ -263,7 +263,7 @@ Rectangle { height: Qt.application.font.pixelSize * 1.3 objectName: "launch" onClicked: { - launch.command(["/usr/bin/gurpmi",name,repo,])} + launch.install([name,repo,])} style: ButtonStyle { label: Label { horizontalAlignment: TextInput.AlignHCenter |