Skip to content

Commit

Permalink
Closes #2418
Browse files Browse the repository at this point in the history
  • Loading branch information
dcwhite committed Mar 21, 2023
1 parent 2a48be7 commit b1ee5e7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Dataflow/Engine/Controller/PythonImpl.cc
Expand Up @@ -534,7 +534,7 @@ SharedPointer<PyModule> PythonImpl::addModule(const std::string& name)
logWarning("Module add failed, no such module type ({})", name);

mostRecentAddModuleId_ = m->id().id_;
logCritical("here i have the most recent added id: {}", mostRecentAddModuleId_);
//logCritical("here i have the most recent added id: {}", mostRecentAddModuleId_);

return modules_[mostRecentAddModuleId_];
}
Expand Down
39 changes: 27 additions & 12 deletions src/Interface/Modules/Render/ViewScene.cc
Expand Up @@ -330,10 +330,7 @@ bool PreviousWidgetSelectionInfo::hasSameWidget(const WidgetHandle widget) const

bool PreviousWidgetSelectionInfo::hasPreviousWidget() const
{
if (previousSelectedWidget_)
return true;
else
return false;
return previousSelectedWidget_ != nullptr;
}

void PreviousWidgetSelectionInfo::deletePreviousWidget()
Expand Down Expand Up @@ -441,6 +438,11 @@ ViewSceneDialog::ViewSceneDialog(const std::string& name, ModuleStateHandle stat
state->connectSpecificStateChanged(Parameters::CameraDistance,[this](){Q_EMIT cameraDistanceChangeForwarder();});
connect(this, &ViewSceneDialog::cameraDistanceChangeForwarder, this, &ViewSceneDialog::pullCameraDistance);

state_->connectSpecificStateChanged(Parameters::WindowSizeX, [this]() { adjustSizeFromState(); });
state_->connectSpecificStateChanged(Parameters::WindowSizeY, [this]() { adjustSizeFromState(); });
state_->connectSpecificStateChanged(Parameters::WindowPositionX, [this]() { adjustPositionFromState(); });
state_->connectSpecificStateChanged(Parameters::WindowPositionY, [this]() { adjustPositionFromState(); });

lockMutex();

const std::string filesystemRoot = Application::Instance().executablePath().string();
Expand Down Expand Up @@ -1086,11 +1088,7 @@ void ViewSceneDialog::pullSpecial()
parentWidget()->show();
}

if (parentWidget())
{
const auto qs = QSize(state_->getValue(Parameters::WindowSizeX).toInt(), state_->getValue(Parameters::WindowSizeY).toInt());
parentWidget()->resize(qs);
}
adjustSizeFromState();

if (parentWidget())
{
Expand All @@ -1107,9 +1105,7 @@ void ViewSceneDialog::pullSpecial()
}
else
{
const auto x = state_->getValue(Parameters::WindowPositionX).toInt();
const auto y = state_->getValue(Parameters::WindowPositionY).toInt();
parentWidget()->move(x, y);
adjustPositionFromState();
}
}
}
Expand All @@ -1122,6 +1118,25 @@ void ViewSceneDialog::pullSpecial()
}
}

void ViewSceneDialog::adjustSizeFromState()
{
if (parentWidget())
{
const auto qs = QSize(state_->getValue(Parameters::WindowSizeX).toInt(), state_->getValue(Parameters::WindowSizeY).toInt());
parentWidget()->resize(qs);
}
}

void ViewSceneDialog::adjustPositionFromState()
{
if (parentWidget() && state_->getValue(Parameters::IsFloating).toBool())
{
const auto x = state_->getValue(Parameters::WindowPositionX).toInt();
const auto y = state_->getValue(Parameters::WindowPositionY).toInt();
parentWidget()->move(x, y);
}
}

void ViewSceneDialog::adjustToolbar(double factor)
{
adjustToolbarForHighResolution(impl_->toolBar1_, factor);
Expand Down
2 changes: 2 additions & 0 deletions src/Interface/Modules/Render/ViewScene.h
Expand Up @@ -290,6 +290,8 @@ namespace SCIRun {
void takeScreenshot();
void sendScreenshotDownstreamForTesting();
void saveScreenshot(QString directory, bool notify);
void adjustSizeFromState();
void adjustPositionFromState();

std::unique_ptr<ViewSceneDialogImpl> impl_;

Expand Down

0 comments on commit b1ee5e7

Please sign in to comment.