Skip to content

Commit

Permalink
Merge pull request #9 from AndreWohnsland/dev
Browse files Browse the repository at this point in the history
Fix pyinstaller build
  • Loading branch information
AndreWohnsland authored Jun 7, 2024
2 parents a291f7d + 5cfee60 commit 0ab92e7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You probably know your ways how to get started with the binary file.
But if you are lazy like me, you can install the application with the [following script](https://github.com/AndreWohnsland/TimeTracker/blob/master/scripts/installer.sh):

```bash
curl -s https://github.com/AndreWohnsland/TimeTracker/blob/master/scripts/installer.sh | bash
curl -s https://raw.githubusercontent.com/AndreWohnsland/TimeTracker/master/scripts/installer.sh | bash
```

This will download the latest release, put it into your binary folder, and create an application entry.
Expand Down
30 changes: 0 additions & 30 deletions logging_config.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions scripts/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ get_latest_release_tag() {

# download the latest release for the corresponding os
download_latest_release() {
curl -o /usr/bin/timetracker https://github.com/AndreWohnsland/TimeTracker/releases/latest/download/timetracker_ubuntu
curl -o /usr/share/pixmaps/timetracker.png https://github.com/AndreWohnsland/TimeTracker/blob/master/ui/clock.png
curl -o /usr/share/applications/timetracker.desktop https://github.com/AndreWohnsland/TimeTracker/blob/master/scripts/timetracker.desktop
sudo curl -o /usr/bin/timetracker https://github.com/AndreWohnsland/TimeTracker/releases/latest/download/timetracker_ubuntu
sudo curl -o /usr/share/pixmaps/timetracker.png https://raw.githubusercontent.com/AndreWohnsland/TimeTracker/master/ui/clock.png
sudo curl -o /usr/share/applications/timetracker.desktop https://raw.githubusercontent.com/AndreWohnsland/TimeTracker/master/scripts/timetracker.desktop
}

# install the application
install() {
download_latest_release
chmod +x /usr/bin/timetracker
sudo chmod +x /usr/bin/timetracker
}

# execute the installer
Expand Down
1 change: 0 additions & 1 deletion src/filepath.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ def get_app_dir(app_name: str = APP_NAME) -> Path:
REPORTS_PATH = SAVE_FOLDER / "reports"

# Logs
LOG_CONFIG_PATH = ROOT_PATH / "logging_config.yaml"
LOG_FILE_PATH = SAVE_FOLDER / "app.log"
43 changes: 36 additions & 7 deletions src/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import logging
import logging.config
import yaml
from pathlib import Path
import platform
from PyQt5.QtWidgets import QApplication
Expand All @@ -16,7 +15,6 @@
OLD_CONFIG_PATH,
OLD_DATABASE_PATH,
REPORTS_PATH,
LOG_CONFIG_PATH,
LOG_FILE_PATH,
)

Expand Down Expand Up @@ -86,8 +84,39 @@ def open_folder_in_explorer(p: Path = SAVE_FOLDER):
os.system(f"xdg-open {resolved_path}")


def setup_logging(config_path=LOG_CONFIG_PATH, log_file_path=LOG_FILE_PATH):
with open(config_path, "r") as log_config_file:
config = yaml.safe_load(log_config_file.read())
config["handlers"]["file"]["filename"] = log_file_path
logging.config.dictConfig(config)
def setup_logging(log_file_path=LOG_FILE_PATH):
logging_config = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {
"format": "%(asctime)s - %(levelname)s | %(name)s | %(message)s",
"datefmt": "%Y-%m-%d %H:%M:%S",
},
},
"handlers": {
"stout": {
"class": "logging.StreamHandler",
"level": "INFO",
"formatter": "simple",
"stream": "ext://sys.stdout",
},
"stderr": {
"class": "logging.StreamHandler",
"level": "ERROR",
"formatter": "simple",
"stream": "ext://sys.stderr",
},
"file": {
"class": "logging.FileHandler",
"level": "DEBUG",
"formatter": "simple",
"filename": log_file_path,
},
},
"root": {
"level": "INFO",
"handlers": ["stout", "stderr", "file"],
},
}
logging.config.dictConfig(logging_config)

0 comments on commit 0ab92e7

Please sign in to comment.