Skip to content

Commit

Permalink
squash: Simplify plugin system loading
Browse files Browse the repository at this point in the history
Signed-off-by: David Feltell <[email protected]>
  • Loading branch information
feltech committed Oct 28, 2024
1 parent e6b6762 commit ed4282c
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions examples/ui_delegation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
" Pretend to do some backend query using the provided connection\n",
" to get the traits of the given entity.\n",
" \"\"\"\n",
" ...\n",
" return set()\n",
"\n"
],
"id": "43eb45d9a0a6766c"
Expand Down Expand Up @@ -414,24 +414,11 @@
"outputs": [],
"execution_count": null,
"source": [
"# For illustration’s sake, we'll use all the plugin systems, even though\n",
"# we know the NotebookPluginSystem defined above is the one that will\n",
"# be able to locate our plugin.\n",
"from openassetio.pluginSystem import (\n",
" # C++ users should use python::hostApi::createPythonPluginSystemManagerImplementationFactory()\n",
" PythonPluginSystemManagerImplementationFactory,\n",
" CppPluginSystemManagerImplementationFactory,\n",
" HybridPluginSystemManagerImplementationFactory\n",
")\n",
"from openassetio.hostApi import ManagerFactory\n",
"\n",
"manager_plugin_system = HybridPluginSystemManagerImplementationFactory(\n",
" [CppPluginSystemManagerImplementationFactory(logger),\n",
" PythonPluginSystemManagerImplementationFactory(logger),\n",
" NotebookPluginSystemManagerImplementationFactory(logger)], logger)\n",
"\n",
"manager = ManagerFactory.createManagerForInterface(\n",
" \"org.openassetio.example.notebook\", host_interface, manager_plugin_system, logger)"
" \"org.openassetio.example.notebook\", host_interface, NotebookPluginSystemManagerImplementationFactory(logger), logger)"
],
"id": "a07d6cbb604bec80"
},
Expand All @@ -447,24 +434,15 @@
"outputs": [],
"execution_count": null,
"source": [
"from openassetio.ui.pluginSystem import (\n",
" # C++ users should use python::ui::createPythonPluginSystemUIDelegateFactory()\n",
" PythonPluginSystemUIDelegateFactory,\n",
" CppPluginSystemUIDelegateFactory,\n",
" HybridPluginSystemUIDelegateFactory,\n",
")\n",
"from openassetio.ui.hostApi import UIDelegateFactory\n",
"\n",
"# We compose the plugin systems, with C++ plugins taking priority.\n",
"ui_delegate_plugin_system = HybridPluginSystemUIDelegateFactory(\n",
" [CppPluginSystemUIDelegateFactory(logger),\n",
" PythonPluginSystemUIDelegateFactory(logger),\n",
" NotebookPluginSystemUIDelegateFactory(logger)], logger)\n",
"ui_delegate_plugin_system = HybridPluginSystemUIDelegateFactory(NotebookPluginSystemUIDelegateFactory(logger), logger)\n",
"\n",
"# Locate the appropriate UI delegate plugin for the given manager\n",
"# implementation. Specifically, a UI delegate plugin will be selected\n",
"# that advertises the same unique identifier as the manager plugin.\n",
"uiDelegate = UIDelegateFactory.createUIDelegateForInterface(\n",
"ui_delegate = UIDelegateFactory.createUIDelegateForInterface(\n",
" \"org.openassetio.example.notebook\", host_interface, ui_delegate_plugin_system, logger)"
],
"id": "ed5184549f1a6efc"
Expand Down

0 comments on commit ed4282c

Please sign in to comment.