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

PySide6 Compatibility #1002

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cd38ee9
Change PySide2 imports to PySide6 imports
obrienpja Aug 22, 2022
2d85448
Update QT_API to PySide6 and update mpl backend
obrienpja Sep 25, 2022
8f1263a
Merge branch 'main' into pyside6-v2
obrienpja Jan 25, 2023
a00ea96
Install libegl in ubuntu environment
obrienpja Jan 26, 2023
e9defda
Comment out mpl.use
obrienpja Jan 26, 2023
d0bcb56
Yapf format main_window.py
obrienpja Jan 31, 2023
2810eb3
Merge branch 'pyside6-v2' of github.com:Qiskit/qiskit-metal into pysi…
obrienpja Jan 31, 2023
61a00c2
Remove sleeps from GUI
obrienpja Feb 1, 2023
fb66b0a
Add qdarkstyle to dependencies
obrienpja Feb 1, 2023
cedd497
Fix version of libegl1 to 22.0.1
obrienpja Feb 6, 2023
c4dd5bd
Fix version number for libegl1
obrienpja Feb 6, 2023
08bf56d
Try installing libegl1 version 22.0.1-1ubuntu2
obrienpja Feb 6, 2023
eb5b94a
Fix libegl1 version to 1.4.0-1
obrienpja Feb 6, 2023
94f791c
Install libegl-mesa0 version 22.0.1-1ubuntu2
obrienpja Feb 6, 2023
35f31ea
Run sudo apt update and remove libegl1 dep
obrienpja Feb 6, 2023
0cfd93a
Change some Qt6 class paths
obrienpja Feb 7, 2023
b6654b4
Merge branch 'main' into pyside6-v2
priti-ashvin-shah-ibm Feb 14, 2023
65d34d7
fix: changed env and qwidget for working gui
shanto268 Nov 18, 2024
a72617f
fix: changed QWidget_PlaceholderText and environment files
shanto268 Nov 18, 2024
352415c
Merge branch 'pyside6-port'
shanto268 Nov 18, 2024
03fe275
docs: got rid of log files
shanto268 Nov 18, 2024
31b612e
fix: changed requirements + fixed the Paths
shanto268 Nov 18, 2024
deb7813
docs: added pyyaml and cython to reqs
shanto268 Nov 18, 2024
566918c
docs: fixing the requirements
shanto268 Nov 18, 2024
a87652e
docs: Fix linting issues to satisfy CI checks
shanto268 Nov 18, 2024
b9ad48c
docs: Update upload-artifact to v3 in docs workflow
shanto268 Nov 18, 2024
06b5b2e
fix: added missing QFileSystemModel import
shanto268 Nov 19, 2024
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
17 changes: 9 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Tests
on:
# Run this workflow every time a new commit is pushed to or a pull request is created from one of these branches
push:
branches: [main, "stable/*"]
branches: [main, 'stable/*']
pull_request:
branches: [main, "stable/*"]
branches: [main, 'stable/*']
jobs:
# NOTE: The ubuntu-22.04 and macos-latest tests have been separated out because ubuntu
# requires installing some additional libraries (libglu1-mesa) for Gmsh to run. Please
Expand All @@ -17,7 +17,7 @@ jobs:
# Set matrix for runs-on
strategy:
matrix:
python-version: ["3.9", "3.10"]
python-version: ['3.9', '3.10']
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -36,8 +36,9 @@ jobs:
ubuntu-latest-${{ matrix.python-version }}
- name: Install Deps
run: |
python -m pip install -U tox==4.11.0 setuptools==67.3.1 virtualenv==20.24.3 wheel==0.38.4
sudo apt install libglu1-mesa=9.0.2-1 libglu1-mesa-dev=9.0.2-1
python -m pip install -U tox setuptools virtualenv wheel
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 All @@ -48,7 +49,7 @@ jobs:
# Set matrix for runs-on
strategy:
matrix:
python-version: ["3.9", "3.10"]
python-version: ['3.9', '3.10']
steps:
- name: Chekout code
uses: actions/checkout@v3
Expand All @@ -74,7 +75,7 @@ jobs:
runs-on: windows-2022
strategy:
matrix:
python-version: ["3.9", "3.10"]
python-version: ['3.9', '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -146,7 +147,7 @@ jobs:
sudo apt install -y graphviz=2.42.2-6 pandoc=2.9.2.1-3ubuntu2 qtbase5-dev=5.15.3+dfsg-2ubuntu0.2 qt5-qmake=5.15.3+dfsg-2ubuntu0.2
- name: Build Docs
run: tox -edocs
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: html_docs
path: docs/_build/html
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.

13 changes: 6 additions & 7 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,27 @@ name: qiskit-metal
channels:
- conda-forge
dependencies:
- python>=3.9
- python=3.10.*
- addict==2.4.0
- descartes==1.1.0
- gdspy==1.6.12
- geopandas==0.12.2
- ipython==8.10.0
- matplotlib==3.7.0
- numpy==1.24.2
- pandas==1.5.3
- pint==0.20.1
- pyepr-quantum==0.8.5.7
- pyEPR-quantum==0.8.5.7
- pygments==2.14.0
- pyside2==5.15.8
- qdarkstyle==3.1
- qutip==4.7.1
- scipy==1.10.0
- shapely==2.0.1
- jupyter==1.0.0
- scqubits==3.1.0
- pyyaml==6.0
- pip==23.0
- jupyter
- cython<3.0.0
- pip
- pip:
- pyaedt==0.6.46
- gmsh==4.11.1
- gdspy==1.6.12
- 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 @@ -18,11 +18,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 @@ -322,13 +322,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
Loading