Skip to content

Commit e41b180

Browse files
Rename sub-controllers
1 parent 8cee25b commit e41b180

33 files changed

+154
-134
lines changed

src/navigate/controller/sub_controllers/__init__.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22
Sub-controllers for navigate.
33
"""
44

5-
from .stage_controller import StageController # noqa
6-
from .acquire_bar_controller import AcquireBarController # noqa
7-
from .channels_tab_controller import ChannelsTabController # noqa
8-
from .camera_view_controller import CameraViewController # noqa
9-
from .camera_setting_controller import CameraSettingController # noqa
10-
from .waveform_tab_controller import WaveformTabController # noqa
11-
from .waveform_popup_controller import WaveformPopupController # noqa
12-
from .autofocus_popup_controller import AutofocusPopupController # noqa
13-
from .features_popup_controller import FeaturePopupController # noqa
14-
from .feature_advanced_setting_controller import (
5+
from .stages import StageController # noqa
6+
from .acquire_bar import AcquireBarController # noqa
7+
from .channels_tab import ChannelsTabController # noqa
8+
from .camera_view import CameraViewController # noqa
9+
from .camera_settings import CameraSettingController # noqa
10+
from .waveform_tab import WaveformTabController # noqa
11+
from .waveform_popup import WaveformPopupController # noqa
12+
from .autofocus import AutofocusPopupController # noqa
13+
from .features_popup import FeaturePopupController # noqa
14+
from .feature_advanced_setting import (
1515
FeatureAdvancedSettingController, # noqa
1616
)
17-
from .keystroke_controller import KeystrokeController # noqa
18-
from .multi_position_controller import MultiPositionController # noqa
19-
from .ilastik_popup_controller import IlastikPopupController # noqa
20-
from .camera_map_setting_popup_controller import CameraMapSettingPopupController # noqa
21-
from .microscope_popup_controller import MicroscopePopupController # noqa
22-
from .adaptiveoptics_popup_controller import AdaptiveOpticsPopupController # noqa
17+
from .keystrokes import KeystrokeController # noqa
18+
from .multiposition import MultiPositionController # noqa
19+
from .ilastik import IlastikPopupController # noqa
20+
from .camera_map import CameraMapSettingPopupController # noqa
21+
from .microscope_popup import MicroscopePopupController # noqa
22+
from .adaptive_optics import AdaptiveOpticsPopupController # noqa
23+
2324
# from .uninstall_plugin_controller import UninstallPluginController # noqa
24-
from .plugins_controller import PluginsController, UninstallPluginController # noqa
25-
from .menu_controller import MenuController # noqa
25+
from .plugins import PluginsController, UninstallPluginController # noqa
26+
from .menus import MenuController # noqa

src/navigate/controller/sub_controllers/acquire_bar_controller.py renamed to src/navigate/controller/sub_controllers/acquire_bar.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# Third Party Imports
3838

3939
# Local Imports
40-
from navigate.controller.sub_controllers.gui_controller import GUIController
40+
from navigate.controller.sub_controllers.gui import GUIController
4141
from navigate.view.popups.acquire_popup import AcquirePopUp
4242

4343
# Logger Setup
@@ -171,10 +171,7 @@ def progress_bar(self, images_received, microscope_state, mode, stop=False):
171171
except ZeroDivisionError:
172172
pass
173173

174-
if (
175-
mode == "z-stack"
176-
or mode == "ConstantVelocityAcquisition"
177-
):
174+
if mode == "z-stack" or mode == "ConstantVelocityAcquisition":
178175
top_percent_complete = 100 * (
179176
images_received / top_anticipated_images
180177
)
@@ -223,9 +220,7 @@ def update_progress_label(self, seconds_left):
223220
hours, remainder = divmod(seconds_left, 3600)
224221
minutes, seconds = divmod(remainder, 60)
225222
self.view.total_acquisition_label.config(
226-
text=f"{int(hours):02}"
227-
f":{int(minutes):02}"
228-
f":{int(seconds):02}"
223+
text=f"{int(hours):02}" f":{int(minutes):02}" f":{int(seconds):02}"
229224
)
230225

231226
def set_mode(self, mode):
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
# from matplotlib.axes import Axes
4040

4141
# Local application imports
42-
from navigate.controller.sub_controllers.gui_controller import GUIController
42+
from navigate.controller.sub_controllers.gui import GUIController
4343

4444
# Logger Setup
4545
p = __name__.split(".")[1]
@@ -318,7 +318,7 @@ def run_tony_wilson(self):
318318
# set the saving file name before running
319319
if self.widgets["save_report"]["variable"].get():
320320
save_dir = self.parent_controller.configuration["experiment"]["Saving"][
321-
"save_directory"
321+
"save_directory"
322322
]
323323

324324
self.report_path = filedialog.asksaveasfilename(
@@ -334,7 +334,7 @@ def save_report_to_file(self, report):
334334
full_report = {}
335335

336336
for i, page in enumerate(report):
337-
full_report[f"iter_{i}"] = page
337+
full_report[f"iter_{i}"] = page
338338

339339
import pandas as pd
340340

src/navigate/controller/sub_controllers/autofocus_popup_controller.py renamed to src/navigate/controller/sub_controllers/autofocus.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from tkinter import messagebox
3939

4040
# Local Imports
41-
from navigate.controller.sub_controllers.gui_controller import GUIController
41+
from navigate.controller.sub_controllers.gui import GUIController
4242
from navigate.tools.common_functions import combine_funcs
4343

4444

@@ -62,13 +62,17 @@ def __init__(self, view, parent_controller):
6262
The parent controller of the autofocus popup.
6363
"""
6464
super().__init__(view, parent_controller)
65+
6566
#: dict: The autofocus setting dictionary.
6667
self.widgets = self.view.get_widgets()
68+
6769
#: object: The autofocus figure.
6870
self.autofocus_fig = self.view.fig
71+
6972
#: object: The autofocus coarse plot.
7073
self.autofocus_coarse = self.view.coarse
7174
self.populate_experiment_values()
75+
7276
#: object: The autofocus coarse plot.
7377
self.coarse_plot = None
7478

