Skip to content

Commit af4c0d1

Browse files
committed
thing
1 parent faef8c6 commit af4c0d1

File tree

3 files changed

+62
-39
lines changed

3 files changed

+62
-39
lines changed

tagstudio/src/qt/widgets/item_thumb.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# Copyright (C) 2024 Travis Abendshien (CyanVoxel).
22
# Licensed under the GPL-3.0 License.
33
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio
4-
import contextlib
54
import logging
6-
import os
75
import platform
86
import time
97
import typing
@@ -39,9 +37,9 @@
3937
if typing.TYPE_CHECKING:
4038
from src.qt.widgets.preview_panel import PreviewPanel
4139

42-
ERROR = f"[ERROR]"
43-
WARNING = f"[WARNING]"
44-
INFO = f"[INFO]"
40+
ERROR = "[ERROR]"
41+
WARNING = "[WARNING]"
42+
INFO = "[INFO]"
4543

4644

4745
logging.basicConfig(format="%(message)s", level=logging.INFO)
@@ -65,27 +63,27 @@ class ItemThumb(FlowWidget):
6563
tag_group_icon_128.load()
6664

6765
small_text_style = (
68-
f"background-color:rgba(0, 0, 0, 192);"
69-
f"font-family:Oxanium;"
70-
f"font-weight:bold;"
71-
f"font-size:12px;"
72-
f"border-radius:3px;"
73-
f"padding-top: 4px;"
74-
f"padding-right: 1px;"
75-
f"padding-bottom: 1px;"
76-
f"padding-left: 1px;"
66+
"background-color:rgba(0, 0, 0, 192);"
67+
"font-family:Oxanium;"
68+
"font-weight:bold;"
69+
"font-size:12px;"
70+
"border-radius:3px;"
71+
"padding-top: 4px;"
72+
"padding-right: 1px;"
73+
"padding-bottom: 1px;"
74+
"padding-left: 1px;"
7775
)
7876

7977
med_text_style = (
80-
f"background-color:rgba(0, 0, 0, 192);"
81-
f"font-family:Oxanium;"
82-
f"font-weight:bold;"
83-
f"font-size:18px;"
84-
f"border-radius:3px;"
85-
f"padding-top: 4px;"
86-
f"padding-right: 1px;"
87-
f"padding-bottom: 1px;"
88-
f"padding-left: 1px;"
78+
"background-color:rgba(0, 0, 0, 192);"
79+
"font-family:Oxanium;"
80+
"font-weight:bold;"
81+
"font-size:18px;"
82+
"border-radius:3px;"
83+
"padding-top: 4px;"
84+
"padding-right: 1px;"
85+
"padding-bottom: 1px;"
86+
"padding-left: 1px;"
8987
)
9088

