29 lines
890 B
QML
29 lines
890 B
QML
pragma Singleton
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
Singleton {
|
|
id: root
|
|
property var details: ({})
|
|
property string error: ""
|
|
property bool busy: false
|
|
function refresh() {
|
|
if (busy) return;
|
|
busy = true;
|
|
probe.running = true;
|
|
}
|
|
Process {
|
|
id: probe
|
|
command: ["python3", Qt.resolvedUrl("../backend/system_info.py").toString().replace(/^file:\/\//, "")]
|
|
stdout: StdioCollector {
|
|
onStreamFinished: {
|
|
try { root.details = JSON.parse(text); root.error = ""; }
|
|
catch (e) { root.error = "Не удалось получить сведения о системе: " + String(e); }
|
|
}
|
|
}
|
|
onExited: root.busy = false
|
|
}
|
|
Timer { interval: 60000; repeat: true; running: true; triggeredOnStart: true; onTriggered: root.refresh() }
|
|
}
|