Skip to content

Commit

Permalink
Merge pull request #36 from taha-abdullah/dev
Browse files Browse the repository at this point in the history
Migrating from PyQt5 to PyQt6:
  • Loading branch information
m-reuter authored Jun 2, 2024
2 parents 8c708fb + 8595730 commit 094a616
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ jobs:
with:
python-version: 3.9
#architecture: 'x64'
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt-get update
sudo apt-get -y install libgl1 libegl1
sudo apt install libxcb-cursor0
- name: Install package
run: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ FROM ubuntu:20.04

# Install packages
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-pip xvfb libglib2.0-0 && \
python3 pip xvfb libglib2.0-0 libxkbcommon-x11-0 libgl1 libegl1 \
libfontconfig1 libdbus-1-3 && \
apt clean && \
rm -rf /var/libs/apt/lists/* /tmp/* /var/tmp/*

# Install python packages
RUN pip3 install pyopengl glfw pillow numpy pyrr PyQt5==5.15.6
RUN pip install --upgrade pip
RUN pip install pyopengl glfw pillow numpy pyrr PyQt6

COPY . /WhipperSnapPy
RUN pip3 install /WhipperSnapPy
RUN pip install /WhipperSnapPy

ENTRYPOINT ["xvfb-run","whippersnap"]
CMD ["--help"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ and capture the contents to an image. In order to run this on a headless
server, inside Docker, or via ssh we recommend to install xvfb and run

```
sudo apt update && apt install -y python3 python3-pip xvfb
pip3 install pyopengl glfw pillow numpy pyrr PyQt5==5.15.6
sudo apt update && apt install -y python3 python3-pip xvfb libxcb-xinerama0
pip3 install pyopengl glfw pillow numpy pyrr PyQt6
pip3 install whippersnappy
xvfb-run whippersnap ...
```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies = [
'pillow',
'pyopengl==3.1.6',
'nibabel',
'PyQt5',
'PyQt6',
'psutil'
]

Expand Down
6 changes: 3 additions & 3 deletions whippersnappy/cli/whippersnap.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Usage:
$ python3 whippersnap.py -lh $LH_OVERLAY_FILE -rh $RH_OVERLAY_FILE \
-sd $SURF_SUBJECT_DIR -o $OUTPUT_PATH
(See help for full list of arguments.)
@Author1 : Martin Reuter
Expand All @@ -31,7 +31,7 @@
import glfw
import OpenGL.GL as gl
import pyrr
from PyQt5.QtWidgets import QApplication
from PyQt6.QtWidgets import QApplication

from whippersnappy.config_app import ConfigWindow
from whippersnappy.core import (
Expand Down Expand Up @@ -296,7 +296,7 @@ def run():
# Setting up and running config app window (must be main thread):
app_ = QApplication([])
app_.setStyle("Fusion") # the default
app_.aboutToQuit.connect(config_app_exit_handler)
app_.signals.aboutToQuit.connect(config_app_exit_handler)

screen_geometry = app_.primaryScreen().availableGeometry()
app_window_ = ConfigWindow(
Expand Down
18 changes: 9 additions & 9 deletions whippersnappy/config_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
during runtime using a simple GUI window.
Dependencies:
PyQt5
PyQt6
@Author : Ahmed Faisal Abdelrahman
@Created : 20.03.2022
"""

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import (
QGroupBox,
QHBoxLayout,
QLineEdit,
Expand All @@ -31,7 +31,7 @@ class ConfigWindow(QWidget):
parent : QWidget
This widget's parent, if any (usually none).
screen_dims : tuple
Integers specifyings screen dims in pixels; used to always position
Integers specifying screen dims in pixels; used to always position
the window in the top-right corner, if given.
initial_fthresh_value : float
Initial fthreshold value is 2.0.
Expand All @@ -58,7 +58,7 @@ def __init__(
# fthresh slider:
self.fthresh_slider_tick_limits = (0.0, 1000.0)
self.fthresh_slider_value_limits = (0.0, 10.0)
self.fthresh_slider = QSlider(Qt.Horizontal)
self.fthresh_slider = QSlider(Qt.Orientation.Horizontal)
self.fthresh_slider.setMinimum(int(self.fthresh_slider_tick_limits[0]))
self.fthresh_slider.setMaximum(int(self.fthresh_slider_tick_limits[1]))
self.fthresh_slider.setValue(
Expand All @@ -70,7 +70,7 @@ def __init__(
)
)
)
self.fthresh_slider.setTickPosition(QSlider.TicksBelow)
self.fthresh_slider.setTickPosition(QSlider.TickPosition.TicksBelow)
self.fthresh_slider.setTickInterval(
int(
(
Expand All @@ -90,7 +90,7 @@ def __init__(
# fmax slider:
self.fmax_slider_tick_limits = (0.0, 1000.0)
self.fmax_slider_value_limits = (0.0, 10.0)
self.fmax_slider = QSlider(Qt.Horizontal)
self.fmax_slider = QSlider(Qt.Orientation.Horizontal)
self.fmax_slider.setMinimum(int(self.fmax_slider_tick_limits[0]))
self.fmax_slider.setMaximum(int(self.fmax_slider_tick_limits[1]))
self.fmax_slider.setValue(
Expand All @@ -102,7 +102,7 @@ def __init__(
)
)
)
self.fmax_slider.setTickPosition(QSlider.TicksBelow)
self.fmax_slider.setTickPosition(QSlider.TickPosition.TicksBelow)
self.fmax_slider.setTickInterval(
int(
(self.fmax_slider_tick_limits[1] - self.fmax_slider_tick_limits[0])
Expand Down Expand Up @@ -309,5 +309,5 @@ def keyPressEvent(self, event):
None
This function return None.
"""
if event.key() == Qt.Key_Escape:
if event.key() == Qt.Key.Escape:
self.close()

0 comments on commit 094a616

Please sign in to comment.