From e45106cd2cb37a44e2dcef148ff1f02782a6e9fa Mon Sep 17 00:00:00 2001 From: Peery Date: Tue, 4 Jan 2022 02:20:45 +0100 Subject: [PATCH] Fixed Bug in Importing Tags Fixed a bug where imported tags were not considered if they were implied by any other tag in the whole database. Also made the image author link clickable and open the URL with QDesktopServices --- ArtNet/artnet_manager.py | 10 +++++++++- ArtNet/gui/window.py | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ArtNet/artnet_manager.py b/ArtNet/artnet_manager.py index 2785cb1..ff36380 100644 --- a/ArtNet/artnet_manager.py +++ b/ArtNet/artnet_manager.py @@ -129,7 +129,15 @@ class ArtNetManager: result = self.db_connection.get_tag_impliers(tag) if len(result) != 0: # tag is implied by some other tag - continue + skip = False + for implier_tag_id in result: + implier_tag_id, implier_tag_name, _, _ = self.db_connection.get_tag_by_ID(implier_tag_id)[0] + + if implier_tag_name.strip() in scraped_tags: + skip = True + break + if skip: # skipping the current tag as it is implied by another tag + continue result = self.db_connection.get_tag_aliases_by_name(tag) if len(result) != 0: # tag is already tagged by an alias diff --git a/ArtNet/gui/window.py b/ArtNet/gui/window.py index 4937a88..2085906 100644 --- a/ArtNet/gui/window.py +++ b/ArtNet/gui/window.py @@ -72,7 +72,9 @@ class Window(QtWidgets.QMainWindow): self.ui.prev_unknown_image_button.clicked.connect(self.on_prev_unknown_image_clicked) self.ui.next_unknown_image_button.clicked.connect(self.on_next_unknown_image_clicked) self.ui.delete_button.clicked.connect(self.on_delete_image_clicked) + self.ui.link_label.linkActivated.connect(self.on_link_label_activated) + self.ui.image_author_label.linkActivated.connect(self.on_image_author_label_activated) self.ui.presence_docker_button.clicked.connect(self.toggle_presence_docker) @@ -1045,4 +1047,8 @@ class Window(QtWidgets.QMainWindow): def on_link_label_activated(self, link: str): print("Source link activated!", link) + QDesktopServices.openUrl(QUrl(link)) + + def on_image_author_label_activated(self, link: str): + print("Image author link activated!", link) QDesktopServices.openUrl(QUrl(link)) \ No newline at end of file