Skip to content

Commit

Permalink
Merge pull request #11 from nodedge/feature/upgrade-pyside6
Browse files Browse the repository at this point in the history
Feature/upgrade pyside6
  • Loading branch information
nodedge committed Oct 27, 2022
2 parents 5658269 + a438439 commit 080c604
Show file tree
Hide file tree
Showing 52 changed files with 223 additions and 207 deletions.
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ include_trailing_comma = True
force_grid_wrap=0
use_parentheses=True

known_third_party = PIL,PyQt5,PySide2,black,coloredlogs,graphene,numpy,pandas,pylab,pyqtconsole,pyqtgraph,pytest,pytestqt,recommonmark,scipy,setuptools,yaml
known_third_party = PIL,PyQt5,PySide2,PySide6,black,coloredlogs,graphene,numpy,pandas,pylab,pyqtconsole,pyqtgraph,pytest,pytestqt,recommonmark,scipy,setuptools,yaml

12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
rev: v2.2.0
hooks:
- id: seed-isort-config
stages: [commit]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
rev: v5.10.1
hooks:
- id: isort
stages: [commit]
- repo: https://github.com/ambv/black
rev: stable
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
language_version: python3.6
language_version: python3.10
stages: [commit]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
rev: v4.3.0
hooks:
- id: check-json
stages: [commit]
Expand Down
27 changes: 18 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
os: linux
dist: bionic
dist: focal
cache: pip

addons:
apt:
packages:
- x11-utils
- libxkbcommon-x11-0
- libxcb-icccm4
- libxcb-image0
- libxcb-keysyms1
- libxcb-randr0
- libxcb-render-util0
- libxcb-xinerama0
- libxcb-xfixes0
- x11-utils


services: xvfb

Expand All @@ -32,23 +41,23 @@ install:

jobs:
include:
- python: 3.6
- python: 3.10
env: TOXENV=flake8
- python: 3.6
- python: 3.10
env: TOXENV=black
- python: 3.6
- python: 3.10
env: TOXENV=mypy
- python: 3.6
env: TOXENV=py36
- python: 3.10
env: TOXENV=py310
- python: 3.7
env: TOXENV=py37
- python: 3.8
env: TOXENV=py38
- python: 3.6
- python: 3.10
env: TOXENV=coverage
- python: 3.6
- python: 3.10
env: TOXENV=packaging
- python: 3.6
- python: 3.10
env: TOXENV=docs


Expand Down
4 changes: 3 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ show_error_context = True
show_column_numbers = True
show_error_codes = True
pretty = True
disable_error_code = attr-defined

[mypy-pytest.*]
ignore_missing_imports = True
Expand All @@ -30,5 +31,6 @@ ignore_missing_imports = True
;disallow_untyped_defs = True
;check_untyped_defs = True


;[mypy-PySide6.*]
;ignore_missing_attribute = True

4 changes: 2 additions & 2 deletions nodedge/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import sys

from PySide2.QtWidgets import QApplication
from PySide6.QtWidgets import QApplication

from nodedge.logger import highLightLoggingSetup, setupLogging
from nodedge.mdi_window import MdiWindow
Expand All @@ -23,7 +23,7 @@ def main():
f"{os.path.dirname(__file__)}/../examples/calculator/calculator.json"
)
try:
sys.exit(app.exec_())
sys.exit(app.exec())
except Exception as e:
dumpException(e)

Expand Down
32 changes: 16 additions & 16 deletions nodedge/application_styler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import logging

import pyqtconsole.highlighter as hl
from PySide2.QtGui import QColor, QGuiApplication, QPalette
from PySide2.QtWidgets import QApplication
# import pyqtconsole.highlighter as hl
from PySide6.QtGui import QColor, QGuiApplication, QPalette
from PySide6.QtWidgets import QApplication


class ApplicationStyler:
Expand Down Expand Up @@ -50,16 +50,16 @@ def __init__(self):
p.setColor(QPalette.WindowText, white)
app.setPalette(p)

