forked from AG_QGIS/Plugin_SN_Basis
Anpassung an den Wrappern für sn_plan41
This commit is contained in:
@@ -29,8 +29,9 @@ QMenu: Type[Any]
|
||||
QToolBar: Type[Any]
|
||||
QActionGroup: Type[Any]
|
||||
QTabWidget: type
|
||||
|
||||
|
||||
QToolButton: Type[Any]
|
||||
QSizePolicy: Type[Any]
|
||||
Qt: Type[Any]
|
||||
|
||||
YES: Optional[Any] = None
|
||||
NO: Optional[Any] = None
|
||||
@@ -65,6 +66,9 @@ try:
|
||||
QActionGroup as _QActionGroup,# type: ignore
|
||||
QDockWidget as _QDockWidget,# type: ignore
|
||||
QTabWidget as _QTabWidget,# type: ignore
|
||||
QToolButton as _QToolButton,#type:ignore
|
||||
QSizePolicy as _QSizePolicy,#type:ignore
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -73,6 +77,7 @@ try:
|
||||
QEventLoop as _QEventLoop,# type: ignore
|
||||
QUrl as _QUrl,# type: ignore
|
||||
QCoreApplication as _QCoreApplication,# type: ignore
|
||||
Qt as _Qt#type:ignore
|
||||
)
|
||||
from qgis.PyQt.QtNetwork import ( # type: ignore
|
||||
QNetworkRequest as _QNetworkRequest,# type: ignore
|
||||
@@ -86,6 +91,7 @@ try:
|
||||
QNetworkRequest = _QNetworkRequest
|
||||
QNetworkReply = _QNetworkReply
|
||||
QCoreApplication = _QCoreApplication
|
||||
Qt=_Qt
|
||||
QDockWidget = _QDockWidget
|
||||
QWidget = _QWidget
|
||||
QGridLayout = _QGridLayout
|
||||
@@ -99,13 +105,37 @@ try:
|
||||
QToolBar = _QToolBar
|
||||
QActionGroup = _QActionGroup
|
||||
QTabWidget = _QTabWidget
|
||||
|
||||
|
||||
QToolButton=_QToolButton
|
||||
QSizePolicy=_QSizePolicy
|
||||
|
||||
YES = QMessageBox.StandardButton.Yes
|
||||
NO = QMessageBox.StandardButton.No
|
||||
CANCEL = QMessageBox.StandardButton.Cancel
|
||||
ICON_QUESTION = QMessageBox.Icon.Question
|
||||
# ---------------------------------------------------------
|
||||
# Qt6 Enum-Aliase (vereinheitlicht)
|
||||
# ---------------------------------------------------------
|
||||
|
||||
ToolButtonTextBesideIcon = Qt.ToolButtonStyle.ToolButtonTextBesideIcon
|
||||
ArrowDown = Qt.ArrowType.DownArrow
|
||||
ArrowRight = Qt.ArrowType.RightArrow
|
||||
# QSizePolicy Enum-Aliase (Qt6)
|
||||
SizePolicyPreferred = QSizePolicy.Policy.Preferred
|
||||
SizePolicyMaximum = QSizePolicy.Policy.Maximum
|
||||
# ---------------------------------------------------------
|
||||
# QDockWidget Feature-Aliase (Qt6)
|
||||
# ---------------------------------------------------------
|
||||
|
||||
DockWidgetMovable = QDockWidget.DockWidgetFeature.DockWidgetMovable
|
||||
DockWidgetFloatable = QDockWidget.DockWidgetFeature.DockWidgetFloatable
|
||||
DockWidgetClosable = QDockWidget.DockWidgetFeature.DockWidgetClosable
|
||||
# ---------------------------------------------------------
|
||||
# Dock-Area-Aliase (Qt6)
|
||||
# ---------------------------------------------------------
|
||||
|
||||
DockAreaLeft = Qt.DockWidgetArea.LeftDockWidgetArea
|
||||
DockAreaRight = Qt.DockWidgetArea.RightDockWidgetArea
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -134,12 +164,14 @@ except Exception:
|
||||
QActionGroup as _QActionGroup,
|
||||
QDockWidget as _QDockWidget,
|
||||
QTabWidget as _QTabWidget,
|
||||
|
||||
QToolButton as _QToolButton,
|
||||
QSizePolicy as _QSizePolicy,
|
||||
)
|
||||
from PyQt5.QtCore import (
|
||||
QEventLoop as _QEventLoop,
|
||||
QUrl as _QUrl,
|
||||
QCoreApplication as _QCoreApplication,
|
||||
Qt as _Qt,
|
||||
)
|
||||
from PyQt5.QtNetwork import (
|
||||
QNetworkRequest as _QNetworkRequest,
|
||||
@@ -153,6 +185,7 @@ except Exception:
|
||||
QNetworkRequest = _QNetworkRequest
|
||||
QNetworkReply = _QNetworkReply
|
||||
QCoreApplication = _QCoreApplication
|
||||
Qt=_Qt
|
||||
QDockWidget = _QDockWidget
|
||||
|
||||
|
||||
@@ -168,8 +201,8 @@ except Exception:
|
||||
QToolBar = _QToolBar
|
||||
QActionGroup = _QActionGroup
|
||||
QTabWidget = _QTabWidget
|
||||
|
||||
|
||||
QToolButton=_QToolButton
|
||||
QSizePolicy=_QSizePolicy
|
||||
|
||||
YES = QMessageBox.Yes
|
||||
NO = QMessageBox.No
|
||||
@@ -177,6 +210,30 @@ except Exception:
|
||||
ICON_QUESTION = QMessageBox.Question
|
||||
|
||||
QT_VERSION = 5
|
||||
# ---------------------------------------------------------
|
||||
# Qt5 Enum-Aliase (vereinheitlicht)
|
||||
# ---------------------------------------------------------
|
||||
|
||||
ToolButtonTextBesideIcon = Qt.ToolButtonTextBesideIcon
|
||||
ArrowDown = Qt.DownArrow
|
||||
ArrowRight = Qt.RightArrow
|
||||
# QSizePolicy Enum-Aliase (Qt5)
|
||||
SizePolicyPreferred = QSizePolicy.Preferred
|
||||
SizePolicyMaximum = QSizePolicy.Maximum
|
||||
# ---------------------------------------------------------
|
||||
# QDockWidget Feature-Aliase (Qt5)
|
||||
# ---------------------------------------------------------
|
||||
|
||||
DockWidgetMovable = QDockWidget.DockWidgetMovable
|
||||
DockWidgetFloatable = QDockWidget.DockWidgetFloatable
|
||||
DockWidgetClosable = QDockWidget.DockWidgetClosable
|
||||
# ---------------------------------------------------------
|
||||
# Dock-Area-Aliase (Qt5)
|
||||
# ---------------------------------------------------------
|
||||
|
||||
DockAreaLeft = Qt.LeftDockWidgetArea
|
||||
DockAreaRight = Qt.RightDockWidgetArea
|
||||
|
||||
|
||||
def exec_dialog(dialog: Any) -> Any:
|
||||
return dialog.exec_()
|
||||
@@ -257,15 +314,26 @@ except Exception:
|
||||
pass
|
||||
|
||||
class _MockLayout:
|
||||
def addWidget(self, *args, **kwargs):
|
||||
pass
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._widgets = []
|
||||
|
||||
def addLayout(self, *args, **kwargs):
|
||||
def addWidget(self, widget):
|
||||
self._widgets.append(widget)
|
||||
|
||||
def addLayout(self, layout):
|
||||
pass
|
||||
|
||||
def addStretch(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def setSpacing(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def setContentsMargins(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class _MockLabel:
|
||||
def __init__(self, text: str = ""):
|
||||
self._text = text
|
||||
@@ -296,7 +364,18 @@ except Exception:
|
||||
pass
|
||||
|
||||
QCoreApplication = _MockQCoreApplication
|
||||
class _MockQt:
|
||||
# ToolButtonStyle
|
||||
ToolButtonTextBesideIcon = 0
|
||||
|
||||
# ArrowType
|
||||
ArrowDown = 1
|
||||
ArrowRight = 2
|
||||
|
||||
Qt=_MockQt
|
||||
ToolButtonTextBesideIcon = Qt.ToolButtonTextBesideIcon
|
||||
ArrowDown = Qt.ArrowDown
|
||||
ArrowRight = Qt.ArrowRight
|
||||
|
||||
class _MockQDockWidget(_MockWidget):
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -380,6 +459,54 @@ except Exception:
|
||||
QToolBar = _MockToolBar
|
||||
QActionGroup = _MockActionGroup
|
||||
|
||||
class _MockToolButton(_MockWidget):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self._checked = False
|
||||
self.toggled = lambda *a, **k: None
|
||||
|
||||
def setText(self, text: str) -> None:
|
||||
pass
|
||||
|
||||
def setCheckable(self, value: bool) -> None:
|
||||
pass
|
||||
|
||||
def setChecked(self, value: bool) -> None:
|
||||
self._checked = value
|
||||
|
||||
def setToolButtonStyle(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def setArrowType(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def setStyleSheet(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
QToolButton=_MockToolButton
|
||||
|
||||
class _MockQSizePolicy:
|
||||
# horizontale Policies
|
||||
Fixed = 0
|
||||
Minimum = 1
|
||||
Maximum = 2
|
||||
Preferred = 3
|
||||
Expanding = 4
|
||||
MinimumExpanding = 5
|
||||
Ignored = 6
|
||||
|
||||
# vertikale Policies (Qt nutzt dieselben Werte)
|
||||
def __init__(self, horizontal=None, vertical=None):
|
||||
self.horizontal = horizontal
|
||||
self.vertical = vertical
|
||||
QSizePolicy=_MockQSizePolicy
|
||||
SizePolicyPreferred = QSizePolicy.Preferred
|
||||
SizePolicyMaximum = QSizePolicy.Maximum
|
||||
DockWidgetMovable = 1
|
||||
DockWidgetFloatable = 2
|
||||
DockWidgetClosable = 4
|
||||
DockAreaLeft = 1
|
||||
DockAreaRight = 2
|
||||
|
||||
def exec_dialog(dialog: Any) -> Any:
|
||||
return YES
|
||||
|
||||
Reference in New Issue
Block a user