Ergänzungen in de Wrappern/ Prüfmanager für Layouts
This commit is contained in:
@@ -26,6 +26,13 @@ QgsGeometry: Type[Any]
|
||||
QgsFeatureRequest: Type[Any]
|
||||
QgsCoordinateTransform: Type[Any]
|
||||
QgsCoordinateReferenceSystem: Type[Any]
|
||||
QgsPrintLayout: Type[Any]
|
||||
QgsLayoutItemMap: Type[Any]
|
||||
QgsLayoutItemLabel: Type[Any]
|
||||
QgsLayoutPoint: Type[Any]
|
||||
QgsLayoutSize: Type[Any]
|
||||
QgsUnitTypes: Type[Any]
|
||||
QgsLayoutItem: Type[Any]
|
||||
|
||||
QGIS_AVAILABLE = False
|
||||
|
||||
@@ -48,6 +55,13 @@ try:
|
||||
QgsFeatureRequest as _QgsFeatureRequest,
|
||||
QgsCoordinateTransform as _QgsCoordinateTransform,
|
||||
QgsCoordinateReferenceSystem as _QgsCoordinateReferenceSystem,
|
||||
QgsPrintLayout as _QgsPrintLayout,
|
||||
QgsLayoutItemMap as _QgsLayoutItemMap,
|
||||
QgsLayoutItemLabel as _QgsLayoutItemLabel,
|
||||
QgsLayoutPoint as _QgsLayoutPoint,
|
||||
QgsLayoutSize as _QgsLayoutSize,
|
||||
QgsUnitTypes as _QgsUnitTypes,
|
||||
QgsLayoutItem as _QgsLayoutItem,
|
||||
)
|
||||
|
||||
QgsProject = _QgsProject
|
||||
@@ -63,6 +77,13 @@ try:
|
||||
QgsFeatureRequest = _QgsFeatureRequest
|
||||
QgsCoordinateTransform = _QgsCoordinateTransform
|
||||
QgsCoordinateReferenceSystem = _QgsCoordinateReferenceSystem
|
||||
QgsPrintLayout = _QgsPrintLayout
|
||||
QgsLayoutItemMap = _QgsLayoutItemMap
|
||||
QgsLayoutItemLabel = _QgsLayoutItemLabel
|
||||
QgsLayoutPoint = _QgsLayoutPoint
|
||||
QgsLayoutSize = _QgsLayoutSize
|
||||
QgsUnitTypes = _QgsUnitTypes
|
||||
QgsLayoutItem = _QgsLayoutItem
|
||||
|
||||
QGIS_AVAILABLE = True
|
||||
|
||||
@@ -73,9 +94,17 @@ try:
|
||||
except Exception:
|
||||
QGIS_AVAILABLE = False
|
||||
|
||||
class _MockLayoutManager:
|
||||
def layoutByName(self, name: str):
|
||||
return None
|
||||
|
||||
def addLayout(self, layout: Any) -> bool:
|
||||
return True
|
||||
|
||||
class _MockQgsProject:
|
||||
def __init__(self):
|
||||
self._variables = {}
|
||||
self._layout_manager = _MockLayoutManager()
|
||||
|
||||
@staticmethod
|
||||
def instance() -> "_MockQgsProject":
|
||||
@@ -84,6 +113,9 @@ except Exception:
|
||||
def read(self) -> bool:
|
||||
return True
|
||||
|
||||
def layoutManager(self):
|
||||
return self._layout_manager
|
||||
|
||||
QgsProject = _MockQgsProject
|
||||
|
||||
class _MockQgsVectorLayer:
|
||||
@@ -134,6 +166,110 @@ except Exception:
|
||||
|
||||
QgsRasterLayer = _MockQgsRasterLayer
|
||||
|
||||
class _MockQgsPrintLayout:
|
||||
def __init__(self, project: Any):
|
||||
self.project = project
|
||||
self._name = ""
|
||||
self._page = _MockQgsLayoutPage()
|
||||
|
||||
def initializeDefaults(self) -> None:
|
||||
pass
|
||||
|
||||
def setName(self, name: str) -> None:
|
||||
self._name = name
|
||||
|
||||
def pageCollection(self):
|
||||
return self
|
||||
|
||||
def page(self, index: int):
|
||||
return self._page
|
||||
|
||||
def addLayoutItem(self, item: Any) -> None:
|
||||
pass
|
||||
|
||||
class _MockQgsLayoutPage:
|
||||
def setPageSize(self, size: Any) -> None:
|
||||
self.size = size
|
||||
|
||||
class _MockQgsLayoutItem:
|
||||
class ReferencePoint:
|
||||
LowerLeft = 0
|
||||
|
||||
class _MockQgsLayoutItemMap:
|
||||
def __init__(self, layout: Any):
|
||||
self.layout = layout
|
||||
|
||||
def setId(self, item_id: str) -> None:
|
||||
pass
|
||||
|
||||
def setExtent(self, extent: Any) -> None:
|
||||
pass
|
||||
|
||||
def setScale(self, scale: float) -> None:
|
||||
pass
|
||||
|
||||
def attemptMove(self, point: Any) -> None:
|
||||
pass
|
||||
|
||||
def attemptResize(self, size: Any) -> None:
|
||||
pass
|
||||
|
||||
def setFollowVisibilityPreset(self, active: bool) -> None:
|
||||
pass
|
||||
|
||||
def setFollowVisibilityPresetName(self, name: str) -> None:
|
||||
pass
|
||||
|
||||
class _MockQgsLayoutItemLabel:
|
||||
ModeHtml = 1
|
||||
|
||||
def __init__(self, layout: Any):
|
||||
self.layout = layout
|
||||
|
||||
def setId(self, item_id: str) -> None:
|
||||
pass
|
||||
|
||||
def setText(self, text: str) -> None:
|
||||
pass
|
||||
|
||||
def setMode(self, mode: Any) -> None:
|
||||
pass
|
||||
|
||||
def setFont(self, font: Any) -> None:
|
||||
pass
|
||||
|
||||
def setReferencePoint(self, point: Any) -> None:
|
||||
pass
|
||||
|
||||
def attemptMove(self, point: Any) -> None:
|
||||
pass
|
||||
|
||||
def attemptResize(self, size: Any) -> None:
|
||||
pass
|
||||
|
||||
class _MockQgsLayoutPoint:
|
||||
def __init__(self, x: float, y: float, unit: Any):
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.unit = unit
|
||||
|
||||
class _MockQgsLayoutSize:
|
||||
def __init__(self, width: float, height: float, unit: Any):
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.unit = unit
|
||||
|
||||
class _MockQgsUnitTypes:
|
||||
LayoutMillimeters = 0
|
||||
|
||||
QgsPrintLayout = _MockQgsPrintLayout
|
||||
QgsLayoutItemMap = _MockQgsLayoutItemMap
|
||||
QgsLayoutItemLabel = _MockQgsLayoutItemLabel
|
||||
QgsLayoutPoint = _MockQgsLayoutPoint
|
||||
QgsLayoutSize = _MockQgsLayoutSize
|
||||
QgsUnitTypes = _MockQgsUnitTypes
|
||||
QgsLayoutItem = _MockQgsLayoutItem
|
||||
|
||||
class _MockQgsFeatureRequest:
|
||||
def __init__(self):
|
||||
self._filter_rect = None
|
||||
|
||||
Reference in New Issue
Block a user