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

Port Qiskit Metal from PySide2 to PySide6 #908

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
- name: Install Deps
run: |
python -m pip install -U tox setuptools virtualenv wheel
sudo apt install libglu1-mesa libglu1-mesa-dev
sudo apt update
sudo apt install libglu1-mesa libglu1-mesa-dev libegl1-mesa
- name: Install and Run Tests
run: tox -e py
macos-tests:
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=PySide2
extension-pkg-whitelist=PySide6

# Add files or directories to the blacklist. They should be base names, not
# paths.
Expand Down
13 changes: 9 additions & 4 deletions docs/tut/quick-topics/Managing-variables.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
- pint
- pyepr-quantum>=0.8.5.7
- pygments
- pyside2
- qdarkstyle
- qutip
- scipy
Expand All @@ -25,3 +24,4 @@ dependencies:
- pip:
- pyaedt
- gmsh
- pyside6
8 changes: 4 additions & 4 deletions qiskit_metal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def __setup_Qt_backend(): # pylint: disable=invalid-name

# When in vscode and in debug-mode, may want to comment
# next line out, "os.environ["QT_API"] = "pyside2""
os.environ["QT_API"] = "pyside2"
os.environ["QT_API"] = "pyside6"

from PySide2 import QtCore #, QtWidgets
from PySide2.QtCore import Qt
from PySide6 import QtCore #, QtWidgets
from PySide6.QtCore import Qt

def set_attribute(name: str, value=True):
"""Describes attributes that change the behavior of application-wide
Expand Down Expand Up @@ -107,7 +107,7 @@ def set_attribute(name: str, value=True):
if not os.getenv('QISKIT_METAL_HEADLESS', None):
# pylint: disable=import-outside-toplevel
import matplotlib as mpl
mpl.use("Qt5Agg")
mpl.use("QtAgg")
# pylint: disable=redefined-outer-name
import matplotlib.pyplot as plt
plt.ion() # interactive
Expand Down
10 changes: 5 additions & 5 deletions qiskit_metal/_gui/__compile_ui_to_py.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ cd /d "%~dp0"

echo "The current directory is %CD%"

call pyside2-uic -o main_window_ui.py --from-imports main_window_ui.ui
call pyside2-uic -o component_widget_ui.py --from-imports component_widget_ui.ui
call pyside2-uic -o plot_window_ui.py --from-imports plot_window_ui.ui
call pyside2-uic -o elements_ui.py --from-imports elements_ui.ui
call pyside6-uic -o main_window_ui.py --from-imports main_window_ui.ui
call pyside6-uic -o component_widget_ui.py --from-imports component_widget_ui.ui
call pyside6-uic -o plot_window_ui.py --from-imports plot_window_ui.ui
call pyside6-uic -o elements_ui.py --from-imports elements_ui.ui

call pyside2-rcc -o main_window_rc_rc.py main_window_rc.qrc
call pyside6-rcc -o main_window_rc_rc.py main_window_rc.qrc

rem ############################################################################
rem # Zlatko:
Expand Down
6 changes: 3 additions & 3 deletions qiskit_metal/_gui/__compile_ui_to_py.shell
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ cd "$(dirname "$0")"
echo -e "Present working directory: ${RED}${PWD}${NC}"

# Define conversion
ui_to_py=pyside2-uic
rc_to_py=pyside2-rcc
# pyside2-uic
ui_to_py=pyside6-uic
rc_to_py=pyside6-rcc
# pyside6-uic
# -o : The Python code generated is written to the file <FILE>.
# -i : Resource modules are imported using
# from <PACKAGE> import ... rather than a simple import ....
Expand Down
4 changes: 2 additions & 2 deletions qiskit_metal/_gui/component_widget_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# licensing of './component_widget_ui.ui' applies.
#
# Created: Sat Jun 19 22:02:29 2021
# by: pyside2-uic running on PySide2 5.13.2
# by: pyside6-uic running on PySide2 5.13.2
#
# WARNING! All changes made in this file will be lost!

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


class Ui_ComponentWidget(object):
Expand Down
8 changes: 4 additions & 4 deletions qiskit_metal/_gui/elements_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# licensing of './elements_ui.ui' applies.
#
# Created: Thu Jun 30 16:30:20 2022
# by: pyside2-uic running on PySide2 5.13.2
# by: pyside6-uic running on PySide2 5.13.2
#
# WARNING! All changes made in this file will be lost!

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


class Ui_ElementsWindow(object):
Expand Down Expand Up @@ -50,7 +50,7 @@ def setupUi(self, ElementsWindow):
self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setWeight(75)
font.setLegacyWeight(75)
font.setBold(True)
self.label.setFont(font)
self.label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing |
Expand All @@ -77,7 +77,7 @@ def setupUi(self, ElementsWindow):
self.horizontalLayout.addWidget(self.line)
self.label_3 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setWeight(75)
font.setLegacyWeight(75)
font.setBold(True)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
Expand Down
8 changes: 4 additions & 4 deletions qiskit_metal/_gui/elements_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from typing import TYPE_CHECKING

import numpy as np
from PySide2 import QtCore, QtWidgets
from PySide2.QtCore import QAbstractTableModel, QModelIndex
from PySide2.QtWidgets import QMainWindow
from PySide6 import QtCore, QtWidgets
from PySide6.QtCore import QAbstractTableModel, QModelIndex
from PySide6.QtWidgets import QMainWindow

from .elements_ui import Ui_ElementsWindow

Expand All @@ -33,7 +33,7 @@ class ElementsWindow(QMainWindow):

Extends the `QMainWindow` class.

PySide2 Signal / Slots Extensions:
PySide6 Signal / Slots Extensions:
The UI can call up to this class to execeute button clicks for instance
Extensiosn in qt designer on signals/slots are linked to this class
"""
Expand Down
2 changes: 1 addition & 1 deletion qiskit_metal/_gui/endcap_hfss_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from typing import Tuple

