Integra calibrazione RGB nel plasmoide e ripristina backend funzionante

This commit is contained in:
enne2
2026-11-01 15:43:28 +01:00
parent 72c7141ecd
commit 344e3c8764
9 changed files with 250 additions and 260 deletions
@@ -10,6 +10,9 @@ PlasmoidItem {
// Percorso dell'helper, sostituito da install.sh con il percorso assoluto
readonly property string ctl: "@CTL@"
readonly property string calibration: "@CALIBRATE@"
property bool polling: false
property bool calibrating: false
property var st: ({ daemon: false, running: false, brightness: 1.0,
contrast: 1.0, saturation: 1.0, band: 0.12,
@@ -28,9 +31,18 @@ PlasmoidItem {
}
function refresh() {
if (root.polling) return
root.polling = true
poll.connectSource(root.ctl + " state")
}
Timer {
interval: 2000
running: true
repeat: true
onTriggered: root.refresh()
}
function run(args) {
if (root.busy)
return
@@ -46,6 +58,7 @@ PlasmoidItem {
connectedSources: []
onNewData: function(source, data) {
poll.disconnectSource(source)
root.polling = false
const out = String(data["stdout"] || "").trim()
if (!out)
return
@@ -248,6 +261,14 @@ PlasmoidItem {
RowLayout {
Layout.fillWidth: true
PC3.Button {
text: i18n("Calibra…")
enabled: root.st.daemon && !root.calibrating
onClicked: {
root.calibrating = true
calibrationSource.connectSource("/usr/bin/python3 " + JSON.stringify(root.calibration))
}
}
PC3.Button {
text: i18n("Riavvia demone")
font: Kirigami.Theme.smallFont
@@ -279,5 +300,18 @@ PlasmoidItem {
}
}
P5Support.DataSource {
id: calibrationSource
engine: "executable"
connectedSources: []
onNewData: function(source, data) {
calibrationSource.disconnectSource(source)
root.calibrating = false
if (data["exit code"] !== 0)
root.lastError = String(data["stderr"] || i18n("Impossibile avviare la calibrazione"))
root.refresh()
}
}
Component.onCompleted: root.refresh()
}