You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
716 B
19 lines
716 B
# core/layout_solver.py
|
|
def analyze_selection(selected_widgets):
|
|
"""
|
|
分析选中的屏幕,判断拼接形状
|
|
:param selected_widgets: 选中的屏幕控件列表
|
|
:return: 拼接类型 (str), 参数 (dict)
|
|
"""
|
|
# 1. 获取所有选中屏幕的编号 (假设编号是 0-11)
|
|
positions = [widget.screen_id for widget in selected_widgets]
|
|
|
|
# 2. 根据编号规律判断形状 (假设屏幕是按行排列的:0,1,2,3 -> 第一行)
|
|
if len(positions) == 4:
|
|
# 判断是否为 2x2 正方形
|
|
if is_square_arrangement(positions):
|
|
return "2x2", {"start": min(positions), "rows": 2, "cols": 2}
|
|
|
|
# ... 其他逻辑 ...
|
|
|
|
return "custom", {"ids": positions}
|