From 3aa2aa93b9f5cf937320383a90a24f39b6f8ceed Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Tue, 13 Jun 2023 20:06:32 -0400 Subject: [PATCH 1/5] Begin logic to add "hide items" style to SubmitOperation Mods to pqSMTKOperationParameterPanel: * Add optional view argument to editExistingOperationParameters() * Also refactor code to create TabData instances --- .../pqSMTKOperationParameterPanel.cxx | 62 ++++++++++++++----- .../pqSMTKOperationParameterPanel.h | 6 +- 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx index ea703ad329..3b11928438 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx +++ b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx @@ -57,6 +57,7 @@ #include "vtkSMProxy.h" #include +#include #include #include #include @@ -199,7 +200,8 @@ void pqSMTKOperationParameterPanel::editExistingOperationParameters( const std::shared_ptr& operation, bool associateSelection, bool isTabClosable, - bool showApply) + bool showApply, + smtk::view::ConfigurationPtr view) { if (!m_wrapper) { @@ -220,6 +222,11 @@ void pqSMTKOperationParameterPanel::editExistingOperationParameters( opTab = &it->second; if (opTab->m_operation == operation) { + if (!opTab->m_view) + { + break; // hasn't been displayed (new preconfigured view) + } + m_tabs->setCurrentWidget(opTab->m_tab); opTab->m_closable = isTabClosable; this->raise(); @@ -228,18 +235,10 @@ void pqSMTKOperationParameterPanel::editExistingOperationParameters( } } - // We didn't find the operation, so create a new tab. - auto it = m_views.emplace(opType, TabData{}); - opTab = &it->second; - opTab->m_operation = operation; - opTab->m_uiMgr = new smtk::extension::qtUIManager( - opTab->m_operation, m_wrapper->smtkResourceManager(), m_wrapper->smtkViewManager()); - opTab->m_uiMgr->setMaxValueLabelLength(100); - opTab->m_uiMgr->managers() = m_wrapper->smtkManagers(); - opTab->m_uiMgr->setOperationManager(m_wrapper->smtkOperationManager()); - opTab->m_uiMgr->setSelection(m_wrapper->smtkSelection()); - opTab->m_tab = new QWidget(m_tabs); - opTab->m_tab->setLayout(new QVBoxLayout); + if (opTab == nullptr) + { + opTab = this->createTabData(operation.get()); + } // Fetch the selection and associate it if directed to do so. if (associateSelection) @@ -261,7 +260,10 @@ void pqSMTKOperationParameterPanel::editExistingOperationParameters( } } - smtk::view::ConfigurationPtr view = opTab->m_uiMgr->findOrCreateOperationView(); + if (view == nullptr) + { + view = opTab->m_uiMgr->findOrCreateOperationView(); + } opTab->m_view = opTab->m_uiMgr->setSMTKView(view, opTab->m_tab); opTab->m_closable = isTabClosable; bool didDisplay = opTab->m_view != nullptr; @@ -666,13 +668,23 @@ void pqSMTKOperationParameterPanel::handleProjectEvent( // value (one of "anew"/"override"/"modified"). if (submitOpTask->state() != smtk::task::State::Completed) { + // Has TabData already been created? + auto* op = submitOpTask->operation(); + TabData* tabData = this->tabDataForOperation(*op); + if (tabData == nullptr) + { + tabData = this->createTabData(op); + } + auto view = tabData->m_uiMgr->findOrCreateOperationView(); + qDebug() << __FILE__ << __LINE__ << (view == nullptr); this->editExistingOperationParameters( submitOpTask->operation()->shared_from_this(), /* associate selection? */ false, // TODO: Determine whether submitOpTask->associations() is specified. /* allow tab to be closed? */ false, /* show apply button */ submitOpTask->runStyle() != - smtk::task::SubmitOperation::RunStyle::OnCompletion); + smtk::task::SubmitOperation::RunStyle::OnCompletion, + view); } } }); @@ -750,6 +762,26 @@ pqSMTKOperationParameterPanel::TabData* pqSMTKOperationParameterPanel::tabDataFo return nullptr; } +pqSMTKOperationParameterPanel::TabData* pqSMTKOperationParameterPanel::createTabData( + smtk::operation::Operation* op) +{ + smtk::operation::Operation::Index opType = op->index(); + auto it = m_views.emplace(opType, TabData{}); + TabData* opTab = &it->second; + + opTab->m_operation = op->shared_from_this(); + opTab->m_uiMgr = new smtk::extension::qtUIManager( + opTab->m_operation, m_wrapper->smtkResourceManager(), m_wrapper->smtkViewManager()); + opTab->m_uiMgr->setMaxValueLabelLength(100); + opTab->m_uiMgr->managers() = m_wrapper->smtkManagers(); + opTab->m_uiMgr->setOperationManager(m_wrapper->smtkOperationManager()); + opTab->m_uiMgr->setSelection(m_wrapper->smtkSelection()); + opTab->m_tab = new QWidget(m_tabs); + opTab->m_tab->setLayout(new QVBoxLayout); + + return opTab; +} + void pqSMTKOperationParameterPanel::activeTaskStateChange( smtk::task::Task& task, smtk::task::State priorState, diff --git a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h index 9fb3305d37..0c6a4d718c 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h +++ b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h @@ -99,7 +99,8 @@ public Q_SLOTS: const std::shared_ptr& operation, bool associateSelection = true, bool isTabClosable = true, - bool showApply = true); + bool showApply = true, + smtk::view::ConfigurationPtr view = nullptr); /// Called when users close an operation-parameter's tab. virtual void cancelEditing(int tabIndex); @@ -145,6 +146,9 @@ protected: /// Return the tab-view metadata for the given operation (if any). TabData* tabDataForOperation(smtk::operation::Operation& op); + /// Create tab-view metadata for the given operation. + TabData* createTabData(smtk::operation::Operation* op); + /// Called when the panel is displaying a SubmitOperation task and the task changes state. void activeTaskStateChange( smtk::task::Task& task, -- GitLab From 9bd6eb12049cb9866766369fb8f367a32817983a Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Tue, 13 Jun 2023 21:23:51 -0400 Subject: [PATCH 2/5] Add logic to insert ItemView components in the operation's view Still has some printf lines commented out --- .../pqSMTKOperationParameterPanel.cxx | 61 ++++++++++++++++++- .../pqSMTKOperationParameterPanel.h | 4 ++ 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx index 3b11928438..5619306e68 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx +++ b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx @@ -73,6 +73,8 @@ using json = nlohmann::json; +// #include + pqSMTKOperationParameterPanel::pqSMTKOperationParameterPanel(QWidget* parent) : Superclass(parent) { @@ -636,6 +638,8 @@ void pqSMTKOperationParameterPanel::handleProjectEvent( { return; } + + nlohmann::json panelStyle; auto styles = submitOpTask->style(); for (const auto& style : styles) { @@ -650,6 +654,7 @@ void pqSMTKOperationParameterPanel::handleProjectEvent( { continue; } + panelStyle = section; // At this point, we know we are going to display this operation to the user // Observe the task so when it transitions state we can react (e.g., by // removing the operation tab when the task is completed.) @@ -668,15 +673,24 @@ void pqSMTKOperationParameterPanel::handleProjectEvent( // value (one of "anew"/"override"/"modified"). if (submitOpTask->state() != smtk::task::State::Completed) { - // Has TabData already been created? + // Find or create TabData instance auto* op = submitOpTask->operation(); TabData* tabData = this->tabDataForOperation(*op); if (tabData == nullptr) { tabData = this->createTabData(op); } - auto view = tabData->m_uiMgr->findOrCreateOperationView(); - qDebug() << __FILE__ << __LINE__ << (view == nullptr); + + // Get the view configuration + smtk::view::ConfigurationPtr view = tabData->m_uiMgr->findOrCreateOperationView(); + + // Process any style:hide-items in the task's style + if (panelStyle.contains("hide-items")) + { + this->configureHiddenItems(view, panelStyle.at("hide-items")); + qDebug() << __FILE__ << __LINE__ << "hide-items!"; + } + this->editExistingOperationParameters( submitOpTask->operation()->shared_from_this(), /* associate selection? */ @@ -782,6 +796,47 @@ pqSMTKOperationParameterPanel::TabData* pqSMTKOperationParameterPanel::createTab return opTab; } +void pqSMTKOperationParameterPanel::configureHiddenItems( + smtk::view::ConfigurationPtr view, + const nlohmann::json& jItemArray) const +{ + // std::cout << "*** BEFORE\n" << *view << std::endl; + int attsIndex = view->details().findChild("InstancedAttributes"); + if (attsIndex < 0) + { + qWarning("View \"%s\" has no InstancedAttributes defined.", view->name().c_str()); + return; + } + + // Current convention and style logic uses 1 attribute - let's get it + smtk::view::Configuration::Component& comp = view->details().child(attsIndex); + std::size_t i, n = comp.numberOfChildren(); + for (i = 0; i < n; i++) + { + smtk::view::Configuration::Component& attComp = comp.child(i); + if (attComp.name() != "Att") + { + continue; + } + + // Check for ItemViews section + int ivIndex = attComp.findChild("ItemViews"); + auto& itemViewsComp = (ivIndex >= 0) ? attComp.child(ivIndex) : attComp.addChild("ItemViews"); + for (auto it : jItemArray) + { + std::string itemPath = it.get(); + qDebug() << __FILE__ << __LINE__ << itemPath.c_str(); + auto& ivComp = itemViewsComp.addChild("View"); + ivComp.setAttribute("Path", itemPath); + ivComp.setAttribute("Type", "null"); + } + + break; // because operations only have 1 attribute, we can quit here + } // for (i) + + // std::cout << "*** AFTER\n" << *view << std::endl; +} + void pqSMTKOperationParameterPanel::activeTaskStateChange( smtk::task::Task& task, smtk::task::State priorState, diff --git a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h index 0c6a4d718c..9d37e188d1 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h +++ b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h @@ -149,6 +149,10 @@ protected: /// Create tab-view metadata for the given operation. TabData* createTabData(smtk::operation::Operation* op); + /// Modify view to hide items specified in task's style + void configureHiddenItems(smtk::view::ConfigurationPtr view, const nlohmann::json& jItemArray) + const; + /// Called when the panel is displaying a SubmitOperation task and the task changes state. void activeTaskStateChange( smtk::task::Task& task, -- GitLab From 1cc93310f4769f7432a5348bfb50dd28bb622e3e Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Tue, 13 Jun 2023 21:28:08 -0400 Subject: [PATCH 3/5] Add SubmitOperationExample project in data section (w/o lfs) 1 SubmitOperation task with CreateUniformGrid op 1 hidden-item: /dimension/size2d --- .gitattributes | 1 + .../SubmitOperationExample.project.smtk | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk diff --git a/.gitattributes b/.gitattributes index 98a6994dc4..86df7d968e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,3 +22,4 @@ doc/**/*.png lfs data/** lfs -format.autopep8 data/**/*.sbt -lfs data/**/*.md -lfs +data/projects/**/*.project.smtk -lfs diff --git a/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk b/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk new file mode 100644 index 0000000000..5a15d320f5 --- /dev/null +++ b/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk @@ -0,0 +1,56 @@ +{ + "conceptual_version": "", + "id": "7221191a-fc10-4d22-8bd7-e8909e4a4948", + "links": null, + "location": "/home/local/KHQ/john.tourtellott/projects/cmb-master/git/smtk/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk", + "operations": { + "types": [] + }, + "properties": { + "unordered_map": {}, + "unordered_map": {}, + "unordered_map": {}, + "unordered_map": {}, + "unordered_map>": {}, + "unordered_map>": {}, + "unordered_map>": {}, + "unordered_map": {}, + "unordered_map": {}, + "unordered_map": {}, + "unordered_map>": {}, + "unordered_map>": {}, + "unordered_map>": {}, + "unordered_map>": {}, + "unordered_map>": {} + }, + "resources": { + "resources": [], + "types": [] + }, + "task_manager": { + "adaptors": [], + "styles": { + "operation_view": { + "operation-panel": { + "focus-task-operation": true, + "hide-items": [ "/dimension/size2d" ] + } + } + }, + "tasks": [ + { + "id": 1, + "operation": "smtk::session::mesh::CreateUniformGrid", + "parameters": [], + "run-style": "smtk::task::SubmitOperation::RunStyle::Once", + "style": [ + "operation_view" + ], + "title": "Create Grid", + "type": "smtk::task::SubmitOperation" + } + ] + }, + "type": "basic", + "version": "3.0" +} -- GitLab From 9a1322c2c6b05b39f16f113fd90f4a66efd3c4c3 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Wed, 14 Jun 2023 13:40:59 -0400 Subject: [PATCH 4/5] Move configureHiddenItems() code from op panel to SubmitOperation task --- .../pqSMTKOperationParameterPanel.cxx | 47 +------------------ .../pqSMTKOperationParameterPanel.h | 4 -- smtk/task/SubmitOperation.cxx | 45 ++++++++++++++++++ smtk/task/SubmitOperation.h | 4 ++ 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx index 5619306e68..35b5a34c20 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx +++ b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx @@ -57,7 +57,6 @@ #include "vtkSMProxy.h" #include -#include #include #include #include @@ -73,8 +72,6 @@ using json = nlohmann::json; -// #include - pqSMTKOperationParameterPanel::pqSMTKOperationParameterPanel(QWidget* parent) : Superclass(parent) { @@ -687,8 +684,7 @@ void pqSMTKOperationParameterPanel::handleProjectEvent( // Process any style:hide-items in the task's style if (panelStyle.contains("hide-items")) { - this->configureHiddenItems(view, panelStyle.at("hide-items")); - qDebug() << __FILE__ << __LINE__ << "hide-items!"; + submitOpTask->configureHiddenItems(view, panelStyle.at("hide-items")); } this->editExistingOperationParameters( @@ -796,47 +792,6 @@ pqSMTKOperationParameterPanel::TabData* pqSMTKOperationParameterPanel::createTab return opTab; } -void pqSMTKOperationParameterPanel::configureHiddenItems( - smtk::view::ConfigurationPtr view, - const nlohmann::json& jItemArray) const -{ - // std::cout << "*** BEFORE\n" << *view << std::endl; - int attsIndex = view->details().findChild("InstancedAttributes"); - if (attsIndex < 0) - { - qWarning("View \"%s\" has no InstancedAttributes defined.", view->name().c_str()); - return; - } - - // Current convention and style logic uses 1 attribute - let's get it - smtk::view::Configuration::Component& comp = view->details().child(attsIndex); - std::size_t i, n = comp.numberOfChildren(); - for (i = 0; i < n; i++) - { - smtk::view::Configuration::Component& attComp = comp.child(i); - if (attComp.name() != "Att") - { - continue; - } - - // Check for ItemViews section - int ivIndex = attComp.findChild("ItemViews"); - auto& itemViewsComp = (ivIndex >= 0) ? attComp.child(ivIndex) : attComp.addChild("ItemViews"); - for (auto it : jItemArray) - { - std::string itemPath = it.get(); - qDebug() << __FILE__ << __LINE__ << itemPath.c_str(); - auto& ivComp = itemViewsComp.addChild("View"); - ivComp.setAttribute("Path", itemPath); - ivComp.setAttribute("Type", "null"); - } - - break; // because operations only have 1 attribute, we can quit here - } // for (i) - - // std::cout << "*** AFTER\n" << *view << std::endl; -} - void pqSMTKOperationParameterPanel::activeTaskStateChange( smtk::task::Task& task, smtk::task::State priorState, diff --git a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h index 9d37e188d1..0c6a4d718c 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h +++ b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.h @@ -149,10 +149,6 @@ protected: /// Create tab-view metadata for the given operation. TabData* createTabData(smtk::operation::Operation* op); - /// Modify view to hide items specified in task's style - void configureHiddenItems(smtk::view::ConfigurationPtr view, const nlohmann::json& jItemArray) - const; - /// Called when the panel is displaying a SubmitOperation task and the task changes state. void activeTaskStateChange( smtk::task::Task& task, diff --git a/smtk/task/SubmitOperation.cxx b/smtk/task/SubmitOperation.cxx index 84c6229ff1..2955e0ebeb 100644 --- a/smtk/task/SubmitOperation.cxx +++ b/smtk/task/SubmitOperation.cxx @@ -308,6 +308,51 @@ smtk::common::Visit SubmitOperation::visitParameterSpecs(ParameterSpecVisitor vi return smtk::common::Visit::Continue; } +void SubmitOperation::configureHiddenItems( + smtk::view::ConfigurationPtr view, + const nlohmann::json& jItemArray) const +{ + if (!m_operation) + { + return; + } + + int attsIndex = view->details().findChild("InstancedAttributes"); + if (attsIndex < 0) + { +#ifdef SMTK_DBG_SUBMITOPERATION + std::cout << "View \"" << view->name() << "\" has no InstancedAttributes defined." + << " (Operation " << m_operation->typeName() << ")\n"; +#endif + return; + } + + // Current convention and style logic uses 1 attribute - let's get it + smtk::view::Configuration::Component& comp = view->details().child(attsIndex); + std::size_t i, n = comp.numberOfChildren(); + for (i = 0; i < n; i++) + { + smtk::view::Configuration::Component& attComp = comp.child(i); + if (attComp.name() != "Att") + { + continue; + } + + // Check for ItemViews section + int ivIndex = attComp.findChild("ItemViews"); + auto& itemViewsComp = (ivIndex >= 0) ? attComp.child(ivIndex) : attComp.addChild("ItemViews"); + for (const auto& it : jItemArray) + { + std::string itemPath = it.get(); + auto& ivComp = itemViewsComp.addChild("View"); + ivComp.setAttribute("Path", itemPath); + ivComp.setAttribute("Type", "null"); + } + + break; // because operations only have 1 attribute, we can quit here + } // for (i) +} + int SubmitOperation::update( const smtk::operation::Operation& op, smtk::operation::EventType event, diff --git a/smtk/task/SubmitOperation.h b/smtk/task/SubmitOperation.h index a0d6befff0..c85d330f47 100644 --- a/smtk/task/SubmitOperation.h +++ b/smtk/task/SubmitOperation.h @@ -147,6 +147,10 @@ public: /// True if the operation has *successfully* run since its parameters were last edited. bool runSinceEdited() const { return m_runSinceEdited; } + /// Modify view to hide items specified in task's style + void configureHiddenItems(smtk::view::ConfigurationPtr view, const nlohmann::json& jItemArray) + const; + protected: friend class adaptor::ResourceAndRole; friend class adaptor::ConfigureOperation; -- GitLab From ff5be2fcab273089e08f20104b61fc2c9b847a00 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Tue, 20 Jun 2023 22:21:11 -0400 Subject: [PATCH 5/5] Update documentation and add release note Plus minor changes not affecting form/fit/function --- .../SubmitOperationExample.project.smtk | 3 +- doc/release/notes/paraview-panels.rst | 10 ++++++ doc/userguide/extension/paraview/panels.rst | 21 ++++++------ doc/userguide/task/classes.rst | 34 ++++++++++++------- .../pqSMTKOperationParameterPanel.cxx | 4 +-- .../testing/cxx/TestConfigureOperation.cxx | 1 - 6 files changed, 44 insertions(+), 29 deletions(-) create mode 100644 doc/release/notes/paraview-panels.rst diff --git a/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk b/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk index 5a15d320f5..e0b5454865 100644 --- a/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk +++ b/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk @@ -2,7 +2,7 @@ "conceptual_version": "", "id": "7221191a-fc10-4d22-8bd7-e8909e4a4948", "links": null, - "location": "/home/local/KHQ/john.tourtellott/projects/cmb-master/git/smtk/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk", + "location": "smtk/data/projects/SubmitOperationExample/SubmitOperationExample.project.smtk", "operations": { "types": [] }, @@ -32,7 +32,6 @@ "styles": { "operation_view": { "operation-panel": { - "focus-task-operation": true, "hide-items": [ "/dimension/size2d" ] } } diff --git a/doc/release/notes/paraview-panels.rst b/doc/release/notes/paraview-panels.rst new file mode 100644 index 0000000000..4270a12baa --- /dev/null +++ b/doc/release/notes/paraview-panels.rst @@ -0,0 +1,10 @@ +ParaView Panels +---------------- + +Changes to operation parameter-editor panel +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A new task style key ``hide-items`` was added to the panel for specifying +operation parameters to be hidden from the user interface when displayed. +The value is an array of strings, each specifying the path to one item +in the operation parameters. diff --git a/doc/userguide/extension/paraview/panels.rst b/doc/userguide/extension/paraview/panels.rst index 8fca04b79d..1deac4bb5f 100644 --- a/doc/userguide/extension/paraview/panels.rst +++ b/doc/userguide/extension/paraview/panels.rst @@ -106,22 +106,21 @@ launch operations via that panel. Otherwise, your application is responsible for listening for the ``runOperation()`` signal and launching the provided operation. +Task system support +^^^^^^^^^^^^^^^^^^^^ + The :smtk:`pqSMTKOperationParameterPanel` supports projects with task-based workflows; when a new task becomes active, if it is a :smtk:`SubmitOperation ` task, and -any of its style tags contain an ``operation-panel`` section: the panel will be raised; a tab for -the task's operation will be created; that tab will gain focus and show a view of the operation's -parameters. +any of its style tags contain an ``operation-panel`` section, the panel will update its behavior +based on the following keys: -The panel does not yet but will eventually look for the following keys in the ``operation-panel`` -section to determine its behavior: +* ``hide-items``: an array of strings specifying paths to operation parameters to be hidden. + This key is typically used to hide parameters that are configured by a + ConfigureOperation adaptor. -* ``display``: true or false depending on whether the panel should display the task's operation. - The default is true, which means that just the existence of an ``operation-panel`` section - can determine whether the panel responds to a SubmitOperation task; if the section exists - even though it may be empty, then the default ``display`` style is assumed. If the section - does not exist, then the panel will ignore the task. +Future keys in the ``operation-panel`` section include: -* ``view``: one of the following enumerants specifying where the operation's view configuration +* (future) ``view``: one of the following enumerants specifying where the operation's view configuration should come from: * ``anew``: the task should create a new view configuration ab initio (i.e., ignoring any diff --git a/doc/userguide/task/classes.rst b/doc/userguide/task/classes.rst index 21538f31b2..0f3a0757be 100644 --- a/doc/userguide/task/classes.rst +++ b/doc/userguide/task/classes.rst @@ -253,7 +253,7 @@ The SubmitOperation task computes its internal state to be: * irrelevant if no ``operation`` type-name is configured (or no operation by that name is registered to the application's operation manager); * unavailable if associations or parameters are configured by a task - adaptor (via the ``configured-by="adaptor"`` setting) and invalid. + adaptor (via the ``configured-by="adaptor"`` setting) and invalid. (future) * incomplete while the operation's ``ableToOperate()`` method returns false; and * completable once @@ -276,9 +276,19 @@ It accepts all the JSON configuration that the base Task class does, plus: has successfully run until the operation's parameters have been modified (by the task, an adaptor, or the user) – at which point it becomes false again. This is used to make the task's state consistent across a save, restart, and load of modelbuilder. -* ``parameters``: a dictionary whose keys are attribute item-paths into the operation's parameters - and whose values are JSON objects containing some subset of the following entries: +Configuration features planned for the future include the following: + +* (**future**) ``associations``: a JSON object specifying how the operation's associations should be configured. + The key-value pairs in the object may be any configuration that items in + the ``parameters`` section above describes. +* (**future**) ``configured-by``: when set to ``adaptor``, indicates that the task associations and/or + parameters are configured by a task adaptor. This feature is not currently enforced by smtk, but + can be used for documentation purposes. +* (**future**) ``parameters``: an array of JSON objects that configure individual items in the operation + parameters. Each JSON object contains some subset of the following entries: + + * ``item``: (string) item-path to the operation's parameter. This entry is *required*. * ``enabled``: true or false indicated whether an optional item is enabled or not. This is ignored if the item is not optional. * ``value``: a JSON array of values to store in the parameter's item. @@ -305,9 +315,6 @@ It accepts all the JSON configuration that the base Task class does, plus: * ``role``: :smtk:`reference items ` may be provided with a role so that the :smtk:`ConfigureOperation ` task-adaptor can copy references to persistent objects into its ``value`` array. -* ``associations``: a JSON object specifying how the operation's associations should be configured. - The key-value pairs in the object may be any configuration that items in - the ``parameters`` section above describes. Example """"""" @@ -324,14 +331,15 @@ Example "configured-by": "adaptor", "value": [] }, - "parameters": { - "/pointGeometry": { - "value": [3], - "configured-by": "task", - "show": "false" + "parameters": [ + { + "item": "/pointGeometry", + "value": [3], + "configured-by": "task", + "visibility": "off" } - } + ] } -See the `smtk-pv-parameter-editor-panel`_ documentation for how +See the :ref:`smtk-pv-parameter-editor-panel` documentation for how the user interface supports SubmitOperation tasks. diff --git a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx index 35b5a34c20..0e72daa30c 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx +++ b/smtk/extension/paraview/appcomponents/pqSMTKOperationParameterPanel.cxx @@ -234,7 +234,7 @@ void pqSMTKOperationParameterPanel::editExistingOperationParameters( } } - if (opTab == nullptr) + if (!opTab) { opTab = this->createTabData(operation.get()); } @@ -259,7 +259,7 @@ void pqSMTKOperationParameterPanel::editExistingOperationParameters( } } - if (view == nullptr) + if (!view) { view = opTab->m_uiMgr->findOrCreateOperationView(); } diff --git a/smtk/task/testing/cxx/TestConfigureOperation.cxx b/smtk/task/testing/cxx/TestConfigureOperation.cxx index 8b6e58f4ba..00a4defead 100644 --- a/smtk/task/testing/cxx/TestConfigureOperation.cxx +++ b/smtk/task/testing/cxx/TestConfigureOperation.cxx @@ -93,7 +93,6 @@ std::string tasksConfig = R"( "styles": { "operation_view": { "operation-panel": { - "focus-task-operation": true } } }, -- GitLab