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

Pyside6 upgrade #127

Merged
merged 9 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ jobs:
ci:
runs-on: ubuntu-latest
container: openmc/openmc:develop
env:
DISPLAY: ':99.0'
steps:
-
name: Apt dependencies
shell: bash
run: |
apt update
apt install -y libglu1-mesa libglib2.0-0 libfontconfig1
apt install -y libglu1-mesa libglib2.0-0 libfontconfig1 libegl-dev libxkbcommon-x11-0 xvfb libdbus-1-3
/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
-
uses: actions/checkout@v2
-
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repository](https://github.com/landonjmitchell/openmc-plotgui)).

## Dependencies

OpenMC, Matplotlib, NumPy, PySide2
OpenMC, Matplotlib, NumPy, PySide6

## Installation

Expand Down
6 changes: 3 additions & 3 deletions openmc_plotter/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import signal
import sys

from PySide2 import QtCore, QtGui
from PySide2.QtWidgets import QApplication, QSplashScreen
from PySide6 import QtCore, QtGui
from PySide6.QtWidgets import QApplication, QSplashScreen

from . import __version__
from .main_window import MainWindow, _openmcReload
Expand Down Expand Up @@ -90,7 +90,7 @@ def run_app(user_args):
timer.start(500)
timer.timeout.connect(lambda: None)

sys.exit(app.exec_())
sys.exit(app.exec())

if __name__ == '__main__':
main()
4 changes: 2 additions & 2 deletions openmc_plotter/custom_widgets.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import partial
import warnings

from PySide2 import QtWidgets, QtCore
from PySide2.QtWidgets import QFrame
from PySide6 import QtWidgets, QtCore
from PySide6.QtWidgets import QFrame


class HorizontalLine(QFrame):
Expand Down
9 changes: 5 additions & 4 deletions openmc_plotter/docks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from collections.abc import Iterable
from collections import defaultdict

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

header = QTreeWidgetItem(["Filters"])
self.filterTree.setHeaderItem(header)
self.filterTree.setItemHidden(header, True)
header.setHidden(True)
#self.filterTree.setItemHidden(header, True)
self.filterTree.setColumnCount(1)

self.filter_map = {}
Expand All @@ -402,7 +403,7 @@ def _createFilterTree(self, spatial_filters):
0, "Only tallies with spatial filters are viewable.")
else:
filter_item.setFlags(
filter_item.flags() | QtCore.Qt.ItemIsTristate | QtCore.Qt.ItemIsUserCheckable)
filter_item.flags() | QtCore.Qt.ItemIsUserCheckable)
filter_item.setCheckState(0, QtCore.Qt.Unchecked)

# all mesh bins are selected by default and not shown in the dock
Expand Down
24 changes: 12 additions & 12 deletions openmc_plotter/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import pickle
from threading import Thread

from PySide2 import QtCore, QtGui
from PySide2.QtGui import QKeyEvent
from PySide2.QtWidgets import (QApplication, QLabel, QSizePolicy, QMainWindow,
QScrollArea, QMessageBox, QAction, QFileDialog,
from PySide6 import QtCore, QtGui
from PySide6.QtGui import QKeyEvent, QAction
from PySide6.QtWidgets import (QApplication, QLabel, QSizePolicy, QMainWindow,
QScrollArea, QMessageBox, QFileDialog,
QColorDialog, QInputDialog, QWidget,
QGestureEvent)

Expand Down Expand Up @@ -547,7 +547,7 @@ def openStatePoint(self):
"opening a new one.")
msg_box.setIcon(QMessageBox.Information)
msg_box.setStandardButtons(QMessageBox.Ok)
msg_box.exec_()
msg_box.exec()
return
filename, ext = QFileDialog.getOpenFileName(self, "Open StatePoint",
".", "statepoint*.h5")
Expand All @@ -562,7 +562,7 @@ def openStatePoint(self):
msg_box.setText(msg.format(filename))
msg_box.setIcon(QMessageBox.Warning)
msg_box.setStandardButtons(QMessageBox.Ok)
msg_box.exec_()
msg_box.exec()
finally:
self.statusBar().showMessage(message.format(filename), 5000)
self.updateDataMenu()
Expand All @@ -583,7 +583,7 @@ def importProperties(self):
msg_box.setText(f"Error opening properties file: \n\n {e} \n")
msg_box.setIcon(QMessageBox.Warning)
msg_box.setStandardButtons(QMessageBox.Ok)
msg_box.exec_()
msg_box.exec()
finally:
self.statusBar().showMessage(message.format(filename), 5000)

Expand Down Expand Up @@ -869,7 +869,7 @@ def editMaskingColor(self):
dlg = QColorDialog(self)

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

dlg.setCurrentColor(QtGui.QColor.fromRgb(*current_color))
if dlg.exec_():
if dlg.exec():
new_color = dlg.currentColor().getRgb()[:3]
self.model.activeView.highlightBackground = new_color
self.colorDialog.updateHighlightColor()
Expand All @@ -894,7 +894,7 @@ def editOverlapColor(self, apply=False):
current_color = self.model.activeView.overlap_color
dlg = QColorDialog(self)
dlg.setCurrentColor(QtGui.QColor.fromRgb(*current_color))
if dlg.exec_():
if dlg.exec():
new_color = dlg.currentColor().getRgb()[:3]
self.model.activeView.overlap_color = new_color
self.colorDialog.updateOverlapColor()
Expand All @@ -907,7 +907,7 @@ def editBackgroundColor(self, apply=False):
dlg = QColorDialog(self)

