Skip to content

Commit

Permalink
Change naming for backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lisham2000 committed Oct 1, 2024
1 parent ea1b8e2 commit 54ca9eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions nion/swift/DocumentController.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions nion/swift/resources/menu_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions nion/swift/test/DisplayPanel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"}
Expand Down

0 comments on commit 54ca9eb

Please sign in to comment.