1
This commit is contained in:
61
display.py
61
display.py
@@ -149,3 +149,64 @@ class Display:
|
||||
|
||||
except Exception as e:
|
||||
print(f"Show chunk error: {e}")
|
||||
|
||||
def render_home_screen(self):
|
||||
"""渲染首页"""
|
||||
if not self.tft:
|
||||
return
|
||||
|
||||
self.tft.fill(st7789.BLACK)
|
||||
|
||||
# 顶部标题栏
|
||||
self.tft.fill_rect(0, 0, 240, 40, 0x2124) # Dark Grey
|
||||
self.text("量迹AI贴纸生成", 45, 12, st7789.WHITE)
|
||||
|
||||
# 中间Logo区域(简单绘制一个框)
|
||||
self.tft.fill_rect(80, 80, 80, 80, st7789.BLUE)
|
||||
self.text("AI", 108, 110, st7789.WHITE)
|
||||
|
||||
# 底部提示
|
||||
self.text("正在启动...", 80, 200, st7789.CYAN)
|
||||
|
||||
def render_wifi_connecting(self):
|
||||
"""渲染WiFi连接中界面"""
|
||||
if not self.tft:
|
||||
return
|
||||
|
||||
self.tft.fill(st7789.BLACK)
|
||||
self.text("WiFi连接中...", 60, 110, st7789.WHITE)
|
||||
# 加载动画会在主循环中绘制
|
||||
|
||||
def render_wifi_status(self, success):
|
||||
"""渲染WiFi连接结果"""
|
||||
if not self.tft:
|
||||
return
|
||||
|
||||
self.tft.fill(st7789.BLACK)
|
||||
if success:
|
||||
self.text("WiFi连接成功!", 60, 100, st7789.GREEN)
|
||||
self.draw_check_icon(110, 130)
|
||||
else:
|
||||
self.text("WiFi连接失败", 60, 100, st7789.RED)
|
||||
self.text("请重试", 95, 130, st7789.WHITE)
|
||||
|
||||
def draw_top_tip(self, text):
|
||||
"""在右上角显示提示文字"""
|
||||
if not self.tft:
|
||||
return
|
||||
|
||||
# 清除区域 (假设背景是白色的,因为顶部栏通常是白色)
|
||||
# x=170, w=70, h=30
|
||||
self.tft.fill_rect(170, 0, 70, 30, st7789.WHITE)
|
||||
|
||||
if text:
|
||||
# 使用红色显示提示,醒目
|
||||
self.text(text, 170, 8, st7789.RED, wait=False)
|
||||
|
||||
def draw_check_icon(self, x, y):
|
||||
"""绘制勾选图标"""
|
||||
if not self.tft:
|
||||
return
|
||||
|
||||
self.tft.line(x, y + 5, x + 3, y + 8, st7789.GREEN)
|
||||
self.tft.line(x + 3, y + 8, x + 10, y, st7789.GREEN)
|
||||
|
||||
Reference in New Issue
Block a user