Skip to content

Commit f9551b9

Browse files
committed
+ Settings for color filter setup
1 parent df5d41c commit f9551b9

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

color_filter.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
from contextlib import suppress
2+
from dataclasses import dataclass
23
from time import sleep
4+
import inject
35
from keyboard import press_and_release as hotkey
46
from winregal import RegKey
57
from os import system
8+
from commented_config import CommentsHolder
9+
10+
11+
@dataclass
12+
class ColorFilterSettings:
13+
"""
14+
Set filter settings on startup
15+
"""
16+
_comments_ = CommentsHolder()
17+
18+
setup_filter_state: bool = True
19+
_comments_.add("""
20+
[{default!r}] Open settings and setup:
21+
Allow the shortcut key to toggle filter = Checked
22+
Filter type = Inverted [first]
23+
""", locals())
24+
25+
close_settings: bool = True
26+
_comments_.add("""
27+
[{default!r}] Close settings after setup
28+
""", locals())
629

730

831
def _get_filter_info(value: str):
@@ -34,7 +57,11 @@ def toggle():
3457
hotkey("ctrl+win", do_press=False)
3558

3659

37-
def setup_color_filer_settings():
60+
@inject.autoparams()
61+
def setup_color_filer_settings(settings: ColorFilterSettings):
62+
if not settings.setup_filter_state:
63+
return
64+
3865
hotkey_enabled = is_hotkey_enabled()
3966

4067
if hotkey_enabled and get_filter_type() == 1:
@@ -45,7 +72,7 @@ def setup_color_filer_settings():
4572
sleep(1)
4673
# Windows has bug, when opening easeofaccess-colorfilter
4774
# while this window is already opened
48-
# filter will always set to Gray
75+
# filter will always set to Grayscale
4976
# So you must check which filter selected twice :)
5077

5178
options = (was_active, hotkey_enabled, get_filter_type() == 1)
@@ -59,4 +86,5 @@ def setup_color_filer_settings():
5986
hotkey("Shift + Tab")
6087
hotkey("Space")
6188

62-
hotkey("Alt + F4")
89+
if settings.close_settings:
90+
hotkey("Alt + F4")

settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Callable, TypeVar
33
from active_window_checker import WinTrackerSettings
44
from auto_update import AutoUpdateSettings
5+
from color_filter import ColorFilterSettings
56
from commented_config import CommentsHolder, CommentsWriter, get_comments_holder
67
from file_tracker import DataFileSyncer, Syncable
78

@@ -13,6 +14,9 @@ class UserSettings:
1314
win_tracker: WinTrackerSettings = WinTrackerSettings()
1415
_comments_.add(None, locals(), True)
1516

17+
color_filter: ColorFilterSettings = ColorFilterSettings()
18+
_comments_.add(None, locals(), True)
19+
1620
auto_update: AutoUpdateSettings = AutoUpdateSettings()
1721
_comments_.add(None, locals())
1822

0 commit comments

Comments
 (0)