Skip to content

Commit ef1435f

Browse files
authored
Merge pull request #25 from int-brain-lab/develop
0.6.1
2 parents 0ac8355 + d98bf26 commit ef1435f

File tree

10 files changed

+123
-20
lines changed

10 files changed

+123
-20
lines changed

.github/workflows/documentation.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4
21-
- uses: pdm-project/setup-pdm@v4
22-
with:
23-
cache: true
24-
python-version: '3.10'
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v6
2523
- name: Install dependencies
26-
run: pdm install -dG doc
27-
- name: Install PyQt5
28-
run: pdm add PyQt5
24+
run: uv sync --no-default-groups --group doc --extra pyqt6
25+
- name: Install libegl1
26+
uses: awalsh128/cache-apt-pkgs-action@latest
27+
with:
28+
packages: libegl1
29+
version: 1.0
2930
- name: Sphinx build
30-
run: pdm run sphinx-build docs/source docs/build
31+
run: uv run sphinx-build docs/source docs/build
3132
- uses: peaceiris/actions-gh-pages@v4
3233
with:
3334
publish_branch: gh-pages

.github/workflows/publish.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
id-token: write
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: pdm-project/setup-pdm@v4
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v6
18+
- name: Build package
19+
run: uv build
1720
- name: Publish package
18-
run: pdm publish
21+
run: uv publish

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [0.6.1] - 2025-07-15
10+
11+
### Changed
12+
- `widgets.RestrictedWebView`: additional parameters to control tool-tips and status-tips
13+
914
## [0.6.0] - 2025-07-15
1015

1116
### Added
@@ -130,6 +135,7 @@ _First release._
130135
providing color-mapped numerical data.
131136
- `widgets.StatefulButton`: A `QPushButton` that maintains an active/inactive state.
132137

138+
[0.6.1]: https://github.com/int-brain-lab/iblqt/releases/tag/v0.6.1
133139
[0.6.0]: https://github.com/int-brain-lab/iblqt/releases/tag/v0.6.0
134140
[0.5.0]: https://github.com/int-brain-lab/iblqt/releases/tag/v0.5.0
135141
[0.4.4]: https://github.com/int-brain-lab/iblqt/releases/tag/v0.4.4

docs/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'sphinx.ext.autodoc',
2626
'sphinx.ext.autosummary',
2727
'sphinx.ext.viewcode',
28+
'sphinx_copybutton',
2829
'sphinx_design',
2930
'sphinx_qt_documentation',
3031
'myst_parser',
@@ -83,3 +84,5 @@
8384
napoleon_preprocess_types = True
8485
napoleon_type_aliases = None
8586
napoleon_attr_annotations = True
87+
88+
copybutton_exclude = '.linenos, .gp'

docs/source/dev_guide.rst

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,34 @@ Installing developer dependencies
3131
To set up your development environment, you need to install the necessary
3232
dependencies. The following command will synchronize your environment with the
3333
dependencies specified in the ``pyproject.toml`` file, including development
34-
dependencies and PyQt6:
34+
dependencies and Qt:
3535

36-
.. code-block:: console
36+
.. tab-set::
37+
38+
.. tab-item:: PyQt5
39+
40+
.. code-block:: console
41+
42+
$ uv sync --extra pyqt5
43+
44+
.. tab-item:: PyQt6
45+
46+
.. code-block:: console
47+
48+
$ uv sync --extra pyqt6
49+
50+
.. tab-item:: PySide6
51+
52+
.. code-block:: console
53+
54+
$ uv sync --extra pyside6
55+
56+
The virtualenv will default to Python 3.13 unless you specify another version of the
57+
interpreter, for instance:
3758

38-
$ uv sync --extra pyqt6
59+
.. code-block:: console
3960
61+
$ uv sync --extra pyside6 --python 3.10
4062
4163
Running the unit-tests
4264
----------------------

