MCPcopy Create free account
hub / github.com/analogdevicesinc/scopy / init

Method init

pluginbase/src/scopyjs.cpp:61–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59void ScopyJS::exit() { QApplication::closeAllWindows(); }
60
61void ScopyJS::init()
62{
63 QJSValue js_obj = m_engine.newQObject(this);
64 auto meta = metaObject();
65 input = "";
66
67 for(int i = meta->methodOffset(); i < meta->methodCount(); i++) {
68 QString name(meta->method(i).name());
69
70 m_engine.globalObject().setProperty(name, js_obj.property(name));
71 }
72
73 m_engine.globalObject().setProperty("inspect()",
74 m_engine.evaluate("(function(o) { for (each in o) { print(each); } })"));
75 m_engine.installExtensions(QJSEngine::ConsoleExtension);
76 m_engine.globalObject().setProperty("fileIO", m_engine.newQObject(new JsFileIo(this)));
77
78 if(isatty(STDIN_FILENO)) {
79 // verify if stdin is a true TTY - prevents QtCreator Application output from flooding the application
80 // notifier->setEnabled(false);
81 notifier = new QSocketNotifier(STDIN_FILENO, QSocketNotifier::Read);
82 connect(notifier, SIGNAL(activated(int)), this, SLOT(hasText()));
83 }
84}
85
86void ScopyJS::returnToApplication()
87{

Callers 2

initPreferencesMethod · 0.45
GetInstanceMethod · 0.45

Calls 1

nameMethod · 0.45

Tested by 1

initPreferencesMethod · 0.36