From 1cd54e81fc1d511820d9268123b0b0815636e4d9 Mon Sep 17 00:00:00 2001 From: jack Date: Thu, 11 Jun 2026 13:09:04 -0700 Subject: [PATCH] refactor: enhance UI components and improve theme properties for better visual consistency --- src/pygui/ISC/Tabs/SettingsTab.qml | 18 +++++---- .../ISC/Tabs/components/ReadoutPanel.qml | 37 ++++++++++++++++++- src/pygui/ISC/Tabs/components/SourcePanel.qml | 32 ++++++++++++++++ src/pygui/ISC/Theme.qml | 4 +- 4 files changed, 80 insertions(+), 11 deletions(-) diff --git a/src/pygui/ISC/Tabs/SettingsTab.qml b/src/pygui/ISC/Tabs/SettingsTab.qml index 4d35d49..c05658b 100644 --- a/src/pygui/ISC/Tabs/SettingsTab.qml +++ b/src/pygui/ISC/Tabs/SettingsTab.qml @@ -107,25 +107,29 @@ Item { x: toggle.leftPadding y: parent.height / 2 - height / 2 radius: Theme.radiusXs - color: toggle.checked ? Theme.primaryAccent : Theme.fieldBackground + color: toggle.checked ? Theme.primaryAccent : "transparent" border.width: Theme.borderThin border.color: toggle.checked ? Theme.primaryAccent : Theme.fieldBorder - Rectangle { + Text { anchors.centerIn: parent - width: 9 - height: 9 - radius: Theme.radiusXs + text: "✓" + font.pixelSize: 14 + font.bold: true + color: Theme.panelBackground visible: toggle.checked - color: Theme.fieldBackground + // Small nudge to center the checkmark perfectly + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter } } contentItem: Text { text: toggle.text - color: Theme.checkboxText + color: Theme.headingColor verticalAlignment: Text.AlignVCenter leftPadding: toggle.indicator.width + toggle.spacing + font.pixelSize: 13 } } diff --git a/src/pygui/ISC/Tabs/components/ReadoutPanel.qml b/src/pygui/ISC/Tabs/components/ReadoutPanel.qml index e302d9d..04df534 100644 --- a/src/pygui/ISC/Tabs/components/ReadoutPanel.qml +++ b/src/pygui/ISC/Tabs/components/ReadoutPanel.qml @@ -9,6 +9,39 @@ ColumnLayout { property alias showLabels: labelsToggle.checked property alias heatmapBlend: heatmapSlider.value + component PanelCheckBox: CheckBox { + id: toggle + indicator: Rectangle { + implicitWidth: 18 + implicitHeight: 18 + x: toggle.leftPadding + y: parent.height / 2 - height / 2 + radius: Theme.radiusXs + color: toggle.checked ? Theme.primaryAccent : "transparent" + border.width: Theme.borderThin + border.color: toggle.checked ? Theme.primaryAccent : Theme.fieldBorder + + Text { + anchors.centerIn: parent + text: "✓" + font.pixelSize: 13 + font.bold: true + color: Theme.panelBackground + visible: toggle.checked + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + } + + contentItem: Text { + text: toggle.text + color: Theme.headingColor + verticalAlignment: Text.AlignVCenter + leftPadding: toggle.indicator.width + toggle.spacing + font.pixelSize: toggle.font.pixelSize || 11 + } + } + // ── READOUT ─────────────────────────────────────────────────────────── Label { text: "READOUT" @@ -142,7 +175,7 @@ ColumnLayout { bottomPadding: 8 } - CheckBox { + PanelCheckBox { id: labelsToggle text: "Labels" checked: true @@ -236,7 +269,7 @@ ColumnLayout { Item { height: 10 } - CheckBox { + PanelCheckBox { id: autoCheck text: "Auto range (mean ± 1σ)" checked: true diff --git a/src/pygui/ISC/Tabs/components/SourcePanel.qml b/src/pygui/ISC/Tabs/components/SourcePanel.qml index f92451e..d44ed39 100644 --- a/src/pygui/ISC/Tabs/components/SourcePanel.qml +++ b/src/pygui/ISC/Tabs/components/SourcePanel.qml @@ -2,6 +2,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts import ISC +import ".." ColumnLayout { spacing: 6 @@ -23,6 +24,32 @@ ColumnLayout { Layout.alignment: Qt.AlignVCenter } + Button { + id: editBtn + text: "✎" + implicitWidth: 26 + implicitHeight: 26 + hoverEnabled: true + font.pixelSize: 14 + background: Rectangle { + color: editBtn.pressed ? Theme.buttonPressed + : editBtn.hovered ? Theme.buttonNeutralHover + : "transparent" + radius: Theme.radiusSm + } + contentItem: Text { + text: parent.text + color: Theme.bodyColor + font: parent.font + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + onClicked: { + file_browser.refreshFiles() + csvEditorDialog.open() + } + } + Button { id: refreshBtn text: "⟳" @@ -260,4 +287,9 @@ ColumnLayout { color: Theme.bodyColor font.pixelSize: 10 } + + SelectFileDialog { + id: csvEditorDialog + tableModel: file_browser.files + } } diff --git a/src/pygui/ISC/Theme.qml b/src/pygui/ISC/Theme.qml index fd5f317..1b1ff1c 100644 --- a/src/pygui/ISC/Theme.qml +++ b/src/pygui/ISC/Theme.qml @@ -81,7 +81,7 @@ QtObject { // ── 8. Tabs (footer tab bar) ───────────────────────────────────────────── readonly property color tabBarBackground: tone200 readonly property color tabBackground: "transparent" - readonly property color tabActiveBackground: "transparent" + readonly property color tabActiveBackground: isDarkMode ? "#333333" : "#FFFFFF" readonly property color tabHoverBackground: tone300 readonly property color tabBorder: "transparent" readonly property color tabText: toneMute @@ -132,7 +132,7 @@ QtObject { readonly property int tabBarHeight: 34 readonly property int tabBarPadding: 6 readonly property int tabSpacing: 2 - readonly property int tabRadius: 2 + readonly property int tabRadius: 8 readonly property int tabFontSize: 12 readonly property int tabButtonMinWidth: 80 // Settings page layout