Skip to content
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

Dark theme #489

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Dark theme #489

wants to merge 7 commits into from

Conversation

DevilXD
Copy link
Owner

@DevilXD DevilXD commented Jun 2, 2024

@DevilXD
Copy link
Owner Author

DevilXD commented Jun 2, 2024

Basically, 90% of this is wrong, and needs a heavy rewrite. Things to note:

  • match-case usage is forbidden, as it was only added in Python 3.10, while TDM supports 3.8+
  • In-place changing of the entire GUI isn't needed, as it complicates the entire thing. It's better to implement this like the language changing, where each GUI element gets to read the currently selected theme (internally: style value), and you have to restart the application to see the effect.
  • Styles have to be pre-defined before the GUI is build, using the TTK styles guide that can be found here: https://tkdocs.com/shipman/ttk-style-layer.html

@Windows200000
Copy link

Windows200000 commented Jun 3, 2024

edit: Changed to if-else

I intentionally wrote it in a way, that would allow other styles in the future, only requiring a change of the checkbox. Especially with that in mind, I think it's useful to change the elements in place, so that people can try stuff out and find what they like. Additionally, this way it's all in one place and doesn't require adding additional variables all throughout the gui code for new styles.

@Majaura
Copy link

Majaura commented Jul 21, 2024

I don't really know anything about anything, but I know Windows made a dark theme that was wonderful. I would absolutely love for this to exist. Sorry, I'm a complete noob and don't know if this is going to be a thing, or wont be.

@Windows200000
Copy link

I did research TKinter styles, but as you mention, there is no way to change them in-place. I find this an unnecessary annoyance for the user, which is why I chose to change them in place.

@Majaura
Copy link

Majaura commented Jul 22, 2024

I did research TKinter styles, but as you mention, there is no way to change them in-place. I find this an unnecessary annoyance for the user, which is why I chose to change them in place.

But is there anyway that this could just make it into the Devil build? I feel like it's so insanely useful and literally saves my eyes. I'm not trying to make waves or drama, I just can't stress how important Dark Themes are, at least for me.

@DevilXD
Copy link
Owner Author

DevilXD commented Jul 22, 2024

Unfortunately, that information is incorrect. I told you that the styles have to be predefined at launch, instead of "manually" changing every single GUI element at runtime. Doing that is not scalable nor maintainable in any efficient way. I knew that Tkinter had a whole setup for changing styles of all widgets with just a little bit of code, and even tried telling you, but you were affixed to it (supposedly) sacrificing the no-restart "feature" of it.

I spent exactly one day yesterday on researching how to actually define a style in Tkinter, and this is actually all you need to change the "theme" (mostly just background color for now) of 99% of the GUI:
picture

No-restart isn't a requirement for this feature, but the above can change the theme dynamically, without having to restart. It's not like I don't want to make it a no-restart feature, it's just that I'm not willing to sacrifice potentially increased complexity and maintenance cost, over just having to restart to see a theme that everyone is gonna set once and pretty much forget about. And since this PR carries a significant maintenance cost right now, I won't be merging it, and I'll instead do it "the right way".

The current in-dev version struggles with Tkinter widgets not really liking having to redraw themselves in an controlled manner, but then again, I'm still working on it. No ETA on this, just me tinkering around like usual.

@Windows200000
Copy link

Windows200000 commented Jul 22, 2024

I unfortunately still don't have much time, and it is too long ago to remember exactly, but I do remember trying ttk styles and it not working out. I also remember running into complications with the background of the Inventory tab, include/exclude lists and other more complicated parts, tho I'm not sure whether that related to styles or whether I moved on from styles at that point. Maybe you manage to do it.

edit: Tho tempting, I would avoid calling them themes in the code, because ttk themes are another thing.

@Windows200000
Copy link

@DevilXD
As all the other pull requests are closed now, I'll put it here:

I still don't really have time, I'll just keep fixing critical issues on my fork for people that want to use it for now.

As for the changes, eventually, I'll look at the diff and probably just copy and paste stuff for each feature into a new commit, as, except for the new priority option, everything was done by me anyway.

@DevilXD
Copy link
Owner Author

DevilXD commented Jul 22, 2024

I mean, I'm working on this feature right in this very moment, so you don't have to do anything here. I don't mind you keeping a personal fork. Unless you're talking about merging your entire fork into this project, in which case it'd be best to either make a relevant PR, or open a separate issue for discussion. This PR is all about dark mode support, and I'd kinda prefer to not litter it with seemingly-unrelated talk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants