summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2023-12-06 08:38:50 +0100
committerPapoteur <papoteur@mageia.org>2023-12-06 08:38:50 +0100
commit89cee0730275748ad19b5203b35f8d0a58dec4e3 (patch)
tree3676fd7de9443a27eeaca5d034e56693450f4903
parent6b4fa7be0839774d165776c88de4b7dda67e1041 (diff)
downloadmga-advisor-89cee0730275748ad19b5203b35f8d0a58dec4e3.tar
mga-advisor-89cee0730275748ad19b5203b35f8d0a58dec4e3.tar.gz
mga-advisor-89cee0730275748ad19b5203b35f8d0a58dec4e3.tar.bz2
mga-advisor-89cee0730275748ad19b5203b35f8d0a58dec4e3.tar.xz
mga-advisor-89cee0730275748ad19b5203b35f8d0a58dec4e3.zip
Add message of loading when retrieving info
Clear the fields before retreiving info Suggest a subject with list of package sources
-rw-r--r--mga-advisor.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/mga-advisor.py b/mga-advisor.py
index 3f9ef11..319e644 100644
--- a/mga-advisor.py
+++ b/mga-advisor.py
@@ -7,6 +7,7 @@ import re
from subprocess import run
import requests
from textwrap import wrap
+import time
from PySide6.QtWidgets import (
QApplication,
@@ -102,10 +103,14 @@ class Widget(QWidget):
return
self.valid_number()
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ self.clean()
+ self.ui.status.setText("Loading...")
+ self.repaint()
url = os.path.join(BASE_URL, self.ui.bug_le.text()) + "?include_fields=cf_rpmpkg,cf_cve,url,component"
headers = {'Accept': 'application/json'}
r = requests.get(url, headers=headers)
if r.status_code == 200 and r.json()["faults"] == []:
+ desc =""
for pkg in re.split(';|,| ', r.json()['bugs'][0]['cf_rpmpkg']):
pkg = pkg.strip()
if pkg == "":
@@ -126,6 +131,7 @@ class Widget(QWidget):
"-" + source["release"] +
suffix,
)))
+ desc += f" {pkg}"
for cve in re.split(';|,| ', r.json()['bugs'][0]['cf_cve']):
cve = cve.strip()
if cve != "":
@@ -138,8 +144,11 @@ class Widget(QWidget):
if "component" in r.json()['bugs'][0].keys():
if r.json()['bugs'][0]["component"] == "Security":
self.ui.security_rb.setChecked(True)
+ self.ui.subject_le.setText(f"Updated{desc} packages fix security vulnerabilities")
else:
self.ui.bugfix_rb.setChecked(True)
+ self.ui.subject_le.setText(f"Updated{desc} packages fix ")
+ self.ui.status.setText("")
else:
self.ui.status.setText("No info retreived")
QTimer.singleShot(5000, self.clean_status)
@@ -148,6 +157,14 @@ class Widget(QWidget):
def clean_status(self):
self.ui.status.setText("")
+ def clean(self):
+ # Delete all fields except bug number
+ self.ui.list_ref.clear()
+ self.ui.list_src.clear()
+ self.ui.subject_le.setText("")
+ self.ui.list_cve.clear()
+ self.ui.description_te.clear()
+
def add_src(self):
dl = SrcDialog()
name = dl.exec()