forked from napari/napari
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Screenshot without margins #7
Open
melonora
wants to merge
86
commits into
main
Choose a base branch
from
screenshot_without_margins
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: [email protected]
…ora/napari into screenshot_without_margins
Co-Authored-By: [email protected]
Co-authored-by: olusesan [email protected]
Co-authored-by: [email protected]
Co-authored-by: [email protected]
Co-authored-by: [email protected]
melonora
commented
May 12, 2024
img = viewer.screenshot(flash=False, fit_to_data=True) | ||
assert img.shape == (250, 250, 4) | ||
assert np.all(img != np.array([0, 0, 0, 1])) | ||
|
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.
This only fails when running the test itself. If you use the same code in a python script it does not fail. For some reason, there is no response to the canvas resize event when running inside a test.
Co-authored-by: [email protected]
Co-authored-by: [email protected]
Co-authored-by: [email protected]
Co-authored-by: Juan Nunez-Iglesias <[email protected]>
Co-authored-by: Lorenzo Gaifas <[email protected]>
…ora/napari into screenshot_without_margins
Co-authored-by: Grzegorz Bokota <[email protected]>
Co-authored-by: Grzegorz Bokota <[email protected]>
for more information, see https://pre-commit.ci
Co-authored-by: Grzegorz Bokota <[email protected]>
…ora/napari into screenshot_without_margins
Co-authored-by: Grzegorz Bokota <[email protected]>
…ons) (napari#7057) # References and relevant issues Follow up for napari#7030 (comment) # Description Add tests for split rgb, split and merge layer actions functions
# References and relevant issues In napari#7054, I noted that in napari#5432 we had inadvertently removed access to mouse events from QtViewer.canvas, without a deprecation. @jni [commented](napari#7054 (comment)) that we could temporarily restore access with a property, followed in later versions by an alternate API and deprecation. # Description This PR adds an `events` property to QtViewer.canvas, restoring the broken behavior. It does not yet have a deprecation message because we don't have an alternate API.
This ensures correct sampling with anisotropic data Co-authored-by: Grzegorz Bokota <[email protected]>
for more information, see https://pre-commit.ci
…`File` menu (napari#7075) # References and relevant issues Closes napari#7068 # Description Add a new group to the `File` menu for the newly contributable menus, allowing `Open Sample` to remain at the bottom of its group as it previously was.
…apari#6965 (napari#7038) # References and relevant issues Alternative to napari#6950 that doesn't rely on registering/deregistering actions but instead uses the mechanism from napari#6965. Depends on: napari#6965 # Description On macOS, there is no indication by default that a menubar submenu is empty — one simply has to hover for an unnaturally long time to be sure that indeed, there is nothing in that submenu. Instead of allowing this behaviour, apps usually put an "Empty" placeholder in empty submenus that quickly indicate to the user that there is nothing in this menu. This is particularly critical for napari users since napari#7011, because that PR added a *lot* of menus that are empty if the user has not installed plugins. In napari#6950, I tried to add this issue by: - registering a do-nothing action - de-registering it and re-registering it whenever the menus changed, placing it in all menus that are empty. The issue with that approach is that de-registering and re-registering the action was itself changing the menus, which could cause infinite loops if we weren't super careful — and indeed we did, and worse, we seemed to do so stochastically. This PR instead uses just-in-time functional context evaluation to check whether a menu is empty as it's about to be shown, and show the empty key if so. https://github.com/napari/napari/assets/17995243/9b051a68-fe1d-41d9-ad39-b7fcc11d5206 ## Trying stuff out The easiest way to try this out is to just launch `napari` from main and look for an empty menu e.g. `Layers -> Data`. Then, if you want to see the placeholder disappear upon action registration, you can run the following code in the console. ```python from napari._app_model import get_app from app_model.types import Action my_action = Action( id='napari.new_action', title='On The Fly', callback=lambda: napari.utils.notifications.show_info("WOOOOOW"), menus=[{'id': 'napari/layers/data'}] ) app = get_app() deregister_action = app.register_action(my_action) # call deregister_action() to deregister the same action ``` --------- Co-authored-by: Grzegorz Bokota <[email protected]> Co-authored-by: Juan Nunez-Iglesias <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References and relevant issues
Description