Dưới đây là 4 bước sửa mã trong file CAMTESST.py để giải quyết chính xác từng yêu cầu của bạn: 1. Đổi màu ô tìm kiếm trong Lịch sử sang nền sáng, chữ đen (dễ nhìn ở mọi theme) Bạn tìm đến hàm def show_input_history(self): (khoảng dòng 1042). Tìm dòng mã này: ts=QLineEdit(); ts.setStyleSheet(f"color:{t['a']};background:{t['i']};border:1px solid {t['d']};padding:4px;border-radius:4px;") Thay thế bằng dòng sau (đổi màu chữ thành đen, nền thành trắng): ts=QLineEdit(); ts.setStyleSheet(f"color: #000000; background: #FFFFFF; border: 1px solid {t['d']}; padding: 4px; border-radius: 4px; font-weight: bold;") 2. Thêm nhóm "Tất Cả" hiện mặc định khi bấm Cập nhật lịch sử Bạn kéo xuống một chút bên trong hàm show_input_history(self), tìm đến vòng lặp for it in reversed(hs): thứ hai (khoảng dòng 1146). Tìm toàn bộ đoạn mã này: max_len = 5 for it in reversed(hs): if kw and kw.upper() not in it.get('lot','').upper(): continue if self.filter_date: tm = it.get('timestamp', '') if not tm: continue try: if datetime.datetime.strptime(tm, "%Y-%m-%d %H:%M:%S").strftime("%d/%m/%Y") != self.filter_date: continue except: continue mh = it.get('ma_hang', '').strip().upper() if mh in mh_to_file: fn = mh_to_file[mh] else: fn = it.get('file_name', 'Khác') if fn not in valid_file_names: fn = "Khác" if fn not in grps: grps[fn]=[] grps[fn].append(it) if len(fn) > max_len: max_len = len(fn) sorted_grps = {} for fname in valid_file_names: if fname in grps: sorted_grps[fname] = grps[fname] if "Khác" in grps: sorted_grps["Khác"] = grps["Khác"] grps = sorted_grps Thay thế toàn bộ bằng đoạn mã sau: max_len = 8 # Đổi thành 8 để chứa vừa chữ Tất Cả all_items = [] # Danh sách tổng for it in reversed(hs): if kw and kw.upper() not in it.get('lot','').upper(): continue if self.filter_date: tm = it.get('timestamp', '') if not tm: continue try: if datetime.datetime.strptime(tm, "%Y-%m-%d %H:%M:%S").strftime("%d/%m/%Y") != self.filter_date: continue except: continue all_items.append(it) # Thêm vào danh sách chung mh = it.get('ma_hang', '').strip().upper() if mh in mh_to_file: fn = mh_to_file[mh] else: fn = it.get('file_name', 'Khác') if fn not in valid_file_names: fn = "Khác" if fn not in grps: grps[fn]=[] grps[fn].append(it) if len(fn) > max_len: max_len = len(fn) sorted_grps = {"Tất Cả": all_items} # Thêm tab Tất Cả mặc định lên đầu for fname in valid_file_names: if fname in grps: sorted_grps[fname] = grps[fname] if "Khác" in grps: sorted_grps["Khác"] = grps["Khác"] grps = sorted_grps 3. Di chuyển nút cái Khóa (🔒) sang trái chữ JNTC Bạn tìm đến hàm def init_ui(self): (khoảng dòng 175). Tìm đoạn mã tạo thanh tiêu đề này: title_bar=QHBoxLayout(); title_bar.setContentsMargins(4,6,10,0); title_bar.setAlignment(Qt.AlignVCenter) self.lbl_title=QLabel("JNTC / FQC Camera Input System"); self.lbl_title.setObjectName("lbl_title"); self.lbl_title.setCursor(Qt.SizeAllCursor); title_bar.addWidget(self.lbl_title); title_bar.addStretch() self.tb_to_label = {} btn_size = 20; rad = 10; spacing_size = 10 self.btn_lock = QPushButton("🔒"); self.btn_lock.setFixedSize(btn_size,btn_size); self.btn_lock.setObjectName("btn_lock"); self.btn_lock.setToolTip("Khóa cài đặt"); self.btn_lock.setStyleSheet("background-color: transparent; border: none; font-size: 14px;"); self.btn_lock.clicked.connect(self.open_lock_settings); title_bar.addWidget(self.btn_lock); title_bar.addSpacing(spacing_size) Thay thế bằng đoạn sau (sắp xếp lại thứ tự widget được add vào layout): title_bar=QHBoxLayout(); title_bar.setContentsMargins(4,6,10,0); title_bar.setAlignment(Qt.AlignVCenter) self.tb_to_label = {} btn_size = 20; rad = 10; spacing_size = 10 self.btn_lock = QPushButton("🔒"); self.btn_lock.setFixedSize(btn_size,btn_size); self.btn_lock.setObjectName("btn_lock"); self.btn_lock.setToolTip("Khóa cài đặt"); self.btn_lock.setStyleSheet("background-color: transparent; border: none; font-size: 14px;"); self.btn_lock.clicked.connect(self.open_lock_settings); title_bar.addWidget(self.btn_lock); title_bar.addSpacing(5) self.lbl_title=QLabel("JNTC / FQC Camera Input System"); self.lbl_title.setObjectName("lbl_title"); self.lbl_title.setCursor(Qt.SizeAllCursor); title_bar.addWidget(self.lbl_title); title_bar.addStretch() 4. Loại bỏ yêu cầu nhập mật khẩu khi bấm Cài đặt HMĐB (Hình bánh răng) Bạn tìm đến hàm def open_abbr_settings(self): (khoảng dòng 402). Xóa (hoặc thêm dấu #) dòng if self.check_settings_locked(): return đầu tiên: def open_abbr_settings(self): # if self.check_settings_locked(): return <-- Bạn xóa hoặc bôi đen dòng này dlg=QDialog(self); dlg.setWindowTitle("Cài Đặt Viết Tắt HMĐB"); dlg.setFixedSize(300,400); layout=QVBoxLayout(dlg); scroll=QScrollArea(); scroll.setWidgetResizable(True); content=QWidget(); form=QGridLayout(content); form.addWidget(QLabel("Viết tắt"),0,0,Qt.AlignCenter); form.addWidget(QLabel("Từ đầy đủ"),0,1,Qt.AlignCenter); self.abbr_inputs=[]; items=list(self.abbr_map.items())