Skip to main content

Qt extensions for the DTOcean GUI

Project description

dtocean-qt actions codecov PyPI - Python Version

dtocean-qt

PySide6 (Qt for Python) utilities for use within the DTOcean software suite. Currently, only widgets and models for pandas (the data analysis / manipulation library for Python) are available.

Part of the DTOcean suite of tools.

Installation

pip install dtocean-qt

Usage

An example of a basic PySide6 widget for a pandas DataFrame. Begin by importing the required functions and classes:

>>> import pandas
>>> import numpy
>>> import sys
>>> from PySide6 import QtWidgets
>>> from dtocean_qt.pandas.excepthook import excepthook
>>> from dtocean_qt.pandas.models.DataFrameModel import DataFrameModel
>>> from dtocean_qt.pandas.views.DataTableView import DataTableWidget
>>> from dtocean_qt.pandas.views._ui import icons_rc

Redirect exceptions:

>>> sys.excepthook = excepthook

Now set up a new empty DataFrame model:

>>> model = DataFrameModel()
>>> model.freeze_first = True

Setup an application and create a data table widget:

>>> app = QtWidgets.QApplication([])
>>> widget = DataTableWidget()
>>> widget.resize(800, 600)
>>> widget.hideVerticalHeader(True)

Assign the created model to the widget:

>>> widget.setViewModel(model)

Now create some test data:

>>> data = {
...    'A': [10, 11, 12], 
...    'B': [20, 21, 22], 
...    'C': ['Peter Pan', 'Cpt. Hook', 'Tinkerbell'],
...    'D': [True, True, False]}
>>> df = pandas.DataFrame(data)
>>> df
    A   B           C      D
0  10  20   Peter Pan   True
1  11  21   Cpt. Hook   True
2  12  22  Tinkerbell  False

Convert the column to the numpy.int8 data type to test the delegates in the table. int8 is limited to -128-127:

>>> df['A'] = df['A'].astype(numpy.int8)
>>> df['B'] = df['B'].astype(numpy.float16)
>>> df
    A     B           C      D
0  10  20.0   Peter Pan   True
1  11  21.0   Cpt. Hook   True
2  12  22.0  Tinkerbell  False

Fill the model with data:

>>> model.setDataFrame(df)

Finally, start the app:

>>> widget.show()
>>> app.exec() # doctest: +SKIP

You can find other examples in the examples folder of the source.

cd examples
python TestApp.py

Development

Development of dtocean-qt uses the Poetry dependency manager. Poetry must be installed and available on the command line.

If installing from the git repository, the image files must first be retrieved using git-lfs (ensure that git-lfs is installed first):

git lfs fetch --all
git lfs pull

To install:

poetry install

Tests

A test suite is provided with the source code that uses pytest.

Install the testing dependencies:

poetry install --with test

Run the tests:

poetry run pytest

Code quality can also be audited using the ruff and pyright tools. Install the dependencies:

poetry install --with audit

Run the audit:

poetry run ruff
poetry run pyright src

The above tests can be run across all compatible Python versions using tox and tox-uv. To install and run:

poetry install --with tox
poetry run tox

Contributing

Please see the dtocean GitHub repository for contributing guidelines.

Credits

This package is a fork of the pandas-qt project by Matthias Ludwig at Datalyze Solutions. It was adapted for use in the EU DTOcean project by Mathew Topper at TECNALIA.

It is now maintained by Mathew Topper at Data Only Greater.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dtocean_qt-4.0.0-cp314-cp314-win_amd64.whl (82.9 kB view details)

Uploaded CPython 3.14Windows x86-64

