mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-01-31 15:19:10 +00:00
clickable label to the right place
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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}')
|
||||
Reference in New Issue
Block a user