Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions STDF-Viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,8 @@ def updateDutSummaryTable(self):
self.tmodel_dut.setQuery(QtSql.QSqlQuery(DUT_SUMMARY_QUERY, self.db_dut))

for column in range(0, header.count()):
if column in [2, 3, header.count()-1]:
# PartID, Head-Site and DUT Flag
if column in [2, 3, 4, header.count()-1]:
# PartID, Part Text, Head-Site and DUT Flag
# column may be too long to display
mode = QHeaderView.ResizeMode.ResizeToContents
else:
Expand All @@ -741,6 +741,19 @@ def updateDutSummaryTable(self):
self.ui.dutInfoTable.hideColumn(1)
else:
self.ui.dutInfoTable.showColumn(1)

# hide Part Text column (column 3) if all values are empty
has_part_txt = False
for row in range(self.tmodel_dut.rowCount()):
part_txt = self.tmodel_dut.data(self.tmodel_dut.index(row, 3), Qt.ItemDataRole.DisplayRole)
if part_txt and part_txt.strip():
has_part_txt = True
break

if not has_part_txt:
self.ui.dutInfoTable.hideColumn(3)
else:
self.ui.dutInfoTable.showColumn(3)
Comment on lines +744 to +756
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not recommended to check part_txt value in qt model.

  1. it is a sql model and rowCount() only returns count of cached rows, there could be millions of rows not loaded yet and skipped unexpectedly.
  2. python loop is too slow.

The correct way is to query the info from database directly, something like following:

diff --git a/STDF-Viewer.py b/STDF-Viewer.py
index cd82c1b..8c1ffd7 100644
--- a/STDF-Viewer.py
+++ b/STDF-Viewer.py
@@ -4,7 +4,7 @@
 # Author: noonchen - chennoon233@foxmail.com
 # Created Date: December 13th 2020
 # -----
-# Last Modified: Sun Oct 12 2025
+# Last Modified: Fri Oct 24 2025
 # Modified By: noonchen
 # -----
 # Copyright (c) 2020 noonchen
@@ -736,24 +736,14 @@ class MyWindow(QtWidgets.QMainWindow):
         
         # always hide dut index column
         self.ui.dutInfoTable.hideColumn(0)
-        # hide file id column if 1 file is opened
-        if self.data_interface.num_files <= 1:
-            self.ui.dutInfoTable.hideColumn(1)
-        else:
-            self.ui.dutInfoTable.showColumn(1)
-        
-        # hide Part Text column (column 3) if all values are empty
-        has_part_txt = False
-        for row in range(self.tmodel_dut.rowCount()):
-            part_txt = self.tmodel_dut.data(self.tmodel_dut.index(row, 3), Qt.ItemDataRole.DisplayRole)
-            if part_txt and part_txt.strip():
-                has_part_txt = True
-                break
-        
-        if not has_part_txt:
-            self.ui.dutInfoTable.hideColumn(3)
-        else:
-            self.ui.dutInfoTable.showColumn(3)
+        for hideCond, col in [(self.data_interface.num_files <= 1, 1),
+                              (self.data_interface.noPartTXT, 3),
+                              (self.data_interface.noWaferID, 9),
+                              (self.data_interface.noWaferXY, 10)]:
+            if hideCond:
+                self.ui.dutInfoTable.hideColumn(col)
+            else:
+                self.ui.dutInfoTable.showColumn(col)
         # # show all rows
         # while self.tmodel_dut.canFetchMore():
         #     self.tmodel_dut.fetchMore()
diff --git a/deps/DataInterface.py b/deps/DataInterface.py
index f989daa..1ceb039 100644
--- a/deps/DataInterface.py
+++ b/deps/DataInterface.py
@@ -4,7 +4,7 @@
 # Author: noonchen - chennoon233@foxmail.com
 # Created Date: November 3rd 2022
 # -----
-# Last Modified: Sun Oct 12 2025
+# Last Modified: Fri Oct 24 2025
 # Modified By: noonchen
 # -----
 # Copyright (c) 2022 noonchen
@@ -80,6 +80,10 @@ class DataInterface:
         # for UI display
         self.completeTestList = self.DatabaseFetcher.getTestItemsList()
         self.completeWaferList = self.DatabaseFetcher.getWaferList()
+        # for dut summary
+        self.noPartTXT = self.DatabaseFetcher.isDutInfoColumnEmpty("PART_TXT")
+        self.noWaferID = self.DatabaseFetcher.isDutInfoColumnEmpty("WaferIndex")
+        self.noWaferXY = self.DatabaseFetcher.isDutInfoColumnEmpty("XCOORD")
         
         
     def close(self):
