Willy-JL / F95Checker

GNU General Public License v3.0
101 stars 16 forks source link

Filepicker file highlighting #145

Open r37r05p3C7 opened 3 months ago

r37r05p3C7 commented 3 months ago

sorry for dumping everything in one commit, installed new git tool today and accidentally messed up my history with a hotkey here is an overview to compensate:

  1. refactored filepicker a little bit
    1. reimplemented listbox with begin_listbox to override item styles
    2. abstracted list item into a class ListItem which handles styles and holds some other stuff which was previously computed inline is_dir is_file path etc.
    3. added PickerType enum and wrapped old dir_picker field with PickerType.Dirs variant
    4. errors are now handled separately from the list items, previoulsy they were written to the item list
  2. added new database/settings entry for file picker higlighting style color
  3. changed the outline folder icon variant to a filled one because the old one was blending in with the file icons, making it harder to distinguish between them imo (you can see the change on first screenshot).

highlighting happens based on picker type and extension, PickerType.Execs will only highlight executables, PickerType.Media only media, etc. i wanted to use mimetypes detection for this feature but turns out that python-magic requires custom libmagic dlls for windows and pure python filetype package is extremely limited at the moment.

execs media errors
image image image

P.S. i noticed that you've added comments like # added and # changed in reference to the gist. i'm not sure what purpose they serve. perhaps it's time to remove them? it should be sufficient to leave the first comment pointing to the gist itself.

FaceCrap commented 3 months ago

P.S. i noticed that you've added comments like # added and # changed in reference to the gist. i'm not sure what purpose they serve. perhaps it's time to remove them? it should be sufficient to leave the first comment pointing to the gist itself.

He didn't do it for every little thing, but those comments reflect exactly that, what he added/changed with respect to the gist version. So if the gist version ever gets changed, he knows what to re-add/change in the implemented version I guess.

r37r05p3C7 commented 3 months ago

those comments reflect exactly that, what he added/changed with respect to the gist version.

I should have expressed myself differently. I understand the purpose of these comments, what I don't understand is the reasoning behind this manual procedure, we have version control software and diff tools built for this purpose after all.

FaceCrap commented 3 months ago

True, but if I look at my own coding habits, I actually do a similar thing, mainly so I don't have to resort to VCS or Differs to see what I changed/added when I just scroll through code. For instance, I've made some changes of my own to my local copy of the checker, using a pattern that makes it easy to see in VSCode where I changed something (using an extension that lists those comments)

FaceCrap commented 3 months ago

I've been playing with the picker highlight. I think this is a case where that same trick needs to be applied as is done to label text in the listview.

image My highlight happened to be the same color as is used for the selected-line highlight...

Actually, this problem existed even before the highlighting got added... just wasn't that visible due to the text still being contrasting enough. But since there wasn't anything to configure, it never ended in a similar state.

Willy-JL commented 1 month ago

is there a particular reason to having a separate setting for highlight color? i feel like following the accent color would suffice and keep consistency, but maybe im missing something

FaceCrap commented 1 month ago

following the accent color leads to the issue as described earlier. The way @r37r05p3C7 has it working at the moment resolved this issue I mentioned above.

It now just automatically uses a slightly different shade of the normal accent color. image

Willy-JL commented 1 month ago

ahh i see. well then now that it uses a darker shade of accent automatically, the custom color for highlighted is effectively just cosmetic, and might aswell just use the accent color itself for consistency then?

FaceCrap commented 1 month ago

Hmmm, just checked again, the highlight is actually controling the text color of the executable(s).

Still, for consistency it might indeed be better to just use the accent color, so it shows the same as updated games.