diff --git a/src/navigate/view/main_window_content/camera_tab.py b/src/navigate/view/main_window_content/camera_tab.py index 5ac66a202..95112e42b 100644 --- a/src/navigate/view/main_window_content/camera_tab.py +++ b/src/navigate/view/main_window_content/camera_tab.py @@ -38,6 +38,7 @@ # Third Party Imports # Local Imports +import navigate from navigate.view.custom_widgets.LabelInputWidgetFactory import LabelInput from navigate.view.custom_widgets.validation import ValidatedSpinbox, ValidatedEntry @@ -46,7 +47,7 @@ logger = logging.getLogger(p) -class CameraSettingsTab(tk.Frame): +class CameraSettingsTab(ttk.Frame): """ This class holds and controls the layout of the major label frames for the camera settings tab in the settings notebook. Any imported classes are children @@ -54,7 +55,12 @@ class CameraSettingsTab(tk.Frame): the frames follow the children. """ - def __init__(self, setntbk, *args, **kwargs): + def __init__( + self, + setntbk: "navigate.view.main_window_content.settings_notebook", + *args: tuple, + **kwargs: dict + ) -> None: """Initialize the Camera Settings Tab Parameters @@ -67,15 +73,14 @@ def __init__(self, setntbk, *args, **kwargs): Keyword arguments for ttk.Frame """ # Init Frame - tk.Frame.__init__(self, setntbk, *args, **kwargs) + ttk.Frame.__init__(self, setntbk, *args, **kwargs) + #: The index of the tab in the notebook self.index = 1 - # Formatting tk.Grid.columnconfigure(self, "all", weight=1) tk.Grid.rowconfigure(self, "all", weight=1) - # Camera Modes Frame #: tk.Frame: The camera mode frame self.camera_mode = CameraMode(self) self.camera_mode.grid(row=0, column=0, sticky=tk.NSEW, padx=10, pady=10) @@ -105,12 +110,17 @@ class CameraMode(ttk.Labelframe): the widget directly or with the dictionary generated by get_variables. """ - def __init__(self, settings_tab, *args, **kwargs): + def __init__( + self, + settings_tab: "CameraSettingsTab", + *args, + **kwargs + ) -> None: """Initialize the Camera Mode Frame Parameters ---------- - settings_tab : ttk.Frame + settings_tab : CameraSettingsTab The settings tab that the frame will be placed in. *args : tuple Positional arguments for ttk.LabelFrame @@ -157,7 +167,7 @@ def __init__(self, settings_tab, *args, **kwargs): self.inputs[self.names[i]].grid( row=i, column=1, pady=3, padx=5, sticky=tk.W) - def get_variables(self): + def get_variables(self) -> dict: """Get Variables. This function returns a dictionary of all the variables that are tied to each @@ -175,7 +185,7 @@ def get_variables(self): variables[key] = widget.get() return variables - def get_widgets(self): + def get_widgets(self) -> dict: """Get Widgets. This function returns the dictionary that holds the widgets. @@ -201,12 +211,17 @@ class FramerateInfo(ttk.LabelFrame): the dictionary generated by get_variables. """ - def __init__(self, settings_tab, *args, **kwargs): + def __init__( + self, + settings_tab: CameraSettingsTab, + *args: tuple, + **kwargs: dict + ) -> None: """Initialize the Framerate Info Frame Parameters ---------- - settings_tab : ttk.Frame + settings_tab : CameraSettingsTab The settings tab that the frame will be placed in. *args : tuple Positional arguments for ttk.LabelFrame @@ -267,7 +282,7 @@ def __init__(self, settings_tab, *args, **kwargs): self.inputs[self.names[i]].grid(row=i, column=1, pady=1, padx=5, sticky=tk.W) - def get_variables(self): + def get_variables(self) -> dict: """Get Variables This function returns a dictionary of all variables tied to each widget. @@ -285,7 +300,7 @@ def get_variables(self): variables[key] = widget.get() return variables - def get_widgets(self): + def get_widgets(self) -> dict: """Get Widgets This function returns the dictionary that holds the widgets. @@ -311,12 +326,16 @@ class ROI(ttk.Labelframe): get_variables. """ - def __init__(self, settings_tab, *args, **kwargs): + def __init__( + self, + settings_tab: CameraSettingsTab, + *args: tuple, + **kwargs: dict) -> None: """Initialize the ROI Frame Parameters ---------- - settings_tab : ttk.Frame + settings_tab : CameraSettingsTab The settings tab that the frame will be placed in. *args : tuple Positional arguments for ttk.LabelFrame @@ -363,9 +382,9 @@ def __init__(self, settings_tab, *args, **kwargs): tk.Grid.columnconfigure(self.roi_boundary_frame, "all", weight=1) tk.Grid.rowconfigure(self.roi_boundary_frame, "all", weight=1) - # Dictionary for all the variables, this will be used by the controller #: dict: Dictionary of all the widgets in the frame. self.inputs = {} + #: dict: Dictionary of all the buttons in the frame. self.buttons = {} @@ -377,6 +396,7 @@ def __init__(self, settings_tab, *args, **kwargs): roi_boundary_names = ["Top_X", "Top_Y", "Bottom_X", "Bottom_Y"] roi_boundary_labels = ["X", "Y", "X", "Y"] + #: str: The binning label. self.binning = "Binning" @@ -451,18 +471,18 @@ def __init__(self, settings_tab, *args, **kwargs): ) self.inputs[self.binning].grid(row=3, column=0, pady=5, padx=5) - # Additional formatting # Number of Pixels self.inputs["Width"].grid(pady=(10, 5)) self.inputs["Width"].label.grid(padx=(0, 13)) self.inputs["Height"].label.grid(padx=(0, 10)) self.inputs["Binning"].label.grid(padx=(0, 6)) + # FOV self.inputs["FOV_X"].grid(pady=(10, 5)) self.inputs["FOV_X"].label.grid(padx=(0, 10)) self.inputs["FOV_Y"].label.grid(padx=(0, 10)) - def get_variables(self): + def get_variables(self) -> dict: """Get Variables. This function returns a dictionary of all the variables that are tied to each @@ -480,7 +500,7 @@ def get_variables(self): variables[key] = widget.get() return variables - def get_widgets(self): + def get_widgets(self) -> dict: """Get Widgets. This function returns the dictionary that holds the widgets. @@ -493,7 +513,7 @@ def get_widgets(self): """ return self.inputs - def get_buttons(self): + def get_buttons(self) -> dict: """Get Buttons. This function returns the dictionary that holds the buttons.