Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion spinetoolbox/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:date: 6.5.2020
"""
# The categories will appear in the main window in the same order they are declared here.
CATEGORIES = ("Data Stores", "Data Connections", "Tools", "Views", "Importers", "Exporters", "Manipulators")
CATEGORIES = ("Data Stores", "Data Connections", "Tools", "Notebooks", "Views", "Importers", "Exporters", "Manipulators")


CATEGORY_DESCRIPTIONS = {
Expand All @@ -25,6 +25,7 @@
"Exporters": "Data conversion from Spine to an external format",
"Importers": "Data conversion from an external format to Spine",
"Tools": "Custom data processing",
"Notebooks": "Custom data processing with Jupyter notebooks",
"Views": "Data visualization",
"Manipulators": "Data conversion from Spine to Spine",
}
5 changes: 4 additions & 1 deletion spinetoolbox/ui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,10 @@ def load_specification(self, definition):
ProjectItemSpecification or NoneType: specification or None if factory isn't found.
"""
# NOTE: If the spec doesn't have the "item_type" key, we can assume it's a tool spec
item_type = definition.get("item_type", "Tool")
if "notebook_type" in definition:
item_type = "Notebook"
else:
item_type = definition.get("item_type", "Tool")
spec_factory = self._item_specification_factories.get(item_type)
if spec_factory is None:
return None
Expand Down
17 changes: 11 additions & 6 deletions tests/test_toolboxUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def test_init_project_item_model_with_project(self):
def check_init_project_item_model(self):
"""Checks that category items are created as expected."""
n = self.toolbox.project_item_model.rowCount()
# Data Stores, Data Connections, Tools, Views, Importers, Exporters, Manipulators
self.assertEqual(n, 7)
# Data Stores, Data Connections, Tools, Notebooks, Views, Importers, Exporters, Manipulators
self.assertEqual(n, 8)
# Check that there's only one column
self.assertEqual(self.toolbox.project_item_model.columnCount(), 1)
# Check that the items DisplayRoles are (In this particular order)
Expand All @@ -111,25 +111,30 @@ def check_init_project_item_model(self):
item3.parent(), RootProjectTreeItem, "Parent item of category item on row 2 should be root"
)
item4 = self.toolbox.project_item_model.root().child(3)
self.assertEqual(item4.name, "Views", "Item on row 3 is not 'Views'")
self.assertEqual(item4.name, "Notebooks", "Item on row 3 is not 'Notebooks'")
self.assertIsInstance(
item4.parent(), RootProjectTreeItem, "Parent item of category item on row 3 should be root"
)
item5 = self.toolbox.project_item_model.root().child(4)
self.assertEqual(item5.name, "Importers", "Item on row 4 is not 'Importers'")
self.assertEqual(item5.name, "Views", "Item on row 4 is not 'Views'")
self.assertIsInstance(
item5.parent(), RootProjectTreeItem, "Parent item of category item on row 4 should be root"
)
item6 = self.toolbox.project_item_model.root().child(5)
self.assertEqual(item6.name, "Exporters", "Item on row 5 is not 'Exporters'")
self.assertEqual(item6.name, "Importers", "Item on row 5 is not 'Importers'")
self.assertIsInstance(
item6.parent(), RootProjectTreeItem, "Parent item of category item on row 5 should be root"
)
item7 = self.toolbox.project_item_model.root().child(6)
self.assertEqual(item7.name, "Manipulators", "Item on row 6 is not 'Manipulators'")
self.assertEqual(item7.name, "Exporters", "Item on row 6 is not 'Exporters'")
self.assertIsInstance(
item7.parent(), RootProjectTreeItem, "Parent item of category item on row 6 should be root"
)
item8 = self.toolbox.project_item_model.root().child(7)
self.assertEqual(item8.name, "Manipulators", "Item on row 7 is not 'Manipulators'")
self.assertIsInstance(
item8.parent(), RootProjectTreeItem, "Parent item of category item on row 7 should be root"
)

def test_init_specification_model(self):
"""Check that specification model has no items after init and that
Expand Down