Stop preselecting a search match, and make the Database jump look like a jump
#8
by lvwerra HF Staff - opened
- app.css +5 -0
- taxonomy.py +7 -6
app.css
CHANGED
|
@@ -12,6 +12,11 @@
|
|
| 12 |
.gradio-container .scope-note { padding:11px 15px; border:1px solid #e0e6d8; border-radius:12px; background:#edf3e7; }
|
| 13 |
.gradio-container .scope-note p { margin:0; }
|
| 14 |
.gradio-container .action-button { align-self:flex-end; min-height:46px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
.gradio-container .atlas-panel > .form { border:0; background:transparent; box-shadow:none; }
|
| 16 |
.gradio-container .atlas-panel .form { border-radius:14px; }
|
| 17 |
.gradio-container .atlas-panel button { transition:background-color .15s, border-color .15s; }
|
|
|
|
| 12 |
.gradio-container .scope-note { padding:11px 15px; border:1px solid #e0e6d8; border-radius:12px; background:#edf3e7; }
|
| 13 |
.gradio-container .scope-note p { margin:0; }
|
| 14 |
.gradio-container .action-button { align-self:flex-end; min-height:46px; }
|
| 15 |
+
/* The jump out of the atlas should read as the one action on the page, not as
|
| 16 |
+
another quiet control among the disclosures. */
|
| 17 |
+
.gradio-container #atlas-open-database { align-self:stretch; width:100%; margin-top:4px; background:#1f5740; border-color:#1f5740; color:#f6faf3; font:600 15px/1.3 Arial,Helvetica,sans-serif; letter-spacing:.2px; }
|
| 18 |
+
.gradio-container #atlas-open-database:hover { background:#143c2b; border-color:#143c2b; }
|
| 19 |
+
.gradio-container #atlas-open-database[disabled], .gradio-container #atlas-open-database:disabled { background:#e7eee0; border-color:#dbe3d3; color:#7d8c79; }
|
| 20 |
.gradio-container .atlas-panel > .form { border:0; background:transparent; box-shadow:none; }
|
| 21 |
.gradio-container .atlas-panel .form { border-radius:14px; }
|
| 22 |
.gradio-container .atlas-panel button { transition:background-color .15s, border-color .15s; }
|
taxonomy.py
CHANGED
|
@@ -467,17 +467,18 @@ def build_taxonomy_tab():
|
|
| 467 |
route = gr.State(DEFAULT_PATH)
|
| 468 |
|
| 469 |
def jump_text(path):
|
|
|
|
| 470 |
name = taxonomy.selected_name(path)
|
| 471 |
-
return (f"Show database results for {name}" if taxonomy.assemblies_for(path)
|
| 472 |
-
else f"No annotated assemblies in {name}")
|
| 473 |
|
| 474 |
def jump_label(path):
|
| 475 |
return gr.Button(jump_text(path), interactive=bool(taxonomy.assemblies_for(path)))
|
| 476 |
|
| 477 |
# The jump into the Database tab needs a real accession, so the button says
|
| 478 |
# up front whether the current group has any annotated assembly behind it.
|
| 479 |
-
open_database = gr.Button(jump_text(DEFAULT_PATH),
|
| 480 |
-
elem_id="atlas-open-database")
|
| 481 |
|
| 482 |
def show(path):
|
| 483 |
return taxonomy.view(path), path, jump_label(path)
|
|
@@ -504,8 +505,8 @@ def build_taxonomy_tab():
|
|
| 504 |
"No matching eukaryotic taxa in this snapshot." if len(typed) >= 2
|
| 505 |
else "Start typing to see matching lineages.")
|
| 506 |
best = choices[0][0].split(" Β· ")[0]
|
| 507 |
-
return (gr.Radio(choices=choices, value=
|
| 508 |
-
f"{len(choices)} matches, closest first.
|
| 509 |
|
| 510 |
def taxonomy_view(taxid):
|
| 511 |
return show(taxonomy.taxon_path(taxid) if taxid else DEFAULT_PATH)
|
|
|
|
| 467 |
route = gr.State(DEFAULT_PATH)
|
| 468 |
|
| 469 |
def jump_text(path):
|
| 470 |
+
# The arrow marks it as leaving the atlas for the other view.
|
| 471 |
name = taxonomy.selected_name(path)
|
| 472 |
+
return (f"Show database results for β{name}β β" if taxonomy.assemblies_for(path)
|
| 473 |
+
else f"No annotated assemblies in β{name}β")
|
| 474 |
|
| 475 |
def jump_label(path):
|
| 476 |
return gr.Button(jump_text(path), interactive=bool(taxonomy.assemblies_for(path)))
|
| 477 |
|
| 478 |
# The jump into the Database tab needs a real accession, so the button says
|
| 479 |
# up front whether the current group has any annotated assembly behind it.
|
| 480 |
+
open_database = gr.Button(jump_text(DEFAULT_PATH), variant="primary",
|
| 481 |
+
elem_classes="action-button", elem_id="atlas-open-database")
|
| 482 |
|
| 483 |
def show(path):
|
| 484 |
return taxonomy.view(path), path, jump_label(path)
|
|
|
|
| 505 |
"No matching eukaryotic taxa in this snapshot." if len(typed) >= 2
|
| 506 |
else "Start typing to see matching lineages.")
|
| 507 |
best = choices[0][0].split(" Β· ")[0]
|
| 508 |
+
return (gr.Radio(choices=choices, value=None),
|
| 509 |
+
f"{len(choices)} matches, closest first. Pick one to open it, or press Enter for **{best}**.")
|
| 510 |
|
| 511 |
def taxonomy_view(taxid):
|
| 512 |
return show(taxonomy.taxon_path(taxid) if taxid else DEFAULT_PATH)
|