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

De-couple file-open from active-leaf-change #37

Open
tzhouhc opened this issue Jan 2, 2022 · 5 comments
Open

De-couple file-open from active-leaf-change #37

tzhouhc opened this issue Jan 2, 2022 · 5 comments

Comments

@tzhouhc
Copy link

tzhouhc commented Jan 2, 2022

Currently, the file-open event has a callback for the TFile opened. However, it provides no information as to the containing leaf of said TFile. I tried iterating through all open leaves, but found out that apparently they all contain the same TFile by reference, so... Is there not an actual way to find out the leaf for a file-open event?

@lishid
Copy link
Collaborator

lishid commented Jan 3, 2022

The file-open is always triggered for the Workspace.activeLeaf. Just to be certain, however, I still suggest running a null check and comparing the TFile, but it should only fire for the active leaf.

@tzhouhc
Copy link
Author

tzhouhc commented Jan 4, 2022

Ah, thank you for the pointer!

@tzhouhc
Copy link
Author

tzhouhc commented Jan 4, 2022

I discovered that file-open events fire for active-leaf-change as well, which is not quite the expected behavior with two events named as such. I was more hoping that file-open would only fire for either a new leaf or a leaf getting a new file opened in it.

So maybe I can retitle the request to be "de-couple file-open from active-leaf-change"?

@tzhouhc tzhouhc changed the title Modify or create new "file-open" event callback that provides leaf information De-couple file-open from active-leaf-change Jan 4, 2022
@lishid
Copy link
Collaborator

lishid commented Jan 4, 2022

I would say that I don't want to change its behavior for backwards compatibility reasons, but we could look into adding a proper event for "file was just opened". Let's leave this issue open until that's available.

@tzhouhc
Copy link
Author

tzhouhc commented Jan 4, 2022

Sounds good! Yeah I agree, the breakages would be very unfunny.

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

3 participants