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

ENH: add notes field in TyphosDisplayTitle #557

Merged
merged 11 commits into from
Jul 25, 2023

Conversation

tangkong
Copy link
Contributor

@tangkong tangkong commented Jul 11, 2023

Description

One proposal for how one might add descriptions to devices.

Searches in the following places for a device notes yaml:

  1. <user_data_path>/device_notes.yaml
  2. PCDS_DEVICE_NOTES environment variable

The above list is also the priority ranking, where higher priority sources shadow/overwrite lower priority information. (aka if both of the above exist, information from DEVICE_NOTES will take precedence). In general more local information will shadow more global information

If nothing exists, we default to the user_data_path, where we also write new note information

All of this is up for debate and subject to change.

Motivation and Context

https://jira.slac.stanford.edu/browse/ECS-1039 , but also dovetailing off of pcdshub/lucid#124

How Has This Been Tested?

interactively, opening typhos and lucid

Where Has This Been Documented?

this PR.

image image

typhos/notes.py Outdated Show resolved Hide resolved
typhos/notes.py Outdated Show resolved Hide resolved
insert_into_data(env_data_path, device_name, data)


class TyphosNotesEdit(QtWidgets.QLineEdit):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intention single-line notes and not multi-line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my intention, but I'm not particularly tied to it. Longer descriptions should probably be covered by the bevy of other help displays (docstring, confluence), right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems logical to me

@tangkong
Copy link
Contributor Author

A brief summary of discussions had on slack about happi integration:

  • It makes a lot of sense to keep this device description information in happi, and it is something we want to target
    • we think this should be a field in the happi container, rather than a separate file(though having user specific description information can remain separate as in this PR)
  • Having a GUI app write to the current happi json db with every edit is a recipe for pain
  • we should set up a mongodb for happi finally

We decided to:

  • make typhos have notes (merge this PR mostly as is)
  • make lucid use the typhos notes
  • try a mongo happi db on the side

@tangkong tangkong marked this pull request as ready for review July 12, 2023 21:46
Copy link
Member

@ZLLentz ZLLentz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added my thoughts from reading the code
I need to give this a spin myself

typhos/notes.py Outdated Show resolved Hide resolved
typhos/notes.py Show resolved Hide resolved
typhos/tests/test_notes.py Outdated Show resolved Hide resolved
@@ -1651,3 +1651,56 @@ def raise_window(widget):
window.raise_()
window.activateWindow()
window.setFocus()


class FrameOnEditFilter(QtCore.QObject):
Copy link
Member

@ZLLentz ZLLentz Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the breakpoint on moving something like this to a utility module vs vendoring it everywhere it is needed? It's pretty short and might want to be customized a bit so I'm not sure. (I recognize this from atef)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did have to tweak it a bit actually, though maybe we should be putting things into pcdswidgets more often?

(sidebar, using the finishedEditing signal requires the FocusIn/FocusOut events to pass through, which mucks around with some of the formatting)

tangkong and others added 2 commits July 12, 2023 16:44
Co-authored-by: Zachary Lentz <[email protected]>
Co-authored-by: Zachary Lentz <[email protected]>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This passes the feels/vibes test for sure, it felt good to use.

typhos/notes.py Outdated Show resolved Hide resolved
typhos/notes.py Outdated Show resolved Hide resolved
@tangkong tangkong requested review from ZLLentz and klauer July 24, 2023 23:10
Copy link
Contributor

@klauer klauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - notes will be very useful 👍

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

Successfully merging this pull request may close these issues.

3 participants