mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-19 04:09:40 +08:00
Delete test-colors path in any case + small refactors.
Less indents and more logging. part of CURA-12469
This commit is contained in:
parent
2b032af13c
commit
fa8e4b26cf
27
conanfile.py
27
conanfile.py
@ -566,22 +566,27 @@ class CuraConan(ConanFile):
|
|||||||
|
|
||||||
def _make_internal_distinct(self):
|
def _make_internal_distinct(self):
|
||||||
test_colors_path = Path(self.source_folder, "resources", "themes", "daily_test_colors.json")
|
test_colors_path = Path(self.source_folder, "resources", "themes", "daily_test_colors.json")
|
||||||
|
if not test_colors_path.exists():
|
||||||
|
print(f"Could not find '{str(test_colors_path)}'. Won't generate rotating colors for alpha builds.")
|
||||||
|
return
|
||||||
if "alpha" in self.version:
|
if "alpha" in self.version:
|
||||||
biweekly_day = (datetime.now() - datetime(2025, 3, 14)).days
|
biweekly_day = (datetime.now() - datetime(2025, 3, 14)).days
|
||||||
with test_colors_path.open("r") as test_colors_file:
|
with test_colors_path.open("r") as test_colors_file:
|
||||||
test_colors = json.load(test_colors_file)
|
test_colors = json.load(test_colors_file)
|
||||||
for theme_dir in Path(self.source_folder, "resources", "themes").iterdir():
|
for theme_dir in Path(self.source_folder, "resources", "themes").iterdir():
|
||||||
if theme_dir.is_dir():
|
if not theme_dir.is_dir():
|
||||||
theme_path = Path(theme_dir, "theme.json")
|
continue
|
||||||
if theme_path.exists():
|
theme_path = Path(theme_dir, "theme.json")
|
||||||
with theme_path.open("r") as theme_file:
|
if not theme_path.exists():
|
||||||
theme = json.load(theme_file)
|
print(f"('Colorize-by-day' alpha builds): Skipping {str(theme_path)}, could not find file.")
|
||||||
if theme["colors"]:
|
continue
|
||||||
theme["colors"]["main_window_header_background"] = test_colors[biweekly_day]
|
with theme_path.open("r") as theme_file:
|
||||||
with theme_path.open("w") as theme_file:
|
theme = json.load(theme_file)
|
||||||
json.dump(theme, theme_file)
|
if theme["colors"]:
|
||||||
elif test_colors_path.exists():
|
theme["colors"]["main_window_header_background"] = test_colors[biweekly_day]
|
||||||
test_colors_path.unlink()
|
with theme_path.open("w") as theme_file:
|
||||||
|
json.dump(theme, theme_file)
|
||||||
|
test_colors_path.unlink()
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
copy(self, "cura_app.py", self.source_folder, str(self._script_dir))
|
copy(self, "cura_app.py", self.source_folder, str(self._script_dir))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user