File: test_errors.qml

package info (click to toggle)
pyotherside 1.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 880 kB
  • sloc: cpp: 2,869; python: 475; makefile: 152; sh: 35
file content (40 lines) | stat: -rw-r--r-- 860 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import QtQuick 2.0
import io.thp.pyotherside 1.0

Rectangle {
    id: page
    width: 300
    height: 300

    Component.onCompleted: {
        py.addImportPath(Qt.resolvedUrl('.').substr('file://'.length));
        py.setHandler("test-errors", page.testErrors);
        py.importModule("test_errors", null);
    }

    Python {
        id: py

        onError: {
            console.log("PYTHON ERROR: " + traceback);
            msg.text += '\n' + traceback;
        }
    }

    Text {
        id: msg
        anchors {
            top: parent.top
            left: parent.left
            right: parent.right
        }
        text: "Testing (you should see errors appearing here)..."
        wrapMode: Text.Wrap
    }

    function testErrors() {
        console.log("starting");
        page.nonexistentMethod();
        console.log("finished");
    }
}