New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add list of libraries into sidebar #151
Conversation
I like the ability to toggle the automatic library loading on start. I saw in #127 you said you motivation for this was the thumbnail threads spooling up, which is more of an issue with the current lack of thumbnail caching than anything else. That being said, there will always be some resources being used when opening a library and having the choice to toggle that off is valuable regardless. While I largely agree with @Loran425 about the approach of having an "Open Recent Libraries" menu over the idea of having a persistent panel on screen, I can see the desire to be able to switch between libraries faster. As long as it's able to be hidden for users who don't want it, I don't see the harm in it. With that being said though, I can't seem to get it to even appear on my end: In addition, the splash screen seems to be broken for me now, which could be related to the changes in |
72672b5
to
80b58ba
Compare
that's not configurable via the following menu item:
That should be fixed now. It got lost when checking in new commits. Thanks for catching that.
I never see the splash screen (even before), so I cant test it, but I made a speculative change which could fix it. Let me know if it works for you now as expected, thanks. |
Currently there's an issue on Windows where the path separators aren't normalized list the library list, resulting in duplicate libraries showing up in the list: Also, the splash screen is still broken for me but I'll see if I can make changes to get that functional on at least my end. |
button.setStyleSheet( | ||
"background-color: #ffffff; color: #000000; text-align: left; padding-left: 10px;" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposed style changes to the library section to better match the look and feel of the rest of the program (screenshot includes changes to the section title not featured in the changes below)
button.setStyleSheet( | |
"background-color: #ffffff; color: #000000; text-align: left; padding-left: 10px;" | |
) | |
button.setStyleSheet( | |
"QPushButton{" | |
"background-color:#65000000;" | |
"border-radius:6px;" | |
"text-align: left;" | |
"padding-top: 3px;" | |
"padding-left: 6px;" | |
"padding-bottom: 4px;" | |
"}" | |
"QPushButton::hover{background-color:#65AAAAAA;}" | |
"QPushButton::pressed{background-color:#65EEEEEE;}" | |
) | |
button.setCursor(Qt.CursorShape.PointingHandCursor) |
# remove from GUI | ||
widget.setParent(None) | ||
|
||
label = QLabel("Select a library") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion to rename this section to "Recent Libraries". I feel this is more descriptive of the section, and is more consistent with similar "File -> Open Recent Thing" functionality found in other programs, and likely this program in the future.
label = QLabel("Select a library") | |
label = QLabel("Recent Libraries") | |
label.setStyleSheet("font-weight:bold;") |
tagstudio/src/qt/ts_qt.py
Outdated
@@ -416,6 +431,20 @@ def start(self): | |||
macros_menu.addAction(self.sort_fields_action) | |||
|
|||
folders_to_tags_action = QAction("Create Tags From Folders", menu_bar) | |||
show_libs_list_action = QAction("Show Libraries List", menu_bar) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar suggestion to the main "Recent Libraries" one, just changing the menu action to match.
show_libs_list_action = QAction("Show Libraries List", menu_bar) | |
show_libs_list_action = QAction("Show Recent Libraries", menu_bar) |
I'll be honest, I was skeptical at first of whether I would personally use this list vs just having it tucked away in the File menu, but as soon as I actually used it I didn't want to live without it 😁 Fantastic work on this so far! Other than the issues and styling changes commented above, I wanted to suggest a few other changes/additions. These tie into the idea of this being more of a "Recent Libraries" list rather than a list of all libraries you've historically opened. Proposed Changes/Additions
Thank you again for all your work on this! |
@@ -90,7 +92,7 @@ | |||
FixDupeFilesModal, | |||
FoldersToTagsModal, | |||
) | |||
import src.qt.resources_rc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this import is what causes in the splash screen to break, and is currently the pinpoint of a merge conflict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah so it's not unused import, but it has side-effect of executing code. Not a good thing to do, but looks like there's no way around it. I'll add comment so it's obvious why is it here.
I'm afraid I dont have any windows machine around here, so I cant reproduce this issue. I just hope the Pathlib PR will solve this automagically. |
I was thinking to implement this in future, but rather than using the context menu, I was considering to add there another button, the same way as Tags have it (➖ ), or Fields have it (🗑️ ), so the design language is somehow consistent. |
10a09af
to
fcb23d3
Compare
Makes sense to me, I thing the (➖) would be the better route. |
Not sure if you're running into this issue as well, but when using the refactored color variable enums: scroll_area.setStyleSheet(
"QWidget#entryScrollContainer{"
f"background: {Theme.COLOR_BG};"
"border-radius:6px;"
"}"
) Qt throws an error trying to read from the stylesheets because it's using the literal name "Theme.COLOR_BG" as the color value. If I change these instances to |
tagstudio/src/qt/ts_qt.py
Outdated
all_libs = {current_time: path} | ||
|
||
for item_key in self.settings.allKeys(): | ||
item_path = self.settings.value(item_key) | ||
if item_path != path: | ||
all_libs[item_key] = item_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the inconsistent path separator bug while keeping in line with #156. Not really a fan of the double casting, but it works. I've also tested this after manually modifying the .ini to use different separators, and it all loads and displays as you'd expect - on Windows at least.
all_libs = {current_time: path} | |
for item_key in self.settings.allKeys(): | |
item_path = self.settings.value(item_key) | |
if item_path != path: | |
all_libs[item_key] = item_path | |
all_libs = {current_time: str(Path(path))} | |
for item_key in self.settings.allKeys(): | |
item_path = Path(self.settings.value(item_key)) | |
if item_path != Path(path): | |
all_libs[item_key] = str(item_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I achieved this with fewer casting, hopefully it will still work as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paths with non-native separators are no longer normalized when loading from the .ini, but honestly this is probably a niche use case anyway and doesn't impact the actual functionality of the program. It's just a small visual quirk at this point. As long as nobody complains, I'm okay with the reduced number of casts.
No issue on my side, but adding the |
402fc54
to
3c40c8a
Compare
c499902
to
46ae3a6
Compare
46ae3a6
to
a71ed7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!! I attempted to find a way to make the library splitter section only take up the minimum amount of space it needs instead of letting it grow along the title label, but couldn't find anything quickly that would do it. Given that it would only be a minor visual enhancement I won't worry about it too much right now. If you or I can't find a solution to it soon then perhaps opening up an issue for it after the fact would be best. After all, I think we'd both rather move onto more important fixes and additions than spend too much time fighting with Qt ;)
seems like that got lost during rebasing and I didnt check after last push. |
ok I see what you mean now. Check the behaviour after the latest commit I pushed. |
Awesome!! Works exactly how I'd expect! Every now and again it won't update the size when when I remove a library, but I can't predictably reproduce it. Overall though I'm more than happy to go ahead and pull this. Thank you again for all your hard work! |
superseding #127
show list of previously opened libraries on bottom of sidebar:
add option (default True) to decide if previous library should be opened on app start
there's a minor refactoring to keep working with variables localized. So instead of this:
...working with the variable is now moved into the same place.