diff --git a/ArtNet/gui/dialogs/tag_import_dialog/tag_imp_dialog.py b/ArtNet/gui/dialogs/tag_import_dialog/tag_imp_dialog.py index bab2e06..4b20df4 100644 --- a/ArtNet/gui/dialogs/tag_import_dialog/tag_imp_dialog.py +++ b/ArtNet/gui/dialogs/tag_import_dialog/tag_imp_dialog.py @@ -1,6 +1,6 @@ from PyQt5 import QtWidgets -from PyQt5.QtGui import QStandardItemModel, QStandardItem -from PyQt5.QtCore import Qt +from PyQt5.QtGui import QStandardItemModel, QStandardItem, QDesktopServices +from PyQt5.QtCore import Qt, QUrl from ArtNet.gui.dialogs.tag_import_dialog.tag_import_dialog import Ui_Dialog @@ -14,6 +14,7 @@ class TagImportDialog(QtWidgets.QDialog): self.ui.setupUi(self) self.ui.import_all_button.clicked.connect(self.on_import_all_clicked) self.ui.remove_all_button.clicked.connect(self.on_remove_all_clicked) + self.ui.used_link_label.linkActivated.connect(self.on_used_link_activated) self.to_import = [] self.not_import = [] @@ -61,7 +62,8 @@ class TagImportDialog(QtWidgets.QDialog): :param link: :return: """ - self.ui.used_link_label.setText(link) + hyperlink = "{1}".format(link, link) + self.ui.used_link_label.setText(hyperlink) def set_ignore_tag_list(self, tags: list): """ @@ -116,6 +118,10 @@ class TagImportDialog(QtWidgets.QDialog): self.set_import_tag_list(self.to_import) self.set_ignore_tag_list(self.not_import) + def on_used_link_activated(self, link): + print("Predicted link activated:", link) + QDesktopServices.openUrl(QUrl(link)) + def exec_(self) -> int: if super(TagImportDialog, self).exec_() == QtWidgets.QDialog.Rejected: return None diff --git a/ArtNet/gui/window.py b/ArtNet/gui/window.py index 6760f46..4937a88 100644 --- a/ArtNet/gui/window.py +++ b/ArtNet/gui/window.py @@ -2,7 +2,7 @@ import validators, os from PyQt5 import QtWidgets from PyQt5.QtCore import Qt, QSize, QUrl -from PyQt5.QtGui import QPixmap, QResizeEvent, QKeyEvent, QStandardItemModel, QStandardItem, QMovie +from PyQt5.QtGui import QPixmap, QResizeEvent, QKeyEvent, QStandardItemModel, QStandardItem, QMovie, QDesktopServices from PyQt5 import QtMultimedia from PyQt5.QtMultimediaWidgets import QVideoWidget @@ -72,6 +72,7 @@ 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.presence_docker_button.clicked.connect(self.toggle_presence_docker) @@ -746,7 +747,7 @@ class Window(QtWidgets.QMainWindow): self.set_tag_list(self.curr_tags) return - self.__main.import_tags(self.curr_art_id, result) + self.__main.import_tags(result) self.set_tag_list(self.curr_tags) def on_next_clicked(self): @@ -1041,3 +1042,7 @@ class Window(QtWidgets.QMainWindow): return self.__main.refresh_shown_image() + + def on_link_label_activated(self, link: str): + print("Source link activated!", link) + QDesktopServices.openUrl(QUrl(link)) \ No newline at end of file