Skip to content

Commit

Permalink
Merge pull request #738 from ImperialCollegeLondon/fix-pyside-mypy
Browse files Browse the repository at this point in the history
Update PySide6 and fix warnings
  • Loading branch information
alexdewar authored Dec 11, 2024
2 parents 4f743d9 + bfbc3e8 commit 788b7f3
Show file tree
Hide file tree
Showing 15 changed files with 481 additions and 515 deletions.
8 changes: 3 additions & 5 deletions finesse/gui/hardware_set/hardware_sets_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
QPushButton,
QSizePolicy,
QVBoxLayout,
QWidget,
)

from finesse.device_info import DeviceInstanceRef
Expand Down Expand Up @@ -66,14 +65,13 @@ def _get_last_selected_hardware_set() -> HardwareSet | None:
class ManageDevicesDialog(QDialog):
"""A dialog for manually opening, closing and configuring devices."""

def __init__(self, parent: QWidget, connected_devices: Set[OpenDeviceArgs]) -> None:
def __init__(self, connected_devices: Set[OpenDeviceArgs]) -> None:
"""Create a new ManageDevicesDialog.
Args:
parent: Parent window
connected_devices: Which devices are already connected
"""
super().__init__(parent)
super().__init__()
self.setWindowTitle("Manage devices")
self.setModal(True)

Expand Down Expand Up @@ -180,7 +178,7 @@ def _show_manage_devices_dialog(self) -> None:
"""
if not hasattr(self, "_manage_devices_dialog"):
self._manage_devices_dialog = ManageDevicesDialog(
self.window(), self._get_connected_devices()
self._get_connected_devices()
)

self._manage_devices_dialog.show()
Expand Down
5 changes: 2 additions & 3 deletions finesse/gui/measure_script/script_edit_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@
class ScriptEditDialog(QDialog):
"""A dialog to create and edit measure scripts."""

def __init__(self, parent: QWidget, script: Script | None = None) -> None:
def __init__(self, script: Script | None = None) -> None:
"""Create a new ScriptEditDialog.
Args:
parent: Parent widget
script: A loaded measure script or None
"""
super().__init__(parent)
super().__init__()
self.setWindowTitle("Edit measurement script")
self.setModal(True)

Expand Down
6 changes: 2 additions & 4 deletions finesse/gui/measure_script/script_run_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
QProgressBar,
QPushButton,
QVBoxLayout,
QWidget,
)

from finesse.gui.measure_script.script import Script, ScriptRunner
Expand All @@ -28,14 +27,13 @@ def get_total_steps(script: Script) -> int:
class ScriptRunDialog(QDialog):
"""A dialog to display the progress of a running measure script."""

def __init__(self, parent: QWidget, script_runner: ScriptRunner) -> None:
def __init__(self, script_runner: ScriptRunner) -> None:
"""Create a new ScriptRunDialog.
Args:
parent: The parent widget (window)
script_runner: The ScriptRunner managing the current script
"""
super().__init__(parent)
super().__init__()
self.setWindowTitle("Running measure script")
self.setModal(True)
self.setMinimumSize(400, 100)
Expand Down
6 changes: 3 additions & 3 deletions finesse/gui/measure_script/script_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _on_recording_stop(self) -> None:
self._data_file_recording = False

def _create_btn_clicked(self) -> None:
self.edit_dialog = ScriptEditDialog(self.window())
self.edit_dialog = ScriptEditDialog()
self.edit_dialog.show()

def _edit_btn_clicked(self) -> None:
Expand All @@ -124,7 +124,7 @@ def _edit_btn_clicked(self) -> None:
return

# Create new dialog showing contents of script
self.edit_dialog = ScriptEditDialog(self.window(), script)
self.edit_dialog = ScriptEditDialog(script)
self.edit_dialog.show()

def _check_data_file_recording(self) -> bool:
Expand Down Expand Up @@ -172,7 +172,7 @@ def _run_btn_clicked(self) -> None:

def _show_run_dialog(self, script_runner: ScriptRunner) -> None:
"""Create a new ScriptRunDialog and show it."""
self.run_dialog = ScriptRunDialog(self.window(), script_runner)
self.run_dialog = ScriptRunDialog(script_runner)
self.run_dialog.show()

def _hide_run_dialog(self) -> None:
Expand Down
3 changes: 1 addition & 2 deletions finesse/hardware/plugins/sensors/decades.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from functools import partial
from typing import Any

from PySide6.QtCore import QUrlQuery, Slot
from PySide6.QtCore import QUrlQuery
from PySide6.QtNetwork import QNetworkReply

from finesse.config import (
Expand Down Expand Up @@ -168,7 +168,6 @@ def _get_decades_data(self, content: dict[str, list]) -> Iterable[SensorReading]
f"DECADES: Server did not return data for parameter {param.name}"
)

@Slot()
def _on_reply_received(self, reply: QNetworkReply) -> None:
"""Handle received HTTP reply.
Expand Down
2 changes: 0 additions & 2 deletions finesse/hardware/plugins/sensors/em27_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from decimal import Decimal

from PySide6.QtCore import Slot
from PySide6.QtNetwork import QNetworkReply

from finesse.config import EM27_HOST, EM27_SENSORS_POLL_INTERVAL, EM27_SENSORS_URL
Expand Down Expand Up @@ -76,7 +75,6 @@ def request_readings(self) -> None:
self.pubsub_errors(self._on_reply_received),
)

@Slot()
def _on_reply_received(self, reply: QNetworkReply) -> None:
"""Handle received HTTP reply.
Expand Down
3 changes: 1 addition & 2 deletions finesse/hardware/plugins/spectrometer/opus_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import logging

from bs4 import BeautifulSoup
from PySide6.QtCore import QTimer, Slot
from PySide6.QtCore import QTimer
from PySide6.QtNetwork import QNetworkReply

from finesse.config import (
Expand Down Expand Up @@ -109,7 +109,6 @@ def close(self) -> None:
self._status_timer.stop()
super().close()

@Slot()
def _on_reply_received(self, reply: QNetworkReply) -> None:
"""Handle received HTTP reply."""
if reply.error() != QNetworkReply.NetworkError.NoError:
Expand Down
Loading

0 comments on commit 788b7f3

Please sign in to comment.