-
Notifications
You must be signed in to change notification settings - Fork 34
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
Make scene.refresh work without an image #691
Make scene.refresh work without an image #691
Conversation
There was an assumption that scene.refresh() would not be called unless an image had been loaded. But there are several ways to have it called, among which: - if the "Default Knit Side Image" setting is checked, the initial `reverse()` call will call `refresh()`; - whenever the preferences panel is closed, `refresh()` is called, even if an image has not yet been loaded. It seems simpler to make `refresh()` able to work without an image. A visible change is that the "machine" (the orange and green bars) will be visible from the start, which I think is an improvement.
WalkthroughThe recent changes to the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/main/python/main/ayab/scene.py (3 hunks)
Additional comments not posted (2)
src/main/python/main/ayab/scene.py (2)
85-88
: Good job adding a conditional check to prevent errors.The conditional check ensures that the
ayabimage.image
is notNone
before attempting to reverse the image. This prevents potential errors that could arise from manipulating a non-existent image.
108-176
: Good job adding a conditional check to prevent errors.The conditional check ensures that the
ayabimage.image
is notNone
before updating the graphics scene with the image. This prevents potential errors that could arise from updating the scene with a non-existent image.
Wait a second, I'm getting a weird new error when starting this. Looking into it, sorry. |
The call to `reverse` that happens in `Scene.__init__` triggers a `refresh` that in turn accesses the `zoom` property. This creates an exception if the property hasn't been initialized yet.
|
OK, now it works, both with the "Default Knit Side Image" preference checked and unchecked. I had to move some code around in init so that we don't access |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/main/python/main/ayab/scene.py (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/main/python/main/ayab/scene.py
Fixes #689.
There was an assumption that scene.refresh() would not be called unless an image had been loaded. But there are several ways to have it called, among which:
reverse()
call will callrefresh()
;refresh()
is called, even if an image has not yet been loaded.It seems simpler to make
refresh()
able to work without an image.A visible change is that the "machine" (the orange and green bars) will be visible from the start, which I think is an improvement.
Summary by CodeRabbit