Krita Source Code Documentation
Loading...
Searching...
No Matches
mikro.PyQtClass Class Reference
+ Inheritance diagram for mikro.PyQtClass:

Public Member Functions

 __del__ (self)
 
 __enter__ (self)
 
 __exit__ (self, exc_type, exc_value, traceback)
 
 __getattr__ (self, name)
 
 __getitem__ (self, key)
 
 __init__ (self, instance)
 
 __members__ (self)
 
 children (self)
 
 connect (self, signal, slot)
 
 disconnect (self, signal, slot)
 
 dynamicPropertyNames (self)
 
 getProperty (self, name)
 
 metaObject (self)
 
 parent (self)
 
 propertyNames (self)
 
 qt (self)
 
 setProperty (self, name, value)
 

Protected Attributes

 _instance
 

Detailed Description

Base class

Definition at line 190 of file mikro.py.

Constructor & Destructor Documentation

◆ __init__()

mikro.PyQtClass.__init__ ( self,
instance )

Definition at line 196 of file mikro.py.

196 def __init__(self, instance):
197 self._instance = instance
198

◆ __del__()

mikro.PyQtClass.__del__ ( self)
If this object is deleted it should also delete the wrapped object
if it was created explicitly for this use.

Definition at line 199 of file mikro.py.

199 def __del__(self):
200 """
201 If this object is deleted it should also delete the wrapped object
202 if it was created explicitly for this use.
203 """
204 qobj = self._instance
205 if is_scripter_child(qobj):
206 if len(qobj.children()):
207 print("Cannot delete", qobj, "because it has child objects")
208 sip.delete(qobj)
209

References mikro.PyQtClass._instance, and mikro.is_scripter_child().

Member Function Documentation

◆ __enter__()

mikro.PyQtClass.__enter__ ( self)

Definition at line 285 of file mikro.py.

285 def __enter__(self):
286 print("__enter__", self)
287

◆ __exit__()

mikro.PyQtClass.__exit__ ( self,
exc_type,
exc_value,
traceback )

Definition at line 288 of file mikro.py.

288 def __exit__(self, exc_type, exc_value, traceback):
289 print("__exit__", self, exc_type, exc_value, traceback)
290
291

◆ __getattr__()

mikro.PyQtClass.__getattr__ ( self,
name )

Definition at line 255 of file mikro.py.

255 def __getattr__(self, name):
256 # Make named child objects available as attributes like QtQml
257 # Check whether the object is in the QObject hierarchy
258 for child in self._instance.children():
259 if str(child.objectName()) == name:
260 obj = wrap(child)
261 # Save found object for faster lookup
262 setattr(self, name, obj)
263 return obj
264
265 # Check whether it's a property
266 v = self._instance.property(name)
267 return convert_value(v)
268

References mikro.PyQtClass._instance, mikro.PyQtClass.children(), mikro.convert_value(), and mikro.wrap().

◆ __getitem__()

mikro.PyQtClass.__getitem__ ( self,
key )

Definition at line 241 of file mikro.py.

241 def __getitem__(self, key):
242 if isinstance(key, int):
243 length = getattr(self, "length", None)
244 if length is not None:
245 # array protocol
246 try:
247 return getattr(self, str(key))
248 except AttributeError as e:
249 raise IndexError(key)
250 else:
251 return self.children()[key]
252 else:
253 return getattr(self, key)
254

References GroupShape.children(), KisKXMLGUI::ContainerNode.children, and mikro.PyQtClass.children().

◆ __members__()

mikro.PyQtClass.__members__ ( self)
This method is for introspection.
Using dir(thispyqtclass_object) returns a list of
all children, methods, properties and dynamic properties.

Definition at line 270 of file mikro.py.

270 def __members__(self):
271 """
272 This method is for introspection.
273 Using dir(thispyqtclass_object) returns a list of
274 all children, methods, properties and dynamic properties.
275 """
276 names = list(self.__dict__.keys())
277 for c in self._instance.children():
278 child_name = str(c.objectName())
279 if child_name:
280 names.append(child_name)
281 for pn in self._instance.dynamicPropertyNames():
282 names.append(str(pn))
283 return names
284

References mikro.PyQtClass._instance, mikro.PyQtClass.children(), KisPipeBrushParasite.dim, KisSpinBoxUnitManager.dim, FlattenSpec.dim, xcfLayer.dim, and mikro.PyQtClass.dynamicPropertyNames().

◆ children()

mikro.PyQtClass.children ( self)

Definition at line 234 of file mikro.py.

234 def children(self):
235 return [wrap(c) for c in self._instance.children()]
236

References mikro.PyQtClass._instance, mikro.PyQtClass.children(), and mikro.wrap().

◆ connect()

mikro.PyQtClass.connect ( self,
signal,
slot )

Definition at line 225 of file mikro.py.

225 def connect(self, signal, slot):
226 getattr(self._instance, signal).connect(slot)
227
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))

References mikro.PyQtClass._instance, and mikro.PyQtClass.connect().

◆ disconnect()

mikro.PyQtClass.disconnect ( self,
signal,
slot )

Definition at line 228 of file mikro.py.

228 def disconnect(self, signal, slot):
229 getattr(self._instance, signal).disconnect(slot)
230

References mikro.PyQtClass._instance, and mikro.PyQtClass.disconnect().

◆ dynamicPropertyNames()

mikro.PyQtClass.dynamicPropertyNames ( self)

Definition at line 219 of file mikro.py.

219 def dynamicPropertyNames(self):
220 return self._instance.dynamicPropertyNames()
221

References mikro.PyQtClass._instance, and mikro.PyQtClass.dynamicPropertyNames().

◆ getProperty()

mikro.PyQtClass.getProperty ( self,
name )

Definition at line 213 of file mikro.py.

213 def getProperty(self, name):
214 return wrap(self._instance.property(name))
215

References mikro.PyQtClass._instance, and mikro.wrap().

◆ metaObject()

mikro.PyQtClass.metaObject ( self)

Definition at line 222 of file mikro.py.

222 def metaObject(self):
223 return self._instance.metaObject()
224

References mikro.PyQtClass._instance, and mikro.PyQtClass.metaObject().

◆ parent()

mikro.PyQtClass.parent ( self)

Definition at line 231 of file mikro.py.

231 def parent(self):
232 return wrap(self._instance.parent())
233

References mikro.PyQtClass._instance, mikro.PyQtClass.parent(), and mikro.wrap().

◆ propertyNames()

mikro.PyQtClass.propertyNames ( self)

Definition at line 216 of file mikro.py.

216 def propertyNames(self):
217 return list(self.__class__.__properties__.keys())
218

References KisPipeBrushParasite.dim, KisSpinBoxUnitManager.dim, FlattenSpec.dim, and xcfLayer.dim.

◆ qt()

mikro.PyQtClass.qt ( self)

Definition at line 238 of file mikro.py.

238 def qt(self):
239 return self._instance
240

References mikro.PyQtClass._instance.

◆ setProperty()

mikro.PyQtClass.setProperty ( self,
name,
value )

Definition at line 210 of file mikro.py.

210 def setProperty(self, name, value):
211 self._instance.setProperty(name, value)
212

References mikro.PyQtClass._instance, and mikro.PyQtClass.setProperty().

Member Data Documentation

◆ _instance

mikro.PyQtClass._instance
protected

Definition at line 197 of file mikro.py.


The documentation for this class was generated from the following file: