Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Python_Engine/Python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies = [
"pytest-cov>=6.0.0",
"pytest-order",
"virtualenv",
"pythonnet",
]

[urls]
Expand Down
8 changes: 7 additions & 1 deletion Python_Engine/Python/src/python_toolkit/bhom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
import tempfile
import importlib.metadata

if os.name == 'nt':
from .installer_info import INSTALLER_INFO
else:
INSTALLER_INFO = {"Version": importlib.metadata.version("python_toolkit")}

BHOM_LOG_FOLDER = Path(path.expandvars("%PROGRAMDATA%/BHoM/Logs"))
TEMP_LOG_FOLDER = Path(tempfile.gettempdir()) / "BHoM" / "Logs"
TOOLKIT_NAME = "Python_Toolkit"
BHOM_VERSION = importlib.metadata.version("python_toolkit")
BHOM_VERSION = INSTALLER_INFO["Version"]

#Environment variable that if set disables BHoM analytics logging.
DISABLE_ANALYTICS = os.environ.get("DISABLE_BHOM_ANALYTICS", None)
Expand All @@ -33,3 +38,4 @@
BHOM_LOG_FOLDER.mkdir(exist_ok=True, parents=True)



17 changes: 17 additions & 0 deletions Python_Engine/Python/src/python_toolkit/bhom/installer_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import sys
import json

import clr

#append assemblies dir
sys.path.append(os.path.expandvars("%ProgramData%\\BHoM\\Assemblies"))

#add required CLR references (dotnet dlls)
clr.AddReference("UI_Engine")
clr.AddReference("Serialiser_Engine")

from BH.Engine.UI import Query
from BH.Engine.Serialiser import Convert

INSTALLER_INFO = json.loads(Convert.ToJson(Query.Information()))
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from python_toolkit.bhom_tkinter.widgets.button import Button
from python_toolkit.bhom_tkinter.theming.theme import ThemeManager

from python_toolkit.bhom import BHOM_VERSION


class BHoMWindowShell:
"""Shared themed window chrome for BHoM Tk root and Toplevel windows."""
Expand Down Expand Up @@ -323,7 +325,7 @@ def _build_banner(self, parent: ttk.Frame, title: str, logo_path: Optional[Path]
# Subtitle
subtitle_label = Label(
text_container,
text="powered by BHoM",
text=f"powered by BHoM (v{BHOM_VERSION})",
style="Caption.TLabel"
)
subtitle_label.pack(anchor="w")
Expand Down
Loading