9189
def __init__(
@@ -195,9 +193,11 @@ def __init__(
195193
self.opener = FileOpenerHelper("")
196194
open_file_action = QAction("Open file", self)
197195
open_file_action.triggered.connect(self.opener.open_file)
198-
196+
199197
system = platform.system()
200-
open_explorer_action = QAction("Open in explorer", self) # Default (mainly going to be for linux)
198+
open_explorer_action = QAction(
199+
"Open in explorer", self
200+
) # Default (mainly going to be for linux)
201201
if system == "Darwin":
202202
open_explorer_action = QAction("Reveal in Finder", self)
203203
elif system == "Windows":

tagstudio/src/qt/widgets/preview_panel.py

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ def __init__(self, library: Library, driver: "QtDriver"):
8686
self.open_file_action = QAction("Open file", self)
8787

8888
system = platform.system()
89-
open_explorer_action = QAction("Open in explorer", self) # Default (mainly going to be for linux)
89+
self.open_explorer_action = QAction(
90+
"Open in explorer", self
91+
) # Default (mainly going to be for linux)
9092
if system == "Darwin":
91-
open_explorer_action = QAction("Reveal in Finder", self)
93+
self.open_explorer_action = QAction("Reveal in Finder", self)
9294
elif system == "Windows":
93-
open_explorer_action = QAction("Open in Explorer", self)
95+
self.open_explorer_action = QAction("Open in Explorer", self)
9496

9597
self.preview_img = QPushButtonWrapper()
9698
self.preview_img.setMinimumSize(*self.img_button_size)
@@ -842,7 +844,10 @@ def write_container(self, index, field, mixed=False):
842844
# f'Are you sure you want to remove this \"{self.lib.get_field_attr(field, "name")}\" field?'
843845
# container.set_remove_callback(lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets(item)))
844846
prompt = f'Are you sure you want to remove this "{self.lib.get_field_attr(field, "name")}" field?'
845-
callback = lambda: (self.remove_field(field), self.update_widgets())
847+
848+
def callback():
849+
return self.remove_field(field), self.update_widgets()
850+
846851
container.set_remove_callback(
847852
lambda: self.remove_message_box(prompt=prompt, callback=callback)
848853
)
@@ -887,7 +892,10 @@ def write_container(self, index, field, mixed=False):
887892
)
888893
container.set_edit_callback(modal.show)
889894
prompt = f'Are you sure you want to remove this "{self.lib.get_field_attr(field, "name")}" field?'
890-
callback = lambda: (self.remove_field(field), self.update_widgets())
895+
896+
def callback():
897+
return self.remove_field(field), self.update_widgets()
898+
891899
container.set_remove_callback(
892900
lambda: self.remove_message_box(prompt=prompt, callback=callback)
893901
)
@@ -927,7 +935,10 @@ def write_container(self, index, field, mixed=False):
927935
)
928936
container.set_edit_callback(modal.show)
929937
prompt = f'Are you sure you want to remove this "{self.lib.get_field_attr(field, "name")}" field?'
930-
callback = lambda: (self.remove_field(field), self.update_widgets())
938+
939+
def callback():
940+
return self.remove_field(field), self.update_widgets()
941+
931942
container.set_remove_callback(
932943
lambda: self.remove_message_box(prompt=prompt, callback=callback)
933944
)
@@ -954,7 +965,10 @@ def write_container(self, index, field, mixed=False):
954965
# container.set_edit_callback(None)
955966
# container.set_remove_callback(lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets(item)))
956967
prompt = f'Are you sure you want to remove this "{self.lib.get_field_attr(field, "name")}" field?'
957-
callback = lambda: (self.remove_field(field), self.update_widgets())
968+
969+
def callback():
970+
return self.remove_field(field), self.update_widgets()
971+
958972
container.set_remove_callback(
959973
lambda: self.remove_message_box(prompt=prompt, callback=callback)
960974
)
@@ -972,7 +986,7 @@ def write_container(self, index, field, mixed=False):
972986
title = f"{self.lib.get_field_attr(field, 'name')} (Date)"
973987
inner_container = TextWidget(title, date.strftime("%D - %r"))
974988
container.set_inner_widget(inner_container)
975-
except:
989+
except Exception:
976990
container.set_title(self.lib.get_field_attr(field, "name"))
977991
# container.set_editable(False)
978992
container.set_inline(False)
@@ -985,7 +999,10 @@ def write_container(self, index, field, mixed=False):
985999
container.set_edit_callback(None)
9861000
# container.set_remove_callback(lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets(item)))
9871001
prompt = f'Are you sure you want to remove this "{self.lib.get_field_attr(field, "name")}" field?'
988-
callback = lambda: (self.remove_field(field), self.update_widgets())
1002+
1003+
def callback():
1004+
return self.remove_field(field), self.update_widgets()
1005+
9891006
container.set_remove_callback(
9901007
lambda: self.remove_message_box(prompt=prompt, callback=callback)
9911008
)
@@ -1012,7 +1029,10 @@ def write_container(self, index, field, mixed=False):
10121029
container.set_edit_callback(None)
10131030
# container.set_remove_callback(lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets(item)))
10141031
prompt = f'Are you sure you want to remove this "{self.lib.get_field_attr(field, "name")}" field?'
1015-
callback = lambda: (self.remove_field(field), self.update_widgets())
1032+
1033+
def callback():
1034+
return self.remove_field(field), self.update_widgets()
1035+
10161036
# callback = lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets())
10171037
container.set_remove_callback(
10181038
lambda: self.remove_message_box(prompt=prompt, callback=callback)
@@ -1067,11 +1087,13 @@ def remove_message_box(self, prompt: str, callback: typing.Callable) -> None:
10671087
cancel_button = remove_mb.addButton(
10681088
"&Cancel", QMessageBox.ButtonRole.DestructiveRole
10691089
)
1070-
remove_button = remove_mb.addButton(
1090+
remove_button = remove_mb.addButton( # noqa: F841
10711091
"&Remove", QMessageBox.ButtonRole.RejectRole
10721092
)
10731093
# remove_mb.setStandardButtons(QMessageBox.StandardButton.Cancel)
1074-
remove_mb.setDefaultButton(cancel_button)
1094+
remove_mb.setDefaultButton(
1095+
cancel_button
1096+
) # TODO: is it supposed to be two cancel buttons? idk but i dont know either way so dont wanna change it
10751097
remove_mb.setEscapeButton(cancel_button)
10761098
result = remove_mb.exec_()
10771099
# logging.info(result)

tagstudio/src/qt/widgets/video_player.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import logging
55

6-
from pathlib import Path
76
import platform
87
import typing
98

@@ -132,7 +131,9 @@ def __init__(self, driver: "QtDriver") -> None:
132131
open_file_action.triggered.connect(self.opener.open_file)
133132

134133
system = platform.system()
135-
open_explorer_action = QAction("Open in explorer", self) # Default (mainly going to be for linux)
134+
open_explorer_action = QAction(
135+
"Open in explorer", self
136+
) # Default (mainly going to be for linux)
136137
if system == "Darwin":
137138
open_explorer_action = QAction("Reveal in Finder", self)
138139
elif system == "Windows":

0 commit comments

Comments
 (0)