Skip to content

Commit 32437f9

Browse files
added bhom version to bhom tkinter UIs (#245)
2 parents 7c4521d + 873e88e commit 32437f9

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

Python_Engine/Python/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies = [
1616
"pytest-cov>=6.0.0",
1717
"pytest-order",
1818
"virtualenv",
19+
"pythonnet",
1920
]
2021

2122
[urls]

Python_Engine/Python/src/python_toolkit/bhom/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
import tempfile
77
import importlib.metadata
88

9+
if os.name == 'nt':
10+
from .installer_info import INSTALLER_INFO
11+
else:
12+
INSTALLER_INFO = {"Version": importlib.metadata.version("python_toolkit")}
13+
914
BHOM_LOG_FOLDER = Path(path.expandvars("%PROGRAMDATA%/BHoM/Logs"))
1015
TEMP_LOG_FOLDER = Path(tempfile.gettempdir()) / "BHoM" / "Logs"
1116
TOOLKIT_NAME = "Python_Toolkit"
12-
BHOM_VERSION = importlib.metadata.version("python_toolkit")
17+
BHOM_VERSION = INSTALLER_INFO["Version"]
1318

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

3540

41+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
import sys
3+
import json
4+
5+
import clr
6+
7+
#append assemblies dir
8+
sys.path.append(os.path.expandvars("%ProgramData%\\BHoM\\Assemblies"))
9+
10+
#add required CLR references (dotnet dlls)
11+
clr.AddReference("UI_Engine")
12+
clr.AddReference("Serialiser_Engine")
13+
14+
from BH.Engine.UI import Query
15+
from BH.Engine.Serialiser import Convert
16+
17+
INSTALLER_INFO = json.loads(Convert.ToJson(Query.Information()))

Python_Engine/Python/src/python_toolkit/bhom_tkinter/bhom_window_shell.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from python_toolkit.bhom_tkinter.widgets.button import Button
1313
from python_toolkit.bhom_tkinter.theming.theme import ThemeManager
1414

15+
from python_toolkit.bhom import BHOM_VERSION
16+
1517

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

0 commit comments

Comments
 (0)