-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First release of EyesGuard for Windows written in Python
- Loading branch information
Dmitry Vorobjev
authored and
Dmitry Vorobjev
committed
Apr 2, 2024
1 parent
cdf59df
commit f4d363f
Showing
36 changed files
with
1,706 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
.vscode | ||
venv | ||
__pycache__ | ||
venv | ||
tmp | ||
settings.json | ||
.* | ||
output | ||
logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## v2.0.0 - 2024-04-02 | ||
- First release of EyesGuard for Windows written in Python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## About EyesGuard | ||
Program EyesGuard helps you to keep vision in order. | ||
It reminds about necessity to have a break during long work and informs about the start and the end of the break. | ||
|
||
EyesGuard is distributed under GPL v3 licence. By for now it is tested with Python 3.11 and Windows 10. | ||
|
||
You can find more info about EyesGuard at [www.eyesguard.ru](https://eyesguard.ru). | ||
|
||
Command to start app while developing: | ||
``` | ||
python ./src/main.py | ||
``` | ||
|
||
Command for running tests: | ||
``` | ||
python -X utf8 -m pytest .\tests\ | ||
``` | ||
|
||
Command for building .exe: | ||
``` | ||
auto-py-to-exe | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
customtkinter==5.2.0 | ||
loguru==0.7.2 | ||
pydantic==2.1.1 | ||
pystray==0.19.4 | ||
pytest==7.4.0 |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from threading import Thread | ||
|
||
from logger import logger | ||
from model import Model | ||
from settings import UserSettingsData | ||
from states import StepType | ||
|
||
|
||
class Controller: | ||
"""Class for time and break control""" | ||
|
||
def __init__(self): | ||
logger.trace("Controller: object was created") | ||
|
||
def set_model(self, model: Model): | ||
"""Assigning model to controller""" | ||
logger.trace("Controller: set_model") | ||
self.model = model | ||
self.thread_alg = None | ||
|
||
def start(self): | ||
"""Start controller in separated thread""" | ||
if self.thread_alg is None: | ||
self.thread_alg = Thread(target=self.main_loop) | ||
self.thread_alg.start() | ||
|
||
def stop(self): | ||
pass | ||
|
||
def main_loop(self): | ||
"""Controller main loop in separated thread""" | ||
|
||
logger.trace("Controller: main_loop") | ||
while True: | ||
self.model.do_current_step_actions() | ||
self.model.wait_for_current_step_is_ended() | ||
self.model.set_new_step_in_sequence() | ||
|
||
def apply_view_user_settings(self, user_settings: UserSettingsData) -> None: | ||
logger.trace("EGModel: apply_view_user_settings") | ||
self.model.apply_new_user_settings(user_settings) | ||
|
||
def switch_suspended_state(self): | ||
self.model.switch_suspended_state() | ||
|
||
def set_step(self, new_step_type: StepType): | ||
logger.trace("Controller: set_step") | ||
self.model.set_step(new_step_type) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from pathlib import Path as __Path | ||
|
||
import loguru as __loguru | ||
|
||
__LOG_LEVEL_DEBUG = "DEBUG" | ||
__LOG_LEVEL_TRACE = "TRACE" | ||
__LOG_LEVEL_WARNING = "WARNING" | ||
__LOG_FORMAT = "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | {file}:{line}: <level><b>{message}</b></level>" | ||
|
||
__LOG_FILE = "./logs/log.log" | ||
|
||
log_file_path = __Path(__LOG_FILE) | ||
if log_file_path.exists(): | ||
log_file_path.unlink(missing_ok=True) | ||
|
||
logger = __loguru.logger | ||
|
||
logger.add( | ||
sink=__LOG_FILE, | ||
level=__LOG_LEVEL_WARNING, | ||
format=__LOG_FORMAT, | ||
colorize=False, | ||
backtrace=True, | ||
diagnose=True, | ||
encoding="utf8", | ||
) | ||
|
||
|
||
logger.debug("Logging started!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from controller import Controller | ||
from logger import logger | ||
from model import Model | ||
from view import View | ||
|
||
|
||
def main(): | ||
"""Main function""" | ||
|
||
logger.trace(f"Function started") | ||
|
||
controller = Controller() | ||
model = Model() | ||
view = View() | ||
|
||
controller.set_model(model=model) | ||
model.set_view(view=view) | ||
view.set_controller(controller=controller) | ||
|
||
controller.start() | ||
logger.info("Program EyesGuard started!") | ||
|
||
view.mainloop() | ||
|
||
|
||
# application entry point | ||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.