aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop/modules/assistant/AssistantModule.qml5
-rw-r--r--desktop/modules/assistant/AssistantPage.qml16
2 files changed, 12 insertions, 9 deletions
diff --git a/desktop/modules/assistant/AssistantModule.qml b/desktop/modules/assistant/AssistantModule.qml
index b56b163..49e8c7b 100644
--- a/desktop/modules/assistant/AssistantModule.qml
+++ b/desktop/modules/assistant/AssistantModule.qml
@@ -262,8 +262,9 @@ Module {
+ " try:\n t = tomllib.load(open(p, 'rb'))\n"
+ " d, c = t.get('description', ''), t.get('cloud')\n"
+ " cloud = c if c is True or c == 'safe' else False\n"
- + " except Exception as e:\n d, cloud = f'unreadable: {e}', False\n"
- + " out.append({'name': name, 'on': on, 'cloud': cloud, 'description': d})\n"
+ + " writes = t.get('writes') is True\n"
+ + " except Exception as e:\n d, cloud, writes = f'unreadable: {e}', False, False\n"
+ + " out.append({'name': name, 'on': on, 'cloud': cloud, 'writes': writes, 'description': d})\n"
+ "print(json.dumps(sorted(out, key=lambda t: t['name'])))\n"
function listTools() {
diff --git a/desktop/modules/assistant/AssistantPage.qml b/desktop/modules/assistant/AssistantPage.qml
index 680692f..7691cb5 100644
--- a/desktop/modules/assistant/AssistantPage.qml
+++ b/desktop/modules/assistant/AssistantPage.qml
@@ -745,10 +745,12 @@ Column {
id: toolText
anchors { left: toolSw.right; leftMargin: 10; right: cloudMark.left; rightMargin: 10
verticalCenter: parent.verticalCenter }
- // A description ending "Read-only." shows it as a chip by
- // the name instead. The toml keeps the sentence: the model
- // reads the description too.
+ // Every tool gets a chip: "writes" for one whose toml says
+ // writes = true, "read only" otherwise. A description ending
+ // "Read-only." drops that sentence here; the toml keeps it,
+ // since the model reads the description too.
readonly property var ro: /\s*Read-only\.\s*$/.exec(toolRow.modelData.description ?? "")
+ readonly property color chip: toolRow.modelData.writes ? Theme.peach : Theme.green
Row {
spacing: 8
Text {
@@ -759,16 +761,16 @@ Column {
}
Rectangle {
anchors.verticalCenter: parent.verticalCenter
- visible: toolText.ro !== null
width: roText.implicitWidth + 12
height: roText.implicitHeight + 4
radius: height / 2
- color: Qt.alpha(Theme.overlay, 0.35)
+ color: Qt.alpha(toolText.chip, 0.18)
+ border { width: 1; color: Qt.alpha(toolText.chip, 0.55) }
Text {
id: roText
anchors.centerIn: parent
- text: "read only"
- color: Theme.subtext
+ text: toolRow.modelData.writes ? "writes" : "read only"
+ color: toolText.chip
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 5 }
}
}