dlg.setCurrentColor(QtGui.QColor.fromRgb(*current_color))
if dlg.exec_():
if dlg.exec():
new_color = dlg.currentColor().getRgb()[:3]
self.model.activeView.domainBackground = new_color
self.colorDialog.updateBackgroundColor()
Expand Down Expand Up @@ -1036,7 +1036,7 @@ def editDomainColor(self, kind, id):
elif isinstance(current_color, str):
current_color = openmc.plots._SVG_COLORS[current_color]
dlg.setCurrentColor(QtGui.QColor.fromRgb(*current_color))
if dlg.exec_():
if dlg.exec():
new_color = dlg.currentColor().getRgb()[:3]
domain[id].color = new_color

Expand Down
4 changes: 2 additions & 2 deletions openmc_plotter/overlays.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from sys import platform

from PySide2 import QtGui, QtCore
from PySide2.QtWidgets import (QWidget, QTableWidget, QSizePolicy,
from PySide6 import QtGui, QtCore
from PySide6.QtWidgets import (QWidget, QTableWidget, QSizePolicy,
QPushButton, QTableWidgetItem, QVBoxLayout)

c_key = "⌘" if platform == 'darwin' else "Ctrl"
Expand Down
6 changes: 3 additions & 3 deletions openmc_plotter/plotgui.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from functools import partial

from PySide2 import QtCore, QtGui
from PySide2.QtWidgets import (QWidget, QPushButton, QHBoxLayout, QVBoxLayout,
from PySide6 import QtCore, QtGui
from PySide6.QtWidgets import (QWidget, QPushButton, QHBoxLayout, QVBoxLayout,
QFormLayout, QComboBox, QSpinBox,
QDoubleSpinBox, QSizePolicy, QMessageBox,
QCheckBox, QRubberBand, QMenu, QDialog,
Expand Down Expand Up @@ -465,7 +465,7 @@ def contextMenuEvent(self, event):
else:
self.main_window.dockAction.setText('Show &Dock')

self.menu.exec_(event.globalPos())
self.menu.exec(event.globalPos())

def generatePixmap(self, update=False):
if self.frozen:
Expand Down
12 changes: 6 additions & 6 deletions openmc_plotter/plotmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import pickle
import threading

from PySide2.QtWidgets import QItemDelegate, QColorDialog, QLineEdit, QMessageBox
from PySide2.QtCore import QAbstractTableModel, QModelIndex, Qt, QSize, QEvent
from PySide2.QtGui import QColor
from PySide6.QtWidgets import QItemDelegate, QColorDialog, QLineEdit, QMessageBox
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, QSize, QEvent
from PySide6.QtGui import QColor
import openmc
import openmc.lib
import numpy as np
Expand Down Expand Up @@ -180,7 +180,7 @@ def __init__(self, use_settings_pkl, model_path):
msg_box.setText(msg)
msg_box.setIcon(QMessageBox.Warning)
msg_box.setStandardButtons(QMessageBox.Ok)
msg_box.exec_()
msg_box.exec()
self.currentView = copy.deepcopy(self.defaultView)

else:
Expand Down Expand Up @@ -212,7 +212,7 @@ def __init__(self, use_settings_pkl, model_path):
msg_box.setText(msg.format(self.model.statepoint.filename))
msg_box.setIcon(QMessageBox.Warning)
msg_box.setStandardButtons(QMessageBox.Ok)
msg_box.exec_()
msg_box.exec()
self.statepoint = None

self.currentView = PlotView(restore_view=view,
Expand Down Expand Up @@ -427,7 +427,7 @@ def create_tally_image(self, view=None):
msg_box.setText(msg)
msg_box.setIcon(QMessageBox.Information)
msg_box.setStandardButtons(QMessageBox.Ok)
msg_box.exec_()
msg_box.exec()
return (None, None, None, None, None)

units_out = list(units)[0]
Expand Down
4 changes: 2 additions & 2 deletions openmc_plotter/scientific_spin_box.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re

from PySide2 import QtGui
from PySide2.QtWidgets import QDoubleSpinBox
from PySide6 import QtGui
from PySide6.QtWidgets import QDoubleSpinBox
import numpy as np

# Regular expression to find floats. Match groups are the whole string, the
Expand Down
6 changes: 3 additions & 3 deletions openmc_plotter/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np
import openmc
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets

from .custom_widgets import HorizontalLine
from .scientific_spin_box import ScientificDoubleSpinBox
Expand Down Expand Up @@ -36,7 +36,7 @@ def _warn(msg):
msg_box.setText(msg)
msg_box.setIcon(QtWidgets.QMessageBox.Information)
msg_box.setStandardButtons(QtWidgets.QMessageBox.Ok)
msg_box.exec_()
msg_box.exec()

def populate(self):
cv = self.model.currentView
Expand Down Expand Up @@ -378,4 +378,4 @@ def _export_data(self):
msg.setText("Export complete!")
msg.setIcon(QtWidgets.QMessageBox.Information)
msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
msg.exec_()
msg.exec()
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
qt_api=pyside2
qt_api=pyside6
python_files = test*.py
python_classes = NoThanks
filterwarnings = ignore::UserWarning
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# Dependencies
'python_requires': '>=3.6',
'install_requires': [
'openmc>0.12.2', 'numpy', 'matplotlib', 'PySide2'
'openmc>0.12.2', 'numpy', 'matplotlib', 'PySide6'
],
'extras_require': {
'test' : ['pytest', 'pytest-qt'],
Expand Down
Loading