trimmy 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- trimmy/__init__.py +0 -0
- trimmy/__main__.py +12 -0
- trimmy/config.py +45 -0
- trimmy/main_window.py +659 -0
- trimmy/presets.py +176 -0
- trimmy/renderer.py +268 -0
- trimmy/widgets.py +405 -0
- trimmy-0.2.0.dist-info/METADATA +6 -0
- trimmy-0.2.0.dist-info/RECORD +11 -0
- trimmy-0.2.0.dist-info/WHEEL +4 -0
- trimmy-0.2.0.dist-info/entry_points.txt +2 -0
trimmy/__init__.py
ADDED
|
File without changes
|
trimmy/__main__.py
ADDED
trimmy/config.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _config_dir() -> Path:
|
|
8
|
+
if sys.platform == "win32":
|
|
9
|
+
base = Path(os.environ.get("LOCALAPPDATA", Path.home() / "AppData" / "Local"))
|
|
10
|
+
elif sys.platform == "darwin":
|
|
11
|
+
base = Path.home() / "Library" / "Application Support"
|
|
12
|
+
else:
|
|
13
|
+
base = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config"))
|
|
14
|
+
return base / "trimmy"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
CONFIG_PATH = _config_dir() / "config.json"
|
|
18
|
+
|
|
19
|
+
_DEFAULTS = {
|
|
20
|
+
"selected_platform": "instagram",
|
|
21
|
+
"selected_format": "feed",
|
|
22
|
+
"selected_quality": "max",
|
|
23
|
+
"split_ratio": 0.5,
|
|
24
|
+
"crops": {
|
|
25
|
+
"top": {"x": 0.0, "y": 0.0, "w": 0.0, "h": 0.0},
|
|
26
|
+
"bottom": {"x": 0.0, "y": 0.0, "w": 0.0, "h": 0.0},
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def load() -> dict:
|
|
32
|
+
if not CONFIG_PATH.exists():
|
|
33
|
+
return dict(_DEFAULTS)
|
|
34
|
+
try:
|
|
35
|
+
data = json.loads(CONFIG_PATH.read_text(encoding="utf-8"))
|
|
36
|
+
merged = dict(_DEFAULTS)
|
|
37
|
+
merged.update(data)
|
|
38
|
+
return merged
|
|
39
|
+
except (json.JSONDecodeError, OSError):
|
|
40
|
+
return dict(_DEFAULTS)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def save(state: dict):
|
|
44
|
+
CONFIG_PATH.parent.mkdir(parents=True, exist_ok=True)
|
|
45
|
+
CONFIG_PATH.write_text(json.dumps(state, indent=2), encoding="utf-8")
|