self.consoleStyle = {
"keyword": hl.format("blue", "bold"),
"operator": hl.format("white"),
"brace": hl.format("lightGray"),
"defclass": hl.format("white", "bold"),
"string": hl.format("magenta"),
"string2": hl.format("lightMagenta"),
"comment": hl.format("lightGreen", "italic"),
"self": hl.format("white", "italic"),
"numbers": hl.format("white"),
"inprompt": hl.format("lightBlue", "bold"),
"outprompt": hl.format("white", "bold"),
}
# self.consoleStyle = {
# "keyword": hl.format("blue", "bold"),
# "operator": hl.format("white"),
# "brace": hl.format("lightGray"),
# "defclass": hl.format("white", "bold"),
# "string": hl.format("magenta"),
# "string2": hl.format("lightMagenta"),
# "comment": hl.format("lightGreen", "italic"),
# "self": hl.format("white", "italic"),
# "numbers": hl.format("white"),
# "inprompt": hl.format("lightBlue", "bold"),
# "outprompt": hl.format("white", "bold"),
# }
2 changes: 1 addition & 1 deletion nodedge/blocks/graphics_block.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import os

from PySide2.QtGui import QImage, QPixmap
from PySide6.QtGui import QImage, QPixmap

from nodedge.graphics_node import GraphicsNode

Expand Down
6 changes: 3 additions & 3 deletions nodedge/blocks/graphics_block_content.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from PySide2.QtCore import Qt
from PySide2.QtWidgets import QHBoxLayout, QListWidget, QListWidgetItem, QSizePolicy
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QHBoxLayout, QListWidget, QListWidgetItem, QSizePolicy

from nodedge.graphics_node_content import GraphicsNodeContent
from nodedge.socket_type import SocketType
Expand All @@ -14,7 +14,7 @@ def initUI(self):
# self.label.setObjectName(self.node.contentLabelObjectName)

