Skip to content
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

Minimal dataitem selector example would be useful #773

Open
kociak opened this issue Dec 3, 2021 · 4 comments
Open

Minimal dataitem selector example would be useful #773

kociak opened this issue Dec 3, 2021 · 4 comments

Comments

@kociak
Copy link

kociak commented Dec 3, 2021

In many cases, when writting scripts or plug-ins (or computations), it is necessary for the user to choose one to several dataitems to perform operation with/on them. Some computation interfaces are nice (where you can e.g drag and drop dataitems on panels/windows). I could not find a minimal example of such a "dataitem selector". This would serve the purpose of the "get2images" or alike function of digital micrograph, but I guess the drag and drop/ visual version of it is quite useful.

@cmeyer
Copy link
Collaborator

cmeyer commented Dec 4, 2021

The approach we've been taking so far is to select two images by clicking on one display panel and then shift-clicking on a second display panel. I'd also like to have exactly what you suggest - but somewhat extended so it was actually a "wizard" that allows you to configure a computation before actually performing it. The "wizard" could have one or more pages and would be a modeless, floating window, so you could do other things while configuring it.

Either way, this is a great request and I'll write up something about it soon. Thanks.

@kociak
Copy link
Author

kociak commented Dec 5, 2021

The idea of a wizard sounds like honey to my ears.
Using a double-selection is not appealing for me in a script, because simply I don't know how to pause a script, letting it waiting for inputs or validation.
In a plug in, i can do it easily with my own buttons. However, what I don't like is that I have trouble remembering which one I selected first - probably not an issue for everybody. So I am planning to make two "select" button (one per dataitem for a 2 parameter function).
I just realized the selected items are numbered if they appear in a display panel... lovely! This would really help me in the future. Having the number also on the miniatures would be fantastic as well!

@kociak
Copy link
Author

kociak commented Dec 13, 2021

Just experimenting with the idea of having several selected items. Using the api_broker does not allow to make it in the script environment. We need to use the Facade instead:

api = api_broker.get_api(version="1.0", ui_version="1.0")
#the following line causes an exception
print(api.application.document_controllers[0]._document_controller.selected_data_items)

does not work while the following works

api=Facade.get_api("~1.0", "~1.0")
print(api.application.document_controllers[0]._document_controller.selected_data_items)

works

@cmeyer cmeyer self-assigned this Jan 3, 2022
@cmeyer
Copy link
Collaborator

cmeyer commented May 21, 2022

@cmeyer cmeyer removed their assignment Dec 13, 2022
@cmeyer cmeyer added this to the Next Minor Release milestone Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants