Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue processing messages while displaying dialogues #1639

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -624,13 +624,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 @@ -641,7 +639,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 @@ -650,7 +647,6 @@ void VisualizationFrame::openNewPanelDialog()
connect(dock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(onDockPanelChange()));
}
}
manager_->startUpdate();
}

void VisualizationFrame::openNewToolDialog()
Expand All @@ -661,12 +657,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 @@ -1015,9 +1009,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 @@ -1060,11 +1052,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 @@ -1092,7 +1082,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 @@ -1104,17 +1093,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 @@ -447,8 +447,6 @@ void VisualizationManager::emitStatusUpdate(const QString& message)

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

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

Expand All @@ -457,8 +455,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 @@ -508,10 +504,6 @@ void VisualizationManager::updateBackgroundColor()

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

void VisualizationManager::updateDefaultLightVisible()
Expand Down