From bcf4453c8d3bbe60404b63bff14e62b3c04a2016 Mon Sep 17 00:00:00 2001 From: Matheus Cirillo Date: Fri, 26 Apr 2024 20:17:54 -0300 Subject: [PATCH] clickable label to the right place --- tagstudio/src/qt/ts_qt.py | 18 +++++++++++++++++- tagstudio/src/qt/utils/clickableLabels.py | 20 -------------------- 2 files changed, 17 insertions(+), 21 deletions(-) delete mode 100644 tagstudio/src/qt/utils/clickableLabels.py diff --git a/tagstudio/src/qt/ts_qt.py b/tagstudio/src/qt/ts_qt.py index 0e352a2a..3d8a593b 100644 --- a/tagstudio/src/qt/ts_qt.py +++ b/tagstudio/src/qt/ts_qt.py @@ -46,7 +46,6 @@ from src.core.ts_core import (TagStudioCore, TAG_COLORS, DATE_FIELDS, TEXT_FIELD from src.core.utils.web import strip_web_protocol from src.qt.flowlayout import FlowLayout, FlowWidget from src.qt.main_window import Ui_MainWindow -from src.qt.utils.clickableLabels import FileOpenerLabel import src.qt.resources_rc # SIGQUIT is not defined on Windows @@ -1970,6 +1969,23 @@ class AddFieldModal(QWidget): self.root_layout.addStretch(1) self.root_layout.addWidget(self.button_container) +class FileOpenerLabel(QLabel): + def __init__(self, text, parent=None): + super().__init__(text, parent) + + def setFilePath(self, filepath): + self.filepath = filepath + + def mousePressEvent(self, event): + super().mousePressEvent(event) + #open file + if hasattr(self, 'filepath'): + if os.path.exists(self.filepath): + os.startfile(self.filepath) + logging.info(f'Opening file: {self.filepath}') + else: + logging.error(f'File not found: {self.filepath}') + class PreviewPanel(QWidget): """The Preview Panel Widget.""" tags_updated = Signal() diff --git a/tagstudio/src/qt/utils/clickableLabels.py b/tagstudio/src/qt/utils/clickableLabels.py deleted file mode 100644 index 12d4cba9..00000000 --- a/tagstudio/src/qt/utils/clickableLabels.py +++ /dev/null @@ -1,20 +0,0 @@ -import os -import logging -from PySide6.QtWidgets import QLabel - -class FileOpenerLabel(QLabel): - def __init__(self, text, parent=None): - super().__init__(text, parent) - - def setFilePath(self, filepath): - self.filepath = filepath - - def mousePressEvent(self, event): - super().mousePressEvent(event) - #open file - if hasattr(self, 'filepath'): - if os.path.exists(self.filepath): - os.startfile(self.filepath) - logging.info(f'Opening file: {self.filepath}') - else: - logging.error(f'File not found: {self.filepath}') \ No newline at end of file