MCPcopy Create free account
hub / github.com/FinStep-AI/ContestTrade / create_layout

Method create_layout

cli/main.py:185–219  ·  view source on GitHub ↗

创建自适应布局

(self, trigger_time: str)

Source from the content-addressed store, hash-verified

183 self.analysis_completed = completed
184
185 def create_layout(self, trigger_time: str) -> Layout:
186 """创建自适应布局"""
187 layout = Layout()
188
189 # 获取终端大小
190 console_size = console.size
191
192 # 根据终端高度调整header大小
193 header_size = min(10, max(9, console_size.height // 6))
194
195 layout.split_column(
196 Layout(name="header", size=header_size),
197 Layout(name="main_content")
198 )
199
200 # 根据终端宽度调整左右面板比例
201 if console_size.width < 120:
202 left_ratio, right_ratio = 2, 3 # 窄屏时调整比例
203 else:
204 left_ratio, right_ratio = 4, 7 # 宽屏时的比例
205
206 layout["main_content"].split_row(
207 Layout(name="left_panel", ratio=left_ratio),
208 Layout(name="right_panel", ratio=right_ratio)
209 )
210 layout["left_panel"].split_column(
211 Layout(name="status", ratio=3),
212 Layout(name="progress", ratio=2)
213 )
214 layout["right_panel"].split_column(
215 Layout(name="content", ratio=3),
216 Layout(name="footer", ratio=2)
217 )
218
219 return layout
220
221 def update_display(self, layout: Layout, trigger_time: str):
222 """更新显示"""

Callers 2

periodic_status_checkFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected