mirror of
https://github.com/pyapp-kit/superqt.git
synced 2026-01-06 04:14:21 +01:00
add screenshots
This commit is contained in:
11
.github/workflows/test_and_deploy.yml
vendored
11
.github/workflows/test_and_deploy.yml
vendored
@@ -93,6 +93,17 @@ jobs:
|
||||
- name: Coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
|
||||
- name: Screenshots
|
||||
run: |
|
||||
pip install . ${{ matrix.backend }}
|
||||
python examples/screenshots.py
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: screenshots
|
||||
path: screenshots
|
||||
|
||||
|
||||
deploy:
|
||||
# this will run when you have tagged a commit, starting with "v*"
|
||||
# and requires that you have put your twine API key in your
|
||||
|
||||
35
examples/screenshots.py
Normal file
35
examples/screenshots.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import pathlib
|
||||
from itertools import product
|
||||
|
||||
from pyqrangeslider import QRangeSlider
|
||||
from pyqrangeslider.qtcompat.QtCore import Qt
|
||||
from pyqrangeslider.qtcompat.QtWidgets import QApplication
|
||||
|
||||
dest = pathlib.Path("screenshots")
|
||||
dest.mkdir(exist_ok=True)
|
||||
|
||||
app = QApplication([])
|
||||
|
||||
orientations = ("horizontal", "vertical")
|
||||
ticks = ("NoTicks", "TicksAbove", "TicksBelow")
|
||||
|
||||
variants = [
|
||||
# (min, max), orient, ticks,
|
||||
((20, 80), "horizontal"),
|
||||
((20, 80), "vertical"),
|
||||
]
|
||||
|
||||
for orient, tick in product(orientations, ticks):
|
||||
slider = QRangeSlider(getattr(Qt, orient.title()))
|
||||
slider.setRange(0, 100)
|
||||
slider.setValue((20, 80))
|
||||
slider.setTickPosition(getattr(slider, tick))
|
||||
slider.activateWindow()
|
||||
if orient == "horizontal":
|
||||
slider.setFixedWidth(300)
|
||||
else:
|
||||
slider.setFixedHeight(200)
|
||||
app.processEvents()
|
||||
fname = dest / f"grab_{orient[:1]}_{tick}.png"
|
||||
slider.grab().save(str(fname))
|
||||
slider.close()
|
||||
Reference in New Issue
Block a user