-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up files and remove small useless ones (#965)
* Cleanup logs in main.py * Move power manager out of its own file * Move enums to a common file * I could never get my head around these filenames * Missed a file again, thanks, Ruff * Seems like I chose a bad way to clean up the imports * Start using pathlib in more places * Fix issues ruff warned about * Update cozy/db/model_base.py
- Loading branch information
Showing
38 changed files
with
273 additions
and
285 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
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,20 +1,28 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from gi.repository import GLib | ||
|
||
|
||
def get_artwork_cache_dir(): | ||
return os.path.join(get_cache_dir(), "artwork") | ||
def get_path_relative_to_chache_folder(*args) -> Path: | ||
dir = Path(GLib.get_user_cache_dir(), "cozy", *args) | ||
dir.mkdir(parents=True, exist_ok=True) | ||
return dir | ||
|
||
|
||
def get_cache_dir(): | ||
cache_dir = os.path.join(GLib.get_user_cache_dir(), "cozy") | ||
def get_artwork_cache_dir() -> Path: | ||
return get_path_relative_to_chache_folder("artwork") | ||
|
||
if not os.path.exists(cache_dir): | ||
os.makedirs(cache_dir) | ||
|
||
return cache_dir | ||
def get_offline_cache_dir() -> Path: | ||
return get_path_relative_to_chache_folder("offline") | ||
|
||
|
||
def get_data_dir(): | ||
return os.path.join(GLib.get_user_data_dir(), "cozy") | ||
def get_cache_dir() -> Path: | ||
return get_path_relative_to_chache_folder() | ||
|
||
|
||
def get_data_dir() -> Path: | ||
dir = Path(GLib.get_user_data_dir(), "cozy") | ||
dir.mkdir(parents=True, exist_ok=True) | ||
|
||
return dir |
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
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
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
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
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
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,19 @@ | ||
from enum import Enum, auto | ||
|
||
|
||
class OpenView(Enum): | ||
AUTHOR = auto() | ||
READER = auto() | ||
BOOK = auto() | ||
LIBRARY = auto() | ||
BACK = auto() | ||
|
||
|
||
class View(Enum): | ||
EMPTY_STATE = auto() | ||
PREPARING_LIBRARY = auto() | ||
LIBRARY = auto() | ||
LIBRARY_FILTER = auto() | ||
LIBRARY_BOOKS = auto() | ||
BOOK_DETAIL = auto() | ||
NO_MEDIA = auto() |
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.