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

Transition to PySide6 #69

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions docs/module_conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ so it keeps track of them and also shows them in the thread view.
A simple example for spawning a worker thread and executing a worker method inside this thread.
```Python
import time
from PySide2.QtCore import QObject, QThread
from PySide6.QtCore import QObject, QThread
from qudi.core.threadmanager import ThreadManager


Expand All @@ -118,7 +118,7 @@ def run_in_thread(thread_name='MyThread'):
thread_manager = ThreadManager.instance()
if thread_manager is None:
raise RuntimeError('No thread manager found. Qudi application is probably not running.')
# Get a newly spawned thread (PySide2.QtCore.QThread) from the thread manager and give it a name
# Get a newly spawned thread (PySide6.QtCore.QThread) from the thread manager and give it a name
my_thread = thread_manager.get_new_thread(thread_name)
# Create worker instance and move the worker object to the new thread
my_worker = Worker()
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'nidaqmx>=0.5.7',
'numpy>=1.23.3',
'pyqtgraph>=0.13.1',
'PySide2>=5.15.2',
'PySide6',
'PyVisa>=1.12.0',
'scipy>=1.9.1',
'zaber_motion>=2.14.6'
Expand All @@ -30,7 +30,7 @@
'nidaqmx>=0.5.7',
'numpy>>=1.23.3',
'pyqtgraph>=0.13.1',
'PySide2>=5.15.2',
'PySide6',
'PyVisa>=1.12.0',
'scipy>=1.9.1',
'zaber_motion>=2.14.6'
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/camera/camera_settings_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

__all__ = ('CameraSettingsDialog',)

from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets
from qudi.util.widgets.scientific_spinbox import ScienDSpinBox


Expand Down
12 changes: 6 additions & 6 deletions src/qudi/gui/camera/cameragui.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"""

import os
from PySide2 import QtCore, QtWidgets, QtGui
from PySide6 import QtCore, QtWidgets, QtGui
import datetime

from qudi.core.module import GuiBase
Expand All @@ -40,17 +40,17 @@ def __init__(self, *args, **kwargs):
# Create menu bar
menu_bar = QtWidgets.QMenuBar()
menu = menu_bar.addMenu('File')
self.action_save_frame = QtWidgets.QAction('Save Frame')
self.action_save_frame = QtGui.QAction('Save Frame')
path = os.path.join(get_artwork_dir(), 'icons', 'document-save')
self.action_save_frame.setIcon(QtGui.QIcon(path))
menu.addAction(self.action_save_frame)
menu.addSeparator()
self.action_show_settings = QtWidgets.QAction('Settings')
self.action_show_settings = QtGui.QAction('Settings')
path = os.path.join(get_artwork_dir(), 'icons', 'configure')
self.action_show_settings.setIcon(QtGui.QIcon(path))
menu.addAction(self.action_show_settings)
menu.addSeparator()
self.action_close = QtWidgets.QAction('Close')
self.action_close = QtGui.QAction('Close')
path = os.path.join(get_artwork_dir(), 'icons', 'application-exit')
self.action_close.setIcon(QtGui.QIcon(path))
self.action_close.triggered.connect(self.close)
Expand All @@ -60,10 +60,10 @@ def __init__(self, *args, **kwargs):
# Create toolbar
toolbar = QtWidgets.QToolBar()
toolbar.setAllowedAreas(QtCore.Qt.AllToolBarAreas)
self.action_start_video = QtWidgets.QAction('Start Video')
self.action_start_video = QtGui.QAction('Start Video')
self.action_start_video.setCheckable(True)
toolbar.addAction(self.action_start_video)
self.action_capture_frame = QtWidgets.QAction('Capture Frame')
self.action_capture_frame = QtGui.QAction('Capture Frame')
self.action_capture_frame.setCheckable(True)
toolbar.addAction(self.action_capture_frame)
self.addToolBar(QtCore.Qt.TopToolBarArea, toolbar)
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/laser/laser_control_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

__all__ = ('LaserControlDockWidget',)

from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets

from qudi.util.widgets.scientific_spinbox import ScienDSpinBox
from qudi.util.widgets.slider import DoubleSlider
Expand Down
16 changes: 7 additions & 9 deletions src/qudi/gui/laser/laser_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"""

import os
from PySide2 import QtCore, QtWidgets, QtGui
from PySide6 import QtCore, QtWidgets, QtGui

from qudi.core.connector import Connector
from qudi.util.colordefs import QudiPalettePale as palette
Expand Down Expand Up @@ -52,34 +52,34 @@ def __init__(self, *args, **kwargs):
layout.addWidget(self.extra_info_label)
layout.addWidget(extra_info_button_box)
self.extra_info_dialog.setLayout(layout)
layout.setSizeConstraint(layout.SetFixedSize)
layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)

# create menu bar and actions
menu_bar = QtWidgets.QMenuBar(self)
self.setMenuBar(menu_bar)

menu = menu_bar.addMenu('File')
self.action_close = QtWidgets.QAction('Close')
self.action_close = QtGui.QAction('Close')
path = os.path.join(get_artwork_dir(), 'icons', 'application-exit')
self.action_close.setIcon(QtGui.QIcon(path))
self.action_close.triggered.connect(self.close)
menu.addAction(self.action_close)

menu = menu_bar.addMenu('View')
self.action_view_controls = QtWidgets.QAction('Show Controls')
self.action_view_controls = QtGui.QAction('Show Controls')
self.action_view_controls.setCheckable(True)
self.action_view_controls.setChecked(True)
menu.addAction(self.action_view_controls)
self.action_view_output_graph = QtWidgets.QAction('Show Output Graph')
self.action_view_output_graph = QtGui.QAction('Show Output Graph')
self.action_view_output_graph.setCheckable(True)
self.action_view_output_graph.setChecked(True)
menu.addAction(self.action_view_output_graph)
self.action_view_temperature_graph = QtWidgets.QAction('Show Temperature Graph')
self.action_view_temperature_graph = QtGui.QAction('Show Temperature Graph')
self.action_view_temperature_graph.setCheckable(True)
self.action_view_temperature_graph.setChecked(True)
menu.addAction(self.action_view_temperature_graph)
menu.addSeparator()
self.action_view_default = QtWidgets.QAction('Restore Default')
self.action_view_default = QtGui.QAction('Restore Default')
menu.addAction(self.action_view_default)

# Create status bar
Expand Down Expand Up @@ -187,7 +187,6 @@ def on_activate(self):
self.control_dock_widget.current_spinbox.setSuffix(logic.current_unit)

self.output_graph_dock_widget = LaserOutputDockWidget()
self.output_graph_dock_widget.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.output_graph_dock_widget.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
self._mw.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.output_graph_dock_widget)
self.output_graph_dock_widget.visibilityChanged.connect(
Expand All @@ -204,7 +203,6 @@ def on_activate(self):
self.temperature_graph_dock_widget = LaserTemperatureDockWidget(
curve_names=tuple(logic.temperatures)
)
self.temperature_graph_dock_widget.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.temperature_graph_dock_widget.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
self._mw.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.temperature_graph_dock_widget)
self.temperature_graph_dock_widget.visibilityChanged.connect(
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/laser/laser_plot_dockwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import time
import pyqtgraph as pg
from PySide2 import QtCore
from PySide6 import QtCore

from qudi.util.colordefs import QudiPalettePale as palette
from qudi.util.widgets.advanced_dockwidget import AdvancedDockWidget
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/laserscanner/laserscannergui.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qudi.util.colordefs import QudiPalettePale as palette
from qudi.core.module import GuiBase
from qudi.util.paths import get_artwork_dir
from PySide2 import QtCore, QtWidgets, QtGui
from PySide6 import QtCore, QtWidgets, QtGui
from qudi.util.uic import loadUi


Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/nv_calculator/nv_calculatorgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from qudi.core.connector import Connector
from qudi.core.module import GuiBase
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets
from qudi.util import uic


Expand Down
6 changes: 3 additions & 3 deletions src/qudi/gui/odmr/odmr_control_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
__all__ = ('OdmrCwControlDockWidget', 'OdmrScanControlDockWidget')

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

from qudi.util.widgets.advanced_dockwidget import AdvancedDockWidget
from qudi.util.widgets.scientific_spinbox import ScienDSpinBox
Expand Down Expand Up @@ -116,7 +116,7 @@ class OdmrScanControlDockWidget(AdvancedDockWidget):
def __init__(self, *args, power_range=None, frequency_range=None, data_channels=None, points_range=None, **kwargs):
super().__init__(*args, **kwargs)
self.setWindowTitle('ODMR Scan Control')
self.setFeatures(self.DockWidgetFloatable | self.DockWidgetMovable)
self.setFeatures(QtWidgets.QDockWidget.DockWidgetFloatable | QtWidgets.QDockWidget.DockWidgetMovable)

# Determine minimal spinbox width from current default metrics
self._min_spinbox_width = QtGui.QFontMetrics(ScienDSpinBox().font()).width(
Expand Down Expand Up @@ -167,7 +167,7 @@ def __init__(self, *args, power_range=None, frequency_range=None, data_channels=
h_layout.addWidget(self.scan_power_spinbox)
layout.addLayout(h_layout)
frame = QtWidgets.QFrame()
frame.setFrameShape(frame.HLine)
frame.setFrameShape(QtWidgets.QFrame.HLine)
layout.addWidget(frame)
self._ranges_layout = QtWidgets.QGridLayout()
self._ranges_layout.setContentsMargins(0, 0, 0, 0)
Expand Down
3 changes: 2 additions & 1 deletion src/qudi/gui/odmr/odmr_fit_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

__all__ = ('OdmrFitDockWidget',)

from PySide6 import QtWidgets
from qudi.util.widgets.advanced_dockwidget import AdvancedDockWidget
from qudi.util.widgets.fitting import FitWidget

Expand All @@ -33,7 +34,7 @@ class OdmrFitDockWidget(AdvancedDockWidget):
def __init__(self, *args, fit_container=None, **kwargs):
super().__init__(*args, **kwargs)
self.setWindowTitle('ODMR Fit')
self.setFeatures(self.DockWidgetFloatable | self.DockWidgetMovable)
self.setFeatures(QtWidgets.QDockWidget.DockWidgetFloatable | QtWidgets.QDockWidget.DockWidgetMovable)

self.fit_widget = FitWidget(fit_container=fit_container)
self.setWidget(self.fit_widget)
20 changes: 10 additions & 10 deletions src/qudi/gui/odmr/odmr_main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import os
import datetime
from PySide2 import QtCore, QtWidgets, QtGui
from PySide6 import QtCore, QtWidgets, QtGui

from qudi.util.widgets.scientific_spinbox import ScienDSpinBox
from qudi.util.paths import get_artwork_dir
Expand All @@ -50,50 +50,50 @@ def __init__(self, *args, **kwargs):
icon = QtGui.QIcon(os.path.join(icon_path, 'start-counter'))
icon.addFile(os.path.join(icon_path, 'stop-counter'),
state=QtGui.QIcon.On)
self.action_toggle_measurement = QtWidgets.QAction('Toggle Measurement')
self.action_toggle_measurement = QtGui.QAction('Toggle Measurement')
self.action_toggle_measurement.setCheckable(True)
self.action_toggle_measurement.setIcon(icon)
self.action_toggle_measurement.setToolTip('Start/Stop ODMR scan measurement')

icon = QtGui.QIcon(os.path.join(icon_path, 'restart-counter'))
self.action_resume_measurement = QtWidgets.QAction('Resume Measurement')
self.action_resume_measurement = QtGui.QAction('Resume Measurement')
self.action_resume_measurement.setIcon(icon)
self.action_resume_measurement.setToolTip('Resume ODMR scan measurement')

icon = QtGui.QIcon(os.path.join(icon_path, 'document-save'))
self.action_save_measurement = QtWidgets.QAction('Save Measurement')
self.action_save_measurement = QtGui.QAction('Save Measurement')
self.action_save_measurement.setIcon(icon)
self.action_save_measurement.setToolTip(
'Save ODMR scan measurement.\n'
'Use text field in the toolbar to specify a nametag for the file.'
)

icon = QtGui.QIcon(os.path.join(icon_path, 'dialog-warning'))
self.action_toggle_cw = QtWidgets.QAction('Toggle CW')
self.action_toggle_cw = QtGui.QAction('Toggle CW')
self.action_toggle_cw.setCheckable(True)
self.action_toggle_cw.setIcon(icon)
self.action_toggle_cw.setToolTip('Toggle continuous microwave output.\n'
'WARNING: Ensure RF network can handle CW power.')

icon = QtGui.QIcon(os.path.join(icon_path, 'application-exit'))
self.action_close = QtWidgets.QAction('Close')
self.action_close = QtGui.QAction('Close')
self.action_close.setIcon(icon)

self.action_show_cw_controls = QtWidgets.QAction('Show CW Controls')
self.action_show_cw_controls = QtGui.QAction('Show CW Controls')
self.action_show_cw_controls.setCheckable(True)
self.action_show_cw_controls.setChecked(True)
self.action_show_cw_controls.setToolTip('Show/Hide CW controls')

self.action_restore_default_view = QtWidgets.QAction('Restore Default')
self.action_restore_default_view = QtGui.QAction('Restore Default')

icon = QtGui.QIcon(os.path.join(icon_path, 'configure'))
self.action_show_odmr_settings = QtWidgets.QAction('ODMR Settings')
self.action_show_odmr_settings = QtGui.QAction('ODMR Settings')
self.action_show_odmr_settings.setToolTip(
'Open a dialog to edit ODMR settings that are not very frequently used.'
)
self.action_show_odmr_settings.setIcon(icon)

self.action_show_fit_configuration = QtWidgets.QAction('Fit Configuration')
self.action_show_fit_configuration = QtGui.QAction('Fit Configuration')
self.action_show_fit_configuration.setToolTip(
'Open a dialog to edit data fitting configurations available to ODMR.'
)
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/odmr/odmr_plot_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
__all__ = ('OdmrPlotWidget',)

import pyqtgraph as pg
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets

from qudi.util.widgets.plotting.plot_item import DataImageItem
from qudi.util.widgets.plotting.colorbar import ColorBarWidget
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/odmr/odmr_settings_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
__all__ = ('OdmrSettingsDialog',)

import numpy as np
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets
from qudi.util.widgets.scientific_spinbox import ScienDSpinBox
from qudi.util.units import ScaledFloat

Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/odmr/odmrgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import os
import datetime
import numpy as np
from PySide2 import QtCore, QtWidgets, QtGui
from PySide6 import QtCore, QtWidgets, QtGui

from qudi.core.connector import Connector
from qudi.core.statusvariable import StatusVar
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/pidgui/pidgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from qudi.util.colordefs import QudiPalettePale as palette
from qudi.util.units import create_formatted_output
from qudi.core.module import GuiBase
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets


class PIDMainWindow(QtWidgets.QMainWindow):
Expand Down
14 changes: 7 additions & 7 deletions src/qudi/gui/poimanager/poimanagergui.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from qudi.core.module import GuiBase

from qudi.util.colordefs import QudiPalettePale as palette
from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets
from qudi.util import uic
from qudi.util.widgets.plotting.image_widget import MouseTrackingImageWidget

Expand Down Expand Up @@ -201,19 +201,19 @@ def validate(self, string, position):
# Return intermediate status when empty string is passed
if not string:
if self._empty_allowed:
return self.Acceptable, '', position
return QtGui.QValidator.Acceptable, '', position
else:
return self.Intermediate, string, position
return QtGui.QValidator.Intermediate, string, position

match = self.name_re.match(string)
if not match:
return self.Invalid, '', position
return QtGui.QValidator.Invalid, '', position

matched = match.group()
if matched == string:
return self.Acceptable, string, position
return QtGui.QValidator.Acceptable, string, position

return self.Invalid, matched, position
return QtGui.QValidator.Invalid, matched, position

def fixup(self, text):
match = self.name_re.search(text)
Expand Down Expand Up @@ -471,7 +471,7 @@ def __connect_control_signals_to_logic(self):
self._poi_manager_logic().set_poi_anchor_from_position, QtCore.Qt.QueuedConnection)
self._mw.delete_poi_PushButton.clicked.connect(
self._poi_manager_logic().delete_poi, QtCore.Qt.QueuedConnection)
self._mw.active_poi_ComboBox.activated[str].connect(
self._mw.active_poi_ComboBox.currentTextChanged.connect(
self._poi_manager_logic().set_active_poi, QtCore.Qt.QueuedConnection)
self._mw.goto_poi_after_update_checkBox.stateChanged.connect(
self._poi_manager_logic().set_move_scanner_after_optimise, QtCore.Qt.QueuedConnection)
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/pulsed/pulse_editors.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import copy

from qudi.util.helpers import natural_sort
from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets
from qudi.gui.pulsed.pulsed_item_delegates import ScienDSpinBoxItemDelegate, ComboBoxItemDelegate
from qudi.gui.pulsed.pulsed_item_delegates import MultipleCheckboxItemDelegate, CheckBoxItemDelegate
from qudi.gui.pulsed.pulsed_item_delegates import SpinBoxItemDelegate, AnalogParametersItemDelegate
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/pulsed/pulsed_custom_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"""

from enum import Enum
from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets
from qudi.util.widgets.scientific_spinbox import ScienDSpinBox, ScienSpinBox


Expand Down
Loading