Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to PySide6 #1476

Merged
merged 37 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3c27b53
Rename "PySide2" to "PySide6"
psavery Oct 12, 2023
2070165
Change import path for SVG widget
psavery Oct 12, 2023
4b311a8
Change PySide2 dependency to PySide6
psavery Oct 12, 2023
07c7a47
Remove silx
psavery Oct 12, 2023
89f3f16
Fix a few more cases of PySide2 to PySide6
psavery Oct 12, 2023
3182346
For CI workflows, install EGL on Linux
psavery Oct 13, 2023
0a69b5e
Change matplotlib to matplotlib-base
psavery Oct 13, 2023
ad86bac
Add back in silx as "silx-base" in conda
psavery Oct 13, 2023
8d7e8f4
Fix an issue with progress accepting for PySide6
psavery Oct 13, 2023
b012a1d
Better fix for QueuedConnection issue
psavery Oct 13, 2023
fa66085
Fix selection enums to use QTableWidget
psavery Oct 13, 2023
a698756
Fix progress accept in RerunClusteringDialog
psavery Oct 13, 2023
331f199
Fix commitData warning in tree views
psavery Oct 16, 2023
24b4837
Add units to stiffness/compliance text
psavery Oct 16, 2023
93a397f
Fix invalid QSettings issue
psavery Oct 16, 2023
81650f5
Do not set panel buffer for LLNL import
bnmajor Oct 16, 2023
a656347
Keep panel buffer dialog in front for MacOS
psavery Oct 17, 2023
f763eab
Reset image series idx to 0 before reading images
psavery Oct 17, 2023
fbc0c7f
Hide QMessageBox instead of rejecting
psavery Oct 17, 2023
24bd30d
Change "exec_" to "exec"
psavery Oct 17, 2023
24a7b70
Update fast powder calibration dialog window title
psavery Oct 17, 2023
53e8c2f
Use the global instance for QThreadPool
psavery Oct 17, 2023
bfd8cd8
Fixed missed case of "self.thread_pool"
psavery Oct 17, 2023
3e3796c
Use most recent images directory for image save
bnmajor Oct 18, 2023
185baba
Ensure disconnect before making new connections
psavery Oct 18, 2023
7bd6c4c
Upgrade to Python3.11
psavery Oct 18, 2023
2de1df0
Remove "cjh1" channel from packaging
psavery Oct 19, 2023
fec2873
Change `hexrd.ui` path to `hexrdgui`
psavery Oct 19, 2023
990b5f0
Fix resources path
psavery Oct 19, 2023
b2f47e9
Fix hexrd/ui path in color_map_editor.ui
psavery Oct 19, 2023
eb4311f
Fix resource path for HEXRDGUI
psavery Oct 19, 2023
cebef1b
Try to build osx-arm64 packages
psavery Oct 19, 2023
878b715
Fix broken sym link for windows icon
psavery Oct 19, 2023
daab6e5
Only test import for non-cross-platform builds
psavery Oct 19, 2023
a05aa04
Upgrade GitHub Actions versions
psavery Oct 19, 2023
337e837
Add Python for cross-platform builds
psavery Oct 19, 2023
55aaf85
Skip focus mode for powder/laue calibration
psavery Oct 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: hexrdgui
Expand All @@ -44,9 +44,13 @@ jobs:
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: '3.10'
python-version: '3.11'
auto-activate-base: false

- name: Install EGL on Linux (PySide6 needs it)
if: ${{ matrix.config.name == 'Linux' }}
run: sudo apt-get install -y libegl1-mesa-dev

- name: Get version using git describe
working-directory: hexrdgui
run: echo "HEXRDGUI_GIT_DESCRIBE=$(git describe --tag)" >> $GITHUB_ENV
Expand Down Expand Up @@ -89,34 +93,34 @@ jobs:

- name: Upload InstallOutput.log
if: ${{ failure() }}
uses: actions/upload-artifact@v2-preview
uses: actions/upload-artifact@v3
with:
name: InstallOutput.log
path: ${{ github.workspace }}/hexrdgui/packaging/_CPack_Packages/*/InstallOutput.log

- name: Upload WIX log ( Windows only )
if: ${{ failure() && matrix.config.os == 'windows-latest'}}
uses: actions/upload-artifact@v2-preview
uses: actions/upload-artifact@v3
with:
name: wix.log
path: ${{ github.workspace }}/hexrdgui/packaging/_CPack_Packages/WIX/wix.log

- name: Upload installer package
uses: actions/upload-artifact@v2-preview
uses: actions/upload-artifact@v3
with:
name: HEXRDGUI-v${{env.VERSION}}.${{ matrix.config.package }}
path: ${{ github.workspace }}/hexrdgui/packaging/HEXRDGUI-${{env.VERSION}}.${{ matrix.config.package }}

- name: Upload installer package Zip ( Windows only )
if: ${{ matrix.config.os == 'windows-latest'}}
uses: actions/upload-artifact@v2-preview
uses: actions/upload-artifact@v3
with:
name: HEXRDGUI-v${{env.VERSION}}.zip
path: ${{ github.workspace }}/hexrdgui/packaging/HEXRDGUI-${{env.VERSION}}.zip

- name: Upload the HEXRDGUI conda package ( PRs only )
if: github.ref != 'refs/heads/master'
uses: actions/upload-artifact@v2-preview
uses: actions/upload-artifact@v3
with:
name: HEXRDGUI-${{ matrix.config.name }}-${{ env.HEXRDGUI_GIT_DESCRIBE }}.tar.bz2
path: ${{ github.workspace }}/hexrdgui/packaging/output/**/*.tar.bz2
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [3.9, '3.10']
python-version: ['3.10', '3.11']
config:
- {
name: "Linux",
Expand All @@ -39,25 +39,29 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Checkout HEXRD
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: HEXRD/hexrd
path: hexrd

- name: Checkout HEXRDGUI
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: hexrdgui

- name: Checkout examples
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: HEXRD/examples
path: examples

- name: Install EGL on Linux (PySide6 needs it)
if: ${{ matrix.config.name == 'Linux' }}
run: sudo apt-get install -y libegl1-mesa-dev

- name: Set environment variable to work around setuptools/numpy issue
run: echo 'SETUPTOOLS_USE_DISTUTILS=stdlib' >> $GITHUB_ENV
if: ${{ matrix.config.os == 'windows-latest'}}
if: ${{ matrix.config.name == 'Windows' }}

- name: Install HEXRD
run: |
Expand Down
7 changes: 7 additions & 0 deletions conda.recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
python:
- 3.11
target_platform:
- linux-64 # [linux]
- osx-64 # [osx]
- osx-arm64 # [osx]
- win-64 # [win]
24 changes: 13 additions & 11 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,34 @@ source:
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
entry_points:
- hexrdgui = hexrd.ui.main:main
- hexrdgui = hexrdgui.main:main

requirements:
build:
- python=3.10
- python {{ python }} # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
host:
- python {{ python }}
- setuptools
- setuptools_scm

run:
- python
- pyside2>=5.15
- Pillow
- matplotlib
- importlib_resources
- fabio
- pyyaml
- hexrd=={{ hexrd_version }}
- matplotlib-base
- Pillow
- pyhdf
- silx
- pyside6
- pyyaml
- silx-base

test:
test: # [build_platform == target_platform]
imports:
- hexrd.ui
- hexrdgui

about:
home: https://github.com/HEXRD/hexrdgui
license: BSD
license_family: BSD
summary: "Qt5 PySide2 based HEXRD GUI"
summary: "Qt6 PySide6 based HEXRD GUI"
1 change: 0 additions & 1 deletion hexrd/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions hexrd/ui/__init__.py → hexrdgui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PySide2.QtCore import QEvent, QObject, Qt
from PySide2.QtWidgets import QDialog, QPushButton
from PySide6.QtCore import QEvent, QObject, Qt
from PySide6.QtWidgets import QDialog, QPushButton


class EnterKeyFilter(QObject):
Expand Down
22 changes: 11 additions & 11 deletions hexrd/ui/about_dialog.py → hexrdgui/about_dialog.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from importlib.metadata import version
import sys

from PySide2.QtCore import Qt, QObject, QSize
from PySide2.QtSvg import QSvgWidget
from PySide2.QtWidgets import QTreeWidgetItem, QLabel
from PySide2.QtGui import QPixmap
from PySide6.QtCore import Qt, QObject, QSize
from PySide6.QtSvgWidgets import QSvgWidget
from PySide6.QtWidgets import QTreeWidgetItem, QLabel
from PySide6.QtGui import QPixmap

import hexrd

from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.resource_loader import load_resource
from hexrdgui.ui_loader import UiLoader
from hexrdgui.resource_loader import load_resource

LOGO_HEIGHT = 80

Expand All @@ -24,7 +24,7 @@ def __init__(self, parent=None):
self._populate_versions()

def _populate_hexrd_logo(self):
data = load_resource(hexrd.ui.resources.icons,
data = load_resource(hexrdgui.resources.icons,
'hexrd.ico', binary=True)
pixmap = QPixmap()
pixmap.loadFromData(data, 'ico')
Expand All @@ -36,7 +36,7 @@ def _calculate_size(self, size):
return QSize(LOGO_HEIGHT/ratio, LOGO_HEIGHT)

def _populate_logos(self):
data = load_resource(hexrd.ui.resources.icons, 'llnl_logo.svg',
data = load_resource(hexrdgui.resources.icons, 'llnl_logo.svg',
binary=True)

self.ui.logos_horizontal_layout.addStretch()
Expand All @@ -47,7 +47,7 @@ def _populate_logos(self):
self.ui.logos_horizontal_layout.addWidget(llnl, stretch=1)
self.ui.logos_horizontal_layout.addStretch()

data = load_resource(hexrd.ui.resources.icons,
data = load_resource(hexrdgui.resources.icons,
'kitware_logo.svg', binary=True)

kitware = QSvgWidget()
Expand All @@ -57,7 +57,7 @@ def _populate_logos(self):
self.ui.logos_horizontal_layout.addWidget(kitware, stretch=1)
self.ui.logos_horizontal_layout.addStretch()

data = load_resource(hexrd.ui.resources.icons,
data = load_resource(hexrdgui.resources.icons,
'afrl_logo.png', binary=True)

pixmap = QPixmap()
Expand All @@ -78,7 +78,7 @@ def _populate_versions(self):
"HEXRD",
"NumPy",
"SciPy",
"PySide2"
"PySide6"
]

for package in packages:
Expand Down
File renamed without changes.
18 changes: 10 additions & 8 deletions hexrd/ui/async_runner.py → hexrdgui/async_runner.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
from PySide2.QtCore import QThreadPool, QTimer
from PySide2.QtWidgets import QMessageBox
from PySide6.QtCore import QThreadPool, QTimer
from PySide6.QtWidgets import QMessageBox

from hexrd.ui.async_worker import AsyncWorker
from hexrd.ui.progress_dialog import ProgressDialog
from hexrdgui.async_worker import AsyncWorker
from hexrdgui.progress_dialog import ProgressDialog


class AsyncRunner:

def __init__(self, parent):
self.parent = parent

self.thread_pool = QThreadPool(parent)

self.progress_dialog = ProgressDialog(parent)

# Some defaults...
Expand Down Expand Up @@ -41,7 +39,7 @@ def run(self, f, *args, **kwargs):
# have a segmentation fault.
self.thread_pool.start(worker)

self.progress_dialog.exec_()
self.progress_dialog.exec()

def on_worker_finished(self):
self.reset_callbacks()
Expand All @@ -67,4 +65,8 @@ def on_async_error(self, t):
msg = f'An ERROR occurred: {exctype}: {value}.'
msg_box = QMessageBox(QMessageBox.Critical, 'Error', msg)
msg_box.setDetailedText(traceback)
msg_box.exec_()
msg_box.exec()

@property
def thread_pool(self):
return QThreadPool.globalInstance()
2 changes: 1 addition & 1 deletion hexrd/ui/async_worker.py → hexrdgui/async_worker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This class was modified from the following example online:
# https://www.learnpyqt.com/courses/concurrent-execution/multithreading-pyqt-applications-qthreadpool/

from PySide2.QtCore import QObject, QRunnable, Signal, Slot
from PySide6.QtCore import QObject, QRunnable, Signal, Slot

import inspect
import traceback
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from hexrd.ui.hexrd_config import HexrdConfig
from hexrd.ui.ui_loader import UiLoader
from hexrdgui.hexrd_config import HexrdConfig
from hexrdgui.ui_loader import UiLoader


class AzimuthalOverlayEditor:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import random
from PySide2.QtCore import Qt, QItemSelectionModel
from PySide2.QtWidgets import (
from PySide6.QtCore import Qt, QItemSelectionModel
from PySide6.QtWidgets import (
QCheckBox, QComboBox, QHBoxLayout, QHeaderView, QSizePolicy,
QTableWidgetItem, QWidget
)
from hexrd.ui import utils
from hexrdgui import utils

from hexrd.ui.hexrd_config import HexrdConfig
from hexrd.ui.azimuthal_overlay_editor import AzimuthalOverlayEditor
from hexrd.ui.azimuthal_overlay_style_picker import AzimuthalOverlayStylePicker
from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.utils import block_signals
from hexrdgui.hexrd_config import HexrdConfig
from hexrdgui.azimuthal_overlay_editor import AzimuthalOverlayEditor
from hexrdgui.azimuthal_overlay_style_picker import AzimuthalOverlayStylePicker
from hexrdgui.ui_loader import UiLoader
from hexrdgui.utils import block_signals

import numpy as np

Expand Down Expand Up @@ -272,7 +272,7 @@ def remove(self):
def edit_style(self):
self._style_picker = AzimuthalOverlayStylePicker(self.active_overlay,
self.ui)
self._style_picker.exec_()
self._style_picker.exec()

def show_legend(self, value):
HexrdConfig().show_azimuthal_legend = value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from PySide2.QtCore import QObject
from PySide2.QtGui import QColor
from PySide2.QtWidgets import QColorDialog
from PySide6.QtCore import QObject
from PySide6.QtGui import QColor
from PySide6.QtWidgets import QColorDialog

from hexrd.ui.hexrd_config import HexrdConfig
from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.utils import block_signals
from hexrdgui.hexrd_config import HexrdConfig
from hexrdgui.ui_loader import UiLoader
from hexrdgui.utils import block_signals


class AzimuthalOverlayStylePicker(QObject):
Expand All @@ -23,9 +23,9 @@ def __init__(self, overlay, parent=None):
self.setup_connections()
self.update_gui()

def exec_(self):
def exec(self):
self.ui.adjustSize()
return self.ui.exec_()
return self.ui.exec()

def setup_connections(self):
self.ui.color.pressed.connect(self.pick_color)
Expand Down Expand Up @@ -72,7 +72,7 @@ def pick_color(self):
color = sender.text()

dialog = QColorDialog(QColor(color), self.ui)
if dialog.exec_():
if dialog.exec():
sender.setText(dialog.selectedColor().name())
self.update_button_colors()
self.update_config()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from matplotlib.markers import MarkerStyle

from PySide2.QtGui import QColor
from PySide2.QtWidgets import QColorDialog
from PySide6.QtGui import QColor
from PySide6.QtWidgets import QColorDialog

from hexrd.ui.hexrd_config import HexrdConfig
from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.utils import block_signals
from hexrdgui.hexrd_config import HexrdConfig
from hexrdgui.ui_loader import UiLoader
from hexrdgui.utils import block_signals


class BeamMarkerStyleEditor:
Expand Down Expand Up @@ -80,7 +80,7 @@ def pick_color(self):
color = w.text()

dialog = QColorDialog(QColor(color), self.ui)
if dialog.exec_():
if dialog.exec():
w.setText(dialog.selectedColor().name())
self.update_button_colors()
self.update_config()
Expand Down
Loading
Loading