From 1f4f920ba5d9f3d7a6c9623529a587409558ec3e Mon Sep 17 00:00:00 2001 From: bgallois Date: Thu, 15 Feb 2024 11:46:36 +0100 Subject: [PATCH] [feat] upgrade to pyside6 --- autoformating.sh | 2 +- build.sh | 10 ++++----- fastanalyzer/__init__.py | 2 -- fastanalyzer/data_calc.py | 8 +++---- fastanalyzer/fastanalyzer.py | 42 +++++++++++++++++++---------------- fastanalyzer/plot.py | 9 ++++---- fastanalyzer/plot_settings.py | 8 +++---- requirements.txt | 2 +- 8 files changed, 43 insertions(+), 40 deletions(-) diff --git a/autoformating.sh b/autoformating.sh index f38f12a..2e50185 100755 --- a/autoformating.sh +++ b/autoformating.sh @@ -1 +1 @@ -autopep8 --in-place --aggressive src/*.py +autopep8 --in-place --aggressive fastanalyzer/*.py diff --git a/build.sh b/build.sh index 228bd31..4af8d4e 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ -pyside2-rcc fastanalyzer/resources.qrc -o fastanalyzer/rc_ressources.py -pyside2-uic fastanalyzer/fastanalyzer.ui -o fastanalyzer/ui_fastanalyzer.py -pyside2-uic fastanalyzer/plot.ui -o fastanalyzer/ui_plot.py -pyside2-uic fastanalyzer/plot_settings.ui -o fastanalyzer/ui_plot_settings.py -pyside2-uic fastanalyzer/data_calc.ui -o fastanalyzer/ui_data_calc.py +pyside6-rcc fastanalyzer/resources.qrc -o fastanalyzer/rc_ressources.py +pyside6-uic fastanalyzer/fastanalyzer.ui -o fastanalyzer/ui_fastanalyzer.py +pyside6-uic fastanalyzer/plot.ui -o fastanalyzer/ui_plot.py +pyside6-uic fastanalyzer/plot_settings.ui -o fastanalyzer/ui_plot_settings.py +pyside6-uic fastanalyzer/data_calc.ui -o fastanalyzer/ui_data_calc.py diff --git a/fastanalyzer/__init__.py b/fastanalyzer/__init__.py index 30d832b..adc639d 100644 --- a/fastanalyzer/__init__.py +++ b/fastanalyzer/__init__.py @@ -2,5 +2,3 @@ if __name__ == '__main__': main() - - diff --git a/fastanalyzer/data_calc.py b/fastanalyzer/data_calc.py index b1093e1..a763fe3 100644 --- a/fastanalyzer/data_calc.py +++ b/fastanalyzer/data_calc.py @@ -1,7 +1,7 @@ -from PySide2.QtWidgets import QApplication, QMainWindow, QAction, QActionGroup, QFileDialog, QMessageBox, QLabel, QMdiArea, QMdiSubWindow, QTableWidget, QTableWidgetItem, QWidget -from PySide2.QtCore import Signal, QFile, QCoreApplication, QStandardPaths, Qt, QTimer, QSignalBlocker -from PySide2.QtGui import QColor, QIcon, QPen, QPainter, QPalette, QPixmap, QFont, QFontDatabase -import PySide2.QtXml +from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QLabel, QMdiArea, QMdiSubWindow, QTableWidget, QTableWidgetItem, QWidget +from PySide6.QtCore import Signal, QFile, QCoreApplication, QStandardPaths, Qt, QTimer, QSignalBlocker +from PySide6.QtGui import QColor, QIcon, QPen, QPainter, QAction, QActionGroup, QPalette, QPixmap, QFont, QFontDatabase +import PySide6.QtXml from ui_data_calc import Ui_DataCalc import numpy as np diff --git a/fastanalyzer/fastanalyzer.py b/fastanalyzer/fastanalyzer.py index 443c00a..956f636 100755 --- a/fastanalyzer/fastanalyzer.py +++ b/fastanalyzer/fastanalyzer.py @@ -1,23 +1,20 @@ #!/usr/bin/env python +from ui_fastanalyzer import Ui_FastAnalyzer +import PySide6.QtXml +from PySide6.QtGui import QColor, QIcon, QPen, QPainter, QAction, QActionGroup, QPalette, QPixmap, QFont, QFontDatabase +from PySide6.QtCore import Signal, Slot, QFile, QStandardPaths, Qt, QTimer, QCoreApplication, QSettings +from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QLabel, QMdiArea, QMdiSubWindow, QTableWidget, QTableWidgetItem +import fastanalysis as fa +from data_calc import DataCalc +from plot import Plot +import pickle +import rc_ressources import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) -import rc_ressources -import sys -import pickle - -from plot import Plot -from data_calc import DataCalc -import fastanalysis as fa - -from PySide2.QtWidgets import QApplication, QMainWindow, QAction, QActionGroup, QFileDialog, QMessageBox, QLabel, QMdiArea, QMdiSubWindow, QTableWidget, QTableWidgetItem -from PySide2.QtCore import Signal, Slot, QFile, QStandardPaths, Qt, QTimer, QCoreApplication, QSettings -from PySide2.QtGui import QColor, QIcon, QPen, QPainter, QPalette, QPixmap, QFont, QFontDatabase -import PySide2.QtXml -from ui_fastanalyzer import Ui_FastAnalyzer -dirname = os.path.dirname(PySide2.__file__) +dirname = os.path.dirname(PySide6.__file__) plugin_path = os.path.join(dirname, 'plugins', 'platforms') os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path @@ -40,7 +37,7 @@ def __init__(self): self.license = int(self.settings.value("main/license", "0o0"), 8) timer = QTimer(self) timer.timeout.connect(self.checkLicense) - timer.setInterval(1000*60) + timer.setInterval(1000 * 60) timer.start() self.restoreGeometry(self.settings.value("main/geometry")) self.restoreState(self.settings.value("main/windowState")) @@ -79,7 +76,8 @@ def __init__(self): winView.toggled.connect(tileView.setEnabled) self.ui.menuView.addAction(tileView) - if int(self.settings.value("main/mode", 0)) == 0: + if self.settings.value( + "main/mode", QMdiArea.TabbedView) == QMdiArea.SubWindowView: winView.setChecked(True) else: tileView.setEnabled(False) @@ -287,9 +285,14 @@ def addTable(self): def checkLicense(self): self.license += 1 - self.ui.statusbar.showMessage("{} minutes remaining in demo".format(30-self.license)) + self.ui.statusbar.showMessage( + "{} minutes remaining in demo".format( + 30 - self.license)) if self.license > 30: - QMessageBox.critical(self, "License expired", "The demo version of FastAnalyzer is expired, check https://www.fasttrack.sh/blog for more information.") + QMessageBox.critical( + self, + "License expired", + "The demo version of FastAnalyzer is expired, check https://www.fasttrack.sh/blog for more information.") self.close() @@ -304,7 +307,8 @@ def main(): app.setOrganizationDomain("fasttrack.sh") widget = FastAnalyzer() widget.show() - sys.exit(app.exec_()) + sys.exit(app.exec()) + if __name__ == '__main__': main() diff --git a/fastanalyzer/plot.py b/fastanalyzer/plot.py index 1901776..10ed3b4 100644 --- a/fastanalyzer/plot.py +++ b/fastanalyzer/plot.py @@ -1,6 +1,6 @@ -from PySide2.QtWidgets import QApplication, QMainWindow, QAction, QFileDialog, QMessageBox, QLabel, QMdiArea, QMdiSubWindow -from PySide2.QtCore import Signal, QFile, QCoreApplication, QStandardPaths, Qt, QTimer -from PySide2.QtGui import QColor, QIcon, QPen, QPainter, QPalette, QPixmap, QFont, QFontDatabase +from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QLabel, QMdiArea, QMdiSubWindow +from PySide6.QtCore import Signal, QFile, QCoreApplication, QStandardPaths, Qt, QTimer +from PySide6.QtGui import QColor, QIcon, QPen, QPainter, QAction, QPalette, QPixmap, QFont, QFontDatabase from ui_plot import Ui_Plot from plot_settings import PlotSettings @@ -17,7 +17,8 @@ def __init__(self, data, parent=None, params=None): self.data = data self.ui = Ui_Plot() self.ui.setupUi(self) - self.settingsWindow = PlotSettings(self, params=params, keys=self.data.getDataframe().columns.values.tolist()) + self.settingsWindow = PlotSettings( + self, params=params, keys=self.data.getDataframe().columns.values.tolist()) self.ui.settingsDock.setWidget(self.settingsWindow) self.canvas = FigureCanvas( diff --git a/fastanalyzer/plot_settings.py b/fastanalyzer/plot_settings.py index a9f3a03..20ba828 100644 --- a/fastanalyzer/plot_settings.py +++ b/fastanalyzer/plot_settings.py @@ -1,7 +1,7 @@ -from PySide2.QtWidgets import QWidget, QApplication, QMainWindow, QAction, QFileDialog, QMessageBox, QLabel, QMdiArea, QMdiSubWindow -from PySide2.QtCore import Signal, QFile, QStandardPaths, Qt, QTimer -from PySide2.QtGui import QColor, QIcon, QPen, QPainter, QPalette, QPixmap, QFont, QFontDatabase -import PySide2.QtXml +from PySide6.QtWidgets import QWidget, QApplication, QMainWindow, QFileDialog, QMessageBox, QLabel, QMdiArea, QMdiSubWindow +from PySide6.QtCore import Signal, QFile, QStandardPaths, Qt, QTimer +from PySide6.QtGui import QColor, QIcon, QPen, QPainter, QPalette, QAction, QPixmap, QFont, QFontDatabase +import PySide6.QtXml from ui_plot_settings import Ui_PlotSettings diff --git a/requirements.txt b/requirements.txt index 1585748..4b7a444 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ fastanalysis>=0.0.3 matplotlib>=3.5.2 numpy>=1.22.4 -PySide2>=5.15.2.1 +PySide6 seaborn>=0.11.2 statannotations>=0.4.4