From 03408f8ba991626cecb0262f763e83ba7d584f98 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Fri, 8 Mar 2024 17:32:08 +0100 Subject: Ad check that there is source at export time --- mga-advisor.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mga-advisor.py b/mga-advisor.py index ef34888..8fbcf73 100644 --- a/mga-advisor.py +++ b/mga-advisor.py @@ -255,7 +255,7 @@ class Widget(QWidget): return yaml.dump(data, default_flow_style=False, sort_keys=False, width=75, allow_unicode=True) def export(self): - if not self.valid_number(): + if not self.check_data(): return default_path = self.settings.value("Default/path", "/mageia-advisories/advisories") if QDir().mkpath(QDir().homePath() + default_path): @@ -275,6 +275,20 @@ class Widget(QWidget): filepath = filepath[len(QDir().homePath()):] self.settings.setValue('Default/path', filepath) + def check_data(self): + anomalies = "" + if self.ui.bug_le.text() == "": + anomalies = "\n".join([anomalies, "- no bug number given"]) + if self.ui.list_src.count() == 0: + anomalies = "\n".join([anomalies, "- no source given"]) + if anomalies != "": + message = "There is anomalies:\n" + anomalies + "\nDo you want to continue?" + mb = QMessageBox(QMessageBox.Warning, "Anomalies", message, QMessageBox.Yes|QMessageBox.No) + returncode = mb.exec() + if returncode != QMessageBox.Yes: + return False + return True + def cancel(self): self.close() -- cgit v1.2.1