✈ Pre-Flight checks
🐞 Describe the bug
When trying to set the icon for a WPFWindow with the set_icon() method, an error is thrown, because the underlying .NET function (Window.Icon.Set) expects a Uri, not a file path.
The pyRevit set_icon wrapper method should explicitly convert a provided file path to a Uri.
⌨ Error/Debug Message
IronPython Traceback:
Traceback (most recent call last):
File "C:\Users\jared\OneDrive\Desktop\pyBimManager\pyBimManager-Admin.extension\Sheet Set Manager.tab\Sheet Set Manager.panel\Sheet Set Manager.pushbutton\script.py", line 13, in <module>
File "C:\pyRevit\main\pyrevitlib\pyrevit\forms\__init__.py", line 313, in set_icon
File "C:\pyRevit\main\pyrevitlib\pyrevit\forms\utils.py", line 18, in bitmap_from_file
SystemError: Invalid URI: The format of the URI could not be determined.
♻️ To Reproduce
- Create a new pushbutton bundle with 'script.py', 'ui.xaml' and 'icon.png' files
- In script.py,
from pyrevit import forms
window = forms.WPFWindow('ui.xaml')
window.set_icon('icon.png')
result = window.show_dialog()
- Run the pushbutton command
⏲️ Expected behavior
The command should successfully open the WPFWindow, with icon.png as the window icon.
🖥️ Hardware and Software Setup (please complete the following information)
==> Registered Clones (full git repos)
==> Registered Clones (deployed from archive/image)
main | Branch: "master" | Version: "5.1.0.25094+1133" | Path: "C:\pyRevit\main"
==> Attachments
main | Product: "2024.3.1" | Engine: IPY342 (342) | Path: "C:\pyRevit\main"
==> Installed Extensions
pyBimManager | Type: Unknown | Repo: "" | Installed: "C:\Users\jared\OneDrive\Desktop\pyBimManager\pyBimManager.lib"
pyBimManager-Admin | Type: Unknown | Repo: "" | Installed: "C:\Users\jared\OneDrive\Desktop\pyBimManager\pyBimManager-Admin.extension"
pyBimManager-User | Type: Unknown | Repo: "" | Installed: "C:\Users\jared\OneDrive\Desktop\pyBimManager\pyBimManager-User.extension"
==> Default Extension Search Path
C:\Users\jared\AppData\Roaming\pyRevit\Extensions
==> Extension Search Paths
C:\Users\jared\OneDrive\Desktop\pyBimManager
==> Extension Sources - Default
https://github.com/pyrevitlabs/pyRevit/raw/master/extensions/extensions.json
==> Extension Sources - Additional
==> Installed Revits
2024.3.1 | Version: 24.3.10.22 | Build: 20241105_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2024\"
==> Running Revit Instances
PID: 34492 | 2024.3.1 | Version: 24.3.10.22 | Build: 20241105_1515(x64) | Language: 0 | Path: "C:\Program Files\Autodesk\Revit 2024"
==> User Environment
Microsoft Windows 10 [Version 10.0.26100]
Executing User: WINDOWS\jared
Error: Could not load file or assembly 'System.Management, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Run with "--debug" option to see debug messages
Additional context
No response
✈ Pre-Flight checks
🐞 Describe the bug
When trying to set the icon for a WPFWindow with the set_icon() method, an error is thrown, because the underlying .NET function (Window.Icon.Set) expects a Uri, not a file path.
The pyRevit set_icon wrapper method should explicitly convert a provided file path to a Uri.
⌨ Error/Debug Message
♻️ To Reproduce
⏲️ Expected behavior
The command should successfully open the WPFWindow, with icon.png as the window icon.
🖥️ Hardware and Software Setup (please complete the following information)
Additional context
No response