@@ -147,7 +151,7 @@ def start_autofocus(self):
147151
value = float(setting_dict[f"{k}_range"])
148152
if step <= 0 or value < step:
149153
warning_message += f"{k} settings are not correct!\n"
150-
except:
154+
except Exception:
151155
warning_message += f"{k} settings are not correct!\n"
152156
if warning_message:
153157
messagebox.showerror(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import tifffile
4040

4141
# Local application imports
42-
from navigate.controller.sub_controllers.gui_controller import GUIController
42+
from navigate.controller.sub_controllers.gui import GUIController
4343
from navigate.config import get_navigate_path
4444
from navigate.model.analysis.camera import compute_scmos_offset_and_variance_map
4545

src/navigate/controller/sub_controllers/camera_setting_controller.py renamed to src/navigate/controller/sub_controllers/camera_settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# Third Party Imports
3737

3838
# Local Imports
39-
from navigate.controller.sub_controllers.gui_controller import GUIController
39+
from navigate.controller.sub_controllers.gui import GUIController
4040

4141
# Logger Setup
4242
p = __name__.split(".")[1]
@@ -445,7 +445,7 @@ def calculate_physical_dimensions(self):
445445
try:
446446
x_pixel = float(self.roi_widgets["Width"].get())
447447
y_pixel = float(self.roi_widgets["Height"].get())
448-
except ValueError as e:
448+
except ValueError:
449449
return
450450

451451
microscope_state_dict = self.parent_controller.configuration["experiment"][
@@ -500,7 +500,7 @@ def update_number_of_pixels(self, *args):
500500

501501
if self.pixel_event_id:
502502
self.view.after_cancel(self.pixel_event_id)
503-
503+
504504
pixels = self.mode_widgets["Pixels"].get()
505505
if pixels == "":
506506
return

src/navigate/controller/sub_controllers/camera_view_controller.py renamed to src/navigate/controller/sub_controllers/camera_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import copy
4545

4646
# Local Imports
47-
from navigate.controller.sub_controllers.gui_controller import GUIController
47+
from navigate.controller.sub_controllers.gui import GUIController
4848
from navigate.model.analysis.camera import compute_signal_to_noise
4949
from navigate.tools.common_functions import VariableWithLock
5050

src/navigate/controller/sub_controllers/channel_setting_controller.py renamed to src/navigate/controller/sub_controllers/channels_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# Third party imports
3838

3939
# Local application imports
40-
from navigate.controller.sub_controllers.gui_controller import GUIController
40+
from navigate.controller.sub_controllers.gui import GUIController
4141

4242
# Logger Setup
4343
p = __name__.split(".")[1]

src/navigate/controller/sub_controllers/channels_tab_controller.py renamed to src/navigate/controller/sub_controllers/channels_tab.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
import tkinter as tk
4141

4242
# Local Imports
43-
from navigate.controller.sub_controllers.gui_controller import GUIController
44-
from navigate.controller.sub_controllers.channel_setting_controller import (
43+
from navigate.controller.sub_controllers.gui import GUIController
44+
from navigate.controller.sub_controllers.channels_settings import (
4545
ChannelSettingController,
4646
)
47-
from navigate.controller.sub_controllers.tiling_wizard_controller import (
47+
from navigate.controller.sub_controllers.tiling import (
4848
TilingWizardController,
4949
)
5050

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040

4141
# Local application imports
4242
from navigate.model.features import feature_related_functions
43-
44-
# from navigate.model.features.feature_related_functions import convert_str_to_feature_list
4543
from navigate.view.popups.feature_list_popup import FeatureAdvancedSettingPopup
4644
from navigate.tools.file_functions import load_yaml_file, save_yaml_file
4745
from navigate.tools.common_functions import load_module_from_file
@@ -85,7 +83,7 @@ def refresh_popup_window(self, popup):
8583
8684
Parameters
8785
----------
88-
popup : navigate.view.popups.feature_list_popup.FeatureAdvancedSettingPopup
86+
popup : FeatureAdvancedSettingPopup
8987
The popup window
9088
"""
9189
feature_name = popup.feature_name_widget.get()
@@ -190,7 +188,9 @@ def save_parameters(self):
190188
if row[1].get() == "None":
191189
feature_parameter_config[arg_name][row[0].get()] = None
192190
else:
193-
feature_parameter_config[arg_name][row[0].get()] = row[1].get()
191+
feature_parameter_config[arg_name][row[0].get()] = row[
192+
1
193+
].get()
194194
else:
195195
unloaded_functions.append(row[0].get())
196196

@@ -208,15 +208,13 @@ def save_parameters(self):
208208
if unloaded_functions:
209209
if len(unloaded_functions) == 1:
210210
alert_message = f"Function {unloaded_functions[0]} isn't loaded!"
211-
else:
212-
alert_message = f"Functions {', '.join(unloaded_functions)} are not loaded!"
213-
messagebox.showwarning(
214-
title="Warning",
215-
message=alert_message
216-
)
211+
else:
212+
alert_message = (
213+
f"Functions {', '.join(unloaded_functions)} are not loaded!"
214+
)
215+
messagebox.showwarning(title="Warning", message=alert_message)
217216
self.popup.popup.attributes("-topmost", 1)
218217

219-
220218
def exit_func(self):
221219
"""Exit the popup window"""
222220
self.save_parameters()

0 commit comments

Comments
 (0)