-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add system theme support #806
base: master
Are you sure you want to change the base?
Conversation
Unit Test Results1 tests - 7 1 ✔️ - 7 0s ⏱️ - 1m 0s Results for commit d2474ae. ± Comparison against base commit c2d5747. This pull request removes 7 tests.
♻️ This comment has been updated with latest results. |
A better way to do this would be to add an observer with a callback, rather than polling. I'll investigate this. A possible example: https://github.com/mborgerson/TrayPlay/blob/5a9e43ca4c32283f6253761b69858ba43ee48720/TrayPlay/AppDelegate.m#L52 |
I made a PR on dark detect to add a listener for macoOS: albertosottile/darkdetect#30 Once it is merged and updated on pypi, I can update the PR to use the listeners instead of doing polling. |
In order to avoid leaving potentially orphaned subprocesses around, I've filed this issue: albertosottile/darkdetect#31 |
Once albertosottile/darkdetect#32 is merged I'll update this PR; hopefully a new PyPi release will be out soon at that point. |
CI will continue to fail until the |
for more information, see https://pre-commit.ci
The test failures are also failing on master. |
@@ -235,6 +259,9 @@ def save_config(self): | |||
for i in self._font_options: | |||
i.update() | |||
|
|||
def revert_unsaved(self): |
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.
Identical to base class implemantation
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 base class raises NotImpelementedError
.
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.
Oh, I guess I was looking at the wrong thing
Why not have the default implementation do nothing instead of raising an error? Or just drop the method because there's not an implementation that does anything?
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 was generally thinking of the page class as abstract and the functions that raise NotImpelemented
as 'things derived classes should implement' (even if they are just no-op's). It's just a different paradigm but either way should be equivalent in this context. I don't have strong preferences either way so I can nuke the function if you prefer.
@@ -29,6 +29,7 @@ install_requires = | |||
qtterm | |||
requests[socks] | |||
tomlkit | |||
darkdetect-angr[macos-listener] |
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.
- It's unfortunate that we have to maintain a forked release of darkdetect now, but I appreicate the work on it
- Did Windows/Linux get tested?
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 majority of the fork has a PR into the main repo, so once that is merged we might not need to hopefully. TBD. I've tested the PR'd version on all three OS's, though less throughly on Windows as I lack said OS. The version we are using is mostly the same so it ought to work. Feel free to test them yourself but the relevant logic that distinguished between OSes wasn't really the code that changed between the PR'd version and the hardfork version.
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've tested the PR'd version on all three OS's
But not the forked version with extra changes?
Feel free to test them yourself
I don't plan to test this PR. Will you please test it
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 extra changes are copyright, README, and __version__
, and pyproject.toml
to change the package name. Not really the code.
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.
If you are curious, here is the diff stats:
LICENSE | 4 ++--
README.md | 8 ++++----
darkdetect/__init__.py | 4 ++--
darkdetect/__main__.py | 2 +-
darkdetect/_dummy.py | 2 +-
darkdetect/_linux_detect.py | 2 +-
docs/api.md | 2 +-
docs/examples.md | 2 +-
pyproject.toml | 10 +++++-----
Note the 2 line changes are copyright comments. I don't have access to a Windows device at the moment so I can't really test these changes easily, but they aren't really code changes just the changes necessary to hard-fork a project (changing the name on pypi, copyright, documentation, and version).
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 do not know how to automate GUI test cases on windows changing system theme and detecting of the colors properly all changed over. Feel free. The actions to test this would be launch app, open preferences, select 'Track System Theme', then toggle the Windows System Theme and visually ensure it tracks the theme.
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.
You don't need to "visually ensure" it, you just need to make sure after the theme is changed the correct behavior occurs in the library. I'm sure applescript and powershell each have ways to adjust the system theme.
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.
If you want to write these test cases, I can tell you how to do it in applescript (via System Events), I don't know powershell. I imagine for Gnome specifically there is a gsettings option you could find? For detecting if it worked, you'll have to query the QApplication to check that all the colors and such have been updated and also ensure that any visual refresh functions have been called (i.e. redrawing the GUI app).
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.
That's on the angr management side, but not necessary for the library itself which is is the subject of this thread.
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'll happily take a PR for them here: https://github.com/zwimer/darkdetect but I don't have plans to write tests myself for them at the moment. If you do PR them, I'll also merge them into the branch that is PR-ing into the original repo https://github.com/albertosottile/darkdetect so as to avoid actively diverging the hard fork from the original more than necessary; my plan is to get rid of the fork once the PR albertosottile/darkdetect#32 in the original is merged.
Right now that PR has been tested on all three OSes and my fork's master branch doesn't meaningfully diverge from said code. I know the maintainer desired to do more thorough testing before merging the PR though, so I'm sure the test cases would be appreciated by all parties.
Implements: #780
Fixes: #805