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

Public Member Functions

 __init__ (self, parent=None, namespace=None)
 
 push (self, line)
 
- Public Member Functions inherited from krita.sceditor.console.ConsoleWidget
 focusInEvent (self, event)
 
 keyPressEvent (self, event)
 
 mousePressEvent (self, event)
 
- Public Member Functions inherited from krita.sceditor.console.OutputWidget
 __del__ (self)
 
 attach (self)
 
 detach (self)
 
 write (self, s)
 
 writelines (self, lines)
 

Public Attributes

 completer
 
 highlighter
 
 inter
 
- Public Attributes inherited from krita.sceditor.console.ConsoleWidget
 history
 
 history_index
 
 ps1
 
 ps2
 
 tab_state
 
- Public Attributes inherited from krita.sceditor.console.OutputWidget
 echo
 

Detailed Description

Definition at line 442 of file console.py.

Constructor & Destructor Documentation

◆ __init__()

krita.sceditor.console.QtQmlConsole.__init__ ( self,
parent = None,
namespace = None )

Reimplemented from krita.sceditor.console.ConsoleWidget.

Definition at line 444 of file console.py.

444 def __init__(self, parent=None, namespace=None):
445 ConsoleWidget.__init__(self, parent, ps1=">>> ", ps2="... ")
446 self.highlighter = QtQmlHighlighter(self)
447 namespace = namespace or {}
448
449 def console_print(context, engine):
450 for i in range(context.argumentCount()):
451 print(context.argument(i).toString(), end='')
452 print()
453 return QScriptValue()
454
455 def dir_context(context, engine):
456 if context.argumentCount() == 0:
457 obj = context.thisObject()
458 else:
459 obj = context.argument(0)
460 l = []
461 it = QScriptValueIterator(obj)
462 while it.hasNext():
463 it.next()
464 l.append(str(it.name()))
465 return QScriptValue(engine, repr(l))
466 namespace["print"] = console_print
467 namespace["dir"] = dir_context
468 namespace["Application"] = QApplication.instance()
469 try:
470 namespace["Scripter"] = Scripter.qt
471 except:
472 pass
473 self.inter = QtQmlInterpreter(namespace)
474 self.completer = QtQmlCompleter(self.inter.engine)
475

Member Function Documentation

◆ push()

krita.sceditor.console.QtQmlConsole.push ( self,
line )

Reimplemented from krita.sceditor.console.ConsoleWidget.

Definition at line 476 of file console.py.

476 def push(self, line):
477 return self.inter.push(line)
478
479

References krita.sceditor.console.PythonConsole.inter, krita.sceditor.console.QtQmlConsole.inter, and krita.sceditor.console.QtQmlConsole.push().

Member Data Documentation

◆ completer

krita.sceditor.console.QtQmlConsole.completer

Definition at line 474 of file console.py.

◆ highlighter

krita.sceditor.console.QtQmlConsole.highlighter

Definition at line 446 of file console.py.

◆ inter

krita.sceditor.console.QtQmlConsole.inter

Definition at line 473 of file console.py.


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