Skip to content

Commit

Permalink
Fix some typing issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeyer committed Jul 24, 2024
1 parent 58207d4 commit bcf2813
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion nionswift_plugin/nion_eels_analysis/AlignZLP.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def align_zlp_fit(api: API.API, window: Facade.DocumentWindow) -> None:
_run_align_zlp(api, window, "fit", "peak fit")


def calibrate_spectrum(api: Facade.API_1, window: Facade.DocumentWindow) -> typing.Optional[Dialog.ActionDialog]:
def _calibrate_spectrum(api: Facade.API_1, window: Facade.DocumentWindow) -> typing.Optional[Dialog.ActionDialog]:

class UIHandler(Declarative.Handler):
def __init__(self, data_item: Facade.DataItem, src_data_item: Facade.DataItem, offset_graphic: Facade.Graphic,
Expand Down Expand Up @@ -336,3 +336,7 @@ def wc(w: Window.Window) -> None:

# Return the dialog which is useful for testing
return dialog


def calibrate_spectrum(api: Facade.API_1, window: Facade.DocumentWindow) -> None:
_calibrate_spectrum(api, window)
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def update_add_buttons() -> None:
edges = PeriodicTable.PeriodicTable().find_edges_in_energy_interval(explore_interval)
for i, edge in enumerate(edges[0:4]):
button = ui.create_push_button_widget(edge.to_long_str())
def add_edge(model_data_item: DataItem.DataItem, edge: PeriodicTable.ElectronShell, data_item: DataItem.DataItem) -> None:
def add_edge(model_data_item: DataItem.DataItem, edge: PeriodicTable.ElectronShell, data_item: typing.Optional[DataItem.DataItem]) -> None:
self.__elemental_mapping_controller.add_edge(edge)
data_item_changed(model_data_item)
data_item_changed(data_item)
Expand Down
2 changes: 1 addition & 1 deletion nionswift_plugin/nion_eels_analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __build_menus(self, document_window: DocumentController.DocumentController)
eels_menu.add_menu_item(_("Show Live Thickness Measurement"), functools.partial(LiveThickness.attach_measure_thickness, api, window))
eels_menu.add_menu_item(_("Show Live ZLP Measurement"), functools.partial(LiveZLP.attach_measure_zlp, api, window))
eels_menu.add_separator()
eels_menu.add_menu_item(_("Calibrate Spectrum"), functools.partial(typing.cast(typing.Callable[[], None], AlignZLP.calibrate_spectrum), api, window))
eels_menu.add_menu_item(_("Calibrate Spectrum"), functools.partial(AlignZLP.calibrate_spectrum, api, window))
eels_menu.add_separator()
eels_menu.add_menu_item(_("Measure Temperature"), functools.partial(Thermometry.measure_temperature, api, window))
eels_menu.add_separator()
2 changes: 1 addition & 1 deletion nionswift_plugin/nion_eels_analysis/test/AlignZLP_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_calibrate_spectrum_for_single_spectrum(self) -> None:
document_controller.select_display_items_in_data_panel([display_item])
document_controller.data_panel_focused()
api = Facade.get_api("~1.0", "~1.0")
dialog = AlignZLP.calibrate_spectrum(api, api.application.document_windows[0])
dialog = AlignZLP._calibrate_spectrum(api, api.application.document_windows[0])
self.assertEqual(1, len(document_model.data_items))
self.assertEqual(1, len(document_model.display_items))
self.assertEqual(1, len(api.library.data_items))
Expand Down

0 comments on commit bcf2813

Please sign in to comment.