-
Notifications
You must be signed in to change notification settings - Fork 81
Multi read style #629
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
Multi read style #629
Conversation
Have you tried using a item delegate? https://doc.qt.io/qt-5/qitemdelegate.html
Going with a list will be better and currently things can end up out-of order as the dict is never sorted.
I'm not sure any sorting is really needed. I don't like that they re-sort whenever I enable one. Also since merging happens as an overlay the "top" item should be the last in the list when it is overlayed as the last item overlayed is what takes priority.
Most good things happen because someone is annoyed
I have an updated message in #616 Also can you rebase this on the current develop branch |
And one of your todo's was to make a separate load and save arguments for the cli, yes that will be needed to merge this |
I'll give it another look. I did try using
Because the dict has the
The re-sort made the most sense as they are numbered. Would you rather they stayed in the same location and it's the
I went back and forth on the ordering and reasoned that the average user would expect
Yep. I'll do the same for the |
Should the naming between the CLI and GUI be unified as well? "type" vs "style" |
I have a delegate Ordering kind of has to come with a list? I altered it so the selection now resets which is more obvious that a change has taken place. Hopefully this helps with the auto-ordering? If not, some idea of how you see it would be helpful. And the order/priority is still outstanding but I'm still of a mind that |
See renamewindow.py line 89 where it isn't reversed |
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.
Also you still have 20+ commits to rebase out
…es and `--type-read` for read styles
I'm not sure we need to show the number. It already has the order by being able to position the styles. If you really want a number to show the user which item is first, make it based on the row number and update it when an item is moved.
Yes, you'll have to make your own signal and trigger it when the dropdown is closed |
…he CLI if modify if empty
comictaggerlib/renamewindow.py
Outdated
md, error = self.parent().overlay_ca_read_style(self.load_data_styles, ca) | ||
# How much should we care about this error? Notify user or not? | ||
if error is not None: | ||
logger.error("Failed to load metadata for %s: %s", ca.path, error) | ||
|
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.
Should the user be informed in a window or is it not all that relevant here?
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 user should have already been informed but we should still let them know here
The |
Seems to be known. Wonder about PyQt6...? Need to switch to 6 or work around the combobox placeholder text issue too. Use the same delegate for both modify and read and hide the arrows might be the best answer? |
PyQt6 does do the same drawing the checkbox differently so I'll unify |
So I found out why it's different. Here's a patch. I also removed the sizeHint and it went down to a normal size. |
The My issue was Using |
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 think the best option would be to re-create QComboMenuDelegate in python and then add the buttons onto the end and extend the sizehint width to include the buttons.
But I don't really care I'll merge how it looks as is.
There are 4 comments that I want taken care of first before I merge.
comictaggerlib/taggerwindow.py
Outdated
self.save_data_styles: list[str] = config[0].internal__save_data_style | ||
self.load_data_style: str = config[0].internal__load_data_style | ||
self.load_data_styles: list[str] = list(reversed(config[0].internal__load_data_style)) |
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 shouldn't be reversed here. Why is it being saved in the wrong order
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.
Reverted.
I thought it made sense to save in the user facing order but it doesn't really.
comictaggerlib/taggerwindow.py
Outdated
@@ -2065,6 +2097,7 @@ def closeEvent(self, event: QtGui.QCloseEvent) -> None: | |||
self.config[0].internal__sort_column, | |||
self.config[0].internal__sort_direction, | |||
) = self.fileSelectionList.get_sorting() | |||
self.config[0].internal__load_data_style = self.cbLoadDataStyle.currentData() |
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.
Why is this added here? why isn't this set in the equivalent place that the save data style is set
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.
Reverted.
This was because of the whole "reversed" thing.
): | ||
self.load_data_style = self.cbLoadDataStyle.itemData(s) | ||
self.config[0].internal__load_data_style = self.load_data_style |
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.
Why was this removed?
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.
Reverted.
It was because the self.config[0].internal__load_data_style
is only used when saving and it had to be unreversed and so was set on closeEvent
it didn't need to be set. Thinking on it, that may have caused issues with the settings window saving.
…e sizeHint as QComboBox for unified height
The only last thing is the calls to |
I used your comments and reverse only in taggerwindow. I didn't use the |
There's a bit to explain...
I tried a few ways to get the dropdown (delegate "widget" built using other widgets). I went with the
QTableWidget
as I think the headers (the order/# at least) is needed and so a table view was the easiest there. Themodel
could be a list view but as theQTableWidget
comes with a table model it was easier than having to create a new model and aQTableView
.Currently the selection is stored as a
dict[str, int]
, I'm not sure on the best way to go: Alist
could work using theindex
for the order. Alist
oftuples
was another option I considered. I went with thedict[str, int]
for the JSON saving (although the other options didn't seem to be much of a problem with JSON either).I went with the custom
QTableWidgetItem
for sorting as using aQSortFilterProxyModel
because it seems theQTableWidget
won't allow a proxy model. It may be better to split the data of thedict
between theorder/#
column (data: -1) and the style name (data: "cr") on theread style
column. Then the display and data should make sorting easier.The
QProxyStyle
to centre the check boxes had to be done because it was annoying me... :) Still need to change the background of the table to match the otherQComboBox
.I went with sub-classing the standard
QComboBox
as the quite extensive changes didn't seem to make sense to subclassCheckableComboBox
The
QButtons
for moving theread style
up and down seemed like the best solution (although I'm sure it's probably bad UX). I plan to add to the settings window a way to set the read and modify styles too.The command line
-t --ttype
help message should populate the styles frommetadata_styles
similar to themetavar
?There are
TODO
questions which should (hopefully) make sense.I expect I've forgotten some things too but I'm sure there's still plenty wrong I've missed.