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

Info widget #33

Open
aljosahafner opened this issue Jan 18, 2021 · 5 comments
Open

Info widget #33

aljosahafner opened this issue Jan 18, 2021 · 5 comments
Assignees
Labels
new feature Completely new feature

Comments

@aljosahafner
Copy link
Collaborator

A widget that can be connected to any point in the beamline (most likely detector) and provide info on:

  • distances between OEs and to the source
  • names of OEs
  • number of calculation points
  • other...
@aljosahafner aljosahafner added the new feature Completely new feature label Jan 18, 2021
@aljosahafner aljosahafner self-assigned this Jan 18, 2021
@aljosahafner
Copy link
Collaborator Author

I will start working on this very soon.

Version 1:

  • Out object will be: WiserBeamline, which is a LibWiser beamline? Or the last/connected optical element?
  • The widget will display print(beamline) command from LibWiser

@capitanevs
Copy link
Collaborator

This is good.
On this note (native scripts) I have some more comments.

I did extensive use, for instance, of the "GetBeamline" script
immagine

Generally, I am also using other "OASYS Snippets" that can be useful while using oasys canvas (see below).
The problem is that I did not found an easy way to gather all these "pre-written" python widget in a unique place, where they can be picked up from. Every time I have to open the *.ow file that contains them, copy the code, paste it to the python widget in the destination canvas, rename the widget with a meaningful name.

OASYS was not conceived for creating "libraries" of python scripts, so I am not complaining :-)
But maybe we can find a common strategy toghether.
For instance I saw that SRW has a section called "native scripts". We could think about something similar.

immagine

@aljosahafner
Copy link
Collaborator Author

If you already have these codes, then it is very easy to convert to a widget, especially those such as GetBeamline, Check Source Name, etc.

@aljosahafner
Copy link
Collaborator Author

For my own reference: use AutomaticWidget class for this and NOT WiserWidget.

@capitanevs
Copy link
Collaborator

Great, it's working.

Some More features

  • Add another tab named "Python Code", displaying the automatically generated code (see below).
  • Add a button, with label "Copy code to clipboard"
  • In Output-tab, use Beamline>Print() rathern than print(Beamline)

import clipboard
B = GetWiserBeamline(in_object_1)
out_object = B
BeamlineCode = B.GenerateCode()
print(BeamlineCode)
clipboard.copy(BeamlineCode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Completely new feature
Projects
None yet
Development

No branches or pull requests

2 participants