-
Notifications
You must be signed in to change notification settings - Fork 382
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
feat: begin adding settings menu #647
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
dcf34fd
to
037ebde
Compare
18989ff
to
e3d90a7
Compare
tagstudio/src/qt/translations.py
Outdated
@@ -30,7 +30,7 @@ def value(self) -> str: | |||
|
|||
@value.setter | |||
def value(self, value: str): | |||
if self.__value != value: | |||
if self.__value != value and value is not None: |
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.
@Computerdores I'm sure this is not at all an ideal solution to this problem, but it seems to fix the problem I was having with changing the language while TagStudio is running and having any non-translated elements have no text. If you have a better way of fixing this, I'm all ears
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.
Yeah you are right it is definitely not ideal as it would introduce another bug. I have an idea for a proper fix - I'll give this PR a review later and include the fix there.
@CyanVoxel After a very quick 4 weeks of development, the extremely basic settings menu is complete and ready for review (sarcasm) but seriously it is ready for review |
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.
Issues I noticed while testing:
- The view menu is empty so clicking it doesn't do anything (should probably be removed)
- Changing the "Show filenames" option has no effect without restarting TS
Changing the language has no effect (at least changing to es-MX doesn't)The Dark mode setting doesn't work for me (Windows 10, Windows is set to dark mode, TS is set to light mode; TS shows in dark mode anyways)
if isinstance(path, str): | ||
path_value = Path(path) | ||
|
||
if path is None: | ||
path_value = Path(self.filename) |
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.
The second if can be an else instead - it would be more intuitive that way
if isinstance(path, str): | |
path_value = Path(path) | |
if path is None: | |
path_value = Path(self.filename) | |
if isinstance(path, str): | |
path_value = Path(path) | |
else: | |
path_value = Path(self.filename) |
# Cant think of any library-specific properties lol | ||
test_prop: bool = False |
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.
There is the list of excluded file extensions that could be here, no?
tagstudio/src/core/tscacheddata.py
Outdated
if not Path(path).exists(): | ||
logger.info("Cache file does not exist - creating", path=path) | ||
open(path, "w").close() |
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 will fail if the parent directory doesn't exist. I would suggest taking the logic from the if path is None:
case and using it for both cases with the path being chosen based on whether path is None
tagstudio/src/qt/ts_qt.py
Outdated
settings_menu_action = QAction("&Settings", menu_bar) | ||
settings_menu_action.triggered.connect(lambda: self.open_settings_menu()) | ||
edit_menu.addAction(settings_menu_action) | ||
|
||
edit_menu.addSeparator() | ||
|
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 would put this under "File" instead of "Edit" since all the other options under "Edit" are about editing the currently open library, while all the options in the Settings menu are unrelated to the library.
# def fill_libs_widget(self, layout: QVBoxLayout): | ||
# settings = self.driver.settings | ||
# settings.beginGroup(SettingItems.LIBS_LIST) | ||
# lib_items: dict[str, tuple[str, str]] = {} | ||
# for item_tstamp in settings.allKeys(): | ||
# val = str(settings.value(item_tstamp, type=str)) | ||
# cut_val = val | ||
# if len(val) > 45: | ||
# cut_val = f"{val[0:10]} ... {val[-10:]}" | ||
# lib_items[item_tstamp] = (val, cut_val) | ||
|
||
# settings.endGroup() | ||
|
||
# new_keys = set(lib_items.keys()) | ||
# if new_keys == self.render_libs: | ||
# # no need to re-render | ||
# return | ||
|
||
# # sort lib_items by the key | ||
# libs_sorted = sorted(lib_items.items(), key=lambda item: item[0], reverse=True) | ||
|
||
# self.render_libs = new_keys | ||
# self._fill_libs_widget(libs_sorted, layout) | ||
|
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 can be removed, no?
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.
What did you change about this file?
god dammit - let me fetch real quick |
I updated my comment - the dark mode and language thing were due to me forgetting to fetch, but the other two are still applicable |
everything should be addressed |
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.
Most stuff indeed seems to be fixed.
Notes:
- search_library is still reported by GitHub to have been changed
- You have added some strings in this PR that aren't using the Translation system
- (There is still the commented out stuff in preview_panel, but that is more of a nit anyways)
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.
in my review, i've included fixes for some type issues reported by mypy/pyright, along with a few doubts i have and some minor nitpicks and suggestions.
- There are three classes inherited from
BaseModel
(TSSettings, LibSettings, TSCachedData) that have almost the same methods. what if it's modularized? - Can you add docstrings for methods
if len(filecontents.strip()) != 0: | ||
settings_data = toml.loads(filecontents.decode("utf-8")) | ||
|
||
settings_data["filename"] = str(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.
what is the purpose of saving the file path of it's own?
3fae2e6
to
b74e872
Compare
This PR addresses the "Settings Menu" item in the tagstudio roadmap