diff --git a/tagstudio/src/qt/ts_qt.py b/tagstudio/src/qt/ts_qt.py index 8cac543c..217b1364 100644 --- a/tagstudio/src/qt/ts_qt.py +++ b/tagstudio/src/qt/ts_qt.py @@ -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() diff --git a/tagstudio/src/qt/widgets/preview_panel.py b/tagstudio/src/qt/widgets/preview_panel.py index 935775fc..19fef2ac 100644 --- a/tagstudio/src/qt/widgets/preview_panel.py +++ b/tagstudio/src/qt/widgets/preview_panel.py @@ -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)