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: Update docs with info about example.py args, new draw option and screenshot #209

Merged
merged 4 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/linux-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
jobs:
linux:
name: Linux Py${{ matrix.PYTHON_VERSION }}
timeout-minutes: 15
runs-on: ubuntu-latest
env:
CI: True
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/macos-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
jobs:
macos:
name: Mac Py${{ matrix.PYTHON_VERSION }}
timeout-minutes: 15
runs-on: macos-latest
env:
CI: True
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ on:

jobs:
windows:
name: Windows Py${{ matrix.PYTHON_VERSION }}
name: Windows Py${{ matrix.PYTHON_VERSION }}
timeout-minutes: 15
runs-on: windows-latest
env:
CI: True
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![Join the chat at https://gitter.im/spyder-ide/public](https://badges.gitter.im/spyder-ide/spyder.svg)](https://gitter.im/spyder-ide/public)<br>
[![PyPI status](https://img.shields.io/pypi/status/qtawesome.svg)](https://github.com/spyder-ide/qtawesome)
[![Github build status](https://github.com/spyder-ide/qtawesome/workflows/Tests/badge.svg)](https://github.com/spyder-ide/qtawesome/actions)
[![Documentation Status](https://readthedocs.org/projects/qtawesomedocs/badge/?version=latest)](https://qtawesomedocs.readthedocs.io/en/latest/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/qtawesome/badge/?version=latest)](https://qtawesome.readthedocs.io/en/latest/?badge=latest)

*Copyright © 2015–2022 Spyder Project Contributors*

Expand Down Expand Up @@ -142,6 +142,16 @@ stack_button = QtWidgets.QPushButton(camera_ban, 'Stack')
stack_button.setIconSize(QtCore.QSize(32, 32))
```

- Define the way to draw icons (`text`- default for icons without animation, `path` - default for icons with animations, `glyphrun` and `image`)

```python
# Icon drawn with the `image` option
drawn_image_icon = qta.icon('ri.truck-fill',
options=[{'draw': 'image'}])
drawn_image_button = QtWidgets.QPushButton(drawn_image_icon,
'Icon drawn as an image')
```

- Animations

```python
Expand Down Expand Up @@ -170,6 +180,12 @@ simple_widget = qta.IconWidget('mdi.web', color='blue')
![QtAwesome screenshot](qtawesome-screenshot.gif)


To check these options you can launch the `example.py` script and pass to it the options as arguments. For example, to test how the icons could look using the `glyphrun` draw option, you can run something like:

```
python example.py draw=glyphrun
```

## Other features

- QtAwesome comes bundled with _Font Awesome_, _Elusive Icons_, _Material Design_
Expand Down
12 changes: 11 additions & 1 deletion docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Examples
color_active='orange')
music_button = QtWidgets.QPushButton(styling_icon, 'Styling')

- Set alpha in colors
- Set alpha in colors:

.. code:: python

Expand All @@ -138,6 +138,16 @@ Examples
toggle_button = QtWidgets.QPushButton(toggle_icon, 'Toggle')
toggle_button.setCheckable(True)

- Define the way to draw icons (`text`- default for icons without animation, `path` - default for icons with animations, `glyphrun` and `image`):

.. code:: python

# Icon drawn with the `image` option
drawn_image_icon = qta.icon('ri.truck-fill',
options=[{'draw': 'image'}])
drawn_image_button = QtWidgets.QPushButton(drawn_image_icon,
'Icon drawn as an image')

- Stack multiple icons:

.. code:: python
Expand Down
11 changes: 10 additions & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ def __init__(self):
iconwidgetholder.setLayout(lo)
iconwidget2 = qta.IconWidget('mdi.web', color='blue')

# Icon drawn with the `image` option
drawn_image_icon = qta.icon('ri.truck-fill',
options=[{'draw': 'image'}])
drawn_image_button = QtWidgets.QPushButton(drawn_image_icon,
'Icon drawn as an image')

# Stack icons
camera_ban = qta.icon('fa5s.camera', 'fa5s.ban',
options=[{'scale_factor': 0.5,
Expand Down Expand Up @@ -160,7 +166,8 @@ def __init__(self):
rot_button,
hflip_button,
vflip_button,
toggle_button
toggle_button,
drawn_image_button
]
animated_widgets = [
spin_button,
Expand Down Expand Up @@ -216,6 +223,8 @@ def main():
if hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'):
app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)

# Timer needed to close the example application
# when testing
QtCore.QTimer.singleShot(10000, app.exit)
_ = AwesomeExample()
sys.exit(app.exec_())
Expand Down
Binary file modified qtawesome-screenshot.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.