From 54ca9eb5287dca92bcd72075aebab4be047a6c82 Mon Sep 17 00:00:00 2001 From: lisham2000 Date: Tue, 1 Oct 2024 13:22:32 +0100 Subject: [PATCH] Change naming for backwards compatibility --- nion/swift/DocumentController.py | 16 ++++++++-------- nion/swift/resources/menu_config.json | 4 ++-- nion/swift/test/DisplayPanel_test.py | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nion/swift/DocumentController.py b/nion/swift/DocumentController.py index db02275e..6067bfd1 100755 --- a/nion/swift/DocumentController.py +++ b/nion/swift/DocumentController.py @@ -2638,8 +2638,8 @@ def create_context_menu_for_display(self, display_items: typing.List[DisplayItem def populate_context_menu(self, menu: UserInterface.Menu, action_context: DocumentController.ActionContext) -> None: self.add_action_to_menu_if_enabled(menu, "display.reveal", action_context) - self.add_action_to_menu_if_enabled(menu, "file.export", action_context) - + self.add_action_to_menu_if_enabled(menu, "export.export", action_context) + self.add_action_to_menu_if_enabled(menu, "export.export_batch", action_context) data_item = action_context.data_item if data_item: source_data_items = self.document_model.get_source_data_items(data_item) @@ -3012,8 +3012,8 @@ def get_action_name(self, context: Window.ActionContext) -> str: return self.action_name -class SingleExportAction(Window.Action): - action_id = "export.single_export" +class ExportAction(Window.Action): + action_id = "export.export" action_name = _("Single Export...") def execute(self, context: Window.ActionContext) -> Window.ActionResult: @@ -3032,8 +3032,8 @@ def is_enabled(self, context: Window.ActionContext) -> bool: return len(context.display_items) == 1 and context.display_item is not None -class BatchExportAction(Window.Action): - action_id = "export.batch_export" +class ExportBatchAction(Window.Action): + action_id = "export.export_batch" action_name = _("Batch Export...") def execute(self, context: Window.ActionContext) -> Window.ActionResult: @@ -3099,8 +3099,8 @@ def invoke(self, context: Window.ActionContext) -> Window.ActionResult: Window.register_action(DeleteItemAction()) Window.register_action(DeleteDataItemAction()) -Window.register_action(SingleExportAction()) -Window.register_action(BatchExportAction()) +Window.register_action(ExportAction()) +Window.register_action(ExportBatchAction()) Window.register_action(ExportSVGAction()) Window.register_action(ImportDataAction()) Window.register_action(ImportFolderAction()) diff --git a/nion/swift/resources/menu_config.json b/nion/swift/resources/menu_config.json index ee6dd19c..fa010309 100644 --- a/nion/swift/resources/menu_config.json +++ b/nion/swift/resources/menu_config.json @@ -47,11 +47,11 @@ "items":[ { "type": "item", - "action_id":"export.single_export" + "action_id":"export.export" }, { "type": "item", - "action_id":"export.batch_export" + "action_id":"export.export_batch" }, { "type": "item", diff --git a/nion/swift/test/DisplayPanel_test.py b/nion/swift/test/DisplayPanel_test.py index 290ff13e..e3e1d797 100644 --- a/nion/swift/test/DisplayPanel_test.py +++ b/nion/swift/test/DisplayPanel_test.py @@ -1365,13 +1365,13 @@ def test_image_display_panel_produces_context_menu_with_correct_item_count(self) self.assertIsNone(self.document_controller.ui.popup) self.display_panel.root_container.canvas_widget.on_context_menu_event(500, 500, 500, 500) # show, sep, delete, sep, split h, split v, sep, none, sep, data, thumbnails, browser, sep - self.assertEqual(19, len(self.document_controller.ui.popup.items)) + self.assertEqual(21, len(self.document_controller.ui.popup.items)) def test_image_display_panel_produces_context_menu_with_correct_item_count_outside_image_area(self): self.assertIsNone(self.document_controller.ui.popup) self.display_panel.root_container.canvas_widget.on_context_menu_event(10, 32, 10, 32) # header + 10 # show, sep, delete, sep, split h, split v, sep, none, sep, data, thumbnails, browser, sep - self.assertEqual(19, len(self.document_controller.ui.popup.items)) + self.assertEqual(21, len(self.document_controller.ui.popup.items)) def test_image_display_panel_with_no_image_produces_context_menu_with_correct_item_count(self): self.display_panel.set_display_panel_display_item(None) @@ -1398,7 +1398,7 @@ def test_browser_display_panel_produces_context_menu_with_correct_item_count_ove self.display_panel.root_container.refresh_layout_immediate() self.display_panel.root_container.canvas_widget.on_context_menu_event(40, 40, 40, 40) # show, sep, delete, sep, split h, split v, sep, none, sep, data, thumbnails, browser, sep - self.assertEqual(19, len(self.document_controller.ui.popup.items)) + self.assertEqual(21, len(self.document_controller.ui.popup.items)) def test_browser_display_panel_produces_context_menu_with_correct_item_count_over_area_to_right_of_data_item(self): d = {"type": "image", "display-panel-type": "browser-display-panel"}