Skip to content

fix bitmap_from_file method in utils.py #2700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 11, 2025

Conversation

jaredholloway94
Copy link
Contributor

@jaredholloway94 jaredholloway94 commented Jun 9, 2025

Fix bitmap_from_file method in utils.py

Description

Explicitly provide UriKind to Uri constructor in bitmap_from_file method.


Checklist

Before submitting your pull request, ensure the following requirements are met:

  • Code follows the PEP 8 style guide.
  • Code has been formatted with Black using the command:
    pipenv run black {source_file_or_directory}
  • Changes are tested and verified to work as expected.

Related Issues

If applicable, link the issues resolved by this pull request:

Copy link
Contributor

devloai bot commented Jun 9, 2025

Unable to perform a code review. You have run out of credits 😔
You can buy additional credits from the subscription page.

@jmcouffin jmcouffin requested a review from Copilot June 9, 2025 19:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fix explicit UriKind usage in bitmap_from_file to ensure proper BitmapImage.UriSource initialization.

  • Imported Uri and UriKind from pyrevit.framework
  • Updated bitmap.UriSource assignment to use Uri.TryCreate with UriKind.RelativeOrAbsolute
Comments suppressed due to low confidence (1)

pyrevitlib/pyrevit/forms/utils.py:11

  • The docstring states absolute path, but UriKind.RelativeOrAbsolute allows relative paths. Update the description to reflect support for both, or enforce only absolute URIs.
bitmap_file (str): absolute path to bitmap file

@jmcouffin jmcouffin added the API Change Revit API change that breaks pyRevit [class->Upgraded #{number}: {title}] label Jun 9, 2025
@jaredholloway94
Copy link
Contributor Author

@jmcouffin what do the emojis mean?

@jmcouffin
Copy link
Contributor

@jmcouffin what do the emojis mean?

If you mean this one ☝️
Just to consider the comments from GitHub copilot review as they make sense.

The other ones on your original post, not much more than thanks, I will look at it and test whenever I get the time.

add error handling for Uri.TryCreate in bitmap_from_file method

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jmcouffin jmcouffin merged commit 95e6046 into pyrevitlabs:develop Jun 11, 2025
@jmcouffin
Copy link
Contributor

jmcouffin commented Jun 11, 2025

Thanks @jaredholloway94.
You are gently becoming a regular!

Copy link
Contributor

📦 New work-in-progress (wip) builds are available for 5.1.0.25162+1306-wip

@jaredholloway94
Copy link
Contributor Author

Thanks @jaredholloway94.

You are gently becoming a regular!

trying!
glad to have my first PR merged.
thanks for the support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Change Revit API change that breaks pyRevit [class->Upgraded #{number}: {title}]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: pyrevit.forms.WPFWindow.set_icon method fails with valid file path; requires formatted Uri
2 participants