Skip to content

Commit f43dd7a

Browse files
authored
Merge pull request #733 from openstudiocoalition/671_MarkPythonErrorClassicCLI
Fix #671 - Mark Python Measures as in Error if use classic CLI to run the simulation
2 parents 82183e6 + 8d50667 commit f43dd7a

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/shared_gui_components/LocalLibraryController.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,11 @@ QWidget* LibraryItemDelegate::view(QSharedPointer<OSListItem> dataSource) {
521521
// Name
522522

523523
widget->label->setText(libraryItem->displayName());
524-
if (libraryItem->hasError()) {
524+
const bool useClassicCLI = OSAppBase::instance()->currentDocument()->mainWindow()->useClassicCLI();
525+
if (useClassicCLI && (measureLanguage == MeasureLanguage::Python)) {
526+
widget->setToolTip("Python Measures are not supported in the Classic CLI.\nYou can change CLI version using 'Preferences->Use Classic CLI'.");
527+
widget->errorLabel->setVisible(true);
528+
} else if (libraryItem->hasError()) {
525529
widget->setToolTip(libraryItem->error());
526530
widget->errorLabel->setVisible(true);
527531
} else {

src/shared_gui_components/WorkflowController.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "BaseApp.hpp"
3636
#include "../openstudio_lib/OSAppBase.hpp"
3737
#include "../openstudio_lib/OSDocument.hpp"
38+
#include "../openstudio_lib/MainWindow.hpp"
3839
#include "LocalLibraryController.hpp"
3940
#include "WorkflowTools.hpp"
4041
#include "../model_editor/Utilities.hpp"
@@ -556,7 +557,9 @@ QWidget* MeasureStepItemDelegate::view(QSharedPointer<OSListItem> dataSource) {
556557
if (QSharedPointer<MeasureStepItem> measureStepItem = dataSource.objectCast<MeasureStepItem>()) {
557558
auto* workflowStepView = new WorkflowStepView();
558559

559-
const QString measureLangStr = toQString(measureStepItem->measureLanguage().valueName());
560+
const MeasureLanguage measureLanguage = measureStepItem->measureLanguage();
561+
562+
const QString measureLangStr = toQString(measureLanguage.valueName());
560563
if (measureStepItem->measureType() == MeasureType::ModelMeasure) {
561564
workflowStepView->workflowStepButton->measureTypeBadge->setPixmap(
562565
QPixmap(QString(":/images/openstudio_measure_icon_%1.png").arg(measureLangStr))
@@ -591,13 +594,20 @@ QWidget* MeasureStepItemDelegate::view(QSharedPointer<OSListItem> dataSource) {
591594

592595
connect(measureStepItem.data(), &MeasureStepItem::selectedChanged, workflowStepView->workflowStepButton, &WorkflowStepButton::setHasEmphasis);
593596

594-
try {
595-
// Warning Icon
596-
workflowStepView->workflowStepButton->cautionLabel->setVisible(measureStepItem->hasIncompleteArguments());
597-
connect(measureStepItem.data(), &MeasureStepItem::argumentsChanged, workflowStepView->workflowStepButton->cautionLabel, &QLabel::setVisible);
598-
} catch (const std::exception& e) {
599-
workflowStepView->workflowStepButton->errorLabel->setToolTip(e.what());
597+
const bool useClassicCLI = OSAppBase::instance()->currentDocument()->mainWindow()->useClassicCLI();
598+
if (useClassicCLI && (measureLanguage == MeasureLanguage::Python)) {
599+
workflowStepView->workflowStepButton->errorLabel->setToolTip(
600+
"Python Measures are not supported in the Classic CLI.\nYou can change CLI version using 'Preferences->Use Classic CLI'.");
600601
workflowStepView->workflowStepButton->errorLabel->setVisible(true);
602+
} else {
603+
try {
604+
// Warning Icon
605+
workflowStepView->workflowStepButton->cautionLabel->setVisible(measureStepItem->hasIncompleteArguments());
606+
connect(measureStepItem.data(), &MeasureStepItem::argumentsChanged, workflowStepView->workflowStepButton->cautionLabel, &QLabel::setVisible);
607+
} catch (const std::exception& e) {
608+
workflowStepView->workflowStepButton->errorLabel->setToolTip(e.what());
609+
workflowStepView->workflowStepButton->errorLabel->setVisible(true);
610+
}
601611
}
602612

603613
// Up and down buttons

0 commit comments

Comments
 (0)