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

Extend the widget to also provide a list of known structures #9

Open
dou-du opened this issue May 7, 2020 · 0 comments
Open

Extend the widget to also provide a list of known structures #9

dou-du opened this issue May 7, 2020 · 0 comments

Comments

@dou-du
Copy link
Contributor

dou-du commented May 7, 2020

This should be optional.
If a list of known_structures is passed from python, in the form

known_structures = [
  [0, "BaTiO<sub>3</sub>", ["Ba", "Ti", "O"]],
  [1, "Fe", ["Fe"]],
  ...
]

(i.e. a list of lists of length three, being an ID (can be a string, an integer, ... - no checks should be done); a string to be rendered in HTML; and a list of elements in the structure), then:

  • show a list of elements near the periodic table (possibly with a text-search like on Materials Cloud/discover/2d?), in the order specified
  • disable all chemical elements not present in any of the structures
  • bind the content of the list to show only the elements that have at least one element selected (or show all if none is selected?)
  • when a structure is selected, update a new attribute selected_structure (but give a way to unselect it) with the ID of the selected structure.

Note: IDs are not required to be unique (but then, there return value will not make it possible to distinguish what has been clicked... but for some cases this might be ok, e.g. if the ID is used to generate a URL, and two entries point to the same URL).

For the latter point, an option could be to provide instead a link to jump when clicking, but for a widget typically it is better to provide the data back without jumping to a different page (if needed, this can be done from python, observing events on the selected_structure variable and redirecting if a valid structure has been selected).

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

No branches or pull requests

1 participant