iblqt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""A collection of extensions to the Qt framework."""
22

3-
__version__ = '0.6.0'
3+
__version__ = '0.6.1'

iblqt/widgets.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,8 @@ def __init__(
662662
self,
663663
url: QUrl | str,
664664
trusted_url_prefix: str | None = None,
665+
use_tool_tips: bool = True,
666+
use_status_tips: bool = False,
665667
parent: QWidget | None = None,
666668
):
667669
"""
@@ -675,6 +677,10 @@ def __init__(
675677
Prefix of trusted URLs. Clicking on links to matching URLs will open
676678
in the widget's web engine view, while other links will open in the default
677679
web browser. Defaults to the value of `url`.
680+
use_tool_tips : bool, optional
681+
Whether to set default tool tips for the buttons. Default is True.
682+
use_status_tips : bool, optional
683+
Whether to set default status tips for the buttons. Default is False.
678684
parent : QWidget or None, optional
679685
The parent widget.
680686
"""
@@ -734,6 +740,18 @@ def __init__(
734740
)
735741
self.webEngineView.urlChanged.connect(self._on_url_changed)
736742

743+
# set tool tips / status tips
744+
if use_tool_tips:
745+
self.uiPushHome.setToolTip('Go to home page')
746+
self.uiPushBack.setToolTip('Go back one page')
747+
self.uiPushForward.setToolTip('Go forward one page')
748+
self.uiPushBrowser.setToolTip('Open page in default browser')
749+
if use_status_tips:
750+
self.uiPushHome.setStatusTip('Go to home page')
751+
self.uiPushBack.setStatusTip('Go back one page')
752+
self.uiPushForward.setStatusTip('Go forward one page')
753+
self.uiPushBrowser.setStatusTip('Open page in default browser')
754+
737755
# set prefix and initial URL
738756
self.setUrl(url)
739757

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ doc = [
5353
"sphinx-qt-documentation>=0.4.1",
5454
"sphinx-rtd-theme>=2.0.0",
5555
"sphinx-design>=0.6.1",
56+
"sphinx-copybutton>=0.5.2",
5657
]
5758
lint = [
5859
"ruff>=0.9.2",

tests/test_widgets.py

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,15 +389,31 @@ def test_threshold_cross_signal_emitted(self, qtbot, monkeypatch):
389389
) # TODO
390390
class TestRestrictedWebView:
391391
@pytest.fixture
392-
def browser_widget(self, qtbot):
393-
widget = widgets.RestrictedWebView(
392+
def browser_widget_factory(self, qtbot):
393+
created_widgets = []
394+
395+
def _browser_widget(*args, **kwargs):
396+
widget = widgets.RestrictedWebView(*args, **kwargs)
397+
created_widgets.append(widget)
398+
qtbot.addWidget(widget)
399+
return widget
400+
401+
yield _browser_widget
402+
403+
for widget in created_widgets:
404+
try:
405+
page = widget.webEngineView.page()
406+
except RuntimeError:
407+
continue
408+
with qtbot.waitSignal(page.destroyed):
409+
widget.close()
410+
411+
@pytest.fixture
412+
def browser_widget(self, qtbot, browser_widget_factory):
413+
yield browser_widget_factory(
394414
url=QUrl('http://localhost/trusted/start'),
395415
trusted_url_prefix='http://localhost/trusted/',
396416
)
397-
qtbot.addWidget(widget)
398-
yield widget
399-
with qtbot.waitSignal(widget.webEngineView.page().destroyed, timeout=100):
400-
widget.close()
401417

402418
def test_default_prefix(self, qtbot):
403419
widget = widgets.RestrictedWebView(url='http://localhost/')
@@ -416,6 +432,7 @@ def test_get_set_url(self, qtbot, browser_widget):
416432
assert not browser_widget.setUrl('http://localhost/external/page')
417433
assert browser_widget.url() == QUrl('http://localhost/trusted/other')
418434

435+
@pytest.mark.xfail(sys.platform == 'win32', reason='Tends to fail on Windows')
419436
def test_home_button_loads_home(self, qtbot, browser_widget):
420437
browser_widget.setUrl('http://localhost/trusted/other')
421438
with qtbot.waitSignal(browser_widget.webEngineView.urlChanged):
@@ -457,3 +474,18 @@ def test_change_prefix(self, mock_open, qtbot, browser_widget):
457474
)
458475
assert result is True
459476
mock_open.assert_not_called()
477+
478+
def test_tool_and_status_tips(self, qtbot, browser_widget_factory):
479+
widget = browser_widget_factory('http://localhost/')
480+
assert len(widget.uiPushHome.toolTip()) > 0
481+
assert len(widget.uiPushHome.statusTip()) == 0
482+
widget = browser_widget_factory(
483+
'http://localhost/', use_tool_tips=False, use_status_tips=True
484+
)
485+
assert len(widget.uiPushHome.toolTip()) == 0
486+
assert len(widget.uiPushHome.statusTip()) > 0
487+
widget = browser_widget_factory(
488+
'http://localhost/', use_tool_tips=True, use_status_tips=False
489+
)
490+
assert len(widget.uiPushHome.toolTip()) > 0
491+
assert len(widget.uiPushHome.statusTip()) == 0

uv.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)