Skip to content

Commit

Permalink
add brainglobe logo to version manager widget
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrofelder committed Sep 28, 2023
1 parent 4afa05d commit b0609a0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
4 changes: 4 additions & 0 deletions brainrender_napari/atlas_version_manager_widget.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from qtpy.QtWidgets import QVBoxLayout, QWidget

from brainrender_napari.utils.brainglobe_logo import header_widget
from brainrender_napari.widgets.atlas_manager_view import AtlasManagerView


Expand All @@ -10,6 +11,9 @@ def __init__(self):
super().__init__()

self.setLayout(QVBoxLayout())
self.layout().addWidget(
header_widget(tutorial_file_name="update-atlas-napari.html")
)

# create widgets
self.atlas_manager_view = AtlasManagerView(parent=self)
Expand Down
4 changes: 3 additions & 1 deletion brainrender_napari/brainrender_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def __init__(self, napari_viewer: Viewer):

self._viewer = napari_viewer
self.setLayout(QVBoxLayout())
self.layout().addWidget(header_widget())
self.layout().addWidget(
header_widget(tutorial_file_name="visualise-atlas-napari.html")
)

# create widgets
self.atlas_table_view = AtlasViewerView(parent=self)
Expand Down
37 changes: 18 additions & 19 deletions brainrender_napari/utils/brainglobe_logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,31 @@
<\h1>
"""

_docs_links_html = """
<h3>
<p>Atlas visualisation</p>
<p><a href="https://brainglobe.info" style="color:gray;">Website</a></p>
<p><a href="https://brainglobe.info/tutorials/visualise-atlas-napari.html" style="color:gray;">Tutorial</a></p>
<p><a href="https://github.com/brainglobe/brainrender-napari" style="color:gray;">Source</a></p>
<p><a href="https://doi.org/10.7554/eLife.65751" style="color:gray;">Citation</a></p>
<p><small>For help, hover the cursor over the atlases/regions.</small>
</h3>
""" # noqa: E501


def _docs_links_widget():
docs_links_widget = QLabel(_docs_links_html)

def _docs_links_widget(tutorial_file_name: str, parent: QWidget = None):
_docs_links_html = f"""
<h3>
<p>Atlas visualisation</p>
<p><a href="https://brainglobe.info" style="color:gray;">Website</a></p>
<p><a href="https://brainglobe.info/tutorials/{tutorial_file_name}" style="color:gray;">Tutorial</a></p>
<p><a href="https://github.com/brainglobe/brainrender-napari" style="color:gray;">Source</a></p>
<p><a href="https://doi.org/10.7554/eLife.65751" style="color:gray;">Citation</a></p>
<p><small>For help, hover the cursor over the atlases/regions.</small>
</h3>
""" # noqa: E501
docs_links_widget = QLabel(_docs_links_html, parent=parent)
docs_links_widget.setOpenExternalLinks(True)
return docs_links_widget


def _logo_widget():
return QLabel(_logo_html)
def _logo_widget(parent: QWidget = None):
return QLabel(_logo_html, parent=None)


def header_widget(parent: QWidget = None):
def header_widget(tutorial_file_name: str, parent: QWidget = None):
box = QGroupBox(parent)
box.setFlat(True)
box.setLayout(QHBoxLayout())
box.layout().addWidget(_logo_widget())
box.layout().addWidget(_docs_links_widget())
box.layout().addWidget(_logo_widget(parent=box))
box.layout().addWidget(_docs_links_widget(tutorial_file_name, parent=box))
return box

0 comments on commit b0609a0

Please sign in to comment.