Skip to content

Commit f93458a

Browse files
authored
Merge pull request #1476 from HEXRD/pyside6
Upgrade to PySide6
2 parents f23950c + 55aaf85 commit f93458a

File tree

292 files changed

+1190
-1120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+1190
-1120
lines changed

.github/workflows/package.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
shell: bash
3636

3737
steps:
38-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
3939
with:
4040
fetch-depth: 0
4141
path: hexrdgui
@@ -44,9 +44,13 @@ jobs:
4444
uses: conda-incubator/setup-miniconda@v2
4545
with:
4646
auto-update-conda: true
47-
python-version: '3.10'
47+
python-version: '3.11'
4848
auto-activate-base: false
4949

50+
- name: Install EGL on Linux (PySide6 needs it)
51+
if: ${{ matrix.config.name == 'Linux' }}
52+
run: sudo apt-get install -y libegl1-mesa-dev
53+
5054
- name: Get version using git describe
5155
working-directory: hexrdgui
5256
run: echo "HEXRDGUI_GIT_DESCRIBE=$(git describe --tag)" >> $GITHUB_ENV
@@ -89,34 +93,34 @@ jobs:
8993

9094
- name: Upload InstallOutput.log
9195
if: ${{ failure() }}
92-
uses: actions/upload-artifact@v2-preview
96+
uses: actions/upload-artifact@v3
9397
with:
9498
name: InstallOutput.log
9599
path: ${{ github.workspace }}/hexrdgui/packaging/_CPack_Packages/*/InstallOutput.log
96100

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

104108
- name: Upload installer package
105-
uses: actions/upload-artifact@v2-preview
109+
uses: actions/upload-artifact@v3
106110
with:
107111
name: HEXRDGUI-v${{env.VERSION}}.${{ matrix.config.package }}
108112
path: ${{ github.workspace }}/hexrdgui/packaging/HEXRDGUI-${{env.VERSION}}.${{ matrix.config.package }}
109113

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

117121
- name: Upload the HEXRDGUI conda package ( PRs only )
118122
if: github.ref != 'refs/heads/master'
119-
uses: actions/upload-artifact@v2-preview
123+
uses: actions/upload-artifact@v3
120124
with:
121125
name: HEXRDGUI-${{ matrix.config.name }}-${{ env.HEXRDGUI_GIT_DESCRIBE }}.tar.bz2
122126
path: ${{ github.workspace }}/hexrdgui/packaging/output/**/*.tar.bz2

