Meshroom/meshroom/common/__init__.py
Yann Lanthony 6ac4a9d712 [desc][qt] use QVariantList for list-type properties
* required for PySide2 > 5.11.1 (and compatible with 5.11.1)
* AttributeItemDelegate: test for list length to determine whether to create a slider component (if range is set to None on Python side, it will be an empty list on the QML/JS side)
2019-01-04 17:30:38 +01:00

60 lines
1.5 KiB
Python

import meshroom
DictModel = None
ListModel = None
Slot = None
Signal = None
Property = None
BaseObject = None
Variant = None
VariantList = None
if meshroom.backend == meshroom.Backend.PYSIDE:
# PySide types
from .qt import DictModel, ListModel, Slot, Signal, Property, BaseObject, Variant, VariantList
elif meshroom.backend == meshroom.Backend.STANDALONE:
# Core types
from .core import DictModel, ListModel, Slot, Signal, Property, BaseObject, Variant, VariantList
class _BaseModel:
""" Common API for model implementation """
def __init__(self, keyAttrName="name", **kwargs):
"""
:param keyAttrName: name of the attribute containing the unique key for an object
"""
pass
@property
def objects(self):
""" Return a dictionary with {unique_key: object} mapping"""
return None
def get(self, key):
""" Get the object with the unique key 'key' """
pass
def add(self, obj):
""" Add given object using its 'keyAttrName' as unique key """
pass
def pop(self, key):
""" Remove 'item' with unique key 'key' from the model """
pass
def remove(self, obj):
""" Remove 'obj' from the model """
pass
def clear(self):
""" Remove all internal objects """
pass
def update(self, d):
""" Combine dict 'd' with self """
pass
def reset(self, d):
""" Reset model with given values """
pass