Thêm tính năng tự động hóa nạp FW

This commit is contained in:
2026-03-09 17:20:07 +07:00
parent 56b688766e
commit 47f3320c3d
5 changed files with 1356 additions and 184 deletions

View File

@@ -3,7 +3,7 @@
Công cụ desktop dùng để **scan, phát hiện và flash firmware hàng loạt** cho các thiết bị OpenWrt trong mạng LAN.
> **Tech stack:** Python 3.9+ · PyQt6 · Paramiko/SCP · Scapy · Requests · PyInstaller
> **Phiên bản:** `1.1.2`
> **Phiên bản:** `1.1.3`
---

200
core/auto_flash_worker.py Normal file
View File

@@ -0,0 +1,200 @@
"""
Worker thread cho chế độ "Tự động hóa nạp FW".
Flow:
1. Scan mạng LAN liên tục (tối đa max_scan_rounds lần)
2. Khi phát hiện đủ số thiết bị yêu cầu → bắt đầu nạp FW
3. Nạp FW theo phương thức đã chọn (API / SSH), tự động retry nếu lỗi
4. Thông báo khi hoàn thành
"""
import time
import ipaddress
from PyQt6.QtCore import QThread, pyqtSignal
from concurrent.futures import ThreadPoolExecutor
from core.scanner import scan_network
from core.api_flash import flash_device_api
from core.ssh_new_flash import flash_device_new_ssh
MAX_FLASH_RETRIES = 3 # Số lần retry nạp FW khi thất bại
MAX_SCAN_ROUNDS = 15 # Số lần scan tối đa trước khi báo không đủ thiết bị
class AutoFlashWorker(QThread):
"""Tự động scan → flash khi đủ số lượng thiết bị."""
# Signals
log_message = pyqtSignal(str) # log message cho UI
scan_found = pyqtSignal(int) # số device tìm thấy trong lần scan hiện tại
devices_ready = pyqtSignal(list) # danh sách devices sẵn sàng flash [{ip, mac}, ...]
device_status = pyqtSignal(str, str) # ip, status message
device_done = pyqtSignal(str, str, str) # ip, mac, result ("DONE"/"FAIL:...")
flash_progress = pyqtSignal(int, int) # done_count, total
all_done = pyqtSignal(int, int) # success_count, fail_count
scan_timeout = pyqtSignal(int, int) # found_count, target_count — scan hết lần mà chưa đủ
stopped = pyqtSignal() # khi dừng bởi user
def __init__(self, network, target_count, method, max_workers,
firmware_path, local_ip="", gateway_ip="",
ssh_user="root", ssh_password="admin123a",
ssh_backup_password="admin123a", set_passwd=True):
super().__init__()
self.network = network
self.target_count = target_count
self.method = method
self.max_workers = max_workers
self.firmware_path = firmware_path
self.local_ip = local_ip
self.gateway_ip = gateway_ip
self.ssh_user = ssh_user
self.ssh_password = ssh_password
self.ssh_backup_password = ssh_backup_password
self.set_passwd = set_passwd
self._stop_flag = False
def stop(self):
self._stop_flag = True
def run(self):
self.log_message.emit("🚀 Bắt đầu chế độ tự động hóa nạp FW...")
self.log_message.emit(f" Mục tiêu: {self.target_count} thiết bị | Phương thức: {self.method.upper()} | Song song: {self.max_workers}")
self.log_message.emit(f" Mạng: {self.network}")
self.log_message.emit("")
# ── Phase 1: Scan liên tục cho đến khi đủ thiết bị (tối đa MAX_SCAN_ROUNDS lần) ──
devices = []
scan_round = 0
excluded = {self.local_ip, self.gateway_ip}
best_found = 0
while not self._stop_flag:
scan_round += 1
self.log_message.emit(f"🔍 Scan lần {scan_round}/{MAX_SCAN_ROUNDS}...")
try:
results = scan_network(str(self.network))
except Exception as e:
self.log_message.emit(f"❌ Scan thất bại: {e}")
if self._stop_flag:
break
time.sleep(3)
continue
# Lọc bỏ gateway, local IP, và 192.168.11.102 (chỉ update mới được nạp)
filtered = [d for d in results if d["ip"] not in excluded and d["ip"] != "192.168.11.102"]
found_count = len(filtered)
best_found = max(best_found, found_count)
self.scan_found.emit(found_count)
self.log_message.emit(f" Tìm thấy {found_count}/{self.target_count} thiết bị")
if found_count >= self.target_count:
# Chỉ lấy đúng số lượng yêu cầu
devices = filtered[:self.target_count]
self.log_message.emit(f"✅ Đủ {self.target_count} thiết bị! Bắt đầu nạp FW...")
self.log_message.emit("")
break
if self._stop_flag:
break
# Kiểm tra đã scan quá số lần tối đa
if scan_round >= MAX_SCAN_ROUNDS:
self.log_message.emit(f"⚠️ Đã scan {MAX_SCAN_ROUNDS} lần mà chỉ tìm thấy {best_found}/{self.target_count} thiết bị.")
self.scan_timeout.emit(best_found, self.target_count)
self.stopped.emit()
return
self.log_message.emit(f" Chưa đủ, chờ 5 giây rồi scan lại...")
# Chờ 5 giây nhưng check stop flag mỗi 0.5s
for _ in range(10):
if self._stop_flag:
break
time.sleep(0.5)
if self._stop_flag:
self.log_message.emit("⛔ Đã dừng bởi người dùng.")
self.stopped.emit()
return
# ── Phase 2: Flash ──
total = len(devices)
success_count = 0
fail_count = 0
done_count = 0
self.flash_progress.emit(0, total)
# Gửi danh sách devices cho UI để populate bảng trước khi flash
self.devices_ready.emit(devices)
# Log danh sách thiết bị
for d in devices:
self.log_message.emit(f" 📱 {d['ip']} ({d['mac']})")
self.log_message.emit("")
def _flash_one(dev):
nonlocal success_count, fail_count, done_count
ip = dev["ip"]
mac = dev.get("mac", "N/A")
result = ""
for attempt in range(1, MAX_FLASH_RETRIES + 1):
if self._stop_flag:
result = "FAIL: Dừng bởi người dùng"
break
if attempt > 1:
self.log_message.emit(f"🔄 [{ip}] Retry lần {attempt}/{MAX_FLASH_RETRIES}...")
self.device_status.emit(ip, f"Retry lần {attempt}/{MAX_FLASH_RETRIES}...")
time.sleep(2) # chờ thiết bị ổn định trước khi retry
try:
def on_status(msg):
self.device_status.emit(ip, msg)
if self.method == "ssh":
result = flash_device_new_ssh(
ip, self.firmware_path,
user=self.ssh_user,
password=self.ssh_password,
backup_password=self.ssh_backup_password,
set_passwd=self.set_passwd,
status_cb=on_status,
)
else:
result = flash_device_api(
ip, self.firmware_path,
status_cb=on_status,
)
except Exception as e:
result = f"FAIL: {e}"
if result.startswith("DONE"):
break
else:
if attempt < MAX_FLASH_RETRIES:
self.log_message.emit(f"⚠️ [{ip}] Lần {attempt} thất bại: {result}")
else:
self.log_message.emit(f"❌ [{ip}] Thất bại sau {MAX_FLASH_RETRIES} lần thử: {result}")
self.device_done.emit(ip, mac, result)
if result.startswith("DONE"):
success_count += 1
else:
fail_count += 1
done_count += 1
self.flash_progress.emit(done_count, total)
workers = self.max_workers if self.max_workers > 0 else total
with ThreadPoolExecutor(max_workers=max(workers, 1)) as executor:
futures = [executor.submit(_flash_one, dev) for dev in devices]
for f in futures:
f.result()
if self._stop_flag:
break
self.log_message.emit("")
self.log_message.emit(f"🏁 Hoàn thành! Thành công: {success_count} | Thất bại: {fail_count}")
self.all_done.emit(success_count, fail_count)

