Krita Source Code Documentation
Loading...
Searching...
No Matches
krita.sceditor.console.QtQmlInterpreter Class Reference
+ Inheritance diagram for krita.sceditor.console.QtQmlInterpreter:

Public Member Functions

 __init__ (self, locals)
 
 execute (self, code)
 
 execute_code (self, code, engine=None)
 
 newEngine (self)
 
 push (self, line)
 

Public Attributes

 code
 
 engine
 
 locals
 
 state
 

Detailed Description

Definition at line 288 of file console.py.

Constructor & Destructor Documentation

◆ __init__()

krita.sceditor.console.QtQmlInterpreter.__init__ ( self,
locals )

Definition at line 290 of file console.py.

290 def __init__(self, locals):
291 self.locals = locals
292 self.engine = self.newEngine()
293 self.code = ""
294 self.state = 0
295

Member Function Documentation

◆ execute()

krita.sceditor.console.QtQmlInterpreter.execute ( self,
code )

◆ execute_code()

krita.sceditor.console.QtQmlInterpreter.execute_code ( self,
code,
engine = None )

Definition at line 310 of file console.py.

310 def execute_code(self, code, engine=None):
311 engine = engine or self.newEngine()
312 result = engine.evaluate(code)
313 try:
314 Scripter.activeWindow.redraw = True
315 Scripter.activeWindow.update()
316 except:
317 pass
318 if engine.hasUncaughtException():
319 bt = engine.uncaughtExceptionBacktrace()
320 print("Traceback:")
321 print("\n".join([" %s" % l for l in list(bt)]))
322 print(engine.uncaughtException().toString())
323 else:
324 if not result.isUndefined():
325 print(result.toString())
326

References krita.sceditor.console.QtQmlInterpreter.newEngine().

◆ newEngine()

krita.sceditor.console.QtQmlInterpreter.newEngine ( self)

Definition at line 296 of file console.py.

296 def newEngine(self):
297 engine = QScriptEngine()
298 ns = engine.globalObject()
299 for name, value in self.locals.items():
300 if isinstance(value, QObject):
301 value = engine.newQObject(value)
302 elif callable(value):
303 value = engine.newFunction(value)
304 ns.setProperty(name, value)
305 return engine
306

References krita.sceditor.console.PythonInterpreter.locals, and krita.sceditor.console.QtQmlInterpreter.locals.

◆ push()

Member Data Documentation

◆ code

krita.sceditor.console.QtQmlInterpreter.code

Definition at line 293 of file console.py.

◆ engine

krita.sceditor.console.QtQmlInterpreter.engine

Definition at line 292 of file console.py.

◆ locals

krita.sceditor.console.QtQmlInterpreter.locals

Definition at line 291 of file console.py.

◆ state

krita.sceditor.console.QtQmlInterpreter.state

Definition at line 294 of file console.py.


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