Skip to content

Commit

Permalink
WIP: Switch to PyQt6
Browse files Browse the repository at this point in the history
  • Loading branch information
doronbehar committed Aug 2, 2024
1 parent 1c11af6 commit c95a710
Show file tree
Hide file tree
Showing 26 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
paramiko
plumbum
pylpsd
pyqt5
pyqt6
pyqtgraph
pyrp3
pytest
Expand Down
4 changes: 2 additions & 2 deletions linien-gui/linien_gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from linien_gui.ui.main_window import MainWindow
from linien_gui.ui.psd_window import PSDWindow
from linien_gui.ui.version_checker import VersionCheckerThread
from PyQt5 import QtWidgets
from PyQt5.QtCore import pyqtSignal
from PyQt6 import QtWidgets
from PyQt6.QtCore import pyqtSignal
from pyqtgraph.Qt import QtCore

sys.path += [str(UI_PATH)]
Expand Down
4 changes: 2 additions & 2 deletions linien-gui/linien_gui/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from typing import Callable

from linien_client.device import Device
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import (
from PyQt6.QtCore import pyqtSignal
from PyQt6.QtWidgets import (
QDialog,
QListWidget,
QMessageBox,
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
)
from linien_client.remote_parameters import RemoteParameter
from linien_common.communication import RestorableParameterValues
from PyQt5.QtCore import QObject, QThread, pyqtSignal
from PyQt6.QtCore import QObject, QThread, pyqtSignal

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
Expand Down
4 changes: 2 additions & 2 deletions linien-gui/linien_gui/ui/device_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
from linien_gui.threads import ConnectionThread
from linien_gui.ui.new_device_dialog import NewDeviceDialog
from linien_gui.utils import get_linien_app_instance, set_window_icon
from PyQt5 import QtCore, QtWidgets, uic
from PyQt5.QtWidgets import QListWidget, QPushButton
from PyQt6 import QtCore, QtWidgets, uic
from PyQt6.QtWidgets import QListWidget, QPushButton


class DeviceManager(QtWidgets.QMainWindow):
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/general_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from linien_gui.config import UI_PATH
from linien_gui.ui.spin_box import CustomDoubleSpinBoxNoSign
from linien_gui.utils import get_linien_app_instance, param2ui
from PyQt5 import QtWidgets, uic
from PyQt6 import QtWidgets, uic


class GeneralPanel(QtWidgets.QWidget):
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/lock_status_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# along with Linien. If not, see <http://www.gnu.org/licenses/>.

from linien_gui.utils import get_linien_app_instance, param2ui
from PyQt5 import QtCore, QtWidgets
from PyQt6 import QtCore, QtWidgets


class LockStatusPanel(QtWidgets.QWidget):
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/locking_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from linien_gui.ui.lock_status_panel import LockStatusPanel
from linien_gui.ui.spin_box import CustomSpinBox
from linien_gui.utils import get_linien_app_instance, param2ui
from PyQt5 import QtWidgets, uic
from PyQt6 import QtWidgets, uic


class LockingPanel(QtWidgets.QWidget):
Expand Down
8 changes: 4 additions & 4 deletions linien-gui/linien_gui/ui/logging_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from linien_common.influxdb import InfluxDBCredentials
from linien_gui.config import UI_PATH
from linien_gui.utils import get_linien_app_instance
from PyQt5 import QtWidgets, uic
from PyQt5.QtCore import pyqtSignal
from PyQt6 import QtWidgets, QtGui, uic
from PyQt6.QtCore import pyqtSignal

START_LOG_BUTTON_TEXT = "Start Logging"
STOP_LOG_BUTTON_TEXT = "Stop Logging"
Expand Down Expand Up @@ -147,11 +147,11 @@ def create_menu_entries(self, parameters: RemoteParameters) -> None:
param_dict = dict(sorted(param_dict.items())) # sort alphabetically
for name, param in param_dict.items():
if param.loggable:
action = QtWidgets.QAction(name, parent=self, checkable=True) # type: ignore[call-overload] # noqa: E501
action = QtGui.QAction(name, parent=self, checkable=True) # type: ignore[call-overload] # noqa: E501
action.setChecked(param.log)
self.addAction(action)
self.triggered.connect(self.on_item_selected)

def on_item_selected(self, action: QtWidgets.QAction) -> None:
def on_item_selected(self, action: QtGui.QAction) -> None:
param_name = action.text()
self.item_clicked.emit(param_name, action.isChecked())
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from linien_gui.ui.spin_box import CustomDoubleSpinBox
from linien_gui.ui.sweep_control import SweepControlWidget, SweepSlider
from linien_gui.utils import color_to_hex, get_linien_app_instance, set_window_icon
from PyQt5 import QtWidgets, uic
from PyQt6 import QtWidgets, uic

ZOOM_STEP = 0.9
MAX_ZOOM = 50
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/modulation_sweep_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from linien_gui.config import UI_PATH
from linien_gui.ui.spin_box import CustomDoubleSpinBoxNoSign
from linien_gui.utils import get_linien_app_instance, param2ui
from PyQt5 import QtWidgets, uic
from PyQt6 import QtWidgets, uic


class ModulationAndSweepPanel(QtWidgets.QWidget):
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/new_device_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from linien_client.device import Device, add_device, update_device
from linien_gui.config import UI_PATH
from PyQt5 import QtWidgets, uic
from PyQt6 import QtWidgets, uic


class NewDeviceDialog(QtWidgets.QDialog):
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/optimization_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from linien_gui.config import UI_PATH
from linien_gui.ui.spin_box import CustomDoubleSpinBoxNoSign
from linien_gui.utils import get_linien_app_instance, param2ui
from PyQt5 import QtWidgets, uic
from PyQt6 import QtWidgets, uic


class OptimizationPanel(QtWidgets.QWidget):
Expand Down
4 changes: 2 additions & 2 deletions linien-gui/linien_gui/ui/plot_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
)
from linien_gui.config import DEFAULT_PLOT_RATE_LIMIT, N_COLORS, Color
from linien_gui.utils import get_linien_app_instance
from PyQt5 import QtGui, QtWidgets
from PyQt5.QtCore import pyqtSignal
from PyQt6 import QtGui, QtWidgets
from PyQt6.QtCore import pyqtSignal
from pyqtgraph.Qt import QtCore

# NOTE: this is required for using a pen_width > 1. There is a bug though that causes
Expand Down
4 changes: 2 additions & 2 deletions linien-gui/linien_gui/ui/psd_table_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from datetime import datetime

from linien_gui.utils import color_to_hex, get_linien_app_instance
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtCore import pyqtSignal
from PyQt6 import QtCore, QtWidgets
from PyQt6.QtCore import pyqtSignal


class PSDTableWidget(QtWidgets.QTableWidget):
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/psd_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
param2ui,
set_window_icon,
)
from PyQt5 import QtWidgets, uic
from PyQt6 import QtWidgets, uic


class PSDWindow(QtWidgets.QMainWindow):
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/right_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# along with Linien. If not, see <http://www.gnu.org/licenses/>.

from linien_gui.utils import get_linien_app_instance
from PyQt5 import QtCore, QtWidgets
from PyQt6 import QtCore, QtWidgets


class RightPanel(QtWidgets.QWidget):
Expand Down
6 changes: 3 additions & 3 deletions linien-gui/linien_gui/ui/spectroscopy_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from linien_gui.config import UI_PATH
from linien_gui.ui.spin_box import CustomDoubleSpinBox, CustomDoubleSpinBoxNoSign
from linien_gui.utils import get_linien_app_instance, param2ui
from PyQt5 import QtWidgets, uic
from PyQt6 import QtWidgets, uic


class SpectroscopyPanel(QtWidgets.QWidget):
Expand All @@ -36,8 +36,8 @@ class SpectroscopyPanel(QtWidgets.QWidget):
manualFilterWidget: QtWidgets.QWidget
signalOffsetSpinBox: CustomDoubleSpinBox

def __init__(self, *args):
super(SpectroscopyPanel, self).__init__(*args)
def __init__(self, *args, **kwargs):
super(SpectroscopyPanel, self).__init__(*args, **kwargs)
uic.loadUi(UI_PATH / "spectroscopy_panel.ui", self)
self.app = get_linien_app_instance()
self.app.connection_established.connect(self.on_connection_established)
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/spin_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with Linien. If not, see <http://www.gnu.org/licenses/>.

from PyQt5.QtWidgets import QDoubleSpinBox, QSpinBox
from PyQt6.QtWidgets import QDoubleSpinBox, QSpinBox


class CustomDoubleSpinBox(QDoubleSpinBox):
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/sweep_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import superqt
from linien_gui.utils import get_linien_app_instance
from PyQt5 import QtCore, QtWidgets
from PyQt6 import QtCore, QtWidgets


class SweepControlWidget(QtWidgets.QWidget):
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/version_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import linien_gui
import requests
from packaging import version
from PyQt5.QtCore import QThread, pyqtSignal
from PyQt6.QtCore import QThread, pyqtSignal

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/linien_gui/ui/view_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from linien_gui.config import N_COLORS, UI_PATH
from linien_gui.ui.spin_box import CustomDoubleSpinBoxNoSign, CustomSpinBox
from linien_gui.utils import color_to_hex, get_linien_app_instance, param2ui
from PyQt5 import QtGui, QtWidgets, uic
from PyQt6 import QtGui, QtWidgets, uic


class ViewPanel(QtWidgets.QWidget):
Expand Down
4 changes: 2 additions & 2 deletions linien-gui/linien_gui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from typing import TYPE_CHECKING, Any, Callable, Tuple

from linien_client.remote_parameters import RemoteParameter
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import (
from PyQt6 import QtWidgets
from PyQt6.QtWidgets import (
QCheckBox,
QComboBox,
QDoubleSpinBox,
Expand Down
12 changes: 6 additions & 6 deletions linien-gui/pkg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
, setuptools
, requests
, pyqtgraph
, pyqt5
, pyqt6
, superqt
, click
, linien-client
, qt5
, qt6
, makeDesktopItem
, copyDesktopItems
, graphicsmagick
Expand All @@ -24,20 +24,20 @@ buildPythonPackage rec {

nativeBuildInputs = [
setuptools
qt5.wrapQtAppsHook
qt6.wrapQtAppsHook
copyDesktopItems
graphicsmagick
];

buildInputs = [
qt5.qtbase
qt5.qtwayland
qt6.qtbase
qt6.qtwayland
];

propagatedBuildInputs = [
requests
pyqtgraph
pyqt5
pyqt6
superqt
click
linien-client
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/pyinstaller.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ a = Analysis(
pathex=[],
binaries=[],
datas=datas,
hiddenimports=["PyQt5.sip", "superqt", "scipy.special._cdflib"],
hiddenimports=["PyQt6.sip", "superqt", "scipy.special._cdflib"],
hookspath=[],
runtime_hooks=[],
excludes=[],
Expand Down
2 changes: 1 addition & 1 deletion linien-gui/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ requires-python = ">=3.8"
dependencies = [
"click>=8.1.7,<9.0",
"pyqtgraph>=0.10.0",
"PyQt5>=5.12.0,<6.0",
"PyQt6<7.0",
"requests>=2.31.0,<3.0",
"superqt>=0.2.3",
"linien_client==2.0.4",
Expand Down

0 comments on commit c95a710

Please sign in to comment.