271
docs/auto_flash_docs.md Normal file
View File

@@ -0,0 +1,271 @@
# Tài liệu Kỹ thuật: Tự động hóa nạp FW (`core/auto_flash_worker.py`)
Module **Tự động hóa nạp FW** tự động quét mạng LAN, phát hiện thiết bị đích, và nạp firmware hàng loạt mà không cần thao tác thủ công. Được thiết kế cho môi trường sản xuất cần nạp FW nhanh cho nhiều thiết bị OpenWrt cùng lúc.
---
## 1. Kiến Trúc — Vai Trò File
| File | Vai trò |
| --------------------------- | ------------------------------------------------------------------------ |
| `core/auto_flash_worker.py` | `AutoFlashWorker` — QThread xử lý toàn bộ quy trình scan → flash tự động |
| `core/scanner.py` | `scan_network()` — quét mạng LAN (ping sweep + ARP table + Scapy) |
| `core/api_flash.py` | `flash_device_api()` — nạp FW qua LuCI HTTP API |
| `core/ssh_new_flash.py` | `flash_device_new_ssh()` — nạp FW qua SSH (paramiko/scp) |
| `main.py` | `AutoFlashWindow` — UI cửa sổ tự động hóa (PyQt6) |
| `ui/styles.py` | `AUTO_STYLE` — stylesheet riêng cho cửa sổ tự động hóa (tím) |
---
## 2. Sơ Đồ Luồng Tổng Quan
```mermaid
flowchart TD
A[👤 Người dùng nhấn XÁC NHẬN & BẮT ĐẦU] --> B[AutoFlashWorker.run]
B --> P1["── Phase 1: Scan LAN ──"]
P1 --> S1["scan_network(network)"]
S1 --> F1{"Lọc bỏ:\n• Local IP\n• Gateway IP\n• 192.168.11.102"}
F1 --> C1{Đủ số lượng\nthiết bị?}
C1 -->|Có| P2["── Phase 2: Flash ──"]
C1 -->|Chưa đủ| C2{Đã scan\n≥ 20 lần?}
C2 -->|Chưa| W1["Chờ 5 giây\n→ scan lại"]
W1 --> S1
C2 -->|Rồi| T1["⚠️ scan_timeout\nThông báo lỗi"]
P2 --> D1["ThreadPoolExecutor\nNạp FW song song"]
D1 --> D2["_flash_one(device)"]
D2 --> D3{Kết quả?}
D3 -->|DONE| D4["✅ Thành công"]
D3 -->|FAIL| D5{Retry < 3?}
D5 -->|Có| D6["🔄 Chờ 2s → Retry"]
D6 --> D2
D5 -->|Không| D7["❌ Thất bại\nsau 3 lần"]
D4 --> D8["Tổng hợp kết quả"]
D7 --> D8
D8 --> D9["🏁 all_done(success, fail)"]
```
---
## 3. Cấu Hình & Hằng Số
| Hằng số | Giá trị | Mô tả |
| ------------------- | ------- | ------------------------------------------------------ |
| `MAX_FLASH_RETRIES` | 3 | Số lần retry tối đa khi nạp FW thất bại cho 1 thiết bị |
| `MAX_SCAN_ROUNDS` | 20 | Số lần scan LAN tối đa trước khi báo timeout |
| Scan interval | 5 giây | Khoảng cách giữa các lần scan (check stop mỗi 0.5s) |
| Retry delay | 2 giây | Thời gian chờ trước khi retry nạp FW |
---
## 4. Tham Số Khởi Tạo Worker
```python
AutoFlashWorker(
network="192.168.11.0/24", # Dải mạng cần scan
target_count=5, # Số lượng thiết bị cần nạp
method="api", # "api" (LuCI) hoặc "ssh"
max_workers=10, # Số luồng nạp song song (0 = không giới hạn)
firmware_path="/path/fw.bin", # Đường dẫn file firmware
local_ip="192.168.11.50", # IP máy host (sẽ bị loại khỏi scan)
gateway_ip="192.168.11.1", # IP gateway (sẽ bị loại khỏi scan)
ssh_user="root", # SSH username (mặc định: root)
ssh_password="admin123a", # SSH password chính
ssh_backup_password="admin123a", # SSH password dự phòng
set_passwd=True, # Có đặt lại mật khẩu sau flash không
)
```
---
## 5. Signal — Giao Tiếp Worker ↔ UI
| Signal | Kiểu dữ liệu | Khi nào emit |
| ---------------- | --------------- | --------------------------------------------------- |
| `log_message` | `str` | Mỗi dòng log (scan, flash, retry, kết quả) |
| `scan_found` | `int` | Sau mỗi lần scan — số thiết bị tìm thấy |
| `devices_ready` | `list[dict]` | Khi đủ thiết bị — danh sách `{ip, mac}` trước flash |
| `device_status` | `str, str` | Cập nhật trạng thái real-time: `(ip, message)` |
| `device_done` | `str, str, str` | Mỗi thiết bị xong: `(ip, mac, result)` |
| `flash_progress` | `int, int` | Tiến trình: `(done_count, total)` |
| `all_done` | `int, int` | Kết thúc: `(success_count, fail_count)` |
| `scan_timeout` | `int, int` | Scan hết lần: `(best_found, target_count)` |
| `stopped` | — | Khi worker dừng (bởi user hoặc timeout) |
---
## 6. Chi Tiết Quy Trình
### 6.1. Phase 1 — Scan Mạng LAN
```
Lần 1/20 → scan_network("192.168.11.0/24")
→ Lọc bỏ: local_ip, gateway_ip, 192.168.11.102
→ Tìm thấy 3/5 thiết bị → chưa đủ
→ Chờ 5 giây...
Lần 2/20 → scan_network(...)
→ Tìm thấy 5/5 thiết bị → ĐỦ!
→ Chuyển sang Phase 2
```
**Quy tắc lọc IP:**
- `local_ip` — IP của máy host (tránh nạp FW vào chính máy mình)
- `gateway_ip` — IP của router/gateway
- `192.168.11.102` — IP thiết bị đã cài FW sẵn, **chỉ được nạp ở chế độ Update FW**
**Timeout:**
- Sau **20 lần scan** mà chưa đủ thiết bị → emit `scan_timeout`
- UI hiện popup cảnh báo kèm gợi ý kiểm tra:
- Thiết bị đã bật và kết nối mạng chưa
- Dải mạng có đúng không
- Thử lại sau khi kiểm tra
### 6.2. Phase 2 — Nạp FW (có Auto-Retry)
Mỗi thiết bị được nạp trong `ThreadPoolExecutor` (chạy song song):
```
[192.168.11.103] Lần 1 → flash_device_api(...) → FAIL: Connection timeout
⚠️ Lần 1 thất bại
Chờ 2 giây...
[192.168.11.103] Lần 2 → flash_device_api(...) → FAIL: Upload error
⚠️ Lần 2 thất bại
Chờ 2 giây...
[192.168.11.103] Lần 3 → flash_device_api(...) → DONE
✅ Thành công (lần thứ 3)
```
**Quy trình retry:**
1. Thực hiện nạp FW (API hoặc SSH)
2. Nếu kết quả bắt đầu bằng `"DONE"` → thành công, dừng retry
3. Nếu thất bại và còn lần retry → log cảnh báo, chờ 2 giây, thử lại
4. Nếu thất bại sau 3 lần → log lỗi, báo kết quả `FAIL`
---
## 7. Giao Diện Cửa Sổ Tự Động (AutoFlashWindow)
### 7.1. Bố Cục
```
┌──────────────────────────────────────────┐
│ 🤖 Tự động hóa nạp FW │
├──────────────────────────────────────────┤
│ ⚙️ Cấu hình nạp (thu gọn được) │
│ FW: V3.0.6p5.bin │ Mạng: .11.0/24 │
│ Số lượng: 5 │ API (LuCI) │ Song song:10│
├──────────────────────────────────────────┤
│ [▶ XÁC NHẬN & BẮT ĐẦU] [■ DỪNG] │
│ 🔍 Đang scan: 3/5 thiết bị... ████░░ │
├──────────────────────────────────────────┤
│ 📋 Danh sách thiết bị │
│ ┌───┬──────────────┬────────────┬──────┐ │
│ │ # │ IP │ MAC │Kết quả│ │
│ ├───┼──────────────┼────────────┼──────┤ │
│ │ 1 │192.168.11.103│ AA:BB:CC.. │✅DONE│ │
│ │ 2 │192.168.11.104│ DD:EE:FF.. │⏳... │ │
│ │ 3 │192.168.11.105│ 11:22:33.. │🔄 R2 │ │
│ └───┴──────────────┴────────────┴──────┘ │
│ Tổng: 5 | Xong: 3 | ✅ 2 | ❌ 1 [📋Lịch sử]│
├──────────────────────────────────────────┤
│ 📝 Log (thu gọn được) │
│ 🚀 Bắt đầu chế độ tự động hóa nạp FW...│
│ 🔍 Scan lần 1/20... │
│ Tìm thấy 5/5 thiết bị │
│ ✅ Đủ 5 thiết bị! Bắt đầu nạp FW... │
│ ⚠️ [192.168.11.105] Lần 1 thất bại... │
│ 🔄 [192.168.11.105] Retry lần 2/3... │
└──────────────────────────────────────────┘
```
### 7.2. Các Thành Phần UI
| Thành phần | Mô tả |
| ------------------------- | ---------------------------------------------------------- |
| **Cấu hình nạp** | CollapsibleGroupBox — chọn FW, mạng, số lượng, phương thức |
| **Nút điều khiển** | XÁC NHẬN & BẮT ĐẦU / DỪNG — enable/disable theo trạng thái |
| **Trạng thái + Progress** | Hiển thị inline trạng thái scan/flash + progress bar |
| **Bảng thiết bị** | 4 cột: #, IP, MAC, Kết quả — cập nhật real-time |
| **Tổng hợp + Lịch sử** | Bộ đếm ✅/❌ + nút "📋 Lịch sử nạp" xem chi tiết |
| **Log** | CollapsibleGroupBox — log chi tiết toàn bộ quá trình |
---
## 8. Lịch Sử Nạp (Flash History)
Kết quả nạp được lưu ở **2 nơi** với cùng format:
| Nơi lưu | Phạm vi | Dữ liệu |
| ------------------------------- | ---------------------- | ------------------------------------ |
| `AutoFlashWindow._auto_history` | Phiên tự động hiện tại | `list[(ip, mac, result, timestamp)]` |
| `App.flashed_macs` | Toàn bộ session app | `dict{MAC: (ip, mac, result, ts)}` |
- Cả thành công ✅ lẫn thất bại ❌ đều được ghi lại
- Nút "📋 Lịch sử nạp" hiển thị danh sách với format: `[HH:MM:SS] ✅/❌ IP (MAC) — result`
- Lịch sử `_auto_history` reset mỗi khi nhấn "XÁC NHẬN & BẮT ĐẦU" lần mới
- Lịch sử `flashed_macs` tồn tại suốt phiên chạy app (cả manual và auto)
---
## 9. Quy Tắc Bảo Vệ IP `192.168.11.102`
| Chế độ | Được nạp 192.168.11.102? | Cơ chế |
| ------------------------ | :----------------------: | --------------------------------------- |
| **New Flash (thủ công)** | ❌ Không | Kiểm tra trước khi flash, hiện cảnh báo |
| **Update FW (thủ công)** | ✅ Có | Cho phép bình thường |
| **Tự động hóa** | ❌ Không | Lọc khỏi kết quả scan tự động |
---
## 10. Xử Lý Lỗi Tổng Hợp
| Tình huống | Hành vi |
| ------------------------------ | --------------------------------------------------- |
| Scan exception (network error) | Log lỗi, chờ 3s, scan lại (đếm vào MAX_SCAN_ROUNDS) |
| Scan 20 lần chưa đủ thiết bị | Emit `scan_timeout`, hiện popup cảnh báo, dừng |
| Flash thất bại lần 1-2 | Log cảnh báo, chờ 2s, retry tự động |
| Flash thất bại sau 3 lần retry | Log lỗi, đánh dấu ❌, tiếp tục device tiếp theo |
| User nhấn DỪNG | Set `_stop_flag`, dừng scan/flash, emit `stopped` |
| Chưa chọn firmware | Hiện popup cảnh báo, không cho bắt đầu |
| Mạng không hợp lệ | Hiện popup cảnh báo, không cho bắt đầu |
---
## 11. Hướng Dẫn Sử Dụng
### Bước 1: Mở tính năng
Nhấn nút **"🤖 Tự động hóa nạp FW"** ở cuối cửa sổ chính.
### Bước 2: Cấu hình
1. **Chọn firmware** — nhấn 📁 hoặc tự động lấy từ cửa sổ chính
2. **Dải mạng** — mặc định lấy từ IP máy host (ví dụ: `192.168.11.0/24`)
3. **Số lượng** — số thiết bị cần nạp (1500)
4. **Phương thức** — API (LuCI) hoặc SSH
5. **Song song** — số thiết bị nạp cùng lúc (0 = tất cả cùng lúc)
### Bước 3: Bắt đầu
Nhấn **"▶ XÁC NHẬN & BẮT ĐẦU"** → xác nhận popup → hệ thống tự động:
1. Scan mạng liên tục cho đến khi đủ thiết bị (tối đa 20 lần)
2. Nạp FW song song cho tất cả thiết bị tìm được
3. Tự động retry nếu thiết bị nào bị lỗi (tối đa 3 lần)
4. Hiện thông báo tổng hợp khi hoàn thành
### Bước 4: Theo dõi
- **Bảng thiết bị** — trạng thái real-time từng thiết bị
- **Log** — chi tiết quá trình scan, flash, retry
- **Lịch sử nạp** — nhấn 📋 để xem danh sách đã nạp
### Dừng giữa chừng
Nhấn **"■ DỪNG"** — worker sẽ dừng an toàn sau khi hoàn thành device đang xử lý.

