Skip to content

Commit

Permalink
Merge branch 'main' into fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Oct 12, 2024
2 parents fc960ca + 952ac33 commit 6f6ec5a
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 28 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-13]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
backend: [pyqt5, pyside2, pyqt6]
exclude:
# Abort (core dumped) on linux pyqt6, unknown reason
Expand All @@ -36,30 +36,32 @@ jobs:
# lack of wheels for pyside2/py3.11
- python-version: "3.11"
backend: pyside2
- python-version: "3.12"
backend: pyside2
- python-version: "3.12"
backend: pyqt5
include:
- python-version: "3.10"
platform: macos-latest
backend: pyside6
backend: "'pyside6<6.8'"
- python-version: "3.11"
platform: macos-latest
backend: pyside6
backend: "'pyside6<6.8'"
- python-version: "3.10"
platform: windows-latest
backend: pyside6
- python-version: "3.11"
platform: windows-latest
backend: pyside6
backend: "'pyside6<6.8'"
- python-version: "3.12"
platform: macos-latest
backend: pyqt6
platform: windows-latest
backend: "'pyside6<6.8'"

# legacy Qt
- python-version: 3.8
- python-version: 3.9
platform: ubuntu-latest
backend: "pyqt5==5.12.*"
- python-version: 3.8
- python-version: 3.9
platform: ubuntu-latest
backend: "pyqt5==5.13.*"
- python-version: 3.8
- python-version: 3.9
platform: ubuntu-latest
backend: "pyqt5==5.14.*"

Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.3
rev: v0.6.9
hooks:
- id: ruff
args: [--fix, --unsafe-fixes]
- id: ruff-format

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
rev: v0.20.2
hooks:
- id: validate-pyproject

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.11.2
hooks:
- id: mypy
exclude: tests|examples
Expand Down
26 changes: 21 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## [v0.6.8](https://github.com/pyapp-kit/superqt/tree/v0.6.8) (2024-06-15)

