mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-03 10:56:16 +00:00
CustomButton stream: i18n + autofmt
This commit is contained in:
@@ -1098,11 +1098,16 @@
|
||||
"dynamic-text": "Dynamischer Text",
|
||||
"display-command-output": {
|
||||
"label": "Befehlsausgabe anzeigen",
|
||||
"description": "Befehl eingeben, der in regelmäßigen Abständen ausgeführt wird. Die erste Zeile seiner Ausgabe wird als Text angezeigt."
|
||||
"description": "Befehl eingeben, der in regelmäßigen Abständen ausgeführt wird. Die erste Zeile seiner Ausgabe wird als Text angezeigt.",
|
||||
"stream-description": "Geben Sie einen Befehl ein, der kontinuierlich ausgeführt werden soll."
|
||||
},
|
||||
"refresh-interval": {
|
||||
"label": "Aktualisierungsintervall",
|
||||
"description": "Intervall in Millisekunden."
|
||||
},
|
||||
"text-stream": {
|
||||
"description": "Gestreamte Zeilen aus dem Befehl werden als Text auf der Schaltfläche angezeigt.",
|
||||
"label": "Strom"
|
||||
}
|
||||
},
|
||||
"media-mini": {
|
||||
|
||||
@@ -1081,11 +1081,16 @@
|
||||
"dynamic-text": "Texto dinámico",
|
||||
"display-command-output": {
|
||||
"label": "Mostrar salida de comando",
|
||||
"description": "Ingresa un comando para ejecutar a intervalos regulares. La primera línea de su salida se mostrará como texto."
|
||||
"description": "Ingresa un comando para ejecutar a intervalos regulares. La primera línea de su salida se mostrará como texto.",
|
||||
"stream-description": "Introduce un comando para ejecutar continuamente."
|
||||
},
|
||||
"refresh-interval": {
|
||||
"label": "Intervalo de actualización",
|
||||
"description": "Intervalo en milisegundos."
|
||||
},
|
||||
"text-stream": {
|
||||
"description": "Las líneas transmitidas desde el comando se mostrarán como texto en el botón.",
|
||||
"label": "Transmisión"
|
||||
}
|
||||
},
|
||||
"media-mini": {
|
||||
|
||||
@@ -1081,11 +1081,16 @@
|
||||
"dynamic-text": "Texte dynamique",
|
||||
"display-command-output": {
|
||||
"label": "Afficher la sortie de la commande",
|
||||
"description": "Entrez une commande à exécuter à intervalle régulier. La première ligne de sa sortie sera affichée sous forme de texte."
|
||||
"description": "Entrez une commande à exécuter à intervalle régulier. La première ligne de sa sortie sera affichée sous forme de texte.",
|
||||
"stream-description": "Entrez une commande à exécuter en continu."
|
||||
},
|
||||
"refresh-interval": {
|
||||
"label": "Intervalle d'actualisation",
|
||||
"description": "Intervalle en millisecondes."
|
||||
},
|
||||
"text-stream": {
|
||||
"description": "Les lignes diffusées depuis la commande seront affichées sous forme de texte sur le bouton.",
|
||||
"label": "Flux"
|
||||
}
|
||||
},
|
||||
"media-mini": {
|
||||
|
||||
@@ -1081,11 +1081,16 @@
|
||||
"dynamic-text": "Texto dinâmico",
|
||||
"display-command-output": {
|
||||
"label": "Exibir Saída de Comando",
|
||||
"description": "Digite um comando para ser executado em um intervalo regular. A primeira linha da sua saída será exibida como texto."
|
||||
"description": "Digite um comando para ser executado em um intervalo regular. A primeira linha da sua saída será exibida como texto.",
|
||||
"stream-description": "Insira um comando para executar continuamente."
|
||||
},
|
||||
"refresh-interval": {
|
||||
"label": "Intervalo de atualização",
|
||||
"description": "Intervalo em milissegundos."
|
||||
},
|
||||
"text-stream": {
|
||||
"description": "As linhas transmitidas do comando serão exibidas como texto no botão.",
|
||||
"label": "Transmissão"
|
||||
}
|
||||
},
|
||||
"media-mini": {
|
||||
|
||||
@@ -1081,11 +1081,16 @@
|
||||
"dynamic-text": "动态文本",
|
||||
"display-command-output": {
|
||||
"label": "显示命令输出",
|
||||
"description": "输入一个定期运行的命令。其输出的第一行将显示为文本。"
|
||||
"description": "输入一个定期运行的命令。其输出的第一行将显示为文本。",
|
||||
"stream-description": "输入一个要持续运行的命令。"
|
||||
},
|
||||
"refresh-interval": {
|
||||
"label": "刷新间隔",
|
||||
"description": "间隔时间(毫秒)。"
|
||||
},
|
||||
"text-stream": {
|
||||
"description": "来自命令的流式输出行将作为文本显示在按钮上。",
|
||||
"label": "流"
|
||||
}
|
||||
},
|
||||
"media-mini": {
|
||||
|
||||
@@ -99,18 +99,18 @@ Item {
|
||||
|
||||
SplitParser {
|
||||
id: textStdoutSplit
|
||||
onRead: (line) => _dynamicText = String(line || "").trim()
|
||||
onRead: line => _dynamicText = String(line || "").trim()
|
||||
}
|
||||
|
||||
StdioCollector {
|
||||
id: textStdoutCollect
|
||||
onStreamFinished: () => {
|
||||
var out = String(this.text || "").trim()
|
||||
if (out.indexOf("\n") !== -1) {
|
||||
out = out.split("\n")[0]
|
||||
}
|
||||
_dynamicText = out
|
||||
}
|
||||
var out = String(this.text || "").trim()
|
||||
if (out.indexOf("\n") !== -1) {
|
||||
out = out.split("\n")[0]
|
||||
}
|
||||
_dynamicText = out
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
@@ -118,11 +118,11 @@ Item {
|
||||
stdout: textStream ? textStdoutSplit : textStdoutCollect
|
||||
stderr: StdioCollector {}
|
||||
onExited: (exitCode, exitStatus) => {
|
||||
if (textStream) {
|
||||
Logger.w("CustomButton", `Streaming text command exited (code: ${exitCode}), restarting...`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (textStream) {
|
||||
Logger.w("CustomButton", `Streaming text command exited (code: ${exitCode}), restarting...`)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onClicked() {
|
||||
@@ -153,9 +153,9 @@ Item {
|
||||
|
||||
function runTextCommand() {
|
||||
if (!textCommand || textCommand.length === 0)
|
||||
return
|
||||
return
|
||||
if (textProc.running)
|
||||
return
|
||||
return
|
||||
textProc.command = ["sh", "-lc", textCommand]
|
||||
textProc.running = true
|
||||
}
|
||||
|
||||
@@ -104,9 +104,7 @@ ColumnLayout {
|
||||
id: textCommandInput
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.widget-settings.custom-button.display-command-output.label")
|
||||
description: valueTextStream ?
|
||||
I18n.tr("bar.widget-settings.custom-button.display-command-output.stream-description") :
|
||||
I18n.tr("bar.widget-settings.custom-button.display-command-output.description")
|
||||
description: valueTextStream ? I18n.tr("bar.widget-settings.custom-button.display-command-output.stream-description") : I18n.tr("bar.widget-settings.custom-button.display-command-output.description")
|
||||
placeholderText: I18n.tr("placeholders.command-example")
|
||||
text: widgetData?.textCommand || widgetMetadata.textCommand
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user