diff --git a/.gitignore b/.gitignore
index c3cc3a48c..f01e8fadc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,8 +63,6 @@ Tools/HolocronToolset/src/toolset/kits/*/*
.venv_wsl
.secrets
tests/results/
-Tools/HolocronToolset/src/toolset/profiler_output.pstat
-Tools/HolocronToolset/src/toolset/profiler_output.pstat
*.pstat
installlog.txt
./vendor
diff --git a/Tools/HolocronToolset/src/toolset/config.py b/Tools/HolocronToolset/src/toolset/config.py
index 1756ee8d0..d5e235018 100644
--- a/Tools/HolocronToolset/src/toolset/config.py
+++ b/Tools/HolocronToolset/src/toolset/config.py
@@ -1,5 +1,22 @@
from __future__ import annotations
-UPDATE_INFO_LINK: str = "https://api.github.com/repos/NickHugi/PyKotor/contents/update_info.json"
-UPDATE_BETA_INFO_LINK: str = "https://api.github.com/repos/NickHugi/PyKotor/contents/update_info_beta.json"
-PROGRAM_VERSION: str = "2.2.1b9"
+# config.py
+
+LOCAL_PROGRAM_INFO = \
+{ #<---JSON_START--->#{
+ "currentVersion": "2.1b18",
+ "toolsetLatestVersion": "2.1.2",
+ "toolsetLatestBetaVersion": "2.2.1b18",
+ "updateInfoLink": "https://api.github.com/repos/NickHugi/PyKotor/contents/Tools/HolocronToolset/src/toolset/config.py",
+ "updateBetaInfoLink": "https://api.github.com/repos/NickHugi/PyKotor/contents/Tools/HolocronToolset/src/toolset/config.py?ref=bleeding-edge",
+ "toolsetDownloadLink": "https://deadlystream.com/files/file/1982-holocron-toolset",
+ "toolsetBetaDownloadLink": "https://mega.nz/folder/cGJDAKaa#WzsWF8LgUkM8U2FDEoeeRA",
+ "toolsetLatestNotes": "Fixed major bug that was causing most editors to load data incorrectly.",
+ "toolsetLatestBetaNotes": "
- Tons of performance optimizations
- Fix filtering by name in the Texture tab
- Fix editors not starting on top
- Use new strategy for IO
- Use pillow to load large TGA images.
- Fix reload/refresh buttons
- Prompt before creating a .mod when using module designer.
- Fix bug when compiling scripts inside RIMs, when rims saving setting is disabled.
- Optimize installation loading and show progress bar for the entire process.
- Fix issue with installations not being cached when swapping to a different installation in the combobox.
- Fix issue with windows not having separate taskbar entries.
- Add an option to disable/enable loading Override textures into the module designer (workaround for large textures taking ages to load).
- Add additional resources into the Core tab.
Thank you to the users who've reported the bugs in the last few versions.",
+ "kits": {
+ "Black Vulkar Base": {"version": 1, "id": "blackvulkar"},
+ "Endar Spire": {"version": 1, "id": "endarspire"},
+ "Hidden Bek Base": {"version": 1, "id": "hiddenbek"}
+ },
+ "help": {"version": 3}
+} #<---JSON_END--->#
diff --git a/Tools/HolocronToolset/src/toolset/gui/dialogs/about.py b/Tools/HolocronToolset/src/toolset/gui/dialogs/about.py
index 25c048629..b9c92657e 100644
--- a/Tools/HolocronToolset/src/toolset/gui/dialogs/about.py
+++ b/Tools/HolocronToolset/src/toolset/gui/dialogs/about.py
@@ -4,7 +4,7 @@
from PyQt5.QtWidgets import QDialog
-from toolset.config import PROGRAM_VERSION
+from toolset.config import LOCAL_PROGRAM_INFO
if TYPE_CHECKING:
from PyQt5.QtWidgets import QWidget
@@ -32,4 +32,4 @@ def __init__(self, parent: QWidget):
self.ui.closeButton.clicked.connect(self.close)
- self.ui.aboutLabel.setText(self.ui.aboutLabel.text().replace("X.X.X", PROGRAM_VERSION))
+ self.ui.aboutLabel.setText(self.ui.aboutLabel.text().replace("X.X.X", LOCAL_PROGRAM_INFO["currentVersion"]))
diff --git a/Tools/HolocronToolset/src/toolset/gui/windows/help.py b/Tools/HolocronToolset/src/toolset/gui/windows/help.py
index 47c894855..30edbd7fb 100644
--- a/Tools/HolocronToolset/src/toolset/gui/windows/help.py
+++ b/Tools/HolocronToolset/src/toolset/gui/windows/help.py
@@ -16,7 +16,7 @@
from pykotor.common.stream import BinaryReader
from pykotor.tools.encoding import decode_bytes_with_fallbacks
from toolset.__main__ import is_frozen
-from toolset.config import UPDATE_INFO_LINK
+from toolset.config import LOCAL_PROGRAM_INFO
from toolset.gui.dialogs.asyncloader import AsyncLoader
from utility.error_handling import universal_simplify_exception
from utility.system.path import Path, PurePath
@@ -26,7 +26,6 @@
from PyQt5.QtWidgets import QWidget
-
class HelpWindow(QMainWindow):
ENABLE_UPDATES = True
@@ -147,7 +146,8 @@ def _request_api_data(self, api_url: str):
def checkForUpdates(self):
try:
- req = requests.get(UPDATE_INFO_LINK, timeout=15)
+ update_info_link = LOCAL_PROGRAM_INFO["updateInfoLink"] # TODO: settings.useBetaChannel
+ req = requests.get(update_info_link, timeout=15)
req.raise_for_status()
file_data = req.json()
base64_content = file_data["content"]
diff --git a/Tools/HolocronToolset/src/toolset/gui/windows/indoor_builder.py b/Tools/HolocronToolset/src/toolset/gui/windows/indoor_builder.py
index 91fca6adb..fccdf18da 100644
--- a/Tools/HolocronToolset/src/toolset/gui/windows/indoor_builder.py
+++ b/Tools/HolocronToolset/src/toolset/gui/windows/indoor_builder.py
@@ -37,7 +37,7 @@
from pykotor.common.geometry import Vector2, Vector3
from pykotor.common.stream import BinaryReader, BinaryWriter
from toolset.__main__ import is_frozen
-from toolset.config import UPDATE_INFO_LINK
+from toolset.config import LOCAL_PROGRAM_INFO
from toolset.data.indoorkit import load_kits
from toolset.data.indoormap import IndoorMap, IndoorMapRoom
from toolset.gui.dialogs.asyncloader import AsyncLoader
@@ -982,7 +982,8 @@ def _setupDownloads(self):
- If not, sets button to "Download"
- Adds kit name and button to layout in group box
"""
- file_data = self._get_update_data(UPDATE_INFO_LINK)
+ update_info_link = LOCAL_PROGRAM_INFO["updateInfoLink"] # TODO: settings.useBetaChannel
+ file_data = self._get_update_data(update_info_link)
base64_content = file_data["content"]
decoded_content = base64.b64decode(base64_content) # Correctly decoding the base64 content
updateInfoData = json.loads(decoded_content.decode("utf-8"))
diff --git a/Tools/HolocronToolset/src/toolset/gui/windows/main.py b/Tools/HolocronToolset/src/toolset/gui/windows/main.py
index 973355dde..04a91e7c0 100644
--- a/Tools/HolocronToolset/src/toolset/gui/windows/main.py
+++ b/Tools/HolocronToolset/src/toolset/gui/windows/main.py
@@ -2,6 +2,7 @@
import base64
import json
+import re
import traceback
from contextlib import suppress
@@ -30,7 +31,8 @@
from pykotor.resource.type import ResourceType
from pykotor.tools import model, module
from pykotor.tools.misc import is_any_erf_type_file, is_bif_file, is_capsule_file, is_erf_file, is_mod_file, is_rim_file
-from toolset.config import PROGRAM_VERSION, UPDATE_BETA_INFO_LINK, UPDATE_INFO_LINK
+from pykotor.tools.path import CaseAwarePath
+from toolset.config import LOCAL_PROGRAM_INFO
from toolset.data.installation import HTInstallation
from toolset.gui.dialogs.about import About
from toolset.gui.dialogs.asyncloader import AsyncBatchLoader, AsyncLoader
@@ -646,53 +648,65 @@ def checkForUpdates(self, *, silent: bool = False):
).exec_()
def _check_toolset_update(self, *, silent: bool):
- if isinstance(PROGRAM_VERSION, tuple):
- x = ""
- for v in PROGRAM_VERSION:
- if not x:
- x = str(v)
- else:
- x += f".{v}"
+ CURRENT_VERSION = LOCAL_PROGRAM_INFO["currentVersion"]
+ if self.settings.useBetaChannel:
+ UPDATE_INFO_LINK = LOCAL_PROGRAM_INFO["updateBetaInfoLink"]
else:
- x = str(PROGRAM_VERSION)
- if "b" in PROGRAM_VERSION:
- self.settings.useBetaChannel = True
+ UPDATE_INFO_LINK = LOCAL_PROGRAM_INFO["updateInfoLink"]
- if self.settings.useBetaChannel: # use the beta channel if the setting is set or their version is already beta.
- req: requests.Response = requests.get(UPDATE_BETA_INFO_LINK, timeout=15)
- else:
- req = requests.get(UPDATE_INFO_LINK, timeout=15)
+ req = requests.get(UPDATE_INFO_LINK, timeout=15)
req.raise_for_status()
file_data = req.json()
base64_content = file_data["content"]
decoded_content = base64.b64decode(base64_content) # Correctly decoding the base64 content
- data = json.loads(decoded_content.decode("utf-8"))
- assert isinstance(data, dict)
+ decoded_content_str = decoded_content.decode(encoding="utf-8")
+ # use for testing only:
+ #with open("config.py") as f:
+ # decoded_content_str = f.read()
+ # Use regex to extract the JSON part between the markers
+ json_data_match = re.search(r"<---JSON_START--->\#(.*)\#<---JSON_END--->", decoded_content_str, flags=re.DOTALL)
+
+ if json_data_match:
+ #print(f"Match found! {json_data_match.group(1)}")
+ json_str = json_data_match.group(1) # Extract the JSON string
+ REMOTE_PROGRAM_INFO = json.loads(json_str) # Parse the JSON string into a Python dictionary
+
+ # Now you can access the data from config_dict
+ print(REMOTE_PROGRAM_INFO["toolsetLatestVersion"])
+ print(REMOTE_PROGRAM_INFO["updateInfoLink"])
+ else:
+ raise ValueError(f"JSON data not found or markers are incorrect: {json_data_match}")
+ assert isinstance(REMOTE_PROGRAM_INFO, dict)
+
+ if self.settings.useBetaChannel:
+ toolsetLatestNotes = REMOTE_PROGRAM_INFO.get("toolsetBetaLatestNotes", "")
+ toolsetDownloadLink = REMOTE_PROGRAM_INFO.get("toolsetDownloadLink", LOCAL_PROGRAM_INFO["toolsetDownloadLink"])
+ else:
+ toolsetLatestNotes = REMOTE_PROGRAM_INFO.get("toolsetLatestNotes", "")
+ toolsetDownloadLink = REMOTE_PROGRAM_INFO.get("toolsetBetaDownloadLink", LOCAL_PROGRAM_INFO["toolsetBetaDownloadLink"])
version_check: bool | None = None
with suppress(Exception):
from packaging import version
- version_check = version.parse(data["toolsetLatestVersion"]) > version.parse(x)
+ version_check = version.parse(REMOTE_PROGRAM_INFO["toolsetLatestVersion"]) > version.parse(CURRENT_VERSION)
if version_check is None:
with suppress(Exception):
from distutils.version import LooseVersion
- version_check = LooseVersion(data["toolsetLatestVersion"]) > LooseVersion(x)
- if version_check is False: # only check False, if None then the version check failed
+ version_check = LooseVersion(REMOTE_PROGRAM_INFO["toolsetLatestVersion"]) > LooseVersion(CURRENT_VERSION)
+ if version_check is False: # Only check False. if None then the version check failed
if silent:
return
QMessageBox(
QMessageBox.Information,
"Version is up to date",
- f"You are running the latest version ({PROGRAM_VERSION}).",
+ f"You are running the latest version ({CURRENT_VERSION}).",
QMessageBox.Ok,
self,
).exec_()
return
- toolsetDownloadLink = data["toolsetDownloadLink"]
- toolsetLatestNotes = data.get("toolsetLatestNotes", "")
betaString = "beta " if self.settings.useBetaChannel else ""
msgBox = QMessageBox(
QMessageBox.Information,
diff --git a/Tools/HolocronToolset/src/toolset/profiler_output.pstat b/Tools/HolocronToolset/src/toolset/profiler_output.pstat
deleted file mode 100644
index f4694a5a6..000000000
Binary files a/Tools/HolocronToolset/src/toolset/profiler_output.pstat and /dev/null differ