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:
@@ -48,7 +48,7 @@ class BaseTab(ttk.Frame):
|
||||
如果 self.logger 未设置,将使用 logging.getLogger(__name__) 作为后备。
|
||||
"""
|
||||
# 获取 logger(优先使用实例的 logger,否则使用模块 logger)
|
||||
logger = getattr(self, 'logger', None) or logging.getLogger(__name__)
|
||||
logger = getattr(self, "logger", None) or logging.getLogger(__name__)
|
||||
|
||||
# 将自定义级别映射到 logging 级别
|
||||
level_upper = level.upper()
|
||||
@@ -83,11 +83,11 @@ class BaseTab(ttk.Frame):
|
||||
需要 main_window 或 session_manager 支持。
|
||||
"""
|
||||
# 尝试从 session_manager 获取
|
||||
if hasattr(self, 'session_manager') and self.session_manager:
|
||||
if hasattr(self, "session_manager") and self.session_manager:
|
||||
return self.session_manager.is_admin()
|
||||
|
||||
# 尝试从 main_window 获取
|
||||
if self.main_window and hasattr(self.main_window, 'session_manager'):
|
||||
if self.main_window and hasattr(self.main_window, "session_manager"):
|
||||
return self.main_window.session_manager.is_admin()
|
||||
|
||||
return False
|
||||
@@ -101,10 +101,10 @@ class BaseTab(ttk.Frame):
|
||||
Note:
|
||||
需要 session_manager 支持。
|
||||
"""
|
||||
if hasattr(self, 'session_manager') and self.session_manager:
|
||||
if hasattr(self, "session_manager") and self.session_manager:
|
||||
return self.session_manager.get_username() or ""
|
||||
|
||||
if self.main_window and hasattr(self.main_window, 'session_manager'):
|
||||
if self.main_window and hasattr(self.main_window, "session_manager"):
|
||||
return self.main_window.session_manager.get_username() or ""
|
||||
|
||||
return ""
|
||||
@@ -128,5 +128,5 @@ class BaseTab(ttk.Frame):
|
||||
|
||||
def reload_config(self):
|
||||
"""重新加载配置(子类可覆盖此方法)"""
|
||||
if self.config and hasattr(self.config, 'reload'):
|
||||
self.config.reload()
|
||||
if self.config and hasattr(self.config, "reload"):
|
||||
self.config.reload()
|
||||
|
||||
Reference in New Issue
Block a user