Debian Codegraph @

tests/test_wrapped/test_wrapped.qml

raw
1 import QtQuick 2.0
2 import io.thp.pyotherside 1.4
3
4 Rectangle {
5 id: page
6 width: 300
7 height: 300
8
9 Python {
10 Component.onCompleted: {
11 addImportPath(Qt.resolvedUrl('.'));
12
13 importModule('test_wrapped', function () {
14 console.log('"test_wrapped" imported successfully');
15
16 var foo = call_sync('test_wrapped.get_foo', []);
17 console.log('got foo: ' + foo);
18
19 console.log('attribute bar of foo: ' + getattr(foo, 'bar'));
20
21 var func = getattr(foo, 'methodman');
22
23 call(func, ['the pain'], function (result) {
24 console.log('methodman() result: ' + result);
25 });
26
27 var mmr = call_sync(func, ['the pain']);
28 console.log('methodman() sync result: ' + mmr);
29
30 var result = call_sync('test_wrapped.set_foo', [foo]);
31 console.log('got result: ' + result);
32 });
33 }
34
35 onError: {
36 console.log('Received error: ' + traceback);
37 }
38 }
39 }