Skip to content

Commit

Permalink
update styles
Browse files Browse the repository at this point in the history
  • Loading branch information
swelborn committed Feb 21, 2024
1 parent 17fb3d7 commit 7c9c023
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 86 deletions.
27 changes: 12 additions & 15 deletions tomopyui/widgets/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from tomopyui._sharedvars import (
tomopy_algorithm_kwargs,
astra_cuda_recon_algorithm_kwargs,
extend_description_style,
)

from tomopyui.backend.io import Metadata_Align, Metadata_Recon, Projections_Child
Expand All @@ -16,6 +15,11 @@
BqImViewer_Projections_Child,
BqImViewer_Projections_Parent,
)
from tomopyui.widgets.styles import (
header_font_style,
button_font_style,
extend_description_style,
)


class AnalysisBase(ABC):
Expand Down Expand Up @@ -53,47 +57,40 @@ def init_attributes(self, Import, Center):
key for key in astra_cuda_recon_algorithm_kwargs
]
self.run_list = []
self.header_font_style = {
"font_size": "22px",
"font_weight": "bold",
"font_variant": "small-caps",
# "text_color": "#0F52BA",
}
self.accordions_open = False
self.plot_output1 = Output()

def init_widgets(self):
"""
Initializes many of the widgets in the Alignment and Recon tabs.
"""
self.button_font = {"font_size": "22px"}
self.button_layout = Layout(width="45px", height="40px")

# -- Button to turn on tab ---------------------------------------------
self.open_accordions_button = Button(
icon="lock-open",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
)

# -- Headers for plotting -------------------------------------
self.import_plot_header = "Imported Projections"
self.import_plot_header = Label(
self.import_plot_header, style=self.header_font_style
self.import_plot_header, style=header_font_style
)
self.altered_plot_header = "Altered Projections"
self.altered_plot_header = Label(
self.altered_plot_header, style=self.header_font_style
self.altered_plot_header, style=header_font_style
)

# -- Headers for results -------------------------------------
self.before_analysis_plot_header = "Analysis Projections"
self.before_analysis_plot_header = Label(
self.before_analysis_plot_header, style=self.header_font_style
self.before_analysis_plot_header, style=header_font_style
)
self.after_analysis_plot_header = "Result"
self.after_analysis_plot_header = Label(
self.after_analysis_plot_header, style=self.header_font_style
self.after_analysis_plot_header, style=header_font_style
)

