mirror of
https://github.com/thp/pyotherside.git
synced 2025-01-28 23:52:55 +08:00
35 lines
931 B
QML
35 lines
931 B
QML
import QtQuick 2.0
|
|
import io.thp.pyotherside 1.0
|
|
|
|
Rectangle {
|
|
id: page
|
|
width: 300
|
|
height: 300
|
|
|
|
Python {
|
|
Component.onCompleted: {
|
|
addImportPath(Qt.resolvedUrl('.'));
|
|
|
|
importModule('test_wrapped', function () {
|
|
console.log('"test_wrapped" imported successfully');
|
|
|
|
var foo = call_sync('test_wrapped.get_foo', []);
|
|
console.log('got foo: ' + foo);
|
|
|
|
console.log('attribute bar of foo: ' + getattr(foo, 'bar'));
|
|
|
|
callMethod(foo, 'methodman', ['the pain'], function (result) {
|
|
console.log('methodman() result: ' + result);
|
|
});
|
|
|
|
var result = call_sync('test_wrapped.set_foo', [foo]);
|
|
console.log('got result: ' + result);
|
|
});
|
|
}
|
|
|
|
onError: {
|
|
console.log('Received error: ' + traceback);
|
|
}
|
|
}
|
|
}
|