summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2018-12-31 14:26:25 +0100
committerPapoteur <papoteur@mageia.org>2019-01-01 12:10:10 +0100
commit437ed496fea43cf6fc4ff09cf04489f328f89525 (patch)
tree31bfb95576042c7e30c1ac0ac7554194bf95f431
parent8178afe08202fed9ccff38b2b2dd23f8ff3dc5e7 (diff)
downloadmageiawelcome-437ed496fea43cf6fc4ff09cf04489f328f89525.tar
mageiawelcome-437ed496fea43cf6fc4ff09cf04489f328f89525.tar.gz
mageiawelcome-437ed496fea43cf6fc4ff09cf04489f328f89525.tar.bz2
mageiawelcome-437ed496fea43cf6fc4ff09cf04489f328f89525.tar.xz
mageiawelcome-437ed496fea43cf6fc4ff09cf04489f328f89525.zip
Applications: update the list after installation (mga#24095)
-rw-r--r--qml/mageiawelcome.py11
-rw-r--r--qml/mw-ui.qml40
2 files changed, 36 insertions, 15 deletions
diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py
index 9ace3ec..dfe6998 100644
--- a/qml/mageiawelcome.py
+++ b/qml/mageiawelcome.py
@@ -3,7 +3,7 @@
from PyQt5.QtGui import QGuiApplication, QIcon
from PyQt5.QtQuick import QQuickView
from PyQt5.QtCore import QUrl, QLocale, QTranslator, QLibraryInfo, QVariant, QAbstractListModel, \
- QModelIndex, Qt, QObject, pyqtSlot, QCoreApplication
+ QModelIndex, Qt, QObject, pyqtSlot, pyqtSignal, QCoreApplication
from PyQt5.QtNetwork import QNetworkConfigurationManager, QNetworkConfiguration
import sys
import os
@@ -90,6 +90,7 @@ class Callbrowser(QObject):
subprocess.Popen(["xdg-open", link])
class Launcher(QObject):
+ installed = pyqtSignal()
def __init__(self):
QObject.__init__(self)
@@ -99,7 +100,13 @@ class Launcher(QObject):
cmd = []
for i in range(0,app.property("length").toInt()):
cmd.append(app.property(i).toString())
- subprocess.Popen(cmd)
+ proc = subprocess.Popen(cmd)
+ if cmd[0] == "gurpmi":
+ proc.wait()
+ print(proc.returncode)
+ if (proc.returncode == 0):
+ # Give the signal to reload the applist
+ self.installed.emit()
class Norun(QObject):
def __init__(self):
diff --git a/qml/mw-ui.qml b/qml/mw-ui.qml
index 0a147f5..3e45c82 100644
--- a/qml/mw-ui.qml
+++ b/qml/mw-ui.qml
@@ -468,6 +468,21 @@ Rectangle {
}
}
// Applications page
+ function update_list(group) {
+ appListDM.items.remove(0,appListDM.count );
+ var rowCount = appList.count;
+ for( var i = 0;i < rowCount;i++ )
+ {
+ var entry = appList.get(i);
+ entry.installable = installable.installable(entry.name, entry.inst_repo)
+ console.log(entry.name, entry.inst_repo, entry.installable)
+ var pattern = new RegExp(group, "g");
+ if(pattern.test(entry.group) ) {
+ appListDM.items.insert(entry, "group");
+ }
+ }
+ appListDM.filterOnGroup = "items";
+ }
Rectangle {
property var title: qsTr("Applications")
width: view.width; height: view.height
@@ -526,6 +541,7 @@ Rectangle {
{'name':qsTr("Programming"),'group': "programming"}]
height: (Qt.application.font.pixelSize + 16) * 9
delegate: Rectangle{
+ property variant myGroup: modelData.group
width: parent.width
height: Qt.application.font.pixelSize + 16
color:"#20FFFFFF"
@@ -540,19 +556,9 @@ Rectangle {
width: parent.width
height: 25
onClicked: {
- categoriesList.currentIndex = index
- appListDM.items.remove(0,appListDM.count );
- var rowCount = appList.count;
- for( var i = 0;i < rowCount;i++ )
- {
- var entry = appList.get(i);
- entry.installable = installable.installable(entry.name, entry.inst_repo)
- var pattern = new RegExp(modelData.group, "g");
- if(pattern.test(entry.group) ) {
- appListDM.items.insert(entry, "group");
- }
- }
- appListDM.filterOnGroup = "items";}
+ categoriesList.currentIndex = index;
+ itemModel.update_list(modelData.group);
+ }
}
}
}
@@ -628,6 +634,7 @@ Rectangle {
}
}
}
+
}
Component { id: launcher;
Button {
@@ -842,4 +849,11 @@ Rectangle {
onClicked: norun.setRunAtLaunch(checked)
}
}
+ Connections {
+ target: launch
+ onInstalled: {
+ // get the signal to reload the applist
+ itemModel.update_list(categoriesList.currentItem.myGroup)
+ }
+ }
}