e8857bcd by shady

Complete PySide6 migration: Replace tkinter with Qt

- Installed PySide6 6.10.1
- Implemented LoginDialog with QDialog (replaces LoginWindow)
- Implemented ImageGeneratorWindow with QMainWindow
- Implemented ImageGenerationWorker with QThread for async operations
- Preserved all functionality: authentication, image generation, config management
- Applied QSS styling for modern UI
- All Phase 1-3 tasks completed (coding)
- Phase 4 tasks (manual testing) ready for user
1 parent 6a204244
...@@ -2,71 +2,71 @@ ...@@ -2,71 +2,71 @@
2 2
3 ## Pre-Migration Tasks 3 ## Pre-Migration Tasks
4 4
5 1. **Install PySide6 dependency** 5 1. **[x] Install PySide6 dependency**
6 - Add `PySide6>=6.6.0` to requirements (if exists) or install directly 6 - [x] Add `PySide6>=6.6.0` to requirements (if exists) or install directly
7 - Run `pip install PySide6` 7 - [x] Run `pip install PySide6`
8 - **Validation**: `python -c "from PySide6.QtWidgets import QApplication; print('OK')"` 8 - **Validation**: `python -c "from PySide6.QtWidgets import QApplication; print('OK')"`
9 9
10 2. **Backup current implementation** 10 2. **[x] Backup current implementation**
11 - Create git commit of current tkinter version 11 - [x] Create git commit of current tkinter version
12 - Tag as `before-qt-migration` for easy rollback 12 - [x] Tag as `before-qt-migration` for easy rollback
13 - **Validation**: `git log --oneline -1` shows commit 13 - **Validation**: `git log --oneline -1` shows commit
14 14
15 ## Phase 1: LoginDialog Migration (Priority: Critical) 15 ## Phase 1: LoginDialog Migration (Priority: Critical)
16 16
17 3. **Create LoginDialog class structure** 17 3. **[x] Create LoginDialog class structure**
18 - Import PySide6 modules (QDialog, QVBoxLayout, QFormLayout, etc.) 18 - [x] Import PySide6 modules (QDialog, QVBoxLayout, QFormLayout, etc.)
19 - Define LoginDialog class inheriting from QDialog 19 - [x] Define LoginDialog class inheriting from QDialog
20 - Move __init__ parameters from LoginWindow 20 - [x] Move __init__ parameters from LoginWindow
21 - **Validation**: Class instantiates without errors 21 - **Validation**: Class instantiates without errors
22 22
23 4. **Implement LoginDialog UI layout** 23 4. **[x] Implement LoginDialog UI layout**
24 - Create QVBoxLayout as main layout 24 - [x] Create QVBoxLayout as main layout
25 - Add title QLabel 25 - [x] Add title QLabel
26 - Create QFormLayout for username/password fields 26 - [x] Create QFormLayout for username/password fields
27 - Add QLineEdit widgets for username and password 27 - [x] Add QLineEdit widgets for username and password
28 - Set password field to QLineEdit.Password mode 28 - [x] Set password field to QLineEdit.Password mode
29 - **Validation**: Dialog shows with all fields visible 29 - **Validation**: Dialog shows with all fields visible
30 30
31 5. **Add checkbox row to LoginDialog** 31 5. **[x] Add checkbox row to LoginDialog**
32 - Create QHBoxLayout for checkboxes 32 - [x] Create QHBoxLayout for checkboxes
33 - Add "记住用户名" QCheckBox 33 - [x] Add "记住用户名" QCheckBox
34 - Add "记住密码" QCheckBox 34 - [x] Add "记住密码" QCheckBox
35 - Set initial checked states from parameters 35 - [x] Set initial checked states from parameters
36 - **Validation**: Checkboxes appear and can be toggled 36 - **Validation**: Checkboxes appear and can be toggled
37 37
38 6. **Add login button and error label** 38 6. **[x] Add login button and error label**
39 - Create QPushButton with text "登录" 39 - [x] Create QPushButton with text "登录"
40 - Connect to on_login slot 40 - [x] Connect to on_login slot
41 - Add QLabel for error messages (initially hidden) 41 - [x] Add QLabel for error messages (initially hidden)
42 - **Validation**: Button appears and is clickable 42 - **Validation**: Button appears and is clickable
43 43
44 7. **Apply LoginDialog styling** 44 7. **[x] Apply LoginDialog styling**
45 - Create QSS stylesheet for dialog 45 - [x] Create QSS stylesheet for dialog
46 - Style title, labels, input fields, button 46 - [x] Style title, labels, input fields, button
47 - Match colors from original design (#ffffff, #007AFF, #fafafa, etc.) 47 - [x] Match colors from original design (#ffffff, #007AFF, #fafafa, etc.)
48 - **Validation**: Dialog matches design mockup 48 - **Validation**: Dialog matches design mockup
49 49
50 8. **Implement password placeholder handling** 50 8. **[x] Implement password placeholder handling**
51 - Check if saved_password_hash exists 51 - [x] Check if saved_password_hash exists
52 - If yes, set placeholder text "••••••••" with gray color 52 - [x] If yes, set placeholder text "••••••••" with gray color
53 - Bind textChanged signal to clear placeholder 53 - [x] Bind textChanged signal to clear placeholder
54 - **Validation**: Placeholder shows and clears on typing 54 - **Validation**: Placeholder shows and clears on typing
55 55
56 9. **Implement authentication logic** 56 9. **[x] Implement authentication logic**
57 - Move database connection code to on_login method 57 - [x] Move database connection code to on_login method
58 - Use pymysql exactly as in tkinter version 58 - [x] Use pymysql exactly as in tkinter version
59 - Handle success: set result variables, accept dialog 59 - [x] Handle success: set result variables, accept dialog
60 - Handle failure: show error in error_label 60 - [x] Handle failure: show error in error_label
61 - **Validation**: Login succeeds with valid credentials, fails with invalid 61 - **Validation**: Login succeeds with valid credentials, fails with invalid
62 62
63 10. **Implement dialog return values** 63 10. **[x] Implement dialog return values**
64 - Store success, authenticated_user, password_hash as instance variables 64 - [x] Store success, authenticated_user, password_hash as instance variables
65 - Provide getter methods or properties 65 - [x] Provide getter methods or properties
66 - Return QDialog.Accepted on success, QDialog.Rejected on cancel 66 - [x] Return QDialog.Accepted on success, QDialog.Rejected on cancel
67 - **Validation**: Calling code can access all return values 67 - **Validation**: Calling code can access all return values
68 68
69 11. **Test LoginDialog on macOS** 69 11. **[ ] Test LoginDialog on macOS**
70 - Run application and verify dialog appears 70 - Run application and verify dialog appears
71 - Verify all UI elements are visible (title, labels, inputs, button, checkboxes) 71 - Verify all UI elements are visible (title, labels, inputs, button, checkboxes)
72 - Test typing in username field 72 - Test typing in username field
......