CR feedback

This commit is contained in:
yedpodtrzitko
2024-05-14 10:30:58 +08:00
parent 94a0b00007
commit 06f528f8b5
2 changed files with 12 additions and 14 deletions

View File

@@ -1330,29 +1330,27 @@ class QtDriver(QObject):
# self.update_thumbs()
def update_libs_list(self, path: str):
# add library to list in SettingItems.LIBS_LIST
def update_libs_list(self, path: str | Path):
"""add library to list in SettingItems.LIBS_LIST"""
ITEMS_LIMIT = 5
path = Path(path)
self.settings.beginGroup(SettingItems.LIBS_LIST)
current_time = str(time.time())
all_libs = {current_time: path}
all_libs = {str(time.time()): str(path)}
for item_key in self.settings.allKeys():
item_path = self.settings.value(item_key)
if item_path != path:
if Path(item_path) != path:
all_libs[item_key] = item_path
# sort items by the most recent first
# sort items, most recent first
all_libs = sorted(all_libs.items(), key=lambda item: item[0], reverse=True)
# remove previously saved items
self.settings.clear()
for idx, (item_key, item_value) in enumerate(all_libs, start=1):
if idx > ITEMS_LIMIT:
break
for item_key, item_value in all_libs[:ITEMS_LIMIT]:
self.settings.setValue(item_key, item_value)
self.settings.endGroup()

View File

@@ -122,7 +122,7 @@ class PreviewPanel(QWidget):
# Qt.TextInteractionFlag.TextSelectableByMouse)
properties_style = (
f"background-color:{Theme.COLOR_BG};"
f"background-color:{Theme.COLOR_BG.value};"
f"font-family:Oxanium;"
f"font-weight:bold;"
f"font-size:12px;"
@@ -163,7 +163,7 @@ class PreviewPanel(QWidget):
# find the right trick to only select that particular element.
scroll_area.setStyleSheet(
"QWidget#entryScrollContainer{"
f"background: {Theme.COLOR_BG};"
f"background: {Theme.COLOR_BG.value};"
"border-radius:6px;"
"}"
)
@@ -273,15 +273,15 @@ class PreviewPanel(QWidget):
button.clicked.connect(open_library_button_clicked(full_val))
button.setStyleSheet(
"QPushButton{"
f"background-color:{Theme.COLOR_BG};"
f"background-color:{Theme.COLOR_BG.value};"
"border-radius:6px;"
"text-align: left;"
"padding-top: 3px;"
"padding-left: 6px;"
"padding-bottom: 4px;"
"}"
f"QPushButton::hover{{background-color:{Theme.COLOR_HOVER};}}"
f"QPushButton::pressed{{background-color:{Theme.COLOR_PRESSED};}}"
f"QPushButton::hover{{background-color:{Theme.COLOR_HOVER.value};}}"
f"QPushButton::pressed{{background-color:{Theme.COLOR_PRESSED.value};}}"
)
button.setCursor(Qt.CursorShape.PointingHandCursor)
layout.addWidget(button)