mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-02-03 16:43:47 +00:00
Merge remote-tracking branch 'refs/remotes/upstream/main'
This commit is contained in:
@@ -15,11 +15,11 @@ class ColorType(Enum):
|
||||
|
||||
_TAG_COLORS = {
|
||||
"": {
|
||||
ColorType.PRIMARY: "#1E1A33",
|
||||
ColorType.PRIMARY: "#1e1e1e",
|
||||
ColorType.TEXT: ColorType.LIGHT_ACCENT,
|
||||
ColorType.BORDER: "#2B2547",
|
||||
ColorType.LIGHT_ACCENT: "#CDA7F7",
|
||||
ColorType.DARK_ACCENT: "#1E1A33",
|
||||
ColorType.BORDER: "#333333",
|
||||
ColorType.LIGHT_ACCENT: "#FFFFFF",
|
||||
ColorType.DARK_ACCENT: "#222222",
|
||||
},
|
||||
"black": {
|
||||
ColorType.PRIMARY: "#111018",
|
||||
|
||||
@@ -38,54 +38,29 @@ class Ui_MainWindow(QMainWindow):
|
||||
# # self.setStyleSheet(
|
||||
# # 'background:#EE000000;'
|
||||
# # )
|
||||
|
||||
|
||||
|
||||
def setupUi(self, MainWindow):
|
||||
if not MainWindow.objectName():
|
||||
MainWindow.setObjectName(u"MainWindow")
|
||||
MainWindow.resize(1300, 720)
|
||||
|
||||
# self._createMenuBar(MainWindow)
|
||||
|
||||
# print(type(MainWindow))
|
||||
self.centralwidget = QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName(u"centralwidget")
|
||||
self.gridLayout = QGridLayout(self.centralwidget)
|
||||
self.gridLayout.setObjectName(u"gridLayout")
|
||||
# self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalLayout = QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(u"horizontalLayout")
|
||||
|
||||
|
||||
|
||||
# tb = StandardTitleBar(MainWindow)
|
||||
# tb.setObjectName('TitleBar')
|
||||
# # # self.setTitleBar(tb)
|
||||
# hor = QVBoxLayout()
|
||||
# self.gridLayout.setContentsMargins(0,0,0,0)
|
||||
# self.gridLayout.addLayout(hor, 0, 0, 1, 1)
|
||||
|
||||
|
||||
|
||||
# hor.addWidget(tb)
|
||||
|
||||
self.splitter = QSplitter()
|
||||
self.splitter.setObjectName(u"splitter")
|
||||
self.splitter.setHandleWidth(12)
|
||||
|
||||
self.frame_container = QWidget()
|
||||
# self.frame_container.setStyleSheet('background:red;')
|
||||
self.frame_layout = QVBoxLayout(self.frame_container)
|
||||
# self.frame_container.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum)
|
||||
|
||||
self.frame_layout.setSpacing(0)
|
||||
|
||||
|
||||
|
||||
self.scrollArea = QScrollArea()
|
||||
# self.scrollArea.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||
# self.scrollArea.setStyleSheet('background:green;')
|
||||
self.scrollArea.setObjectName(u"scrollArea")
|
||||
self.scrollArea.setFocusPolicy(Qt.WheelFocus)
|
||||
self.scrollArea.setFrameShape(QFrame.NoFrame)
|
||||
@@ -102,12 +77,6 @@ class Ui_MainWindow(QMainWindow):
|
||||
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
|
||||
self.frame_layout.addWidget(self.scrollArea)
|
||||
|
||||
self.scrollArea.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground)
|
||||
# self.scrollArea.setWindowFlag(Qt.WindowType.FramelessWindowHint)
|
||||
self.scrollArea.setAttribute(
|
||||
Qt.WidgetAttribute.WA_TranslucentBackground)
|
||||
self.scrollArea.setStyleSheet('background:#00000000;')
|
||||
|
||||
# self.page_bar_controls = QWidget()
|
||||
# self.page_bar_controls.setStyleSheet('background:blue;')
|
||||
# self.page_bar_controls.setMinimumHeight(32)
|
||||
@@ -118,7 +87,6 @@ class Ui_MainWindow(QMainWindow):
|
||||
# self.frame_layout.addWidget(self.page_bar_controls)
|
||||
# self.frame_layout.addWidget(self.page_bar_controls)
|
||||
|
||||
# self.horizontalLayout.addWidget(self.scrollArea)
|
||||
self.horizontalLayout.addWidget(self.splitter)
|
||||
self.splitter.addWidget(self.frame_container)
|
||||
self.splitter.setStretchFactor(0, 1)
|
||||
@@ -154,13 +122,6 @@ class Ui_MainWindow(QMainWindow):
|
||||
self.searchField = QLineEdit(self.centralwidget)
|
||||
self.searchField.setObjectName(u"searchField")
|
||||
self.searchField.setMinimumSize(QSize(0, 32))
|
||||
self.searchField.setStyleSheet(
|
||||
'background:#55000000;'
|
||||
'border-radius:6px;'
|
||||
'border-style:solid;'
|
||||
'border-width:1px;'
|
||||
'border-color:#11FFFFFF;'
|
||||
)
|
||||
font2 = QFont()
|
||||
font2.setPointSize(11)
|
||||
font2.setBold(False)
|
||||
@@ -174,7 +135,6 @@ class Ui_MainWindow(QMainWindow):
|
||||
self.searchButton.setFont(font2)
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.searchButton)
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_2, 3, 0, 1, 1)
|
||||
|
||||
self.comboBox = QComboBox(self.centralwidget)
|
||||
@@ -213,7 +173,6 @@ class Ui_MainWindow(QMainWindow):
|
||||
self.frame_layout.addWidget(menu_bar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
# self.dumpObjectTree()
|
||||
|
||||
QMetaObject.connectSlotsByName(MainWindow)
|
||||
# setupUi
|
||||
|
||||
@@ -165,25 +165,26 @@ class FoldersToTagsModal(QWidget):
|
||||
self.count = -1
|
||||
self.filename = ""
|
||||
|
||||
self.setWindowTitle(f"Folders To Tags")
|
||||
self.setWindowTitle(f"Create Tags From Folders")
|
||||
self.setWindowModality(Qt.WindowModality.ApplicationModal)
|
||||
self.setMinimumSize(500, 800)
|
||||
self.setMinimumSize(640, 640)
|
||||
self.root_layout = QVBoxLayout(self)
|
||||
self.root_layout.setContentsMargins(6, 6, 6, 6)
|
||||
|
||||
self.title_widget = QLabel()
|
||||
self.title_widget.setObjectName("title")
|
||||
self.title_widget.setWordWrap(True)
|
||||
self.title_widget.setStyleSheet(
|
||||
"font-weight:bold;" "font-size:14px;" "padding-top: 6px"
|
||||
)
|
||||
self.title_widget.setText("Create Tags From Folders")
|
||||
self.title_widget.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
|
||||
self.desc_widget = QLabel()
|
||||
self.desc_widget.setObjectName("descriptionLabel")
|
||||
self.desc_widget.setWordWrap(True)
|
||||
self.desc_widget.setStyleSheet(
|
||||
# 'background:blue;'
|
||||
"text-align:left;"
|
||||
# 'font-weight:bold;'
|
||||
"font-size:18px;"
|
||||
# 'padding-top: 6px'
|
||||
""
|
||||
)
|
||||
self.desc_widget.setText(
|
||||
"""Creates tags based on the folder structure and applies them to entries.\n The Structure below shows all the tags that would be added and to which files they would be added. It being empty means that there are no Tag to be created or assigned"""
|
||||
"""Creates tags based on your folder structure and applies them to your entries.\n The structure below shows all the tags that will be created and what entries they will be applied to."""
|
||||
)
|
||||
self.desc_widget.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
|
||||
@@ -216,14 +217,18 @@ class FoldersToTagsModal(QWidget):
|
||||
|
||||
self.apply_button = QPushButton()
|
||||
self.apply_button.setText("&Apply")
|
||||
self.apply_button.setMinimumWidth(100)
|
||||
self.apply_button.clicked.connect(self.on_apply)
|
||||
|
||||
self.showEvent = self.on_open
|
||||
|
||||
self.root_layout.addWidget(self.title_widget)
|
||||
self.root_layout.addWidget(self.desc_widget)
|
||||
self.root_layout.addWidget(self.open_close_button_w)
|
||||
self.root_layout.addWidget(self.scroll_area)
|
||||
self.root_layout.addWidget(self.apply_button)
|
||||
self.root_layout.addWidget(
|
||||
self.apply_button, alignment=Qt.AlignmentFlag.AlignCenter
|
||||
)
|
||||
|
||||
def on_apply(self, event):
|
||||
folders_to_tags(self.library)
|
||||
|
||||
@@ -16901,17 +16901,10 @@ qt_resource_struct = b"\
|
||||
\x00\x00\x01\x8a\xd2\x83?\x9d\
|
||||
"
|
||||
|
||||
|
||||
def qInitResources():
|
||||
QtCore.qRegisterResourceData(
|
||||
0x03, qt_resource_struct, qt_resource_name, qt_resource_data
|
||||
)
|
||||
|
||||
QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
def qCleanupResources():
|
||||
QtCore.qUnregisterResourceData(
|
||||
0x03, qt_resource_struct, qt_resource_name, qt_resource_data
|
||||
)
|
||||
|
||||
QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
qInitResources()
|
||||
|
||||
@@ -264,8 +264,11 @@ class QtDriver(QObject):
|
||||
self.splash.show()
|
||||
|
||||
menu_bar = self.main_window.menuBar()
|
||||
menu_bar.setNativeMenuBar(False)
|
||||
# menu_bar.setStyleSheet('background:#00000000;')
|
||||
|
||||
# Allow the use of the native macOS menu bar.
|
||||
if sys.platform != "darwin":
|
||||
menu_bar.setNativeMenuBar(False)
|
||||
|
||||
file_menu = QMenu("&File", menu_bar)
|
||||
edit_menu = QMenu("&Edit", menu_bar)
|
||||
tools_menu = QMenu("&Tools", menu_bar)
|
||||
@@ -354,13 +357,13 @@ class QtDriver(QObject):
|
||||
|
||||
edit_menu.addSeparator()
|
||||
|
||||
manage_file_extensions_action = QAction("Ignore File Extensions", menu_bar)
|
||||
manage_file_extensions_action = QAction("Ignored File Extensions", menu_bar)
|
||||
manage_file_extensions_action.triggered.connect(
|
||||
lambda: self.show_file_extension_modal()
|
||||
)
|
||||
edit_menu.addAction(manage_file_extensions_action)
|
||||
|
||||
tag_database_action = QAction("Tag Database", menu_bar)
|
||||
tag_database_action = QAction("Manage Tags", menu_bar)
|
||||
tag_database_action.triggered.connect(lambda: self.show_tag_database())
|
||||
edit_menu.addAction(tag_database_action)
|
||||
|
||||
@@ -410,13 +413,13 @@ class QtDriver(QObject):
|
||||
self.sort_fields_action.setToolTip("Alt+S")
|
||||
macros_menu.addAction(self.sort_fields_action)
|
||||
|
||||
folders_to_tags_action = QAction("Folders to Tags", menu_bar)
|
||||
folders_to_tags_action = QAction("Create Tags From Folders", menu_bar)
|
||||
ftt_modal = FoldersToTagsModal(self.lib, self)
|
||||
folders_to_tags_action.triggered.connect(lambda: ftt_modal.show())
|
||||
macros_menu.addAction(folders_to_tags_action)
|
||||
|
||||
# Help Menu ==========================================================
|
||||
self.repo_action = QAction("Go to GitHub Repository", menu_bar)
|
||||
self.repo_action = QAction("Visit GitHub Repository", menu_bar)
|
||||
self.repo_action.triggered.connect(
|
||||
lambda: webbrowser.open("https://github.com/TagStudioDev/TagStudio")
|
||||
)
|
||||
@@ -641,7 +644,7 @@ class QtDriver(QObject):
|
||||
|
||||
def show_tag_database(self):
|
||||
self.modal = PanelModal(
|
||||
TagDatabasePanel(self.lib), "Tag Database", "Tag Database", has_save=False
|
||||
TagDatabasePanel(self.lib), "Library Tags", "Library Tags", has_save=False
|
||||
)
|
||||
self.modal.show()
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class ItemThumb(FlowWidget):
|
||||
tag_group_icon_128.load()
|
||||
|
||||
small_text_style = (
|
||||
f"background-color:rgba(0, 0, 0, 128);"
|
||||
f"background-color:rgba(0, 0, 0, 192);"
|
||||
f"font-family:Oxanium;"
|
||||
f"font-weight:bold;"
|
||||
f"font-size:12px;"
|
||||
@@ -77,7 +77,7 @@ class ItemThumb(FlowWidget):
|
||||
)
|
||||
|
||||
med_text_style = (
|
||||
f"background-color:rgba(17, 15, 27, 192);"
|
||||
f"background-color:rgba(0, 0, 0, 192);"
|
||||
f"font-family:Oxanium;"
|
||||
f"font-weight:bold;"
|
||||
f"font-size:18px;"
|
||||
|
||||
@@ -38,9 +38,7 @@ class PanelModal(QWidget):
|
||||
self.title_widget.setObjectName("fieldTitle")
|
||||
self.title_widget.setWordWrap(True)
|
||||
self.title_widget.setStyleSheet(
|
||||
# 'background:blue;'
|
||||
# 'text-align:center;'
|
||||
"font-weight:bold;" "font-size:14px;" "padding-top: 6px" ""
|
||||
"font-weight:bold;" "font-size:14px;" "padding-top: 6px"
|
||||
)
|
||||
self.title_widget.setText(title)
|
||||
self.title_widget.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
|
||||
@@ -136,19 +136,20 @@ class PreviewPanel(QWidget):
|
||||
self.dimensions_label.setWordWrap(True)
|
||||
# self.dim_label.setTextInteractionFlags(
|
||||
# Qt.TextInteractionFlag.TextSelectableByMouse)
|
||||
self.dimensions_label.setStyleSheet(ItemThumb.small_text_style)
|
||||
|
||||
# small_text_style = (
|
||||
# f'background-color:rgba(17, 15, 27, 192);'
|
||||
# f'font-family:Oxanium;'
|
||||
# f'font-weight:bold;'
|
||||
# f'font-size:12px;'
|
||||
# f'border-radius:3px;'
|
||||
# f'padding-top: 4px;'
|
||||
# f'padding-right: 1px;'
|
||||
# f'padding-bottom: 1px;'
|
||||
# f'padding-left: 1px;'
|
||||
# )
|
||||
properties_style = (
|
||||
f"background-color:#65000000;"
|
||||
f"font-family:Oxanium;"
|
||||
f"font-weight:bold;"
|
||||
f"font-size:12px;"
|
||||
f"border-radius:6px;"
|
||||
f"padding-top: 4px;"
|
||||
f"padding-right: 1px;"
|
||||
f"padding-bottom: 1px;"
|
||||
f"padding-left: 1px;"
|
||||
)
|
||||
|
||||
self.dimensions_label.setStyleSheet(properties_style)
|
||||
|
||||
self.scroll_layout = QVBoxLayout()
|
||||
self.scroll_layout.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
@@ -157,20 +158,14 @@ class PreviewPanel(QWidget):
|
||||
scroll_container: QWidget = QWidget()
|
||||
scroll_container.setObjectName("entryScrollContainer")
|
||||
scroll_container.setLayout(self.scroll_layout)
|
||||
# scroll_container.setStyleSheet('background:#080716; border-radius:12px;')
|
||||
scroll_container.setStyleSheet(
|
||||
"background:#00000000;"
|
||||
"border-style:none;"
|
||||
f"QScrollBar::{{background:red;}}"
|
||||
)
|
||||
|
||||
info_section = QWidget()
|
||||
info_layout = QVBoxLayout(info_section)
|
||||
info_layout.setContentsMargins(0, 0, 0, 0)
|
||||
info_layout.setSpacing(6)
|
||||
self.setStyleSheet("background:#00000000;" f"QScrollBar::{{background:red;}}")
|
||||
|
||||
scroll_area = QScrollArea()
|
||||
scroll_area.setObjectName("entryScrollArea")
|
||||
scroll_area.setSizePolicy(
|
||||
QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding
|
||||
)
|
||||
@@ -178,15 +173,15 @@ class PreviewPanel(QWidget):
|
||||
scroll_area.setWidgetResizable(True)
|
||||
scroll_area.setFrameShadow(QFrame.Shadow.Plain)
|
||||
scroll_area.setFrameShape(QFrame.Shape.NoFrame)
|
||||
# NOTE: I would rather have this style applied to the scroll_area
|
||||
# background and NOT the scroll container background, so that the
|
||||
# rounded corners are maintained when scrolling. I was unable to
|
||||
# find the right trick to only select that particular element.
|
||||
scroll_area.setStyleSheet(
|
||||
"background:#55000000;"
|
||||
"border-radius:12px;"
|
||||
"border-style:solid;"
|
||||
"border-width:1px;"
|
||||
"border-color:#11FFFFFF;"
|
||||
# f'QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal {{border: none;background: none;}}'
|
||||
# f'QScrollBar::left-arrow:horizontal, QScrollBar::right-arrow:horizontal, QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {{border: none;background: none;color: none;}}'
|
||||
f"QScrollBar::{{background:red;}}"
|
||||
f"QWidget#entryScrollContainer{{"
|
||||
"background:#65000000;"
|
||||
"border-radius:6px;"
|
||||
f"}}"
|
||||
)
|
||||
scroll_area.setWidget(scroll_container)
|
||||
|
||||
@@ -207,29 +202,6 @@ class PreviewPanel(QWidget):
|
||||
self.add_field_button.setMinimumSize(96, 28)
|
||||
self.add_field_button.setMaximumSize(96, 28)
|
||||
self.add_field_button.setText("Add Field")
|
||||
self.add_field_button.setStyleSheet(
|
||||
f"QPushButton{{"
|
||||
# f'background: #1E1A33;'
|
||||
# f'color: #CDA7F7;'
|
||||
f"font-weight: bold;"
|
||||
# f"border-color: #2B2547;"
|
||||
f"border-radius: 6px;"
|
||||
f"border-style:solid;"
|
||||
# f'border-width:{math.ceil(1*self.devicePixelRatio())}px;'
|
||||
"background:#55000000;"
|
||||
"border-width:1px;"
|
||||
"border-color:#11FFFFFF;"
|
||||
# f'padding-top: 1.5px;'
|
||||
# f'padding-right: 4px;'
|
||||
# f'padding-bottom: 5px;'
|
||||
# f'padding-left: 4px;'
|
||||
f"font-size: 13px;"
|
||||
f"}}"
|
||||
f"QPushButton::hover"
|
||||
f"{{"
|
||||
f"background: #333333;"
|
||||
f"}}"
|
||||
)
|
||||
self.afb_layout.addWidget(self.add_field_button)
|
||||
self.afm = AddFieldModal(self.lib)
|
||||
self.place_add_field_button()
|
||||
@@ -398,7 +370,7 @@ class PreviewPanel(QWidget):
|
||||
if extension in IMAGE_TYPES:
|
||||
image = Image.open(filepath)
|
||||
if image.mode == "RGBA":
|
||||
new_bg = Image.new("RGB", image.size, color="#222222")
|
||||
new_bg = Image.new("RGB", image.size, color="#1e1e1e")
|
||||
new_bg.paste(image, mask=image.getchannel(3))
|
||||
image = new_bg
|
||||
if image.mode != "RGB":
|
||||
|
||||
@@ -52,10 +52,10 @@ class TagBoxWidget(FieldWidget):
|
||||
self.add_button.setText("+")
|
||||
self.add_button.setStyleSheet(
|
||||
f"QPushButton{{"
|
||||
# f'background: #1E1A33;'
|
||||
# f'color: #CDA7F7;'
|
||||
f"background: #1e1e1e;"
|
||||
f"color: #FFFFFF;"
|
||||
f"font-weight: bold;"
|
||||
# f"border-color: #2B2547;"
|
||||
f"border-color: #333333;"
|
||||
f"border-radius: 6px;"
|
||||
f"border-style:solid;"
|
||||
f"border-width:{math.ceil(1*self.devicePixelRatio())}px;"
|
||||
@@ -67,7 +67,8 @@ class TagBoxWidget(FieldWidget):
|
||||
f"}}"
|
||||
f"QPushButton::hover"
|
||||
f"{{"
|
||||
# f'background: #2B2547;'
|
||||
f"border-color: #CCCCCC;"
|
||||
f"background: #555555;"
|
||||
f"}}"
|
||||
)
|
||||
tsp = TagSearchPanel(self.lib)
|
||||
|
||||
@@ -142,7 +142,7 @@ class ThumbRenderer(QObject):
|
||||
# image = self.thumb_debug
|
||||
if image.mode == "RGBA":
|
||||
# logging.info(image.getchannel(3).tobytes())
|
||||
new_bg = Image.new("RGB", image.size, color="#222222")
|
||||
new_bg = Image.new("RGB", image.size, color="#1e1e1e")
|
||||
new_bg.paste(image, mask=image.getchannel(3))
|
||||
image = new_bg
|
||||
if image.mode != "RGB":
|
||||
@@ -173,7 +173,7 @@ class ThumbRenderer(QObject):
|
||||
text: str = extension
|
||||
with open(filepath, "r", encoding="utf-8") as text_file:
|
||||
text = text_file.read(256)
|
||||
bg = Image.new("RGB", (256, 256), color="#222222")
|
||||
bg = Image.new("RGB", (256, 256), color="#1e1e1e")
|
||||
draw = ImageDraw.Draw(bg)
|
||||
draw.text((16, 16), text, file=(255, 255, 255))
|
||||
image = bg
|
||||
@@ -325,7 +325,7 @@ class ThumbRenderer(QObject):
|
||||
# image = self.thumb_debug
|
||||
if image.mode == "RGBA":
|
||||
# logging.info(image.getchannel(3).tobytes())
|
||||
new_bg = Image.new("RGB", image.size, color="#222222")
|
||||
new_bg = Image.new("RGB", image.size, color="#1e1e1e")
|
||||
new_bg.paste(image, mask=image.getchannel(3))
|
||||
image = new_bg
|
||||
if image.mode != "RGB":
|
||||
@@ -355,7 +355,7 @@ class ThumbRenderer(QObject):
|
||||
text: str = extension
|
||||
with open(filepath, "r", encoding="utf-8") as text_file:
|
||||
text = text_file.read(256)
|
||||
bg = Image.new("RGB", (256, 256), color="#222222")
|
||||
bg = Image.new("RGB", (256, 256), color="#1e1e1e")
|
||||
draw = ImageDraw.Draw(bg)
|
||||
draw.text((16, 16), text, file=(255, 255, 255))
|
||||
image = bg
|
||||
|
||||
Reference in New Issue
Block a user