# -- Button to load metadata ----------------------------------------------
Expand Down Expand Up @@ -451,7 +448,7 @@ def containerize(self):
# -- Methods ----------------------------------------------------------
self.tomopy_methods_hbox = VBox(
[
Label("Tomopy", style=self.header_font_style),
Label("Tomopy", style=header_font_style),
VBox(
self.tomopy_methods_checkboxes,
layout=Layout(flex_flow="column wrap", align_content="flex-start"),
Expand All @@ -462,7 +459,7 @@ def containerize(self):

self.astra_methods_hbox = VBox(
[
Label("Astra", style=self.header_font_style),
Label("Astra", style=header_font_style),
VBox(
self.astra_cuda_methods_checkboxes,
layout=Layout(flex_flow="column wrap"),
Expand Down
18 changes: 7 additions & 11 deletions tomopyui/widgets/center.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from tomopyui.backend.util.center import write_center
from tomopyui.widgets.helpers import ReactiveIconButton, ReactiveTextButton
from tomopyui.widgets.view import BqImViewer_Center, BqImViewer_Center_Recon
from tomopyui.widgets.styles import header_font_style, button_font_style


class Center:
Expand Down Expand Up @@ -71,11 +72,6 @@ def __init__(self, Import):
self.rec_viewer = BqImViewer_Center_Recon()
self.rec_viewer.create_app()
self.reg = None
self.header_font_style = {
"font_size": "22px",
"font_weight": "bold",
"font_variant": "small-caps",
}
self.button_font = {"font_size": "22px"}
self.button_layout = Layout(width="45px", height="40px")
self._init_widgets()
Expand Down Expand Up @@ -180,21 +176,21 @@ def _init_widgets(self):
)
self.projections_plot_header = "Projections"
self.projections_plot_header = Label(
self.projections_plot_header, style=self.header_font_style
self.projections_plot_header, style=header_font_style
)
self.reconstructions_plot_header = "Reconstructions"
self.reconstructions_plot_header = Label(
self.reconstructions_plot_header, style=self.header_font_style
self.reconstructions_plot_header, style=header_font_style
)

# -- Centers display -----------------------------------------------------------
self.center_select_label = Label("Slice : Center", style=self.header_font_style)
self.center_select_label = Label("Slice : Center", style=header_font_style)
self.center_select = Select(
disabled=True,
rows=10,
)
self.all_centers_select_label = Label(
"Centers for reconstruction", style=self.header_font_style
"Centers for reconstruction", style=header_font_style
)
self.all_centers_select = Select(
disabled=True,
Expand All @@ -205,7 +201,7 @@ def _init_widgets(self):
icon="fa-minus-square",
tooltip="Remove selected center.",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
)
self.buttons_to_disable = [
self.center_select,
Expand All @@ -217,7 +213,7 @@ def _init_widgets(self):
tooltip="Add center from reconstruction of this slice.",
skip_during=True,
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
disabled=False,
)
self.add_center_button.button.disabled = True
Expand Down
3 changes: 1 addition & 2 deletions tomopyui/widgets/dataexplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ def __init__(self):
self.quick_path_search.observe(
self.update_filechooser_from_quicksearch, names="value"
)
self.quick_path_label = Label("Quick path search")

# subdirectory selector
self.subdir_list = []
Expand Down Expand Up @@ -369,7 +368,7 @@ def load_metadata(self):
def create_app(self):
quickpath = VBox(
[
self.quick_path_label,
widgets.Label("Quick path search:"),
self.quick_path_search,
],
layout=Layout(align_items="center"),
Expand Down
6 changes: 3 additions & 3 deletions tomopyui/widgets/hdf_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from tomopyui.widgets.hdf_viewer import *
from tomopyui.widgets.helpers import ToggleIconButton
from tomopyui.widgets.imports import UploaderBase
from tomopyui.widgets.styles import button_font_style


class HDF5_GeneralUploader(UploaderBase):
Expand Down Expand Up @@ -43,20 +44,19 @@ def init_state(self):
self.turn_off_callbacks = False

def init_widgets(self):
self.button_font = {"font_size": "22px"}
self.button_layout = Layout(width="45px", height="40px")
self.files_sel = Select()
# Go faster on play button
self.home_button: ipywidgets.Button = Button(
icon="home",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
tooltip="Speed up play slider.",
)
self.reset_button: ipywidgets.Button = Button(
icon="redo",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
tooltip="Reset to original.",
)
self.tree_output = Output()
Expand Down
37 changes: 16 additions & 21 deletions tomopyui/widgets/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from ..tomocupy.prep.alignment import shift_prj_cp, batch_cross_correlation
from ..tomocupy.prep.sampling import shrink_and_pad_projections

from tomopyui.widgets.styles import header_font_style, button_font_style


import tomopy.misc.corr as tomocorr


Expand Down Expand Up @@ -49,12 +52,6 @@ def init_widgets(self):
"""
Initializes widgets in the Prep tab.
"""
self.header_font_style = {
"font_size": "22px",
"font_weight": "bold",
"font_variant": "small-caps",
}
self.button_font = {"font_size": "22px"}
self.button_layout = Layout(width="45px", height="40px")

# -- Main viewers --------------------------------------------------------------
Expand All @@ -68,18 +65,16 @@ def init_widgets(self):
# -- Headers for plotting -------------------------------------
self.import_plot_header = "Imported Projections"
self.import_plot_header = Label(
self.import_plot_header, style=self.header_font_style
self.import_plot_header, style=header_font_style
)
self.altered_plot_header = "Altered Projections"
self.altered_plot_header = Label(
self.altered_plot_header, style=self.header_font_style
self.altered_plot_header, style=header_font_style
)

# -- Header for methods -------------------------------------
self.prep_list_header = "Methods"
self.prep_list_header = Label(
self.prep_list_header, style=self.header_font_style
)
self.prep_list_header = Label(self.prep_list_header, style=header_font_style)

# -- Prep List -------------------------------------
self.prep_list_select = Select(
Expand All @@ -93,21 +88,21 @@ def init_widgets(self):
icon="arrow-up",
tooltip="Move method up.",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
)
self.down_button = Button(
disabled=True,
icon="arrow-down",
tooltip="Move method down.",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
)
self.remove_method_button = Button(
disabled=True,
icon="fa-minus-square",
tooltip="Remove selected method.",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
)
self.start_button = Button(
disabled=True,
Expand All @@ -118,7 +113,7 @@ def init_widgets(self):
),
icon="fa-running",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
)
self.preview_only_button = Button(
disabled=True,
Expand All @@ -129,15 +124,15 @@ def init_widgets(self):
),
icon="glasses",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
)
self.save_on_button = Button(
disabled=True,
button_style="",
tooltip=("Turn this on to save the data when you click the run button."),
icon="fa-file-export",
layout=self.button_layout,
style=self.button_font,
style=button_font_style,
)
self.methods_button_box = VBox(
[
Expand Down Expand Up @@ -191,22 +186,22 @@ def init_widgets(self):
# -- Shifts uploader --------------------------------------------------------
self.shifts_uploader = ShiftsUploader(self)
self.shift_x_header = "Shift in X"
self.shift_x_header = Label(self.shift_x_header, style=self.header_font_style)
self.shift_x_header = Label(self.shift_x_header, style=header_font_style)
self.shifts_sx_select = Select(
options=[],
rows=10,
disabled=True,
)
self.shift_y_header = "Shift in Y"
self.shift_y_header = Label(self.shift_y_header, style=self.header_font_style)
self.shift_y_header = Label(self.shift_y_header, style=header_font_style)
self.shifts_sy_select = Select(
options=[],
rows=10,
disabled=True,
)
self.shifts_filechooser_label = "Filechooser"
self.shifts_filechooser_label = Label(
self.shifts_filechooser_label, style=self.header_font_style
self.shifts_filechooser_label, style=header_font_style
)

# -- List manipulation ---------------------------------------------------------
Expand Down Expand Up @@ -560,7 +555,7 @@ def make_tab(self):
[
VBox(
[
self.shifts_uploader.quick_path_label,
widgets.Label("Quick path search:"),
self.shifts_uploader.quick_path_search,
],
),
Expand Down
9 changes: 9 additions & 0 deletions tomopyui/widgets/styles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
header_font_style = {
"font_size": "22px",
"font_weight": "bold",
"font_variant": "small-caps",
}

button_font_style = {"font_size": "22px"}

extend_description_style = {"description_width": "auto", "font_family": "Helvetica"}
Loading

0 comments on commit 7c9c023

Please sign in to comment.