SharpMeow commited on
Commit
70cea09
·
verified ·
1 Parent(s): 0640a74

Fill the window's width and load the guide's scan previews again

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -486,7 +486,7 @@ stream it names). Coordinates are level-0 (full resolution) voxels, z then y the
486
 
487
  CSS = """
488
  :root, .dark { --lf-accent:#c2462b; }
489
- .gradio-container { max-width: 1240px !important; margin: 0 auto !important; }
490
  .lf-head { display:flex; align-items:center; gap:14px; padding:6px 2px 2px; }
491
  .lf-head .layers { width:30px; height:24px; border-radius:5px; flex:none;
492
  background:repeating-linear-gradient(180deg,#c2462b 0 4px,#e07a3f 4px 7px,#f3e2bf 7px 10px,#4f7a3a 10px 11px,#f3e2bf 11px 12px); }
@@ -502,7 +502,7 @@ CSS = """
502
  .lf-howto img { border-radius:10px; border:1px solid var(--border-color-primary); max-width:min(100%, 760px); display:block; margin:8px 0; }
503
  #lf-dl .empty { min-height: 64px !important; height: 64px !important; }
504
  #lf-dl .empty .icon { height: 28px; }
505
- .lf-howto { max-width: 920px; }
506
  .lf-howto h3 { scroll-margin-top: 16px; margin-top: 1.6em !important; }
507
  .lf-howto em { color: var(--body-text-color-subdued); font-size: 13.5px; }
508
  .lf-toc { font-size: 14px; line-height: 1.9; padding: 10px 14px; border-radius: 10px;
@@ -511,6 +511,7 @@ CSS = """
511
  .lf-head h1 { font-size:24px; }
512
  .lf-head span { display:none; }
513
  .lf-guide iframe { height:calc(100vh - 120px); min-height:520px; }
 
514
  }
515
  """
516
 
@@ -546,8 +547,10 @@ def guide_html():
546
  return "<p>The guide is missing from this copy.</p>"
547
  import html
548
  page = GUIDE.read_text()
549
- # a <base> so assets/... resolve to Gradio's file route; anchors scroll inside the frame instead of navigating
550
- fix = ('<base href="/gradio_api/file=">'
 
 
551
  '<script>document.addEventListener("click",function(e){var a=e.target.closest&&e.target.closest("a");'
552
  'if(!a)return;var h=a.getAttribute("href")||"";if(h.charAt(0)==="#"){e.preventDefault();'
553
  'var t=document.getElementById(h.slice(1));if(t)t.scrollIntoView({behavior:"smooth"});}'
 
486
 
487
  CSS = """
488
  :root, .dark { --lf-accent:#c2462b; }
489
+ .gradio-container { width: 100% !important; max-width: 1600px !important; margin: 0 auto !important; }
490
  .lf-head { display:flex; align-items:center; gap:14px; padding:6px 2px 2px; }
491
  .lf-head .layers { width:30px; height:24px; border-radius:5px; flex:none;
492
  background:repeating-linear-gradient(180deg,#c2462b 0 4px,#e07a3f 4px 7px,#f3e2bf 7px 10px,#4f7a3a 10px 11px,#f3e2bf 11px 12px); }
 
502
  .lf-howto img { border-radius:10px; border:1px solid var(--border-color-primary); max-width:min(100%, 760px); display:block; margin:8px 0; }
503
  #lf-dl .empty { min-height: 64px !important; height: 64px !important; }
504
  #lf-dl .empty .icon { height: 28px; }
505
+ .lf-howto { max-width: 1000px; margin: 0 auto !important; }
506
  .lf-howto h3 { scroll-margin-top: 16px; margin-top: 1.6em !important; }
507
  .lf-howto em { color: var(--body-text-color-subdued); font-size: 13.5px; }
508
  .lf-toc { font-size: 14px; line-height: 1.9; padding: 10px 14px; border-radius: 10px;
 
511
  .lf-head h1 { font-size:24px; }
512
  .lf-head span { display:none; }
513
  .lf-guide iframe { height:calc(100vh - 120px); min-height:520px; }
514
+ #lf-tabs .tab-container button { padding:6px 6px !important; font-size:12.5px !important; }
515
  }
516
  """
517
 
 
547
  return "<p>The guide is missing from this copy.</p>"
548
  import html
549
  page = GUIDE.read_text()
550
+ # its pictures (assets/..., built in its script) point at Gradio's file route; a <base> cannot do it, because a
551
+ # base of /gradio_api/file= resolves assets/x to /gradio_api/assets/x. Anchors scroll inside the frame
552
+ page = page.replace("'assets/", "'/gradio_api/file=assets/").replace('"assets/', '"/gradio_api/file=assets/')
553
+ fix = ('<style>.wrap{max-width:1480px!important}</style>'
554
  '<script>document.addEventListener("click",function(e){var a=e.target.closest&&e.target.closest("a");'
555
  'if(!a)return;var h=a.getAttribute("href")||"";if(h.charAt(0)==="#"){e.preventDefault();'
556
  'var t=document.getElementById(h.slice(1));if(t)t.scrollIntoView({behavior:"smooth"});}'