diff options
-rw-r--r-- | mga-advisor.py | 17 |
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() |