Skip to content

Commit

Permalink
Continue processing messages while displaying dialogues
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Jun 18, 2021
1 parent b7bc6ad commit 37dc241
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
4 changes: 0 additions & 4 deletions src/rviz/displays_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ void DisplaysPanel::onNewDisplay()
&display_name, &topic, &datatype);
QApplication::restoreOverrideCursor();

vis_manager_->stopUpdate();
if (dialog.exec() == QDialog::Accepted)
{
Display* disp = vis_manager_->createDisplay(lookup_name, display_name, true);
Expand All @@ -123,7 +122,6 @@ void DisplaysPanel::onNewDisplay()
disp->setTopic(topic, datatype);
}
}
vis_manager_->startUpdate();
activateWindow(); // Force keyboard focus back on main window.
}

Expand All @@ -133,7 +131,6 @@ void DisplaysPanel::onDuplicateDisplay()
QList<Display*> duplicated_displays;
QProgressDialog progress_dlg("Duplicating displays...", "Cancel", 0, displays_to_duplicate.size(),
this);
vis_manager_->stopUpdate();
progress_dlg.setWindowModality(Qt::WindowModal);
progress_dlg.show();
QApplication::processEvents(); // explicitly progress events for update
Expand Down Expand Up @@ -164,7 +161,6 @@ void DisplaysPanel::onDuplicateDisplay()
QItemSelection selection(first, last);
property_grid_->selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect);
}
vis_manager_->startUpdate();
activateWindow(); // Force keyboard focus back on main window.
}

Expand Down
14 changes: 0 additions & 14 deletions src/rviz/visualization_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,11 @@ void VisualizationFrame::openPreferencesDialog()
{
Preferences temp_preferences(*preferences_);
PreferencesDialog dialog(panel_factory_, &temp_preferences, this);
manager_->stopUpdate();
if (dialog.exec() == QDialog::Accepted)
{
// Apply preferences.
preferences_ = boost::make_shared<Preferences>(temp_preferences);
}
manager_->startUpdate();
}

void VisualizationFrame::openNewPanelDialog()
Expand All @@ -651,7 +649,6 @@ void VisualizationFrame::openNewPanelDialog()

NewObjectDialog* dialog =
new NewObjectDialog(panel_factory_, "Panel", empty, empty, &class_id, &display_name, this);
manager_->stopUpdate();
if (dialog->exec() == QDialog::Accepted)
{
QDockWidget* dock = addPanelByName(display_name, class_id);
Expand All @@ -660,7 +657,6 @@ void VisualizationFrame::openNewPanelDialog()
connect(dock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(onDockPanelChange()));
}
}
manager_->startUpdate();
}

void VisualizationFrame::openNewToolDialog()
Expand All @@ -671,12 +667,10 @@ void VisualizationFrame::openNewToolDialog()

NewObjectDialog* dialog =
new NewObjectDialog(tool_man->getFactory(), "Tool", empty, tool_man->getToolClasses(), &class_id);
manager_->stopUpdate();
if (dialog->exec() == QDialog::Accepted)
{
tool_man->addTool(class_id);
}
manager_->startUpdate();
activateWindow(); // Force keyboard focus back on main window.
}

Expand Down Expand Up @@ -1024,9 +1018,7 @@ bool VisualizationFrame::prepareToExit()
box.setInformativeText(QString::fromStdString("Save changes to " + display_config_file_ + "?"));
box.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
box.setDefaultButton(QMessageBox::Save);
manager_->stopUpdate();
int result = box.exec();
manager_->startUpdate();
switch (result)
{
case QMessageBox::Save:
Expand Down Expand Up @@ -1069,11 +1061,9 @@ bool VisualizationFrame::prepareToExit()

void VisualizationFrame::onOpen()
{
manager_->stopUpdate();
QString filename = QFileDialog::getOpenFileName(this, "Choose a file to open",
QString::fromStdString(last_config_dir_),
"RViz config files (" CONFIG_EXTENSION_WILDCARD ")");
manager_->startUpdate();

if (!filename.isEmpty())
{
Expand Down Expand Up @@ -1101,7 +1091,6 @@ void VisualizationFrame::onSave()

if (!saveDisplayConfig(QString::fromStdString(display_config_file_)))
{
manager_->stopUpdate();
QMessageBox box(this);
box.setWindowTitle("Failed to save.");
box.setText(getErrorMessage());
Expand All @@ -1113,17 +1102,14 @@ void VisualizationFrame::onSave()
{
onSaveAs();
}
manager_->startUpdate();
}
}

void VisualizationFrame::onSaveAs()
{
manager_->stopUpdate();
QString q_filename = QFileDialog::getSaveFileName(this, "Choose a file to save to",
QString::fromStdString(last_config_dir_),
"RViz config files (" CONFIG_EXTENSION_WILDCARD ")");
manager_->startUpdate();

if (!q_filename.isEmpty())
{
Expand Down
8 changes: 0 additions & 8 deletions src/rviz/visualization_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,6 @@ void VisualizationManager::emitStatusUpdate(const QString& message)

void VisualizationManager::load(const Config& config)
{
stopUpdate();

emitStatusUpdate("Creating displays");
root_display_group_->load(config);

Expand All @@ -521,8 +519,6 @@ void VisualizationManager::load(const Config& config)

emitStatusUpdate("Creating views");
view_manager_->load(config.mapGetChild("Views"));

startUpdate();
}

void VisualizationManager::save(Config config) const
Expand Down Expand Up @@ -572,10 +568,6 @@ void VisualizationManager::updateBackgroundColor()

void VisualizationManager::updateFps()
{
if (update_timer_->isActive())
{
startUpdate();
}
}

void VisualizationManager::updateDefaultLightVisible()
Expand Down

0 comments on commit 37dc241

Please sign in to comment.