Commit ffc8ac72 authored by Aron Helser's avatar Aron Helser

AssignColorsView: fix pqPalletChooser behavior on apply.

Paraview's pqPalletChooser has a weird semi-modal behavior
where it disables interaction with the UI except for the
render view, when it is open. Instead of destroying/recreating
the dialog, call close() so it properly cleans up the
event filter that causes this behavior. Makes the dialog
testable using the recorded xml tests.

add a few more UI names.
parent ebd7c796
......@@ -4,3 +4,4 @@
- Added `knee.ex2` exodus test data, used by ModelBuilder tests for now.
- If we are running tests, don't display the "Your data is modified, save changes?" dialog on exit.
- Plugin (contract) tests now have a timeout of 600 seconds to allow more time for cloning and building a repository.
- fix the smtkAssignColorsView pallet choose dialog handling so it is testable with xml tests.
......@@ -177,6 +177,7 @@ pqSMTKCloseResourceBehavior::pqSMTKCloseResourceBehavior(QObject* parent)
QAction* closeResourceAction =
new QAction(QPixmap(":/CloseResourceBehavior/Close22.png"), tr("&Close Resource"), this);
closeResourceAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
closeResourceAction->setObjectName("closeResource");
QMainWindow* mainWindow = qobject_cast<QMainWindow*>(pqCoreUtilities::mainWidget());
......
......@@ -253,8 +253,6 @@ void smtkAssignColorsView::prepPaletteChooser()
QObject::connect( // When the user has chosen a preference, remember and apply it.
this->Internals->PaletteChooser, SIGNAL(applyPreset(const Json::Value&)), this,
SLOT(setDefaultPaletteAndApply()));
QObject::connect( // When the user has cancel the dialog.
this->Internals->PaletteChooser, SIGNAL(rejected()), this, SLOT(resetPaletteChooser()));
}
void smtkAssignColorsView::createWidget()
......@@ -441,12 +439,6 @@ void smtkAssignColorsView::applyDefaultColor()
this->requestOperation(this->Internals->CurrentOp);
}
void smtkAssignColorsView::resetPaletteChooser()
{
delete this->Internals->PaletteChooser;
this->prepPaletteChooser();
}
void smtkAssignColorsView::setDefaultPaletteAndApply()
{
const Json::Value& preset = this->Internals->PaletteChooser->currentPreset();
......@@ -455,12 +447,12 @@ void smtkAssignColorsView::setDefaultPaletteAndApply()
pqSettings* settings = pqApplicationCore::instance()->settings();
settings->setValue("ModelBuilder/Operations/AssignColors/defaultPalette", name.c_str());
// There is a strange bug that seems to make QT treat the PaletteChooser as a modal
// dialog - the UI does not seem to respond after you set the default palette.
// One solution that seems to work is to destroy and recreate the dialog
this->Internals->PaletteChooser->hide();
this->Internals->PaletteChooser->deleteLater();
this->prepPaletteChooser();
// pqPresetDialog has a custom event filter in ParaView, disabling everything except
// the render window when opened.
// If we don't 'close', the UI does not seem to respond after you set the default palette.
// The close slot cleans up the custom event filter which blocks UI events.
// Also makes the dialog testable with recorded xml tests.
this->Internals->PaletteChooser->close();
this->Internals->ApplyDefaultPaletteBtn->setText(QString::fromUtf8(name.c_str()));
this->Internals->updatePaletteIcon(name);
......
......@@ -58,7 +58,6 @@ protected slots:
virtual void processOpacityValue(double);
virtual void removeColors();
virtual void setDefaultPaletteAndApply();
virtual void resetPaletteChooser();
// This slot is used to indicate that the underlying attribute
// for the operation should be checked for validity
virtual void attributeModified();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment