~~Ah, found the cause.~~
~~languages/details.json has strings as numbers, e.g. "file_size": "86.17", while extensions/details.json has true numbers, e.g. "file_size": 85880322. So in order to fix this I need the numbers in languages/details.json to be in numerical style, rather than striated style (this is the wrong word, I know, but I don't know the adjective form of string).~~
EDIT: Wait. It probably isn't about this. I just successfully converted fileSize to a double by toString().remove(QChar('"')).toDouble()(EDIT: It isn't successful now, don't know how I did it), but the sorting is still wrong. I'm starting to think about maybe it doesn't matter what type fileSize is, because it gets converted to string once displayed on the Resource Manager. Maybe the sorting is itself bugged instead of the numbers, the sorting always treat the values as strings no matter what type we intend them to be. Maybe the extensions are sorted wrongly too, I cannot tell because there're only two (default) extensions in my MuseScore version, of which the sizes are 22 MB and 82 MB, I can't get to know how they're sorted because both sorting principles yield the same result.
If that's true, i.e. some inner working of sorting in Qt should be corrected, then I'm afraid I've no idea how to do it in the present time. I can try search-and-learn and see if I figure out something.
I tried to set up a new class QTableNumberItem derived from QTableWidgetItem so that the members can be sorted like numbers, but again it's not working, the behaviour of sorting doesn't change.
See the commit. I basically followed this, I don't know what I missed.
As you can see in your screenshot, you have clicked on the "File size" tab, that mean you have choose yourself the sorting.
By default this dialog show up in first place the system language, followed by the language sorted aphabetically.
I have verified for the 3.2.3, 3.3 RC, and the latest dv build.
Changing that behavior would be a real regression.
Being able to really sort by file size rather then the alphabethicat ordeor for those file size numbers would surely not be a regression.
The fact that this sorting does work for extentions seems to prove the point
Nobody here wants to change the default of sorting by language.
I do not agree with that, the actual behavior is perfect, each people can choose what they want, the actual behavior schow the system language first, this is perfect for people that do not want to search, typically for French people that do update language for only their own native language, for most.
Changing that would really be a regression even extensions work differently.
I think you're not understanding what this issue is about: you can change the sorting by clicing on the 3 different headings, to sort after those column, accending or decending. This works fine for the 1st and 2nd column, which are text, but does not for the 3rd column. So you can sort by language (the default, won't change) and by filename, but not by size.
Sorting by the rightmost 4th column doesn't work either BTW.
Extensions doesn't. The default behaviour of sorting of QTableWidget cannot be changed without creating a new class. It appears to be sorted numerically but it's actually not, it's just that there's no difference in appearance of the results of these two if the only extensions there are the two default ones.
May be I have not understanding, BTW the purpose of this dialog is to choos it s language easily.
For my own, and I think for hundreds of French people, we never sort by size, and present the system language first is a well coded design, the rest is really minor.
It seems like those who have write access to extensions.musescore.org really should make the file sizes numbers, not strings. The current format is "file_size": "86.17" and every time I try to convert it into a double, the number becomes 0.0, even after I strip the quotation marks (OK, maybe the quotation marks in a JSON file aren't truly quotation marks, but I don't understand why they can be such a trouble).
Let's see whether @Anatoly_os is willing to change that json file on extensions.musescore.org
But I understood that for the other tab, extensions, that is the case but doesn't work either?
I just checked, no, you cannot set some columns to sortingEnabled = true and others to sortingEnabled = false. The property of sortingEnabled is that of an entire QTableWidget, not of a single column.
extensions/details.json have file sizes as numbers, so the fileSize variable can be int in the first place. So when a QTableNumberWidget class is set up, they can be compared correctly.
Comments
See a WIP fix.
In reply to (No subject) by Jojo-Schmitz
Well, David and I both (and you also) found the issue, so it's "Few" ;-)
Don't count me, that issue doesn't bother me the least ;-)
In reply to Don't count me, that issue… by Jojo-Schmitz
Well it doesn't bother me either. So "Frequency" means the frequency of bothering people, not the frequency of being found?
In reply to Well it doesn't bother me… by Howard-C
It depends on how many people found that.
The number of reports, not the number of times it happens to one person
~~Ah, found the cause.~~
~~languages/details.json has strings as numbers, e.g.
"file_size": "86.17"
, while extensions/details.json has true numbers, e.g."file_size": 85880322
. So in order to fix this I need the numbers in languages/details.json to be in numerical style, rather than striated style (this is the wrong word, I know, but I don't know the adjective form of string).~~EDIT: Wait. It probably isn't about this. I just successfully converted
fileSize
to adouble
bytoString().remove(QChar('"')).toDouble()
(EDIT: It isn't successful now, don't know how I did it), but the sorting is still wrong. I'm starting to think about maybe it doesn't matter what typefileSize
is, because it gets converted tostring
once displayed on the Resource Manager. Maybe the sorting is itself bugged instead of the numbers, the sorting always treat the values as strings no matter what type we intend them to be. Maybe the extensions are sorted wrongly too, I cannot tell because there're only two (default) extensions in my MuseScore version, of which the sizes are 22 MB and 82 MB, I can't get to know how they're sorted because both sorting principles yield the same result.If that's true, i.e. some inner working of sorting in Qt should be corrected, then I'm afraid I've no idea how to do it in the present time. I can try search-and-learn and see if I figure out something.
Every noun can get verbed, for string it'd be stinging/stringed or strung, like for guitars, which have strings too ;-)
In reply to Every noun can get verbed,… by Jojo-Schmitz
But none of "stringing/stringed/strung style" sound right to me...
In reply to The number of reports, not… by Jojo-Schmitz
I tried to set up a new class
QTableNumberItem
derived fromQTableWidgetItem
so that the members can be sorted like numbers, but again it's not working, the behaviour of sorting doesn't change.See the commit. I basically followed this, I don't know what I missed.
stringified?
In reply to stringified? by Jojo-Schmitz
OK, OK XD
In reply to The number of reports, not… by Jojo-Schmitz
Shouldn't it be called "reported" rather than "frequency" then?
Maybe. The other is Reproducability
As you can see in your screenshot, you have clicked on the "File size" tab, that mean you have choose yourself the sorting.
By default this dialog show up in first place the system language, followed by the language sorted aphabetically.
I have verified for the 3.2.3, 3.3 RC, and the latest dv build.
Changing that behavior would be a real regression.
Being able to really sort by file size rather then the alphabethicat ordeor for those file size numbers would surely not be a regression.
The fact that this sorting does work for extentions seems to prove the point
Nobody here wants to change the default of sorting by language.
In reply to Being able to really sort ba… by Jojo-Schmitz
I do not agree with that, the actual behavior is perfect, each people can choose what they want, the actual behavior schow the system language first, this is perfect for people that do not want to search, typically for French people that do update language for only their own native language, for most.
Changing that would really be a regression even extensions work differently.
My vote is "do not change what is working now"
I think you're not understanding what this issue is about: you can change the sorting by clicing on the 3 different headings, to sort after those column, accending or decending. This works fine for the 1st and 2nd column, which are text, but does not for the 3rd column. So you can sort by language (the default, won't change) and by filename, but not by size.
Sorting by the rightmost 4th column doesn't work either BTW.
In reply to Being able to really sort ba… by Jojo-Schmitz
Extensions doesn't. The default behaviour of sorting of QTableWidget cannot be changed without creating a new class. It appears to be sorted numerically but it's actually not, it's just that there's no difference in appearance of the results of these two if the only extensions there are the two default ones.
In reply to I think you're not… by Jojo-Schmitz
May be I have not understanding, BTW the purpose of this dialog is to choos it s language easily.
For my own, and I think for hundreds of French people, we never sort by size, and present the system language first is a well coded design, the rest is really minor.
That's why this is indeed minor issue
And of low priority too
In reply to I think you're not… by Jojo-Schmitz
And we can simply disable sorting by the rightmost column by setting
sortEnabled
to false, or something like that.In reply to And of low priority too by Jojo-Schmitz
It seems like those who have write access to extensions.musescore.org really should make the file sizes numbers, not strings. The current format is
"file_size": "86.17"
and every time I try to convert it into adouble
, the number becomes 0.0, even after I strip the quotation marks (OK, maybe the quotation marks in a JSON file aren't truly quotation marks, but I don't understand why they can be such a trouble).We could disable sorting for 3rd and 4th column. Sorting by size is not really making much sense.
And pretending to be able to even less so.
In reply to We could dieable sorting for… by Jojo-Schmitz
Well, if that's what we should do, I'll do it.
Let's see whether @Anatoly_os is willing to change that json file on extensions.musescore.org
But I understood that for the other tab, extensions, that is the case but doesn't work either?
In reply to Let's see whether @Anatoly… by Jojo-Schmitz
Well, just writing "@Anatoly_os" won't give him a notification and let him see it ;-)
In reply to Let's see whether @Anatoly… by Jojo-Schmitz
I just checked, no, you cannot set some columns to sortingEnabled = true and others to sortingEnabled = false. The property of sortingEnabled is that of an entire QTableWidget, not of a single column.
In reply to Let's see whether @Anatoly… by Jojo-Schmitz
extensions/details.json have file sizes as numbers, so the
fileSize
variable can beint
in the first place. So when aQTableNumberWidget
class is set up, they can be compared correctly.A draft PR: https://github.com/musescore/MuseScore/pull/5405. Not marking this as PR created now.
Fixed in https://github.com/musescore/MuseScore/pull/5405.
Fixed in branch master, commit c69c61ff82
_fix #295895: language list in Resource Manager sorted by size is sorted in the style of string rather than that of number
Resolves: https://musescore.org/node/295895.
Follows the idea of https://stackoverflow.com/questions/7848683/how-to-sort-data-in-qtablew….
Two new classes ExtensionFileSize and LanguageFileSize are setup to overload the `_
Fixed in branch master, commit ee9b44f069
_Merge pull request #5405 from Howard-C/sort-size
fix #295895: language list in Resource Manager sorted by size is sorted in the style of string rather than that of number_
Automatically closed -- issue fixed for 2 weeks with no activity.