refactor: update UI layout for wafer data display and add file browser auto-refresh on tab switch

This commit is contained in:
jack
2026-06-30 22:15:14 -07:00
parent 0d5cf9e4ff
commit 0a2d6b78ba
2 changed files with 115 additions and 96 deletions
+5
View File
@@ -19,6 +19,11 @@ Rectangle {
// ===== View State ===== // ===== View State =====
property int selectedTabIndex: 0 property int selectedTabIndex: 0
onSelectedTabIndexChanged: {
if (selectedTabIndex === 2) {
file_browser.refreshFiles();
}
}
property bool memoryRead: false property bool memoryRead: false
property bool waferDetected: false property bool waferDetected: false
+110 -96
View File
@@ -51,29 +51,31 @@ ColumnLayout {
} }
} }
component GridCell : ColumnLayout { component GridCell : RowLayout {
property alias label: labelText.text property alias label: labelText.text
property alias value: valueText.text property alias value: valueText.text
property bool isRight: false
property bool active: root.waferDetected property bool active: root.waferDetected
spacing: 1 spacing: 8
Layout.alignment: isRight ? Qt.AlignRight : Qt.AlignLeft Layout.fillWidth: true
Text { Text {
id: labelText id: labelText
color: Theme.sideMutedText color: Theme.sideMutedText
font.pixelSize: Theme.fontXs font.pixelSize: Theme.fontXs
font.family: Theme.uiFontFamily font.family: Theme.uiFontFamily
Layout.alignment: isRight ? Qt.AlignRight : Qt.AlignLeft Layout.fillWidth: true
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
} }
Text { Text {
id: valueText id: valueText
color: active ? Theme.headingColor : Theme.sideMutedText color: active ? Theme.headingColor : Theme.sideMutedText
font.pixelSize: Theme.fontMd font.pixelSize: Theme.fontSm
font.weight: Font.Bold font.weight: Font.Bold
font.family: Theme.uiFontFamily font.family: Theme.uiFontFamily
Layout.alignment: isRight ? Qt.AlignRight : Qt.AlignLeft Layout.alignment: Qt.AlignRight
verticalAlignment: Text.AlignVCenter
} }
} }
@@ -107,6 +109,12 @@ ColumnLayout {
function parseAndSavePendingRead() { function parseAndSavePendingRead() {
deviceController.parseAndSaveData(root.currentFamilyCode(), deviceController.selectedPort || ""); deviceController.parseAndSaveData(root.currentFamilyCode(), deviceController.selectedPort || "");
} }
function getCsvFileName() {
var path = root.csvPath;
if (!path) return "";
var parts = path.split(/[\/\\]/);
return parts[parts.length - 1].toUpperCase();
}
FolderDialog { FolderDialog {
id: saveDirDialog id: saveDirDialog
@@ -292,64 +300,32 @@ ColumnLayout {
spacing: 2 spacing: 2
Text { Text {
text: "DIRECTORY" text: root.csvPath !== "" ? root.getCsvFileName() : "DIRECTORY"
color: Theme.sideMutedText color: root.csvPath !== "" ? Theme.headingColor : Theme.sideMutedText
font.pixelSize: Theme.fontMd font.pixelSize: root.csvPath !== "" ? Theme.fontSm : Theme.fontMd
font.weight: Font.Medium font.weight: root.csvPath !== "" ? Font.Bold : Font.Medium
font.letterSpacing: 1.2 font.letterSpacing: root.csvPath !== "" ? 0 : 1.2
font.family: Theme.uiFontFamily font.family: Theme.uiFontFamily
} elide: Text.ElideRight
Text {
text: deviceController.saveDataDir || "Not configured"
color: Theme.bodyColor
font.pixelSize: Theme.fontSm
font.family: Theme.uiFontFamily
font.italic: true
opacity: 0.7
elide: Text.ElideMiddle
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
Item { Layout.fillHeight: true }
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
spacing: 8 spacing: 8
Button { Text {
id: browseBtn text: deviceController.saveDataDir || "Not configured"
text: "Browse" color: Theme.bodyColor
font.pixelSize: Theme.fontSm font.pixelSize: Theme.fontXs
font.weight: Font.Medium
font.family: Theme.uiFontFamily font.family: Theme.uiFontFamily
implicitHeight: 24 font.italic: true
implicitWidth: 60 opacity: 0.6
hoverEnabled: true elide: Text.ElideMiddle
background: Rectangle { Layout.fillWidth: true
color: browseBtn.hovered ? Theme.buttonNeutralHover : Theme.buttonNeutralBackground
border.color: Theme.cardBorder
border.width: 1
radius: Theme.radiusSm
}
contentItem: Text {
text: browseBtn.text
color: Theme.bodyColor
font: browseBtn.font
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: saveDirDialog.open()
}
Item { Layout.fillWidth: true }
Row {
spacing: 4
visible: root.isConnected
Rectangle {
width: 6; height: 6; radius: 3
color: Theme.statusSuccessColor
anchors.verticalCenter: parent.verticalCenter
}
} }
Rectangle { Rectangle {
@@ -372,6 +348,31 @@ ColumnLayout {
font.letterSpacing: 0.6 font.letterSpacing: 0.6
} }
} }
Button {
id: browseBtn
text: "Save As"
font.pixelSize: Theme.fontSm
font.weight: Font.Medium
font.family: Theme.uiFontFamily
implicitHeight: 24
implicitWidth: 70
hoverEnabled: true
background: Rectangle {
color: browseBtn.hovered ? Theme.buttonNeutralHover : Theme.buttonNeutralBackground
border.color: Theme.cardBorder
border.width: 1
radius: Theme.radiusSm
}
contentItem: Text {
text: browseBtn.text
color: Theme.bodyColor
font: browseBtn.font
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: saveDirDialog.open()
}
} }
} }
} }
@@ -386,53 +387,66 @@ ColumnLayout {
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: Theme.panelPadding anchors.margins: 10
spacing: 8 spacing: 4
Item { Text {
text: "WAFER & SENSOR DATA"
color: Theme.sideMutedText
font.pixelSize: Theme.fontXs
font.weight: Font.Bold
font.family: Theme.uiFontFamily
font.letterSpacing: 0.6
Layout.bottomMargin: 2
}
GridLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
columns: 2
rowSpacing: 4
columnSpacing: 16
GridLayout { GridCell {
anchors.fill: parent id: waferInfoFamilyCell
columns: 2 label: "Family Code"
rowSpacing: 6 value: {
columnSpacing: 16 var info = deviceController.lastWaferInfo;
return (info && info.length > 0 && info[0]) ? info[0] : "—";
}
}
GridCell {
id: waferCyclesCell
label: "Cycles Completed"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 5 && info[5] !== undefined) ? String(info[5]) : "—";
}
active: root.waferDetected
}
GridCell { Rectangle {
id: waferInfoFamilyCell Layout.columnSpan: 2
label: "Family Code" Layout.fillWidth: true
value: { height: 1
var info = deviceController.lastWaferInfo; color: Theme.cardBorder
return (info && info.length > 0 && info[0]) ? info[0] : "—"; opacity: 0.5
} }
GridCell {
id: waferSerialCell
label: "Serial"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 1 && info[1]) ? info[1] : "—";
} }
GridCell { }
id: waferCyclesCell GridCell {
label: "Cycles Completed" id: waferSensorsCell
value: { label: "Sensors"
var info = deviceController.lastWaferInfo; value: {
return (info && info.length > 5 && info[5] !== undefined) ? String(info[5]) : "—"; var info = deviceController.lastWaferInfo;
} return (info && info.length > 2 && info[2]) ? String(info[2]) : "—";
isRight: true
active: root.waferDetected
}
GridCell {
id: waferSerialCell
label: "Serial"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 1 && info[1]) ? info[1] : "—";
}
}
GridCell {
id: waferSensorsCell
label: "Sensors"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 2 && info[2]) ? String(info[2]) : "—";
}
isRight: true
} }
} }
} }