from PySide2.QtWidgets import (QComboBox, QTableWidgetItem, QAbstractItemView,
from PySide6.QtWidgets import (QComboBox, QTableWidgetItem, QAbstractItemView,
QMainWindow, QLineEdit)

from .endcap_hfss_ui import Ui_mainWindow
Expand Down
4 changes: 2 additions & 2 deletions qiskit_metal/_gui/endcap_hfss_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# licensing of './endcap_hfss_ui.ui' applies.
#
# Created: Sat Jun 19 22:02:30 2021
# by: pyside2-uic running on PySide2 5.13.2
# by: pyside6-uic running on PySide2 5.13.2
#
# WARNING! All changes made in this file will be lost!

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


class Ui_mainWindow(object):
Expand Down
2 changes: 1 addition & 1 deletion qiskit_metal/_gui/endcap_q3d_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from typing import Tuple

from PySide2.QtWidgets import (QComboBox, QTableWidgetItem, QAbstractItemView,
from PySide6.QtWidgets import (QComboBox, QTableWidgetItem, QAbstractItemView,
QMainWindow)

from .endcap_q3d_ui import Ui_mainWindow
Expand Down
4 changes: 2 additions & 2 deletions qiskit_metal/_gui/endcap_q3d_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# licensing of './endcap_q3d_ui.ui' applies.
#
# Created: Sat Jun 19 22:02:29 2021
# by: pyside2-uic running on PySide2 5.13.2
# by: pyside6-uic running on PySide2 5.13.2
#
# WARNING! All changes made in this file will be lost!

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


class Ui_mainWindow(object):
Expand Down
6 changes: 3 additions & 3 deletions qiskit_metal/_gui/list_model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

from PySide2 import QtCore
from PySide2.QtCore import Qt
from PySide2.QtGui import QStandardItem, QStandardItemModel
from PySide6 import QtCore
from PySide6.QtCore import Qt
from PySide6.QtGui import QStandardItem, QStandardItemModel


class DynamicList(QStandardItemModel):
Expand Down
12 changes: 7 additions & 5 deletions qiskit_metal/_gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
from pathlib import Path
from typing import TYPE_CHECKING, List

from PySide2.QtCore import Qt, QTimer
from PySide2.QtGui import QIcon, QPixmap
from PySide2.QtWidgets import (QAction, QDialog, QDockWidget, QFileDialog,
QLabel, QMainWindow, QMessageBox, QVBoxLayout)
from PySide2.QtCore import QSortFilterProxyModel
from PySide6.QtCore import Qt, QTimer
from PySide6.QtGui import QIcon, QPixmap, QAction
from PySide6.QtWidgets import (QDialog, QDockWidget, QFileDialog, QLabel,
QMainWindow, QMessageBox, QVBoxLayout)
from PySide6.QtCore import QSortFilterProxyModel
from qiskit_metal._gui.widgets.qlibrary_display.delegate_qlibrary import \
LibraryDelegate
from qiskit_metal._gui.widgets.qlibrary_display.file_model_qlibrary import \
Expand Down Expand Up @@ -323,13 +323,15 @@ def __init__(self, design: QDesign = None):
self._setup_plot_widget()
self._setup_design_components_widget()
self._setup_elements_widget()
self.main_window.show()
self._setup_variables_widget()
self._ui_adjustments_final()
self._setup_library_widget()
self._setup_net_list_widget()

# Show and raise
self.main_window.show()

# self.qApp.processEvents(QEventLoop.AllEvents, 1)
# - don't think I need this here, it doesn't help to show and raise
# - need to call from different thread.
Expand Down
12 changes: 6 additions & 6 deletions qiskit_metal/_gui/main_window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from copy import deepcopy
from pathlib import Path

from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import QTimer
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QApplication, QFileDialog, QMainWindow, QMessageBox, QDockWidget
from PySide6 import QtCore, QtGui, QtWidgets
from PySide6.QtCore import QTimer
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QApplication, QFileDialog, QMainWindow, QMessageBox, QDockWidget

from .. import Dict, config
from ..toolbox_python._logging import setup_logger
Expand Down Expand Up @@ -497,7 +497,7 @@ def load_stylesheet(self, path=None):
'Please do so from the terminal using\n'
' >>> pip install qdarkstyle')

os.environ['QT_API'] = 'pyside2'
os.environ['QT_API'] = 'pyside6'
self.main_window.setStyleSheet(qdarkstyle.load_stylesheet())

elif path == 'metal_dark':
Expand Down Expand Up @@ -618,7 +618,7 @@ def kick_start_qApp():
try:
from IPython import get_ipython
ipython = get_ipython()
ipython.magic('gui qt5')
ipython.magic('gui qt6')

except Exception as e:
print("exception")
Expand Down
4 changes: 2 additions & 2 deletions qiskit_metal/_gui/main_window_rc_rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Resource object code
#
# Created: Thu Jun 30 16:30:21 2022
# by: The Resource Compiler for PySide2 (Qt v5.12.9)
# by: The Resource Compiler for PySide6 (Qt v5.12.9)
#
# WARNING! All changes made in this file will be lost!

from PySide2 import QtCore
from PySide6 import QtCore

qt_resource_data = b"\
\x00\x00e\xee\
Expand Down
Loading