Thanks to visit codestin.com
Credit goes to github.com

Skip to content

working on toolbar #195

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 14 commits into from
May 23, 2023
Merged

working on toolbar #195

merged 14 commits into from
May 23, 2023

Conversation

clewis7
Copy link
Member

@clewis7 clewis7 commented May 17, 2023

#149

started working on creating a toolbar similar to bokeh's

used thenounproject.com to get free icons for buttons

have buttons in place in ipywidget HBox and then put plot and toolbar in VBox

just playing around in notebooks for now, need to figure out event system before incorporating into plots

@clewis7
Copy link
Member Author

clewis7 commented May 17, 2023

current thought is to just use default bool for tool_buttons and when plot.show is called if True will render plot in VBox with toolbar

@kushalkolar
Copy link
Member

Do these images appear as buttons? If not is there a way to set an image inside a ipywidget button?

@clewis7
Copy link
Member Author

clewis7 commented May 17, 2023

I tried to make the buttons as images and was unsuccessful but then I found a library called ipyevents that allows you to make the images clickable but was going to keep playing around with making the button widget as images

@kushalkolar
Copy link
Member

Seems like you can choose icons from the "FontAwesome" collection and set them on ipywidget buttons with the icon= arg!

https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20List.html#togglebutton
https://fontawesome.com/icons

@clewis7
Copy link
Member Author

clewis7 commented May 18, 2023

got icons working in notebook with event handling, just need to implement into fpl

@kushalkolar
Copy link
Member

kushalkolar commented May 19, 2023

I think the best places to implement would be Plot.show() and GridPlot.show() . And make and return them only if it's detected to be running within jupyter.

One caveat with GridPlot is that we often want to apply these options (like not maintain aspect) to only certain subplots. Maybe we can have a dropdown menu for GridPlot which is filled with the subplot positions or names (if exists). Clicking within a subplot's scene also activates it in the dropdown menu.

Ideally it would be nice to show these buttons within the canvas, but that is more involved: pygfx/pygfx#519

what do you think about this for center-scene? https://fontawesome.com/icons/arrows-to-eye?f=classic&s=solid