.github/workflows/test.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: true
1515
matrix:
16-
python-version: [3.9, '3.10']
16+
python-version: ['3.10', '3.11']
1717
config:
1818
- {
1919
name: "Linux",
@@ -39,25 +39,29 @@ jobs:
3939
python-version: ${{ matrix.python-version }}
4040

4141
- name: Checkout HEXRD
42-
uses: actions/checkout@v2
42+
uses: actions/checkout@v4
4343
with:
4444
repository: HEXRD/hexrd
4545
path: hexrd
4646

4747
- name: Checkout HEXRDGUI
48-
uses: actions/checkout@v2
48+
uses: actions/checkout@v4
4949
with:
5050
path: hexrdgui
5151

5252
- name: Checkout examples
53-
uses: actions/checkout@v2
53+
uses: actions/checkout@v4
5454
with:
5555
repository: HEXRD/examples
5656
path: examples
5757

58+
- name: Install EGL on Linux (PySide6 needs it)
59+
if: ${{ matrix.config.name == 'Linux' }}
60+
run: sudo apt-get install -y libegl1-mesa-dev
61+
5862
- name: Set environment variable to work around setuptools/numpy issue
5963
run: echo 'SETUPTOOLS_USE_DISTUTILS=stdlib' >> $GITHUB_ENV
60-
if: ${{ matrix.config.os == 'windows-latest'}}
64+
if: ${{ matrix.config.name == 'Windows' }}
6165

6266
- name: Install HEXRD
6367
run: |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
python:
2+
- 3.11
3+
target_platform:
4+
- linux-64 # [linux]
5+
- osx-64 # [osx]
6+
- osx-arm64 # [osx]
7+
- win-64 # [win]

conda.recipe/meta.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,34 @@ source:
88
build:
99
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
1010
entry_points:
11-
- hexrdgui = hexrd.ui.main:main
11+
- hexrdgui = hexrdgui.main:main
1212

1313
requirements:
1414
build:
15-
- python=3.10
15+
- python {{ python }} # [build_platform != target_platform]
16+
- cross-python_{{ target_platform }} # [build_platform != target_platform]
17+
host:
18+
- python {{ python }}
1619
- setuptools
1720
- setuptools_scm
1821

1922
run:
2023
- python
21-
- pyside2>=5.15
22-
- Pillow
23-
- matplotlib
24-
- importlib_resources
2524
- fabio
26-
- pyyaml
2725
- hexrd=={{ hexrd_version }}
26+
- matplotlib-base
27+
- Pillow
2828
- pyhdf
29-
- silx
29+
- pyside6
30+
- pyyaml
31+
- silx-base
3032

31-
test:
33+
test: # [build_platform == target_platform]
3234
imports:
33-
- hexrd.ui
35+
- hexrdgui
3436

3537
about:
3638
home: https://github.com/HEXRD/hexrdgui
3739
license: BSD
3840
license_family: BSD
39-
summary: "Qt5 PySide2 based HEXRD GUI"
41+
summary: "Qt6 PySide6 based HEXRD GUI"

hexrd/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

hexrd/ui/__init__.py renamed to hexrdgui/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from PySide2.QtCore import QEvent, QObject, Qt
2-
from PySide2.QtWidgets import QDialog, QPushButton
1+
from PySide6.QtCore import QEvent, QObject, Qt
2+
from PySide6.QtWidgets import QDialog, QPushButton
33

44

55
class EnterKeyFilter(QObject):

hexrd/ui/about_dialog.py renamed to hexrdgui/about_dialog.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
from importlib.metadata import version
22
import sys
33

4-
from PySide2.QtCore import Qt, QObject, QSize
5-
from PySide2.QtSvg import QSvgWidget
6-
from PySide2.QtWidgets import QTreeWidgetItem, QLabel
7-
from PySide2.QtGui import QPixmap
4+
from PySide6.QtCore import Qt, QObject, QSize
5+
from PySide6.QtSvgWidgets import QSvgWidget
6+
from PySide6.QtWidgets import QTreeWidgetItem, QLabel
7+
from PySide6.QtGui import QPixmap
88

99
import hexrd
1010

11-
from hexrd.ui.ui_loader import UiLoader
12-
from hexrd.ui.resource_loader import load_resource
11+
from hexrdgui.ui_loader import UiLoader
12+
from hexrdgui.resource_loader import load_resource
1313

1414
LOGO_HEIGHT = 80
1515

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

2626
def _populate_hexrd_logo(self):
27-
data = load_resource(hexrd.ui.resources.icons,
27+
data = load_resource(hexrdgui.resources.icons,
2828
'hexrd.ico', binary=True)
2929
pixmap = QPixmap()
3030
pixmap.loadFromData(data, 'ico')
@@ -36,7 +36,7 @@ def _calculate_size(self, size):
3636
return QSize(LOGO_HEIGHT/ratio, LOGO_HEIGHT)
3737

3838
def _populate_logos(self):
39-
data = load_resource(hexrd.ui.resources.icons, 'llnl_logo.svg',
39+
data = load_resource(hexrdgui.resources.icons, 'llnl_logo.svg',
4040
binary=True)
4141

4242
self.ui.logos_horizontal_layout.addStretch()
@@ -47,7 +47,7 @@ def _populate_logos(self):
4747
self.ui.logos_horizontal_layout.addWidget(llnl, stretch=1)
4848
self.ui.logos_horizontal_layout.addStretch()
4949

50-
data = load_resource(hexrd.ui.resources.icons,
50+
data = load_resource(hexrdgui.resources.icons,
5151
'kitware_logo.svg', binary=True)
5252

5353
kitware = QSvgWidget()
@@ -57,7 +57,7 @@ def _populate_logos(self):
5757
self.ui.logos_horizontal_layout.addWidget(kitware, stretch=1)
5858
self.ui.logos_horizontal_layout.addStretch()
5959

60-
data = load_resource(hexrd.ui.resources.icons,
60+
data = load_resource(hexrdgui.resources.icons,
6161
'afrl_logo.png', binary=True)
6262

6363
pixmap = QPixmap()
@@ -78,7 +78,7 @@ def _populate_versions(self):
7878
"HEXRD",
7979
"NumPy",
8080
"SciPy",
81-
"PySide2"
81+
"PySide6"
8282
]
8383

8484
for package in packages:
File renamed without changes.

hexrd/ui/async_runner.py renamed to hexrdgui/async_runner.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
from PySide2.QtCore import QThreadPool, QTimer
2-
from PySide2.QtWidgets import QMessageBox
1+
from PySide6.QtCore import QThreadPool, QTimer
2+
from PySide6.QtWidgets import QMessageBox
33

4-
from hexrd.ui.async_worker import AsyncWorker
5-
from hexrd.ui.progress_dialog import ProgressDialog
4+
from hexrdgui.async_worker import AsyncWorker
5+
from hexrdgui.progress_dialog import ProgressDialog
66

77

88
class AsyncRunner:
99

1010
def __init__(self, parent):
1111
self.parent = parent
1212

13-
self.thread_pool = QThreadPool(parent)
14-
1513
self.progress_dialog = ProgressDialog(parent)
1614

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

44-
self.progress_dialog.exec_()
42+
self.progress_dialog.exec()
4543

4644
def on_worker_finished(self):
4745
self.reset_callbacks()
@@ -67,4 +65,8 @@ def on_async_error(self, t):
6765
msg = f'An ERROR occurred: {exctype}: {value}.'
6866
msg_box = QMessageBox(QMessageBox.Critical, 'Error', msg)
6967
msg_box.setDetailedText(traceback)
70-
msg_box.exec_()
68+
msg_box.exec()
69+
70+
@property
71+
def thread_pool(self):
72+
return QThreadPool.globalInstance()

hexrd/ui/async_worker.py renamed to hexrdgui/async_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This class was modified from the following example online:
22
# https://www.learnpyqt.com/courses/concurrent-execution/multithreading-pyqt-applications-qthreadpool/
33

4-
from PySide2.QtCore import QObject, QRunnable, Signal, Slot
4+
from PySide6.QtCore import QObject, QRunnable, Signal, Slot
55

66
import inspect
77
import traceback

0 commit comments

Comments
 (0)