Skip to content

Commit 6722586

Browse files
committed
add option for warning popups
1 parent 53eb105 commit 6722586

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

include/polyscope/options.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ extern bool hideWindowAfterShow;
6969
// Give warnings for inf/nan values
7070
extern bool warnForInvalidValues;
7171

72+
// Show warnings/errors in popup modal dialogs
73+
extern bool displayMessagePopups;
74+
7275
// === Scene options
7376

7477
// Behavior of the ground plane

src/messages.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void terminatingError(std::string message) {
234234
}
235235

236236
// Enter a modal UI loop showing the warning
237-
if (!isHeadless()) { // don't do it if running headless
237+
if (options::displayMessagePopups && !isHeadless()) {
238238
auto func = std::bind(buildErrorUI, message, true);
239239
pushContext(func, false);
240240
}
@@ -279,7 +279,7 @@ void showDelayedWarnings() {
279279
WarningMessage& currMessage = warningMessages.front();
280280

281281
// Enter a modal UI loop showing the warning
282-
if (!isHeadless()) { // don't do it if running headless
282+
if (options::displayMessagePopups && !isHeadless()) {
283283
auto func =
284284
std::bind(buildWarningUI, currMessage.baseMessage, currMessage.detailMessage, currMessage.repeatCount);
285285
pushContext(func, false);

src/options.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ bool invokeUserCallbackForNestedShow = false;
2424
bool giveFocusOnShow = false;
2525
bool hideWindowAfterShow = true;
2626
bool warnForInvalidValues = true;
27+
bool displayMessagePopups = true;
2728

2829
bool screenshotTransparency = true;
2930
std::string screenshotExtension = ".png";

test/include/polyscope_test.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class PolyscopeTest : public ::testing::Test {
3232
polyscope::options::enableRenderErrorChecks = true;
3333
polyscope::options::errorsThrowExceptions = true;
3434
polyscope::options::hideWindowAfterShow = false;
35+
polyscope::options::displayMessagePopups = false; // these make the tests block otherwise
3536
polyscope::init(testBackend);
3637
}
3738

0 commit comments

Comments
 (0)