dtocean_qt-4.0.0-cp314-cp314-manylinux_2_39_x86_64.whl (82.7 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ x86-64

dtocean_qt-4.0.0-cp313-cp313-win_amd64.whl (83.1 kB view details)

Uploaded CPython 3.13Windows x86-64

dtocean_qt-4.0.0-cp313-cp313-manylinux_2_39_x86_64.whl (82.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

dtocean_qt-4.0.0-cp312-cp312-win_amd64.whl (83.1 kB view details)

Uploaded CPython 3.12Windows x86-64

dtocean_qt-4.0.0-cp312-cp312-manylinux_2_39_x86_64.whl (82.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

File details

Details for the file dtocean_qt-4.0.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: dtocean_qt-4.0.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 82.9 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dtocean_qt-4.0.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 fc27373c3f8f4bdd4483ecf0b002e211af9161e9c8c825422c2093268985fdff
MD5 a81c248c9958bdfc0b3c7db05ee7525c
BLAKE2b-256 ce5cae86372e48421e430bfb862c018dbaa2e90d7844d0b0703dfc39e1a9e583

See more details on using hashes here.

Provenance

The following attestation bundles were made for dtocean_qt-4.0.0-cp314-cp314-win_amd64.whl:

Publisher: release.yml on DTOcean/dtocean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dtocean_qt-4.0.0-cp314-cp314-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for dtocean_qt-4.0.0-cp314-cp314-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2e00ffc9c5641e2a35566d67e079ffc0c4f6ce9abc421cb213c1e783f0f273ac
MD5 63dc775b652f6132065ff8c8582d36f4
BLAKE2b-256 f9838e567643d5c42c0bfca304dbc56dc9aaaa8dd103c1b24d5f3c05db7a500b

See more details on using hashes here.

Provenance

The following attestation bundles were made for dtocean_qt-4.0.0-cp314-cp314-manylinux_2_39_x86_64.whl:

Publisher: release.yml on DTOcean/dtocean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dtocean_qt-4.0.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: dtocean_qt-4.0.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 83.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dtocean_qt-4.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 de5b156f11c44e35bdd575d64f5e01e6ac6e48c971c5f65742397c0b4fc1cc4b
MD5 2b5bb0eccdf977411db5a131c9e4d22a
BLAKE2b-256 09f1cda8bce79d27b0e78ba27659f1c79ba1b92f97e7811f067390780bfbf906

See more details on using hashes here.

Provenance

The following attestation bundles were made for dtocean_qt-4.0.0-cp313-cp313-win_amd64.whl:

Publisher: release.yml on DTOcean/dtocean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dtocean_qt-4.0.0-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for dtocean_qt-4.0.0-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 f3f178d7074d3e4b2896c10d2d2ec85e4ba9e69201815925abaf36f2c53d173a
MD5 b3f684293d93688e9ccfb714d80defb7
BLAKE2b-256 755f87262d7a00d9e27b1536f0a9767c0882218884e6f2dddf3508dde0bc4b7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for dtocean_qt-4.0.0-cp313-cp313-manylinux_2_39_x86_64.whl:

Publisher: release.yml on DTOcean/dtocean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dtocean_qt-4.0.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: dtocean_qt-4.0.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 83.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dtocean_qt-4.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2d1ddfccaf09f894343264d3f2f79e04befe67bfd12acc1876188663cde86e9d
MD5 e14aeb8ba64505146d493394d9d4949b
BLAKE2b-256 42c4b2c749acaba544fb9ae89c39afad570e6c6184aff5cc11b70df86d794d01

See more details on using hashes here.

Provenance

The following attestation bundles were made for dtocean_qt-4.0.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on DTOcean/dtocean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dtocean_qt-4.0.0-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for dtocean_qt-4.0.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 59026cc27df0f9151015bef377f486b0472c723ed0c73b30ef31644313b916b0
MD5 5bd5341fe040c168ac1cc85caf40682f
BLAKE2b-256 9d9ee66995f1698d0656cbb46a8180509a79307ccc2d2253bcc261b224473c5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for dtocean_qt-4.0.0-cp312-cp312-manylinux_2_39_x86_64.whl:

Publisher: release.yml on DTOcean/dtocean

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page