Simplify UI layout API by removing pre_render()
This commit is contained in:
parent
786a50b90a
commit
0224fd9861
@ -25,7 +25,6 @@ UI_LAYOUT_MODULES : List[ModuleType] = []
|
||||
UI_LAYOUT_METHODS =\
|
||||
[
|
||||
'pre_check',
|
||||
'pre_render',
|
||||
'render',
|
||||
'listen',
|
||||
'run'
|
||||
@ -83,14 +82,14 @@ def launch() -> None:
|
||||
with gradio.Blocks(theme = get_theme(), css = get_css(), title = metadata.get('name') + ' ' + metadata.get('version'), fill_width = True) as ui:
|
||||
for ui_layout in state_manager.get_item('ui_layouts'):
|
||||
ui_layout_module = load_ui_layout_module(ui_layout)
|
||||
if ui_layout_module.pre_render():
|
||||
if ui_layouts_total > 1:
|
||||
with gradio.Tab(ui_layout):
|
||||
ui_layout_module.render()
|
||||
ui_layout_module.listen()
|
||||
else:
|
||||
|
||||
if ui_layouts_total > 1:
|
||||
with gradio.Tab(ui_layout):
|
||||
ui_layout_module.render()
|
||||
ui_layout_module.listen()
|
||||
else:
|
||||
ui_layout_module.render()
|
||||
ui_layout_module.listen()
|
||||
|
||||
for ui_layout in state_manager.get_item('ui_layouts'):
|
||||
ui_layout_module = load_ui_layout_module(ui_layout)
|
||||
|
@ -23,10 +23,6 @@ def pre_check() -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def pre_render() -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def render() -> gradio.Blocks:
|
||||
with gradio.Blocks() as layout:
|
||||
with gradio.Row():
|
||||
|
@ -8,10 +8,6 @@ def pre_check() -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def pre_render() -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def render() -> gradio.Blocks:
|
||||
with gradio.Blocks() as layout:
|
||||
with gradio.Row():
|
||||
|
@ -8,10 +8,6 @@ def pre_check() -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def pre_render() -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def render() -> gradio.Blocks:
|
||||
with gradio.Blocks() as layout:
|
||||
with gradio.Row():
|
||||
|
@ -8,10 +8,6 @@ def pre_check() -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def pre_render() -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def render() -> gradio.Blocks:
|
||||
with gradio.Blocks() as layout:
|
||||
with gradio.Row():
|
||||
|
Loading…
Reference in New Issue
Block a user