forked from anixart-mod/patcher
Улучшение кода main.py и конфигурации
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ def apply(config: dict) -> bool:
|
||||
if config.get("verbose", False):
|
||||
tqdm.write(f'Удалён файл: {item_path}')
|
||||
elif os.path.isdir(item_path):
|
||||
if item not in config["cleanup"]["keep_dirs"]:
|
||||
if item not in config["keep_dirs"]:
|
||||
shutil.rmtree(item_path)
|
||||
if config.get("verbose", False):
|
||||
tqdm.write(f'Удалена папка: {item_path}')
|
||||
|
||||
@@ -11,11 +11,11 @@ from utils.public import (
|
||||
)
|
||||
|
||||
def apply(config: dict) -> bool:
|
||||
main_color = config["theme"]["colors"]["primary"]
|
||||
splash_color = config["theme"]["colors"]["secondary"]
|
||||
gradient_angle = config["theme"]["gradient"]["angle"]
|
||||
gradient_from = config["theme"]["gradient"]["from"]
|
||||
gradient_to = config["theme"]["gradient"]["to"]
|
||||
main_color = config["colors"]["primary"]
|
||||
splash_color = config["colors"]["secondary"]
|
||||
gradient_angle = config["gradient"]["angle"]
|
||||
gradient_from = config["gradient"]["from"]
|
||||
gradient_to = config["gradient"]["to"]
|
||||
|
||||
# No connection alert coolor
|
||||
with open("./decompiled/assets/no_connection.html", "r", encoding="utf-8") as file:
|
||||
|
||||
@@ -11,8 +11,6 @@ def rename_dir(src, dst):
|
||||
|
||||
|
||||
def apply(config: dict) -> bool:
|
||||
assert config["new_package_name"] is not None, "new_package_name is not configured"
|
||||
|
||||
for root, dirs, files in os.walk("./decompiled"):
|
||||
for filename in files:
|
||||
file_path = os.path.join(root, filename)
|
||||
|
||||
@@ -32,7 +32,7 @@ def apply(config: dict) -> bool:
|
||||
# Insert new PreferenceCategory before the last element
|
||||
last = root[-1] # last element
|
||||
pos = root.index(last)
|
||||
for section, items in config["settings_urls"].items():
|
||||
for section, items in config["menu"].items():
|
||||
root.insert(pos, make_category(config["xml_ns"], section, items))
|
||||
pos += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user