Explorar el Código

优化数据表格显示,调整宽度设置,简化布局创建方法

zhch158_admin hace 2 meses
padre
commit
526ecd7e70
Se han modificado 1 ficheros con 5 adiciones y 27 borrados
  1. 5 27
      streamlit_ocr_validator.py

+ 5 - 27
streamlit_ocr_validator.py

@@ -198,8 +198,8 @@ class StreamlitOCRValidator:
                 st.markdown(f'<div class="{container_class}">', unsafe_allow_html=True)
                 st.dataframe(
                     filtered_table, 
-                    use_container_width=True,
-                    height=400 if len(table.columns) > 8 else None
+                    # use_container_width=True,
+                    width =400 if len(table.columns) > 8 else "stretch"
                 )
                 st.markdown('</div>', unsafe_allow_html=True)
             
@@ -334,13 +334,9 @@ class StreamlitOCRValidator:
             return table
     
     # 布局方法现在委托给布局管理器
-    def create_standard_layout(self, font_size: int = 12, zoom_level: float = 1.0):
-        """创建标准布局"""
-        return self.layout_manager.create_standard_layout(font_size, zoom_level)
-    
-    def create_compact_layout(self, font_size: int = 12, zoom_level: float = 1.0):
+    def create_compact_layout(self, config):
         """创建滚动凑布局"""
-        return self.layout_manager.create_compact_layout(font_size, zoom_level)
+        return self.layout_manager.create_compact_layout(config)
 
 
 def main():
@@ -431,25 +427,7 @@ def main():
     tab1, tab2, tab3, tab4 = st.tabs(["📄 内容校验", "📊 表格分析", "📈 数据统计", "🚀 快速导航"])
     
     with tab1:
-        # 顶部控制区域
-        control_col1, control_col2 = st.columns(2)
-        
-        with control_col1:
-            layout_mode = st.selectbox(
-                "布局模式", 
-                ["标准布局", "滚动布局"],
-                key="layout_mode"
-            )
-        
-        with control_col2:
-            font_size = st.selectbox("字体大小", [10, 12, 14, 16], index=0, key="font_size_select")
-        
-        # 根据选择的布局模式显示不同的界面,传递参数
-        if layout_mode == "滚动布局":
-            validator.create_compact_layout(font_size, 1.0)
-        else:
-            # 调用封装的标准布局方法
-            validator.create_standard_layout(font_size, 1.0)
+        validator.create_compact_layout(config)
 
     with tab2:
         # 表格分析页面