Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

add Deleted as a graphic feature #404

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

Merged
merged 1 commit into from
Feb 20, 2024
Merged

add Deleted as a graphic feature #404

merged 1 commit into from
Feb 20, 2024

Conversation

kushalkolar
Copy link
Member

@kushalkolar kushalkolar commented Feb 19, 2024

This makes it possible to create callbacks to do things when a Graphic is deleted from a PlotArea.

garbage collection is actinng wonky again so I need to fix that too... nevermind, I think was accessing stuff users wouldn't normally access in jupyter so ipython was clinging onto it, as usual 😄

This also changes all feature_events class attributes to be a set.

Useage:
image

@kushalkolar kushalkolar requested a review from clewis7 February 19, 2024 10:32
@kushalkolar kushalkolar marked this pull request as ready for review February 19, 2024 10:36
@kushalkolar kushalkolar mentioned this pull request Feb 19, 2024
@kushalkolar
Copy link
Member Author

@clewis7 notebook tests are failing due to a new change in pygfx which we haven't caught up to yet, but I want to merge this anyways and deal with the pygfx changes later.

Copy link
Member

@clewis7 clewis7 left a comment

Choose a reason for hiding this comment

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

Had a couple of clarifying questions? Has been too long since I have looked at this. Otherwise, LGTM!

def __init__(self, parent, value: bool):
super(Deleted, self).__init__(parent, value)

def _set(self, value: bool):
Copy link
Member

Choose a reason for hiding this comment

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

So, this will get triggered when __del__ is called and self.deleted = True is set?

Copy link
Member

Choose a reason for hiding this comment

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

How are we preventing users from if a graphic has been deleted to still having reference to the graphic and trying to say something silly like graphic.deleted=False? Will this throw an error if the graphic has already been deleted? I would assume so because there will be no reference.

Copy link
Member Author

Choose a reason for hiding this comment

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

So, this will get triggered when __del__ is called and self.deleted = True is set?

Yes, Graphic.__del__ sets self.deleted = True https://github.com/fastplotlib/fastplotlib/pull/404/files#diff-a57994ecff1cde4e05c8175265219f0b5200da144ce8733b9eb560c09bcea7ddR179

How are we preventing users from if a graphic has been deleted to still having reference to the graphic and trying to say something silly like graphic.deleted=False? Will this throw an error if the graphic has already been deleted? I would assume so because there will be no reference.

Since users are only given acccess to weakreferences, it will throw a reference error if they try to do anything with a deleted Graphic.


pick_info = {
"index": None,
"collection-index": self._collection_index,
Copy link
Member

Choose a reason for hiding this comment

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

What is the difference here between index vs collection-index? Also, collection-index could be None if the graphic is not a CollectionGraphic, no?

Copy link
Member

Choose a reason for hiding this comment

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

It seems like index will always be None?

Copy link
Member Author

Choose a reason for hiding this comment

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

index is buffer index, used for things like data and colors features. Not used here since it's not relevant

@kushalkolar kushalkolar merged commit 78f1d2a into main Feb 20, 2024
kushalkolar added a commit that referenced this pull request Feb 20, 2024
@kushalkolar kushalkolar deleted the deleted-feature branch February 26, 2024 06:58
kushalkolar added a commit that referenced this pull request Feb 29, 2024
* start legends, not functional yet

* add faq (#400)

* fix bug when remove_graphic() is used (#405)

* add 'Deleted' as a graphic feature (#404)

* very basic adding line legends works

* use OrderedDict for legend items

* allow accessing legend items via Graphic, updating colors works

* legend mesh resizes properly

* remove legend items and reorder works

* enforce all legend labels to be unique

* add legends property to PlotArea

* checks for Graphic name

* highlight linegraphic when legend item is clicked

* legend is moveable

* remove weird characters that were committed for some reason

* progress on legend grid placement, not yet working

* max_rows works for legend

* just allow max_rows kwarg for legends, no cols

* line that snuck in from another branch

* small changes
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.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.