style: format all Python files with Black
Apply Black formatter to the entire codebase for consistent code style. Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
User Selection Dialog - Allows Admin to choose which user identity to use
|
||||
"""
|
||||
|
||||
import tkinter as tk
|
||||
from tkinter import ttk, messagebox
|
||||
from typing import Optional, Dict, Any, List
|
||||
@@ -64,9 +65,7 @@ class UserSelectionDialog:
|
||||
|
||||
# Title
|
||||
title_label = ttk.Label(
|
||||
main_frame,
|
||||
text="请选择要使用的用户身份",
|
||||
font=('', 14, 'bold')
|
||||
main_frame, text="请选择要使用的用户身份", font=("", 14, "bold")
|
||||
)
|
||||
title_label.pack(pady=(0, 20))
|
||||
|
||||
@@ -82,12 +81,15 @@ class UserSelectionDialog:
|
||||
# Sort users: current user first, then by username
|
||||
sorted_users = sorted(
|
||||
self.users,
|
||||
key=lambda u: (0 if u['username'] == self.current_username else 1, u['username'])
|
||||
key=lambda u: (
|
||||
0 if u["username"] == self.current_username else 1,
|
||||
u["username"],
|
||||
),
|
||||
)
|
||||
|
||||
for user in sorted_users:
|
||||
username = user['username']
|
||||
user_type = user['user_type']
|
||||
username = user["username"]
|
||||
user_type = user["user_type"]
|
||||
is_current = username == self.current_username
|
||||
|
||||
# Mark current user
|
||||
@@ -99,7 +101,7 @@ class UserSelectionDialog:
|
||||
list_frame,
|
||||
text=display_text,
|
||||
variable=self.selected_var,
|
||||
value=username
|
||||
value=username,
|
||||
)
|
||||
rb.pack(anchor=tk.W, pady=3, padx=5)
|
||||
|
||||
@@ -111,18 +113,12 @@ class UserSelectionDialog:
|
||||
button_frame.pack(pady=(20, 0))
|
||||
|
||||
confirm_btn = ttk.Button(
|
||||
button_frame,
|
||||
text="确认",
|
||||
command=self._on_confirm,
|
||||
width=10
|
||||
button_frame, text="确认", command=self._on_confirm, width=10
|
||||
)
|
||||
confirm_btn.pack(side=tk.LEFT, padx=5)
|
||||
|
||||
cancel_btn = ttk.Button(
|
||||
button_frame,
|
||||
text="取消",
|
||||
command=self._on_cancel,
|
||||
width=10
|
||||
button_frame, text="取消", command=self._on_cancel, width=10
|
||||
)
|
||||
cancel_btn.pack(side=tk.LEFT, padx=5)
|
||||
|
||||
@@ -136,7 +132,7 @@ class UserSelectionDialog:
|
||||
|
||||
# Find the selected user
|
||||
for user in self.users:
|
||||
if user['username'] == selected_username:
|
||||
if user["username"] == selected_username:
|
||||
self.selected_user = user
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user