From 0237b2698b37346dff9f43102ca36505b1883b56 Mon Sep 17 00:00:00 2001 From: StasJ Date: Mon, 4 Mar 2024 17:28:26 -0700 Subject: [PATCH] Fix #3556 --- CMakeLists.txt | 2 +- apps/vaporgui/PStringDropdown.cpp | 10 +++++++++- apps/vaporgui/PStringDropdown.h | 2 ++ apps/vaporgui/PVariableSelector.cpp | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f64387ee6..c5072d20b9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/lib/osgl/glad/include") if (WIN32) get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) endif () -if (BUILD_VDC) +if (BUILD_VDC AND EXISTS ${PYTHONPATH}/lib-dynload) link_directories (${PYTHONPATH}/lib-dynload) endif () diff --git a/apps/vaporgui/PStringDropdown.cpp b/apps/vaporgui/PStringDropdown.cpp index 5a51b4f950..46f0f2e964 100644 --- a/apps/vaporgui/PStringDropdown.cpp +++ b/apps/vaporgui/PStringDropdown.cpp @@ -10,6 +10,14 @@ PStringDropdown::PStringDropdown(const std::string &tag, const std::vector &items) const { _vComboBox->SetOptions(items); } -void PStringDropdown::updateGUI() const { _vComboBox->SetValue(getParamsString()); } +void PStringDropdown::updateGUI() const +{ + auto val = getParamsString(); + if (val.empty()) + val = _customBlankText; + _vComboBox->SetValue(val); +} + +void PStringDropdown::setCustomBlankText(std::string text) { _customBlankText = text; } void PStringDropdown::dropdownTextChanged(std::string text) { setParamsString(text); } diff --git a/apps/vaporgui/PStringDropdown.h b/apps/vaporgui/PStringDropdown.h index 6e0b372220..7e0e46b2ec 100644 --- a/apps/vaporgui/PStringDropdown.h +++ b/apps/vaporgui/PStringDropdown.h @@ -14,6 +14,7 @@ class PStringDropdown : public PLineItem { Q_OBJECT VComboBox *_vComboBox; + std::string _customBlankText; public: PStringDropdown(const std::string &tag, const std::vector &items, const std::string &label = ""); @@ -22,6 +23,7 @@ class PStringDropdown : public PLineItem { protected: virtual void updateGUI() const override; + void setCustomBlankText(std::string text); protected slots: virtual void dropdownTextChanged(std::string text); diff --git a/apps/vaporgui/PVariableSelector.cpp b/apps/vaporgui/PVariableSelector.cpp index 59985099d8..e177381438 100644 --- a/apps/vaporgui/PVariableSelector.cpp +++ b/apps/vaporgui/PVariableSelector.cpp @@ -8,7 +8,8 @@ typedef VAPoR::DataMgr::VarType VarType; #define NULL_TEXT "" -PVariableSelector::PVariableSelector(const std::string &tag, const std::string &label) : PStringDropdown(tag, {}, label) {} +PVariableSelector::PVariableSelector(const std::string &tag, const std::string &label) +: PStringDropdown(tag, {}, label) { setCustomBlankText(NULL_TEXT); } void PVariableSelector::updateGUI() const {