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

PR: Add API to start/stop animations to the Spin class #245

Merged
merged 3 commits into from
Dec 8, 2023

Conversation

ccordoba12
Copy link
Member

@ccordoba12 ccordoba12 commented Nov 6, 2023

Fixes #165.

@ccordoba12 ccordoba12 added this to the v1.3.0 milestone Nov 6, 2023
@ccordoba12 ccordoba12 self-assigned this Nov 6, 2023
@dalthviz
Copy link
Member

dalthviz commented Nov 22, 2023

Should we mark this as the fix for #165 @ccordoba12 ?

@ccordoba12
Copy link
Member Author

Yep, you're totally right (I didn't know about that issue).

@ccordoba12
Copy link
Member Author

ccordoba12 commented Nov 22, 2023

And my question for you: should we add documentation for this new feature? And if so, where should I put it?

@dalthviz
Copy link
Member

should we add documentation for this new feature?

That's a good point, I would say yes 👍

And if so, where should I put it?

Probably we could expand the Animations usage example at least:

qtawesome/README.md

Lines 158 to 166 in d1371a7

- Animations
```python
# Spining icons
spin_button = QtWidgets.QPushButton(' Spinning icon')
spin_icon = qta.icon('fa5s.spinner', color='red',
animation=qta.Spin(spin_button))
spin_button.setIcon(spin_icon)
```

- Animations:
.. code:: python
# Spin icons
spin_button = QtWidgets.QPushButton(' Spinning icon')
spin_icon = qta.icon('fa5s.spinner', color='red',
animation=qta.Spin(spin_button))
spin_button.setIcon(spin_icon)

qtawesome/example.py

Lines 123 to 127 in d1371a7

# Spin icons
spin_button = QtWidgets.QPushButton(' Spinning icon')
spin_icon = qta.icon('fa5s.spinner', color='red',
animation=qta.Spin(spin_button))
spin_button.setIcon(spin_icon)

Maybe in the future we should try to expand the API reference to cover not only the qtawesome/__init__.py but also improve other places docstrings and use those to autogenerate more docs reference pages 🤔

This also adds a kwarg to decide if the animation should be
automatically started (in some situations that's not desired).
@ccordoba12
Copy link
Member Author

Probably we could expand the Animations usage example at least:

Done in the three places you referenced above.

@dalthviz
Copy link
Member

dalthviz commented Dec 7, 2023

Note: Seems like on Windows with PyQt5 running the example.py script (or maybe pytest?) is failing with exit code 127. Other checks were failing due to the coverage upload step failing but a couple of reruns help with that 🤔

@ccordoba12
Copy link
Member Author

ccordoba12 commented Dec 7, 2023

Fixed in my last commit by skip running the example file when using PyQt5.

Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

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

Thanks @ccordoba12 ! Regarding your last comment:

Fixed in my last commit by skip running the example file when using PyQt5.

I think is fine for the moment but probably worthy to understand why the running the example.py run is failing over CI, no? Should we at least create a follow up issue for that before merging this as it is? What do you think?

@ccordoba12
Copy link
Member Author

ccordoba12 commented Dec 7, 2023

I think is fine for the moment but probably worthy to understand why the running the example.py run is failing over CI, no?

Yeah, that's a good point. I think the problem has to do with the new timers I added to start/stop animations of some icons.

Should we at least create a follow up issue for that before merging this as it is? What do you think?

Agreed. I'll create one and take a look at it after Spyder 6 alpha3 is released.

@dalthviz
Copy link
Member

dalthviz commented Dec 8, 2023

Created #254 to proceed with the merge here

@dalthviz dalthviz merged commit c759f98 into spyder-ide:master Dec 8, 2023
13 checks passed
@ccordoba12 ccordoba12 deleted the start-stop-spin branch December 8, 2023 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need a way to stop animation icon from calling _update
2 participants