Skip to content

Commit 5c5163d

Browse files
authored
Merge pull request #127 from eepeterson/pyside6_upgrade
Pyside6 upgrade
2 parents 431fe5f + a9f7edb commit 5c5163d

File tree

13 files changed

+45
-41
lines changed

13 files changed

+45
-41
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ jobs:
2121
ci:
2222
runs-on: ubuntu-latest
2323
container: openmc/openmc:develop
24+
env:
25+
DISPLAY: ':99.0'
2426
steps:
2527
-
2628
name: Apt dependencies
2729
shell: bash
2830
run: |
2931
apt update
30-
apt install -y libglu1-mesa libglib2.0-0 libfontconfig1
32+
apt install -y libglu1-mesa libglib2.0-0 libfontconfig1 libegl-dev libxkbcommon-x11-0 xvfb libdbus-1-3
33+
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX
3134
-
3235
uses: actions/checkout@v2
3336
-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repository](https://github.com/landonjmitchell/openmc-plotgui)).
1515

1616
## Dependencies
1717

18-
OpenMC, Matplotlib, NumPy, PySide2
18+
OpenMC, Matplotlib, NumPy, PySide6
1919

2020
## Installation
2121

openmc_plotter/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import signal
66
import sys
77

8-
from PySide2 import QtCore, QtGui
9-
from PySide2.QtWidgets import QApplication, QSplashScreen
8+
from PySide6 import QtCore, QtGui
9+
from PySide6.QtWidgets import QApplication, QSplashScreen
1010

1111
from . import __version__
1212
from .main_window import MainWindow, _openmcReload
@@ -90,7 +90,7 @@ def run_app(user_args):
9090
timer.start(500)
9191
timer.timeout.connect(lambda: None)
9292

93-
sys.exit(app.exec_())
93+
sys.exit(app.exec())
9494

9595
if __name__ == '__main__':
9696
main()

openmc_plotter/custom_widgets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from functools import partial
22
import warnings
33

4-
from PySide2 import QtWidgets, QtCore
5-
from PySide2.QtWidgets import QFrame
4+
from PySide6 import QtWidgets, QtCore
5+
from PySide6.QtWidgets import QFrame
66

77

88
class HorizontalLine(QFrame):

openmc_plotter/docks.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from collections.abc import Iterable
33
from collections import defaultdict
44

5-
from PySide2 import QtCore
6-
from PySide2.QtWidgets import (QWidget, QPushButton, QHBoxLayout, QVBoxLayout,
5+
from PySide6 import QtCore
6+
from PySide6.QtWidgets import (QWidget, QPushButton, QHBoxLayout, QVBoxLayout,
77
QGroupBox, QFormLayout, QLabel, QLineEdit,
88
QComboBox, QSpinBox, QDoubleSpinBox, QSizePolicy,
99
QCheckBox, QDockWidget, QScrollArea, QListWidget,
@@ -384,7 +384,8 @@ def _createFilterTree(self, spatial_filters):
384384

385385
header = QTreeWidgetItem(["Filters"])
386386
self.filterTree.setHeaderItem(header)
387-
self.filterTree.setItemHidden(header, True)
387+
header.setHidden(True)
388+
#self.filterTree.setItemHidden(header, True)
388389
self.filterTree.setColumnCount(1)
389390

390391
self.filter_map = {}
@@ -402,7 +403,7 @@ def _createFilterTree(self, spatial_filters):
402403
0, "Only tallies with spatial filters are viewable.")
403404
else:
404405
filter_item.setFlags(
405-
filter_item.flags() | QtCore.Qt.ItemIsTristate | QtCore.Qt.ItemIsUserCheckable)
406+
filter_item.flags() | QtCore.Qt.ItemIsUserCheckable)
406407
filter_item.setCheckState(0, QtCore.Qt.Unchecked)
407408

408409
# all mesh bins are selected by default and not shown in the dock

openmc_plotter/main_window.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import pickle
55
from threading import Thread
66

7-
from PySide2 import QtCore, QtGui
8-
from PySide2.QtGui import QKeyEvent
9-
from PySide2.QtWidgets import (QApplication, QLabel, QSizePolicy, QMainWindow,
10-
QScrollArea, QMessageBox, QAction, QFileDialog,
7+
from PySide6 import QtCore, QtGui
8+
from PySide6.QtGui import QKeyEvent, QAction
9+
from PySide6.QtWidgets import (QApplication, QLabel, QSizePolicy, QMainWindow,
10+
QScrollArea, QMessageBox, QFileDialog,
1111
QColorDialog, QInputDialog, QWidget,
1212
QGestureEvent)
1313

@@ -547,7 +547,7 @@ def openStatePoint(self):
547547
"opening a new one.")
548548
msg_box.setIcon(QMessageBox.Information)
549549
msg_box.setStandardButtons(QMessageBox.Ok)
550-
msg_box.exec_()
550+
msg_box.exec()
551551
return
552552
filename, ext = QFileDialog.getOpenFileName(self, "Open StatePoint",
553553
".", "statepoint*.h5")
@@ -562,7 +562,7 @@ def openStatePoint(self):
562562
msg_box.setText(msg.format(filename))
563563
msg_box.setIcon(QMessageBox.Warning)
564564
msg_box.setStandardButtons(QMessageBox.Ok)
565-
msg_box.exec_()
565+
msg_box.exec()
566566
finally:
567567
self.statusBar().showMessage(message.format(filename), 5000)
568568
self.updateDataMenu()
@@ -583,7 +583,7 @@ def importProperties(self):
583583
msg_box.setText(f"Error opening properties file: \n\n {e} \n")
584584
msg_box.setIcon(QMessageBox.Warning)
585585
msg_box.setStandardButtons(QMessageBox.Ok)
586-
msg_box.exec_()
586+
msg_box.exec()
587587
finally:
588588
self.statusBar().showMessage(message.format(filename), 5000)
589589

@@ -869,7 +869,7 @@ def editMaskingColor(self):
869869
dlg = QColorDialog(self)
870870

871871
dlg.setCurrentColor(QtGui.QColor.fromRgb(*current_color))
872-
if dlg.exec_():
872+
if dlg.exec():
873873
new_color = dlg.currentColor().getRgb()[:3]
874874
self.model.activeView.maskBackground = new_color
875875
self.colorDialog.updateMaskingColor()
@@ -879,7 +879,7 @@ def editHighlightColor(self):
879879
dlg = QColorDialog(self)
880880

881881
dlg.setCurrentColor(QtGui.QColor.fromRgb(*current_color))
882-
if dlg.exec_():
882+
if dlg.exec():
883883
new_color = dlg.currentColor().getRgb()[:3]
884884
self.model.activeView.highlightBackground = new_color
885885
self.colorDialog.updateHighlightColor()
@@ -894,7 +894,7 @@ def editOverlapColor(self, apply=False):
894894
current_color = self.model.activeView.overlap_color
895895
dlg = QColorDialog(self)
896896
dlg.setCurrentColor(QtGui.QColor.fromRgb(*current_color))
897-
if dlg.exec_():
897+
if dlg.exec():
898898
new_color = dlg.currentColor().getRgb()[:3]
899899
self.model.activeView.overlap_color = new_color
900900
self.colorDialog.updateOverlapColor()
@@ -907,7 +907,7 @@ def editBackgroundColor(self, apply=False):
907907
dlg = QColorDialog(self)
908908

909909
dlg.setCurrentColor(QtGui.QColor.fromRgb(*current_color))
910-
if dlg.exec_():
910+
if dlg.exec():
911911
new_color = dlg.currentColor().getRgb()[:3]
912912
self.model.activeView.domainBackground = new_color
913913
self.colorDialog.updateBackgroundColor()
@@ -1036,7 +1036,7 @@ def editDomainColor(self, kind, id):
10361036
elif isinstance(current_color, str):
10371037
current_color = openmc.plots._SVG_COLORS[current_color]
10381038
dlg.setCurrentColor(QtGui.QColor.fromRgb(*current_color))
1039-
if dlg.exec_():
1039+
if dlg.exec():
10401040
new_color = dlg.currentColor().getRgb()[:3]
10411041
domain[id].color = new_color
10421042

openmc_plotter/overlays.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from sys import platform
22

3-
from PySide2 import QtGui, QtCore
4-
from PySide2.QtWidgets import (QWidget, QTableWidget, QSizePolicy,
3+
from PySide6 import QtGui, QtCore
4+
from PySide6.QtWidgets import (QWidget, QTableWidget, QSizePolicy,
55
QPushButton, QTableWidgetItem, QVBoxLayout)
66

77
c_key = "⌘" if platform == 'darwin' else "Ctrl"

openmc_plotter/plotgui.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from functools import partial
22

3-
from PySide2 import QtCore, QtGui
4-
from PySide2.QtWidgets import (QWidget, QPushButton, QHBoxLayout, QVBoxLayout,
3+
from PySide6 import QtCore, QtGui
4+
from PySide6.QtWidgets import (QWidget, QPushButton, QHBoxLayout, QVBoxLayout,
55
QFormLayout, QComboBox, QSpinBox,
66
QDoubleSpinBox, QSizePolicy, QMessageBox,
77
QCheckBox, QRubberBand, QMenu, QDialog,
@@ -465,7 +465,7 @@ def contextMenuEvent(self, event):
465465
else:
466466
self.main_window.dockAction.setText('Show &Dock')
467467

468-
self.menu.exec_(event.globalPos())
468+
self.menu.exec(event.globalPos())
469469

470470
def generatePixmap(self, update=False):
471471
if self.frozen:

openmc_plotter/plotmodel.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import pickle
99
import threading
1010

11-
from PySide2.QtWidgets import QItemDelegate, QColorDialog, QLineEdit, QMessageBox
12-
from PySide2.QtCore import QAbstractTableModel, QModelIndex, Qt, QSize, QEvent
13-
from PySide2.QtGui import QColor
11+
from PySide6.QtWidgets import QItemDelegate, QColorDialog, QLineEdit, QMessageBox
12+
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, QSize, QEvent
13+
from PySide6.QtGui import QColor
1414
import openmc
1515
import openmc.lib
1616
import numpy as np
@@ -180,7 +180,7 @@ def __init__(self, use_settings_pkl, model_path):
180180
msg_box.setText(msg)
181181
msg_box.setIcon(QMessageBox.Warning)
182182
msg_box.setStandardButtons(QMessageBox.Ok)
183-
msg_box.exec_()
183+
msg_box.exec()
184184
self.currentView = copy.deepcopy(self.defaultView)
185185

186186
else:
@@ -212,7 +212,7 @@ def __init__(self, use_settings_pkl, model_path):
212212
msg_box.setText(msg.format(self.model.statepoint.filename))
213213
msg_box.setIcon(QMessageBox.Warning)
214214
msg_box.setStandardButtons(QMessageBox.Ok)
215-
msg_box.exec_()
215+
msg_box.exec()
216216
self.statepoint = None
217217

218218
self.currentView = PlotView(restore_view=view,
@@ -427,7 +427,7 @@ def create_tally_image(self, view=None):
427427
msg_box.setText(msg)
428428
msg_box.setIcon(QMessageBox.Information)
429429
msg_box.setStandardButtons(QMessageBox.Ok)
430-
msg_box.exec_()
430+
msg_box.exec()
431431
return (None, None, None, None, None)
432432

433433
units_out = list(units)[0]

openmc_plotter/scientific_spin_box.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22

3-
from PySide2 import QtGui
4-
from PySide2.QtWidgets import QDoubleSpinBox
3+
from PySide6 import QtGui
4+
from PySide6.QtWidgets import QDoubleSpinBox
55
import numpy as np
66

77
# Regular expression to find floats. Match groups are the whole string, the

0 commit comments

Comments
 (0)