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

QtPy #1

Open
wants to merge 6 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@

## Added

- `QtPy` support
- `widgets.SvgWidget`
- `tools.SvgRenderer`
- `tools.SvgGenerator`
Expand Down
13 changes: 9 additions & 4 deletions Qtica/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# Qtica
__version__ = "0.5.1"
__version_info__ = (0, 5, 1, "", "")
__version__ = "0.6.0"
__version_info__ = (0, 6, 0, "", "")

# Python
__minimum_python_version__ = (3, 10)
__maximum_python_version__ = (3, 12)

# PySide6
# PySide/PyQt
__pyside_version__ = "6.7.2"
__pyqt_version__ = "6.7.0"

# QtPy
import os
os.environ["QT_API"] = "pyside6"

from PySide6.QtCore import (

from qtpy.QtCore import (
Qt,
Property,
Signal,
Expand Down
2 changes: 1 addition & 1 deletion Qtica/animations/animation_group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from PySide6.QtCore import QParallelAnimationGroup, QSequentialAnimationGroup
from qtpy.QtCore import QParallelAnimationGroup, QSequentialAnimationGroup
from ..core import AbstractQObject


Expand Down
2 changes: 1 addition & 1 deletion Qtica/animations/property_animation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from PySide6.QtCore import QPropertyAnimation
from qtpy.QtCore import QPropertyAnimation
from ..core import AbstractQObject


Expand Down
3 changes: 2 additions & 1 deletion Qtica/core/_IODevice.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from PySide6.QtCore import QIODevice
from ._qobject import AbstractQObject

from qtpy.QtCore import QIODevice


class AbstractIODevice(AbstractQObject):
def __init__(self, mode: QIODevice.OpenModeFlag, **kwargs):
Expand Down
5 changes: 3 additions & 2 deletions Qtica/core/_api.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Any, Union
from PySide6.QtCore import Qt, QObject
from PySide6.QtWidgets import QApplication, QWidget
from ._declarative import AbstractDec, TrackingDec
from ._base import WidgetsType
from .. import enums

from qtpy.QtCore import Qt, QObject
from qtpy.QtWidgets import QApplication, QWidget


class Api:
'''
Expand Down
7 changes: 4 additions & 3 deletions Qtica/core/_base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Any, Callable, TypeAlias, Union
from PySide6.QtCore import Qt, QObject
from PySide6.QtWidgets import QApplication
from ..utils.caseconverter import camelcase, snakecase
from .objects import Args, MArgs, Func
from ..utils.caseconverter import camelcase, snakecase
from .. import enums

from qtpy.QtCore import Qt, QObject
from qtpy.QtWidgets import QApplication


EventsType: TypeAlias = Union[list[tuple[Union[enums.Events, str], Callable[..., Any]]],
dict[Union[enums.Events, str], Callable[..., Any]]]
Expand Down
3 changes: 2 additions & 1 deletion Qtica/core/_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from abc import ABCMeta, abstractmethod
from typing import Any, Callable
from PySide6.QtCore import Signal

from qtpy.QtCore import Signal


class AbstractConfig(metaclass=ABCMeta):
Expand Down
3 changes: 2 additions & 1 deletion Qtica/core/_icons.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from enum import Enum
from PySide6.QtGui import QIcon, QIconEngine, QImage, QPixmap

from qtpy.QtGui import QIcon, QIconEngine, QImage, QPixmap


class AbstractIcons(Enum):
Expand Down
5 changes: 3 additions & 2 deletions Qtica/core/_painter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from PySide6.QtGui import QPaintEvent
from PySide6.QtWidgets import QWidget
from ._declarative import AbstractDec

from qtpy.QtGui import QPaintEvent
from qtpy.QtWidgets import QWidget


class AbstractPainter(AbstractDec):
def __init__(self, child: QWidget, **kwargs) -> QWidget:
Expand Down
2 changes: 0 additions & 2 deletions Qtica/core/_qobject.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/python3

from ._base import AbstractBase
from ._declarative import AbstractDec

Expand Down
4 changes: 2 additions & 2 deletions Qtica/core/objects/box_layout.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PySide6.QtWidgets import QWidget, QLayout
from PySide6.QtCore import Qt
from qtpy.QtWidgets import QWidget, QLayout
from qtpy.QtCore import Qt


class BoxLayoutWrapper:
Expand Down
4 changes: 2 additions & 2 deletions Qtica/core/objects/pos_events.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from typing import Callable, TypeAlias, Union
from PySide6.QtCore import QPoint, QPointF
from Qtica import Qt

from qtpy.QtCore import Qt, QPoint, QPointF


@dataclass
Expand Down
7 changes: 4 additions & 3 deletions Qtica/core/objects/qss.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

from string import Template
from typing import Mapping, Union
from PySide6.QtCore import QFile
from PySide6.QtGui import QGradient, QColor
from PySide6.QtWidgets import QGraphicsDropShadowEffect, QWidget

from qtpy.QtCore import QFile
from qtpy.QtGui import QGradient, QColor
from qtpy.QtWidgets import QGraphicsDropShadowEffect, QWidget


INDENT_WIDTH: str = " " * 4
Expand Down
3 changes: 2 additions & 1 deletion Qtica/core/objects/routes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Union
from PySide6.QtWidgets import QStackedLayout, QStackedWidget, QWidget

from qtpy.QtWidgets import QStackedLayout, QStackedWidget, QWidget


class Routes:
Expand Down
3 changes: 2 additions & 1 deletion Qtica/core/widgets/box_layout.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import TypeAlias, Union
from PySide6.QtWidgets import QLayoutItem, QSpacerItem, QWidget, QLayout
from ...utils.alignment import Alignment
from .._qobject import AbstractQObject
from ..objects import BoxLayoutWrapper

from qtpy.QtWidgets import QLayoutItem, QSpacerItem, QWidget, QLayout


BoxLayoutChildrenType: TypeAlias = list[Union[QWidget, QLayout, BoxLayoutWrapper, Alignment]]

Expand Down
3 changes: 2 additions & 1 deletion Qtica/core/widgets/button.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from PySide6.QtCore import Signal
from .widget import AbstractWidget

from qtpy.QtCore import Signal


class AbstractButton(AbstractWidget):
long_press = Signal()
Expand Down
3 changes: 2 additions & 1 deletion Qtica/core/widgets/container.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import TypeAlias, Union
from PySide6.QtWidgets import QLayout, QWidget
from .widget import AbstractWidget

from qtpy.QtWidgets import QLayout, QWidget


ContainerChildType: TypeAlias = Union[QWidget, QLayout, list[QWidget]]

Expand Down
7 changes: 4 additions & 3 deletions Qtica/core/widgets/dialog.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from PySide6.QtWidgets import QApplication, QDialog, QWidget
from PySide6.QtCore import QEvent, QObject, QTimer
from PySide6.QtGui import QCloseEvent, QShowEvent
from .widget import AbstractWidget

from qtpy.QtWidgets import QApplication, QDialog, QWidget
from qtpy.QtCore import QEvent, QObject, QTimer
from qtpy.QtGui import QCloseEvent, QShowEvent


class AbstractDialog(AbstractWidget, QDialog):
def __init__(self,
Expand Down
5 changes: 3 additions & 2 deletions Qtica/core/widgets/widget.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from typing import TypeAlias, Union
from PySide6.QtWidgets import QGraphicsEffect
from PySide6.QtCore import QAbstractAnimation, QAnimationGroup,QTimer, QVariantAnimation, Qt, Signal
from .._base import AbstractBase
from .._declarative import AbstractDec
from ..objects import PosEvents, PosEventsRange, PosEventsArg, QStyleSheet
from ...utils.key_events import MouseButtons, Modifiers

from qtpy.QtWidgets import QGraphicsEffect
from qtpy.QtCore import QAbstractAnimation, QAnimationGroup,QTimer, QVariantAnimation, Qt, Signal


QssType: TypeAlias = Union[str, dict, QStyleSheet]
WidgetAttrsType: TypeAlias = Union[list[Qt.WidgetAttribute], dict[Qt.WidgetAttribute, bool]]
Expand Down
10 changes: 4 additions & 6 deletions Qtica/core/widgets/window.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from typing import Union
from PySide6.QtCore import Signal
from PySide6.QtGui import QShowEvent, QCloseEvent
from PySide6.QtWidgets import (
QWidget,
QLayout
)
from .widget import AbstractWidget

from qtpy.QtCore import Signal
from qtpy.QtGui import QShowEvent, QCloseEvent
from qtpy.QtWidgets import QWidget, QLayout


class AbstractWindow(AbstractWidget):
startup_changed = Signal()
Expand Down
2 changes: 1 addition & 1 deletion Qtica/enums/colors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import Enum
from PySide6.QtGui import QColor
from qtpy.QtGui import QColor


class Colors(Enum):
Expand Down
2 changes: 1 addition & 1 deletion Qtica/enums/events.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PySide6 import QtCore
from enum import Enum, auto
from qtpy import QtCore


class Events(Enum):
Expand Down
2 changes: 1 addition & 1 deletion Qtica/enums/signals.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PySide6 import QtCore
from enum import Enum, auto
from qtpy import QtCore


class Signals(Enum):
Expand Down
5 changes: 3 additions & 2 deletions Qtica/enums/widgets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from PySide6.QtCore import QObject
from PySide6 import QtWidgets
from enum import Enum

from qtpy.QtCore import QObject
from qtpy import QtWidgets


class Widgets(Enum):
any: QObject = QObject
Expand Down
13 changes: 7 additions & 6 deletions Qtica/layouts/border.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from typing import Union
from PySide6.QtCore import QRect, QSize, Qt
from PySide6.QtWidgets import (
from ..enums.position import Positions
from ..enums.size import Sizes
from ..core import AbstractQObject
from ..tools.wrappers.border_layout import BorderLayoutWrapper

from qtpy.QtCore import QRect, QSize, Qt
from qtpy.QtWidgets import (
QLayout,
QLayoutItem,
QWidget,
QWidgetItem,
)
from ..enums.position import Positions
from ..enums.size import Sizes
from ..core import AbstractQObject
from ..tools.wrappers.border_layout import BorderLayoutWrapper


class _BorderLayout(QLayout):
Expand Down
2 changes: 1 addition & 1 deletion Qtica/layouts/box.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PySide6.QtWidgets import QBoxLayout, QHBoxLayout, QVBoxLayout
from ..core import AbstractBoxLayout, BoxLayoutChildrenType
from qtpy.QtWidgets import QBoxLayout, QHBoxLayout, QVBoxLayout


class BoxLayout(AbstractBoxLayout, QBoxLayout):
Expand Down
5 changes: 3 additions & 2 deletions Qtica/layouts/expand.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# coding:utf-8
from typing import Union
from PySide6.QtCore import QSize, QPoint, Qt, QEvent, QRect
from PySide6.QtWidgets import QLayout, QWidget, QLayoutItem
from ..core import AbstractQObject
from ..utils.alignment import Alignment

from qtpy.QtCore import QSize, QPoint, Qt, QEvent, QRect
from qtpy.QtWidgets import QLayout, QWidget, QLayoutItem


class _ExpandLayout(QLayout):
""" Expand layout """
Expand Down
10 changes: 5 additions & 5 deletions Qtica/layouts/flow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Union
from PySide6.QtWidgets import QLayout, QLayoutItem, QWidget
from PySide6.QtCore import (
from ..core import AbstractQObject
from ..utils.alignment import Alignment

from qtpy.QtWidgets import QLayout, QLayoutItem, QWidget
from qtpy.QtCore import (
QSize,
QPoint,
Qt,
Expand All @@ -9,9 +12,6 @@
QParallelAnimationGroup
)

from ..core import AbstractQObject
from ..utils.alignment import Alignment


class _FlowLayout(QLayout):
""" Flow layout """
Expand Down
3 changes: 2 additions & 1 deletion Qtica/layouts/form.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Union
from PySide6.QtWidgets import QFormLayout, QWidget, QLayoutItem
from ..tools.wrappers.form_layout import FormLayoutWrapper
from ..utils.alignment import Alignment
from ..core import AbstractQObject

from qtpy.QtWidgets import QFormLayout, QWidget, QLayoutItem


class FormLayout(AbstractQObject, QFormLayout):
def __init__(self,
Expand Down
3 changes: 2 additions & 1 deletion Qtica/layouts/grid.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Union
from PySide6.QtWidgets import QGridLayout, QWidget, QLayout, QLayoutItem
from ..tools.wrappers.grid_layout import GridLayoutWrapper
from ..utils.alignment import Alignment
from ..core import AbstractQObject

from qtpy.QtWidgets import QGridLayout, QWidget, QLayout, QLayoutItem


class GridLayout(AbstractQObject, QGridLayout):
def __init__(self,
Expand Down
3 changes: 2 additions & 1 deletion Qtica/layouts/stacked.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import Union
from PySide6.QtWidgets import QStackedLayout, QWidget, QLayoutItem
from ..utils.alignment import Alignment
from ..core import AbstractQObject, Routes

from qtpy.QtWidgets import QStackedLayout, QWidget, QLayoutItem


class StackedLayout(AbstractQObject, QStackedLayout):
def __init__(self,
Expand Down
7 changes: 4 additions & 3 deletions Qtica/painters/circular_progress.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Callable
from PySide6.QtWidgets import QWidget
from PySide6.QtCore import QRect, QTimer, Qt
from PySide6.QtGui import QColor, QPainter, QPen
from ..core import AbstractPainter

from qtpy.QtWidgets import QWidget
from qtpy.QtCore import QRect, QTimer, Qt
from qtpy.QtGui import QColor, QPainter, QPen


class CircularProgressPaint(AbstractPainter):
def __init__(self,
Expand Down
Loading