[Full Changelog](https://github.com/pyapp-kit/superqt/compare/v0.6.7...v0.6.8)

**Implemented enhancements:**

- feat: graceful offline fallback for qiconify [\#251](https://github.com/pyapp-kit/superqt/pull/251) ([tlambert03](https://github.com/tlambert03))

## [v0.6.7](https://github.com/pyapp-kit/superqt/tree/v0.6.7) (2024-06-07)

[Full Changelog](https://github.com/pyapp-kit/superqt/compare/v0.6.6...v0.6.7)

**Fixed bugs:**

- fix: prevent qthrottled and qdebounced from holding strong references with bound methods [\#247](https://github.com/pyapp-kit/superqt/pull/247) ([tlambert03](https://github.com/tlambert03))

**Merged pull requests:**

- Prevent computing full document content highlight per block and only compute current block content for performance [\#246](https://github.com/pyapp-kit/superqt/pull/246) ([dalthviz](https://github.com/dalthviz))

## [v0.6.6](https://github.com/pyapp-kit/superqt/tree/v0.6.6) (2024-05-12)

[Full Changelog](https://github.com/pyapp-kit/superqt/compare/v0.6.5...v0.6.6)
Expand All @@ -8,10 +28,6 @@

- perf: improve paint time for QColormapLineEdit [\#245](https://github.com/pyapp-kit/superqt/pull/245) ([tlambert03](https://github.com/tlambert03))

**Merged pull requests:**

- ci: \[pre-commit.ci\] autoupdate [\#244](https://github.com/pyapp-kit/superqt/pull/244) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))

## [v0.6.5](https://github.com/pyapp-kit/superqt/tree/v0.6.5) (2024-05-06)

[Full Changelog](https://github.com/pyapp-kit/superqt/compare/v0.6.4...v0.6.5)
Expand All @@ -20,7 +36,7 @@

- fix: fix a number of issues with Labeled and Range Sliders, add LabelsOnHandle mode. [\#242](https://github.com/pyapp-kit/superqt/pull/242) ([tlambert03](https://github.com/tlambert03))

**Merged pull requests:**
**Tests & CI:**

- ci: trying to fix tests on various platforms [\#243](https://github.com/pyapp-kit/superqt/pull/243) ([tlambert03](https://github.com/tlambert03))

Expand Down
2 changes: 1 addition & 1 deletion examples/demo_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# patch for Qt 5.15 on macos >= 12
os.environ["USE_MAC_SLIDER_PATCH"] = "1"

from superqt import QRangeSlider # noqa
from superqt import QRangeSlider

QSS = """
QSlider {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pyside2 = ["pyside2"]
# https://github.com/pyapp-kit/superqt/pull/177
# https://github.com/pyapp-kit/superqt/pull/164
# https://bugreports.qt.io/browse/PYSIDE-2627
pyside6 = ["pyside6 !=6.5.0,!=6.5.1,!=6.6.2"]
pyside6 = ["pyside6 !=6.5.0,!=6.5.1,!=6.6.2,<6.8"]
pyqt5 = ["pyqt5"]
pyqt6 = ["pyqt6<6.7"]
font-fa5 = ["fonticon-fontawesome5"]
Expand Down
30 changes: 26 additions & 4 deletions src/superqt/iconify/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from __future__ import annotations

import warnings
from typing import TYPE_CHECKING

from qtpy.QtCore import QSize
from qtpy.QtGui import QIcon
from qtpy.QtCore import QSize, Qt
from qtpy.QtGui import QIcon, QPainter, QPixmap
from qtpy.QtWidgets import QApplication

if TYPE_CHECKING:
from typing import Literal
Expand Down Expand Up @@ -122,5 +124,25 @@ def addKey(
state : QIcon.State, optional
State specified for the icon, passed to `QIcon.addFile`.
"""
path = svg_path(*key, color=color, flip=flip, rotate=rotate, dir=dir)
self.addFile(str(path), size or QSize(), mode, state)
try:
path = svg_path(*key, color=color, flip=flip, rotate=rotate, dir=dir)
except OSError:
warnings.warn(
f"Unable to connect to internet, and icon {key} not cached.",
stacklevel=2,
)
self._draw_text_fallback(key)
else:
self.addFile(str(path), size or QSize(), mode, state)

def _draw_text_fallback(self, key: tuple[str, ...]) -> None:
if style := QApplication.style():
pixmap = style.standardPixmap(style.StandardPixmap.SP_MessageBoxQuestion)
else:
pixmap = QPixmap(18, 18)
pixmap.fill(Qt.GlobalColor.transparent)
painter = QPainter(pixmap)
painter.drawText(pixmap.rect(), Qt.AlignmentFlag.AlignCenter, "?")
painter.end()

self.addPixmap(pixmap)
11 changes: 10 additions & 1 deletion src/superqt/sliders/_labeled.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,16 @@ def __init__(
slider.rangeChanged.connect(self._update_size)
self.setAlignment(alignment)
self.setButtonSymbols(QSpinBox.ButtonSymbols.NoButtons)
self.setStyleSheet("background:transparent; border: 0;")

le = self.lineEdit()
# make the lineedit transparent
palette = le.palette()
palette.setColor(palette.ColorRole.Base, Qt.GlobalColor.transparent)
le.setPalette(palette)
le.setFrame(False) # no border

# if connect is not None:
# self.editingFinished.connect(lambda: connect(self.value()))
self.editingFinished.connect(self._silent_clear_focus)
self._update_size()

Expand Down
2 changes: 1 addition & 1 deletion tests/test_ensure_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_names(qapp):
signature = inspect.signature(ob.check_object_thread_return_future)
assert len(signature.parameters) == 1
assert next(iter(signature.parameters.values())).name == "a"
assert next(iter(signature.parameters.values())).annotation == int
assert next(iter(signature.parameters.values())).annotation is int
assert ob.check_main_thread_return.__name__ == "check_main_thread_return"


Expand Down

0 comments on commit 6f6ec5a

Please sign in to comment.