For maintain-aspect you can do a toggleable button with bold text "1:1" instead of checkbox (I also call them checkable buttons because they're boolean buttons)

@clewis7
Copy link
Member Author

clewis7 commented May 19, 2023

unfortunately ipywidgets is only current with fontawesome buttons from version 5.15.4, so the arrow-to-eye icon is not available

@clewis7
Copy link
Member Author

clewis7 commented May 19, 2023

I think for now I will just use VBox and have the toolbar below the plot or gridplot and then when everything is functional I can look into doing canvas UI components

@clewis7
Copy link
Member Author

clewis7 commented May 19, 2023

Running into small issue, want to get your thoughts...

You can specify the enumeration of selectable options by passing a list (options are either (label, value) pairs, or simply values for which the labels are derived by calling str).

So gp tool bar is working when subplots have names or when there is combination of names/no names for subplots but I am running into an issue when all the subplots have no names due to above

When I try to input the options for the dropdown widget as tuples corresponding to plot position that can later be used as indexing for toolbar events, I think the widget thinks I am passing (label, value) pairs and therefore only the label is being put into the option instead of the entire subplot position :(

But I am also confused because it does fine when I am having a mix of subplots with names and no names

@kushalkolar kushalkolar merged commit f872155 into master May 23, 2023
@kushalkolar
Copy link
Member

works for plot and gridplot 😄

toolbar-2023-05-23_14.17.28.mp4

@kushalkolar kushalkolar mentioned this pull request Jun 4, 2023
10 tasks
kushalkolar added a commit that referenced this pull request Jun 14, 2023
* restarted tests, now work from the command line

* more tests

* more tests, still working on iw

* ipywidget can only be tested w/ nbmake

* updated tests

* support numpy fancy indexing for colors and data features (#177)

* type annotation fix for older python versions

* adding fancy indexing implemented in #177

* requested changes

* adding diff storage for CI pipeline usage

* use readthedocs.yaml for doc build (#189)

* tests changes, ready to start CI pipeline

* allow for screenshots to be regenerated via os.environ key

* CI build

* linux-build passes, still working on examples passing

* progress on CI pipeline, still need to figure out test build

* still failing test build, what I have for now

* kwargs for Plot and GridPlot to set canvas star size (#194)

* Update ci.yml

use pygfx before pylinalg refactor

* Update ci.yml

sed to remove pygfx from setup.py

* Update ci.yml

imageio

* Delete requirements_rtd.txt

* Update ci.yml

testing upload screens

* create BaseSelector, heatmap also works with LinearSelector and LinearRegionSelector (#187)

* BaseSelector handles most of the event handling, simplifies a lot of implementation.
* same functionality between Linear and LinearRegion, shift + arrow keys to move
* sync not tested for LinearRegion
* HeatmapGraphic has helpers to add Linear and LinearRegion
* indices getters and get_selected_data() are now based on Graphic type, so line and heatmap are handled differently
* started RectangleRegionSelector, will finish in another PR

* add features section to docs for Graphics

* fix sync bug, arrow key movements are toggleable (#198)

* finishes #107, #119, #192 (#200)

* more selector stuff (#199)

* garbage collection of selectors, not tested yet

* selecors gc progress, not there yet but not broken either

* move events for transparent fill areas

* rectangle region selector basic functionality works

* more rectangle region stuff

* basic recording for Plot (#178)

* basic recording for Plot

* opencv conditional import, reduce fps slightly in recorded vid to compensat, looks fine now

* forgot to add the actual recorder

* record Plot or GridPlot, uses PyAV, works well enough

* comment, organization

* cleaup

* changing linux build to have python versions matrix

* working on toolbar (#195)

* working on toolbar

* toolbar updates

* basic toolbar for plot implemented

* base logic in notebook for gridplot toolbar

* gp toolbar working when subplots have names & mix names/no names

* initial changes to simple plot toolbar

* updates to plot toolbar, still need to refactor into separate file

* fixed gridplot toolbar, still need to move to separate class

* add flip button

* adding click event handler for gp toolbar dropdown options

* keep new clicked plot up-to-date with toggle button values

* requested changes

* catchup with pygfx linalg refactor (#203)

* WIP, mapping to points and selectors not updated

* everything updated for linalg refactor except rectangle selector

* update toolbar w.r.t. linalg refactor

* update examples w.r.t. linalg refactor

* update readme

* image selector and heatmap linalg fixes (#204)

* add selector performance example nb

* Docs build fix (#210)

* Update .readthedocs.yaml, install pygfx from main

* Update .readthedocs.yaml

* Update .readthedocs.yaml

* all feature docs (#212)

* add all feature docs

* Create examples README

* Update README

* Update and rename README to README.md

* finish buttons for toolbar (#207)

* working on toolbar

* toolbar updates

* basic toolbar for plot implemented

* base logic in notebook for gridplot toolbar

* gp toolbar working when subplots have names & mix names/no names

* initial changes to simple plot toolbar

* updates to plot toolbar, still need to refactor into separate file

* fixed gridplot toolbar, still need to move to separate class

* add flip button

* adding click event handler for gp toolbar dropdown options

* keep new clicked plot up-to-date with toggle button values

* requested changes

* adding record button

* record button

* silly miss in merge conflict resolve

* wow I am struggling this am

* imagewidget toolbar for single plot iw

* toolbar for iw with gridplot

* requested changes

* update flip icon

* toolbar updates

* changes to linear selector event handler removal

* Update fastplotlib/widgets/image.py

* simplify toolbar stuff in show(), simplify image widget toolbar

---------

Co-authored-by: Kushal Kolar <[email protected]>

* nbmake tests work

* updating CI file

* all tests passing locally

* trying to get CI to run on ghub

* change screenshots to be stored as png files

* restarted tests, now work from the command line

* more tests

* more tests, still working on iw

* ipywidget can only be tested w/ nbmake

* updated tests

* adding fancy indexing implemented in #177

* requested changes

* adding diff storage for CI pipeline usage

* tests changes, ready to start CI pipeline

* allow for screenshots to be regenerated via os.environ key

* CI build

* linux-build passes, still working on examples passing

* progress on CI pipeline, still need to figure out test build

* still failing test build, what I have for now

* Update ci.yml

use pygfx before pylinalg refactor

* Update ci.yml

sed to remove pygfx from setup.py

* Update ci.yml

imageio

* Update ci.yml

testing upload screens

* changing linux build to have python versions matrix

* nbmake tests work

* updating CI file

* all tests passing locally

* trying to get CI to run on ghub

* change screenshots to be stored as png files

* rebase with master and update CI

* track *.png files using Git LFS

* yml for regenerating screenshots, updating CI yml to not regenerate

* update .gitignore and regen screenshots yml

* hopefully works

* add screenshots

* remove screenshots from git

* add screenshots, yet again

* setup options

* remove type annotation

* change workflow to use setup optiosn

* add pyav to setup for tests

* add scikit-image

* opencv instead of pyav

* add libpng-dev

* try pillow, better work ffs

* bah

* add git-lfs to apt install for github actions

* add interactive again

* install git lfs before checkout repo

* add git lfs fetch pull

* diffs

* diffs path

* update examples for canvas size and autoscale

* remove gpu screenshots

* add screenshot ground truth files from github actions generated screenshots

* remove interactive session stuff

---------

Co-authored-by: Kushal Kolar <[email protected]>
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