self.hLayout = QHBoxLayout(self)
self.hLayout.setMargin(0)
self.hLayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.hLayout)
self.listInputs = QListWidget(self)
self.listInputs.setSizePolicy(
Expand Down
2 changes: 1 addition & 1 deletion nodedge/blocks/graphics_input_block_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from typing import Optional

from PySide2.QtWidgets import QLineEdit
from PySide6.QtWidgets import QLineEdit

from nodedge.graphics_node_content import GraphicsNodeContent
from nodedge.utils import dumpException
Expand Down
4 changes: 2 additions & 2 deletions nodedge/blocks/graphics_output_block_content.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from PySide2.QtCore import Qt
from PySide2.QtWidgets import QLabel
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QLabel

from nodedge.graphics_node_content import GraphicsNodeContent

Expand Down
2 changes: 1 addition & 1 deletion nodedge/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from enum import IntEnum
from typing import List, Optional

from PySide2.QtCore import QPointF
from PySide6.QtCore import QPointF

from nodedge.graphics_socket import GraphicsSocket
from nodedge.serializable import Serializable
Expand Down
2 changes: 1 addition & 1 deletion nodedge/edge_dragging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from enum import IntEnum
from typing import Optional

from PySide2.QtWidgets import QGraphicsItem
from PySide6.QtWidgets import QGraphicsItem

from nodedge.connector import Socket
from nodedge.edge import Edge, EdgeType
Expand Down
6 changes: 3 additions & 3 deletions nodedge/editor_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import os
from typing import List, Optional

from PySide2.QtCore import Qt
from PySide2.QtGui import QBrush, QMouseEvent, QPen
from PySide2.QtWidgets import (
from PySide6.QtCore import Qt
from PySide6.QtGui import QBrush, QMouseEvent, QPen
from PySide6.QtWidgets import (
QApplication,
QGraphicsItem,
QLabel,
Expand Down
17 changes: 11 additions & 6 deletions nodedge/editor_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
import os
from typing import Callable, Optional, Union, cast

from PySide2.QtCore import QPoint, QSettings, QSize, Qt
from PySide2.QtGui import QClipboard, QCloseEvent, QGuiApplication, QKeySequence
from PySide2.QtWidgets import (
from PySide6.QtCore import QPoint, QSettings, QSize, Qt
from PySide6.QtGui import (
QAction,
QClipboard,
QCloseEvent,
QGuiApplication,
QKeySequence,
)
from PySide6.QtWidgets import (
QFileDialog,
QLabel,
QMainWindow,
Expand Down Expand Up @@ -64,7 +69,7 @@ def __init__(self, parent: Optional[QWidget] = None):

# Pycharm does not recognise resolve connect method so the inspection is
# noinspection PyUnresolvedReferences
self.clipboard.dataChanged.connect(self.onClipboardChanged)
self.clipboard.dataChanged.connect(self.onClipboardChanged) # type: ignore

self.lastActiveEditorWidget: Optional[EditorWidget] = None

Expand Down Expand Up @@ -130,7 +135,7 @@ def createStatusBar(self) -> None:
if self.currentEditorWidget is None:
return

self.currentEditorWidget.graphicsView.scenePosChanged.connect( # type: ignore
self.currentEditorWidget.graphicsView.scenePosChanged.connect(
self.OnScenePosChanged
)

Expand Down Expand Up @@ -576,7 +581,7 @@ def createAction(
:return:
"""
act = QAction(name, self)
act.triggered.connect(callback)
act.triggered.connect(callback) # type: ignore

if statusTip is not None:
act.setStatusTip(statusTip)
Expand Down
8 changes: 4 additions & 4 deletions nodedge/graphics_cut_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from enum import IntEnum
from typing import List, Optional

from PySide2.QtCore import QEvent, QPointF, QRectF, Qt
from PySide2.QtGui import QMouseEvent, QPainter, QPainterPath, QPen, QPolygonF
from PySide2.QtWidgets import (
from PySide6.QtCore import QEvent, QPointF, QRectF, Qt
from PySide6.QtGui import QMouseEvent, QPainter, QPainterPath, QPen, QPolygonF
from PySide6.QtWidgets import (
QApplication,
QGraphicsItem,
QStyleOptionGraphicsItem,
Expand Down Expand Up @@ -53,7 +53,7 @@ def update(self, event: QMouseEvent) -> Optional[QMouseEvent]:
eventButton: Qt.MouseButton = event.button()
eventType: QEvent.Type = event.type()
eventScenePos = self.graphicsView.mapToScene(event.pos())
eventModifiers: Qt.KeyboardModifiers = event.modifiers()
eventModifiers: Qt.KeyboardModifiers = event.modifiers() # type: ignore
if self.mode == CutLineMode.NOOP:
if (
eventType == QEvent.MouseButtonPress
Expand Down
6 changes: 3 additions & 3 deletions nodedge/graphics_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import math
from typing import Optional, Union

from PySide2.QtCore import QPointF, Qt
from PySide2.QtGui import QColor, QPainterPath, QPen
from PySide2.QtWidgets import (
from PySide6.QtCore import QPointF, Qt
from PySide6.QtGui import QColor, QPainterPath, QPen
from PySide6.QtWidgets import (
QApplication,
QGraphicsItem,
QGraphicsPathItem,
Expand Down
8 changes: 4 additions & 4 deletions nodedge/graphics_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import logging
from typing import Optional, cast

from PySide2.QtCore import QRectF, Qt
from PySide2.QtGui import QBrush, QColor, QFont, QPainterPath, QPen
from PySide2.QtWidgets import (
from PySide6.QtCore import QRectF, Qt
from PySide6.QtGui import QBrush, QColor, QFont, QPainterPath, QPen
from PySide6.QtWidgets import (
QApplication,
QFrame,
QGraphicsItem,
Expand Down Expand Up @@ -167,7 +167,7 @@ def initContent(self) -> None:
titleFrame = GraphicsNodeTitleFrame(widget)
titleFrame.setMaximumHeight(30)
titleLayout = QHBoxLayout()
titleLayout.setMargin(0)
titleLayout.setContentsMargins(0, 0, 0, 0)
titleFrame.setLayout(titleLayout)
self.titleLabel = GraphicsNodeTitleLabel(self.title, widget)
self.titleLabel.setSizePolicy(
Expand Down
6 changes: 3 additions & 3 deletions nodedge/graphics_node_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from collections import OrderedDict
from typing import Optional, cast

from PySide2.QtCore import Qt
from PySide2.QtGui import QFocusEvent
from PySide2.QtWidgets import QGraphicsProxyWidget, QTextEdit, QVBoxLayout, QWidget
from PySide6.QtCore import Qt
from PySide6.QtGui import QFocusEvent
from PySide6.QtWidgets import QGraphicsProxyWidget, QTextEdit, QVBoxLayout, QWidget

from nodedge.serializable import Serializable

Expand Down
2 changes: 1 addition & 1 deletion nodedge/graphics_node_title_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Graphics node title item module containing
:class:`~nodedge.graphics_node_title_label.GraphicsNodeTitleLabel` class. """

from PySide2.QtWidgets import QLabel, QWidget
from PySide6.QtWidgets import QLabel, QWidget


class GraphicsNodeTitleLabel(QLabel):
Expand Down

0 comments on commit 080c604

Please sign in to comment.