mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
add settings_path to AppState and add models for download logging
This commit is contained in:
@@ -14,10 +14,10 @@ def create_config():
|
|||||||
else:
|
else:
|
||||||
config_dir = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
config_dir = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
||||||
|
|
||||||
settings_path = os.path.join(config_dir, "SoftwareManager")
|
state.settings_path = os.path.join(config_dir, "SoftwareManager")
|
||||||
os.makedirs(settings_path, exist_ok=True)
|
os.makedirs(state.settings_path, exist_ok=True)
|
||||||
|
|
||||||
with open(os.path.join(settings_path, "config.yml"), 'w') as cf:
|
with open(os.path.join(state.settings_path, "config.yml"), 'w') as cf:
|
||||||
config.write(cf)
|
config.write(cf)
|
||||||
|
|
||||||
|
|
||||||
@@ -29,8 +29,8 @@ def read_config():
|
|||||||
config_dir = os.environ.get("APPDATA", os.path.expanduser("~\\AppData\\Roaming"))
|
config_dir = os.environ.get("APPDATA", os.path.expanduser("~\\AppData\\Roaming"))
|
||||||
else:
|
else:
|
||||||
config_dir = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
config_dir = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
||||||
settings_path = os.path.join(config_dir, "SoftwareManager")
|
state.settings_path = os.path.join(config_dir, "SoftwareManager")
|
||||||
config_file = os.path.join(settings_path, "config.yml")
|
config_file = os.path.join(state.settings_path, "config.yml")
|
||||||
|
|
||||||
if not os.path.exists(config_file):
|
if not os.path.exists(config_file):
|
||||||
create_config()
|
create_config()
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Download:
|
||||||
|
title: str
|
||||||
|
url: str
|
||||||
|
torrent_uri: str
|
||||||
|
completed: bool
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class DownloadList:
|
||||||
|
count: int
|
||||||
|
data: List[Download]
|
||||||
@@ -24,6 +24,7 @@ class AppState(QObject):
|
|||||||
self.aria2: Any = None
|
self.aria2: Any = None
|
||||||
self.aria2p: Any = None
|
self.aria2p: Any = None
|
||||||
self.aria2_threads: int = 4
|
self.aria2_threads: int = 4
|
||||||
|
self.settings_path: str = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def image_path(self) -> str:
|
def image_path(self) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user