858
main.py

File diff suppressed because it is too large Load Diff

View File

@@ -278,3 +278,202 @@ QCheckBox::indicator:hover {
border-color: #7eb8f7;
}
"""
AUTO_STYLE = """
QWidget {
background-color: #1a1b2e;
color: #e2e8f0;
font-family: 'Segoe UI', 'SF Pro Display', sans-serif;
font-size: 12px;
}
QGroupBox {
border: 1px solid #2d3748;
border-radius: 8px;
margin-top: 10px;
padding: 20px 8px 6px 8px;
font-weight: bold;
color: #c4b5fd;
background-color: #1e2035;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left;
left: 14px;
top: 5px;
padding: 0px 8px;
background-color: transparent;
}
QLabel {
background-color: transparent;
}
QLabel#title {
font-size: 16px;
font-weight: bold;
color: #c4b5fd;
letter-spacing: 1px;
}
QPushButton {
background-color: #2d3352;
border: 1px solid #3d4a6b;
border-radius: 6px;
padding: 4px 12px;
color: #e2e8f0;
font-weight: 600;
min-height: 24px;
}
QPushButton:hover {
background-color: #3d4a6b;
border-color: #c4b5fd;
color: #ffffff;
}
QPushButton#start_btn {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop:0 #7c3aed, stop:1 #a78bfa);
border-color: #7c3aed;
color: #ffffff;
font-size: 14px;
font-weight: bold;
letter-spacing: 1px;
}
QPushButton#start_btn:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop:0 #8b5cf6, stop:1 #c4b5fd);
}
QPushButton#start_btn:disabled {
background: #3d3d5c;
color: #6b7280;
}
QPushButton#stop_btn {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop:0 #dc2626, stop:1 #ef4444);
border-color: #dc2626;
color: #ffffff;
font-size: 14px;
font-weight: bold;
}
QPushButton#stop_btn:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop:0 #ef4444, stop:1 #f87171);
}
QPushButton#stop_btn:disabled {
background: #3d3d5c;
color: #6b7280;
}
QLineEdit {
background-color: #13141f;
border: 1px solid #2d3748;
border-radius: 8px;
padding: 7px 12px;
color: #e2e8f0;
}
QLineEdit:focus {
border-color: #7c3aed;
background-color: #161727;
}
QComboBox {
background-color: #1e1e2e;
border: 1px solid #3d4a6b;
border-radius: 4px;
padding: 4px 10px;
color: #ffffff;
font-size: 13px;
font-weight: bold;
}
QSpinBox {
background-color: #13141f;
border: 1px solid #2d3748;
border-radius: 4px;
padding: 4px 8px;
color: #e2e8f0;
}
QTableWidget {
background-color: #13141f;
alternate-background-color: #1a1b2e;
border: 1px solid #2d3748;
border-radius: 8px;
gridline-color: #2d3748;
selection-background-color: #2d3a5a;
selection-color: #e2e8f0;
}
QTableWidget::item {
padding: 2px 6px;
border: none;
}
QHeaderView::section {
background-color: #1e2035;
color: #c4b5fd;
border: none;
border-bottom: 2px solid #7c3aed;
border-right: 1px solid #2d3748;
padding: 4px 6px;
font-weight: bold;
font-size: 11px;
}
QHeaderView::section:last {
border-right: none;
}
QProgressBar {
border: 1px solid #2d3748;
border-radius: 6px;
text-align: center;
background-color: #13141f;
color: #e2e8f0;
height: 20px;
font-size: 11px;
font-weight: 600;
}
QProgressBar::chunk {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop:0 #7c3aed, stop:1 #a78bfa);
border-radius: 5px;
}
QScrollBar:vertical {
background: #13141f;
width: 10px;
border-radius: 5px;
margin: 2px;
}
QScrollBar::handle:vertical {
background: #3d4a6b;
border-radius: 5px;
min-height: 30px;
}
QScrollBar::handle:vertical:hover {
background: #c4b5fd;
}
QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical {
height: 0px;
}
QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical {
background: transparent;
}
"""