Skip to content

Commit

Permalink
Direct port to Qt6 (containers remain on qt5)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelzwiers committed Aug 29, 2023
1 parent 3ceb0e3 commit 997a0c1
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 102 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ COPY --from=builder /usr/local/bin/dcm2niix /usr/local/bin/dcm2niix
# First install pyqt5 as Debian package to solve dependencies issues occurring when installed with pip
# Then install the latest stable BIDScoin release from Python repository
ENV PIP_NO_CACHE_DIR=off
RUN apt-get update && apt-get -y --no-install-recommends install pigz curl python3-pyqt5 python3-pyqt5.qtx11extras && apt-get clean; \
RUN apt-get update && apt-get -y --no-install-recommends install pigz curl python3-pyqt5 python3-pyqt5.qtx11extras git && apt-get clean; \
pip install --upgrade pip; \
pip install bidscoin[all]
pip install bidscoin[all]@git+https://github.com/Donders-Institute/[email protected]+qt5
4 changes: 2 additions & 2 deletions apptainer.def
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ Stage: final

# Install the latest stable BIDScoin release from Python repository
# NOTE: PyQt5 is installed as Debian package to solve dependencies issues occurring when installed with pip
apt-get -y --no-install-recommends install python3-pyqt5 python3-pyqt5.qtx11extras && apt-get clean
apt-get -y --no-install-recommends install python3-pyqt5 python3-pyqt5.qtx11extras git && apt-get clean
pip install --upgrade pip
pip install bidscoin[all]
pip install bidscoin[all]@git+https://github.com/Donders-Institute/[email protected]+qt5

# Uncomment the line below if you get errors like: ImportError: libQt5Core.so.5: cannot open shared object file: No such file or directory
# strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
Expand Down
2 changes: 1 addition & 1 deletion bidscoin/bcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def test_bidscoin(bidsmapfile: Union[Path,dict], options: dict=None, testplugins
if testgui:
LOGGER.info('Testing the PyQt GUI setup:')
try:
from PyQt5.QtWidgets import QApplication, QPushButton
from PyQt6.QtWidgets import QApplication, QPushButton
app = QApplication(sys.argv)
window = QPushButton('Minimal GUI test: OK')
window.show()
Expand Down
184 changes: 93 additions & 91 deletions bidscoin/bidseditor.py

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions bidscoin/bidsmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def bidsmapper(rawfolder: str, bidsfolder: str, bidsmapfile: str, templatefile:

else:
LOGGER.info('Opening the bidseditor')
from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import QApplication, QMessageBox
from PyQt6 import QtCore, QtGui
from PyQt6.QtWidgets import QApplication, QMessageBox
try:
from bidscoin import bidseditor
except ImportError:
Expand All @@ -160,8 +160,8 @@ def bidsmapper(rawfolder: str, bidsfolder: str, bidsmapfile: str, templatefile:
f"bidsmapper or by just running the bidseditor tool\n\n"
f"{versionmessage}")
messagebox.setWindowTitle('About the BIDS-mapping workflow')
messagebox.setIconPixmap(QtGui.QPixmap(str(bidseditor.BIDSCOIN_LOGO)).scaled(150, 150, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation))
messagebox.setWindowFlags(messagebox.windowFlags() & ~QtCore.Qt.WindowMinMaxButtonsHint)
messagebox.setIconPixmap(QtGui.QPixmap(str(bidseditor.BIDSCOIN_LOGO)).scaled(150, 150, QtCore.Qt.AspectRatioMode.KeepAspectRatio, QtCore.Qt.TransformationMode.SmoothTransformation))
messagebox.setWindowFlags(messagebox.windowFlags() & ~QtCore.Qt.WindowType.WindowMinMaxButtonsHint)
messagebox.show()

app.exec()
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. The format
### Changed
- Template bidsmap tweaks to support (XA30) enhanced DICOM
- Skip all subfolders of hidden folders
- GUI upgraded from Qt5 to Qt6 (supporting the new Apple silicon)

## [4.0.0] - 2023-03-18

Expand Down
6 changes: 6 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ If you do not have git (or any other version control system) installed you can `
$ pip install ./bidscoin
If you are installing BIDScoin on an older system and you are getting Qt6 errors, you can try to install a ``+qt5`` build, e.g. for version 4.1.0:

.. code-block:: console
$ pip install bidscoin[all]@git+https://github.com/Donders-Institute/[email protected]+qt5
Updating BIDScoin
^^^^^^^^^^^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion docs/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This is an `installation <installation.html#dcm2niix-installation>`__ problem an

Could not load the Qt platform plugin "xcb"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This error message may occur on certain Linux platforms when opening the bidseditor. This is an `installation <installation.html#bidscoin-installation>`__ issue that may be solved by downgrading your PyQt5 library, e.g. by running ``pip install --upgrade pyqt5==5.14`` in your terminal environment. Another solution might be to use your Linux package manager to install PyQt5, e.g. like this: `apt-get install python3-pyqt5 python3-pyqt5.qtx11extras`
This error message may occur on certain Linux platforms when opening the bidseditor. This is an `installation <installation.html#bidscoin-installation>`__ issue that may occur if you have installed a ``+qt5`` build of BIDScoin (e.g. because your system does not support Qt6). Sometimes this error can be solved by downgrading your PyQt5 library, e.g. by running ``pip install --upgrade pyqt5==5.14`` in your terminal environment. Another solution might be to use your Linux package manager to install PyQt5, e.g. like this: ``apt-get install python3-pyqt5 python3-pyqt5.qtx11extras``

My Apptainer/Singularity container fails
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies = ['pandas',
'matplotlib',
'numpy',
'pydicom >= 2',
'PyQt5 >= 5.12.1',
'PyQt6',
'ruamel.yaml >= 0.15.35',
'tomli >= 1.1.0 ; python_version < "3.11"',
'coloredlogs',
Expand Down

0 comments on commit 997a0c1

Please sign in to comment.