@@ -56,13 +56,6 @@ def __init__(self) -> None:
5656 self .service = ServiceData (CacheFile (None ))
5757 self .root = os .path .dirname (__file__ )
5858
59- self .downloader = Downloader (
60- id = "download" ,
61- to_addr = (
62- lambda trigger : (trigger [8 :] if trigger .startswith ("success-" ) else "" )
63- ),
64- )
65-
6659 def layout (self ) -> html .Div :
6760 return html .Div (
6861 (
@@ -79,13 +72,11 @@ def layout(self) -> html.Div:
7972 html .Div ((html .P (("Progress:" , html .Span (id = "prog" ))))),
8073 html .Div ((html .P ("Cache type:" ), html .P (id = "type" ))),
8174 html .Div ((html .P ("Cache address:" ), html .P (id = "addr" ))),
82- self . downloader . layout ( ),
75+ Downloader ( id = "download" ),
8376 ),
8477 )
8578
8679 def bind (self , app : dash .Dash ):
87- self .downloader .use_callbacks (app )
88-
8980 @app .callback (
9081 Output ("type" , "children" ),
9182 Output ("addr" , "children" ),
@@ -119,14 +110,14 @@ def click_get_image(
119110 return str (file_path .__class__ .__name__ ), addr
120111
121112 @app .callback (
122- self . downloader . as_output ,
113+ Output ( "download" , "url" ) ,
123114 Input ("addr" , "children" ),
124115 prevent_initial_call = True ,
125116 )
126117 def trigger_downloading_event (addr ):
127118 if not addr :
128119 return dash .no_update
129- return "success-{0}" . format ( addr )
120+ return addr
130121
131122
132123class WrappedApp :
0 commit comments