diff --git a/deps/DatabaseFetcher.py b/deps/DatabaseFetcher.py
index 80b0bc4..72ce356 100644
--- a/deps/DatabaseFetcher.py
+++ b/deps/DatabaseFetcher.py
@@ -4,7 +4,7 @@
 # Author: noonchen - chennoon233@foxmail.com
 # Created Date: May 15th 2021
 # -----
-# Last Modified: Sun Dec 11 2022
+# Last Modified: Fri Oct 24 2025
 # Modified By: noonchen
 # -----
 # Copyright (c) 2021 noonchen
@@ -89,6 +89,22 @@ class DatabaseFetcher:
         return len(self.file_paths)
     
     
+    def isDutInfoColumnEmpty(self, columnName: str) -> bool:
+        '''return True if the given column of Dut_Info table has no valid value'''
+        if self.cursor is None: raise RuntimeError("No database is connected")
+
+        sql = f'''SELECT EXISTS (
+                    SELECT 1 
+                    FROM Dut_Info 
+                    WHERE {columnName} IS NOT NULL 
+                        AND 
+                        (typeof({columnName}) != 'text' OR trim({columnName}) != "")
+                    )'''
+        
+        validDataExist = self.cursor.execute(sql).fetchone()[0]
+        return not validDataExist
+    
+    
     def getWaferCount(self) -> list[int]:
         '''return a list of int, where list[file_index] = count'''
         if self.cursor is None: raise RuntimeError("No database is connected")

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tampueroc I've added this method to main already, you can use it directly when updated from upstream.

However, it will bring conflicts to your branch, apologies for the inconvenience.

# # show all rows
# while self.tmodel_dut.canFetchMore():
# self.tmodel_dut.fetchMore()
Expand Down
1 change: 1 addition & 0 deletions deps/SharedSrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def getIcon(name: str) -> QtGui.QIcon:
DUTIndex,
Dut_Info.Fid AS "File ID",
PartID AS "Part ID",
PART_TXT AS "Part Text",
'Head ' || HEAD_NUM || ' - ' || 'Site ' || SITE_NUM AS "Test Head - Site",
TestCount AS "Tests Executed",
TestTime || ' ms' AS "Test Time",
Expand Down
17 changes: 9 additions & 8 deletions deps/customizedQtClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,15 @@ def __init__(self, parent=None):
self.dutIndexInd = 0
self.fidColInd = 1
self.pidColInd = 2
self.hsColInd = 3
self.tcntColInd = 4
self.ttimColInd = 5
self.hbinColInd = 6
self.sbinColInd = 7
self.widColInd = 8
self.xyColInd = 9
self.flagColInd = 10
self.ptxtColInd = 3
self.hsColInd = 4
self.tcntColInd = 5
self.ttimColInd = 6
self.hbinColInd = 7
self.sbinColInd = 8
self.widColInd = 9
self.xyColInd = 10
self.flagColInd = 11


def lessThan(self, left: QModelIndex, right: QModelIndex) -> bool:
Expand Down
3 changes: 2 additions & 1 deletion deps/rust_stdf_helper/src/database_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ static CREATE_TABLE_SQL: &str = "DROP TABLE IF EXISTS File_List;
TestCount INTEGER,
TestTime INTEGER,
PartID TEXT,
PART_TXT TEXT,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename column to PartText for style consistency.

HBIN INTEGER,
SBIN INTEGER,
Flag INTEGER,
Expand Down Expand Up @@ -226,7 +227,7 @@ static INSERT_DUT: &str = "INSERT INTO
(?,?,?,?);";

static UPDATE_DUT: &str = "UPDATE Dut_Info SET
TestCount=:TestCount, TestTime=:TestTime, PartID=:PartID,
TestCount=:TestCount, TestTime=:TestTime, PartID=:PartID, PART_TXT=:PART_TXT,
HBIN=:HBIN_NUM, SBIN=:SBIN_NUM, Flag=:Flag,
WaferIndex=:WaferIndex, XCOORD=:XCOORD, YCOORD=:YCOORD,
Supersede=:Supersede
Expand Down
1 change: 1 addition & 0 deletions deps/rust_stdf_helper/src/rust_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,7 @@ fn on_prr_rec(
prr_rec.num_test,
prr_rec.test_t,
prr_rec.part_id,
prr_rec.part_txt,
prr_rec.hard_bin,
prr_rec.soft_bin,
prr_rec.part_flg[0],
Expand Down
Loading