summaryrefslogtreecommitdiffstats
path: root/qml
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2020-06-26 22:40:29 +0200
committerPapoteur <papoteur@mageia.org>2020-06-26 22:43:39 +0200
commit569653708c79d2a232fcdca46c9945867de4f2a0 (patch)
tree163ba99b6f8cee4c5c5a9bd80742aec7471127a3 /qml
parente0f03586b4b3c7a89abdd43a94276e9cdb83d415 (diff)
downloadmageiawelcome-569653708c79d2a232fcdca46c9945867de4f2a0.tar
mageiawelcome-569653708c79d2a232fcdca46c9945867de4f2a0.tar.gz
mageiawelcome-569653708c79d2a232fcdca46c9945867de4f2a0.tar.bz2
mageiawelcome-569653708c79d2a232fcdca46c9945867de4f2a0.tar.xz
mageiawelcome-569653708c79d2a232fcdca46c9945867de4f2a0.zip
Add dialog messages when repositories are not enabled for software installation (mga#24695)
Suppress warning about int conversion.
Diffstat (limited to 'qml')
-rw-r--r--qml/mageiawelcome.py46
-rw-r--r--qml/mw-ui.qml41
2 files changed, 76 insertions, 11 deletions
diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py
index 20cc8aa..52e0339 100644
--- a/qml/mageiawelcome.py
+++ b/qml/mageiawelcome.py
@@ -110,6 +110,9 @@ class Callbrowser(QObject):
class Launcher(QObject):
installed = pyqtSignal()
+ tainted = pyqtSignal()
+ repo = pyqtSignal()
+
def __init__(self):
QObject.__init__(self)
@@ -119,12 +122,45 @@ class Launcher(QObject):
cmd = []
for i in range(0,app.property("length").toInt()):
cmd.append(app.property(i).toString())
- proc = subprocess.Popen(cmd)
if cmd[0] == "gurpmi":
+ repo = cmd[2]
+ # Check if repositories are enabled
+ core = False
+ updates = False
+ tainted = False
+ t_updates = False
+ try:
+ active = subprocess.run(['urpmq','--list-media','active'], capture_output=True, text=True)
+ active.check_returncode()
+ except subprocess.CallProcessError:
+ print("Error with urpmq")
+ return
+ for line in active.stdout:
+ if line.startswith('Core Release'):
+ core = True
+ if line.startswith('Core Updates'):
+ updates = True
+ if line.startswith('Tainted Release'):
+ core = True
+ if line.startswith('Tainted Updates'):
+ core = True
+ if repo == 'tainted' and not (tainted and t_updates) :
+ # repo not enabled
+ # print("Tainted not active")
+ self.tainted.emit()
+ 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]])
proc.wait()
- print(proc.returncode)
# Give the signal to reload the applist
self.installed.emit()
+ return
+ proc = subprocess.Popen(cmd)
class Norun(QObject):
def __init__(self):
@@ -196,10 +232,10 @@ if __name__ == '__main__':
# if density is high, use at least factor 2 to scale the initial window. Considering high is more than 190 px/inches.
if screen.logicalDotsPerInch() > 190 :
factor = max(2.0, factor)
- defaultHeight = min(700 * factor, screen.availableGeometry().height())
- defaultWidth = min(1000 * factor, screen.availableGeometry().width())
+ defaultHeight = min(int(700 * factor), screen.availableGeometry().height())
+ defaultWidth = min(int(1000 * factor), screen.availableGeometry().width())
centerPoint = screen.availableGeometry().center()
- view.setGeometry(centerPoint.x() -defaultWidth/2, centerPoint.y() - defaultHeight/2, defaultWidth,defaultHeight)
+ view.setGeometry(centerPoint.x() -defaultWidth//2, centerPoint.y() - defaultHeight//2, defaultWidth,defaultHeight)
view.rootContext().setContextProperty('link', cb)
view.rootContext().setContextProperty('launch', la)
view.rootContext().setContextProperty('user', us)
diff --git a/qml/mw-ui.qml b/qml/mw-ui.qml
index 4c93854..3adf1b1 100644
--- a/qml/mw-ui.qml
+++ b/qml/mw-ui.qml
@@ -83,10 +83,10 @@ Rectangle {
// MCC Page
Mcc {}
-
+
// Install software page
InstallSoftware {}
-
+
// Applications page
function update_list(group) {
appListDM.items.remove(0,appListDM.count );
@@ -263,7 +263,7 @@ Rectangle {
height: Qt.application.font.pixelSize * 1.3
objectName: "launch"
onClicked: {
- launch.command(["gurpmi",name,])}
+ launch.command(["gurpmi",name,repo,])}
style: ButtonStyle {
label: Label {
horizontalAlignment: TextInput.AlignHCenter
@@ -345,7 +345,6 @@ Rectangle {
}
}
}
-
// Configuration summary Page
Configuration {}
@@ -382,7 +381,7 @@ Rectangle {
anchors.leftMargin: 0
anchors.topMargin: 0
anchors { fill: parent; bottomMargin: startCB.implicitHeight +10 }
- model: itemModelLive
+ model: (user == 'live' ? itemModelLive : itemModel)
preferredHighlightBegin: 0; preferredHighlightEnd: 0
highlightRangeMode: ListView.StrictlyEnforceRange
orientation: ListView.Horizontal
@@ -445,12 +444,42 @@ Rectangle {
onClicked: norun.setRunAtLaunch(checked)
}
}
+
+ MessageDialog {
+ id: no_tainted
+ icon: StandardIcon.Warning
+ title: qsTr("Application installation")
+ //: %1 will be replaced with the 'Media sources' translation
+ text: qsTr("Tainted repositories are not enabled. See the '%1' tab.").arg(qsTr("Media sources"))
+ standardButtons: StandardButton.Close
+ }
+
+ MessageDialog {
+ id: no_core
+ icon: StandardIcon.Warning
+ title: qsTr("Application installation")
+ //: %1 will be replaced with the 'Media sources' translation
+ text: qsTr("Core repositories are not enabled. See the '%1' tab.").arg(qsTr("Media sources"))
+ standardButtons: StandardButton.Close
+ }
+
Connections {
target: launch
- onInstalled: {
+ function onInstalled() {
// get the signal to reload the applist
console.log("Reload applications list")
itemModel.update_list(categoriesList.currentItem.myGroup)
}
+
+ function onRepo() {
+ // get the signal that core repo is not enabled
+ 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
+ }
}
}