Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 26 additions & 51 deletions src/navigate/controller/sub_controllers/acquire_bar.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -79,6 +79,7 @@ def __init__(self, view, parent_controller):

self.view.pull_down["values"] = list(self.mode_dict.keys())
self.view.pull_down.current(0)
self.view.pull_down.state(["!disabled", "readonly"])

# gui event bind
self.view.acquire_btn.config(command=self.launch_popup_window)
Expand Down Expand Up @@ -248,16 +249,27 @@ def get_mode(self):
return self.mode

def add_mode(self, mode):
"""Add a new mode to the mode dictionary.

Parameters
----------
mode : str
Mode to add to the dictionary.
"""
if mode not in self.mode_dict:
self.mode_dict[mode] = mode
self.view.pull_down["values"] = list(self.mode_dict.keys())

def stop_acquire(self):
"""Stop the acquisition."""
"""Stop the acquisition.

Stop the progress bar, set the acquire button back to "Acquire", place pull
down menu in non-disabled format.
"""
self.stop_progress_bar()
self.view.acquire_btn.configure(text="Acquire")
self.view.acquire_btn.configure(state="normal")
self.view.pull_down.configure(state="normal")
self.view.pull_down.state(["!disabled", "readonly"])
self.is_acquiring = False

def set_save_option(self, is_save):
Expand All @@ -267,10 +279,6 @@ def set_save_option(self, is_save):
----------
is_save : bool
True if we will save the data. False if we will not.

Examples
--------
>>> set_save_option(True)
"""
self.is_save = is_save
self.parent_controller.configuration["experiment"]["MicroscopeState"][
Expand All @@ -282,14 +290,9 @@ def launch_popup_window(self):
"""Launch the Save Dialog Popup Window

The popup window should only be launched if the microscope is set to save the
data, with the exception of the continuous acquisition mode.
The popup window provides the user with the opportunity to fill in fields that
describe the experiment and also dictate the save path of the data in a
standardized format.

Examples
--------
>>> launch_popup_window()
data, except the continuous acquisition mode. The popup window provides the
user with the opportunity to fill in fields that describe the experiment and
also dictate the save path of the data in a standardized format.
"""
if self.is_acquiring and self.view.acquire_btn["text"] == "Acquire":
return
Expand All @@ -303,9 +306,7 @@ def launch_popup_window(self):
elif self.is_save and self.mode != "live":
#: object: Instance of the popup save dialog.
self.acquire_pop = AcquirePopUp(self.view)
buttons = (
self.acquire_pop.get_buttons()
) # This holds all the buttons in the popup
buttons = self.acquire_pop.get_buttons()
widgets = self.acquire_pop.get_widgets()

# Configure the button callbacks on the popup window
Expand All @@ -326,22 +327,20 @@ def launch_popup_window(self):
else:
self.is_acquiring = True
self.view.acquire_btn.configure(state="disabled")
self.view.pull_down.configure(state="disabled")
# self.view.pull_down.configure(state="disabled")
self.view.pull_down.state(["disabled", "readonly"])

self.parent_controller.execute("acquire")

def update_microscope_mode(self, *args):
"""Gets the state of the pull-down menu and tells the central controller
Will additionally call functions to disable and enable widgets based on mode

Parameters
Will additionally call functions to disable and enable widgets based on mode

Parameters
----------
args : str
Imaging Mode.

Examples
--------
>>> update_microscope_mode('live')
"""
self.mode = self.mode_dict[self.view.pull_down.get()]
self.show_verbose_info("The Microscope State is now:", self.get_mode())
Expand All @@ -359,10 +358,6 @@ def update_file_type(self, file_type):
----------
file_type : str
File type.

Examples
--------
>>> update_file_type('tiff')
"""
self.saving_settings["file_type"] = file_type.get()

Expand All @@ -379,10 +374,6 @@ def launch_acquisition(self, popup_window):
----------
popup_window : object
Instance of the popup save dialog.

Examples
--------
>>> launch_acquisition(popup_window)
"""
# update saving settings according to user's input
self.update_experiment_values(popup_window)
Expand All @@ -404,26 +395,14 @@ def launch_acquisition(self, popup_window):
self.parent_controller.execute("acquire_and_save")

def exit_program(self):
"""Exit Button

Quit the software.

Examples
--------
>>> exit_program()
"""
"""Exit Button to close the program."""
if messagebox.askyesno("Exit", "Are you sure?"):
self.show_verbose_info("Exiting Program")
# call the central controller to stop all the threads
self.parent_controller.execute("exit")

def populate_experiment_values(self):
"""Populate the experiment values from the config file.

Examples
--------
>>> populate_experiment_values()
"""
"""Populate the experiment values from the config file."""
#: dict: Saving settings.
self.saving_settings = self.parent_controller.configuration["experiment"][
"Saving"
Expand All @@ -446,10 +425,6 @@ def update_experiment_values(self, popup_window):
----------
popup_window : object
Instance of the popup save dialog.

Examples
--------
>>> update_experiment_values(popup_window)
"""
popup_vals = popup_window.get_variables()
for name in popup_vals:
Expand Down
7 changes: 3 additions & 4 deletions src/navigate/view/main_window_content/acquire_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def __init__(self, top_frame, root, *args, **kwargs):
self.options = tk.StringVar()
#: ttk.Combobox: Pull down menu to select acquisition type
self.pull_down = ttk.Combobox(self, textvariable=self.options)
self.pull_down.state(["readonly"])

# Progress Bar: Current Acquisitions and Overall
#: ttk.Frame: Frame to hold the progress bars
Expand All @@ -104,9 +103,9 @@ def __init__(self, top_frame, root, *args, **kwargs):
)

#: tk.Label: Label to display the current acquisition progress
self.total_acquisition_label = tk.Label(self, text=f"{0:02}"
f":{0:02}"
f":{0:02}")
self.total_acquisition_label = tk.Label(
self, text=f"{0:02}" f":{0:02}" f":{0:02}"
)

self.CurAcq.grid(row=0, column=0)
self.OvrAcq.grid(row=1, column=0)
Expand Down
Loading