MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); std::string homeDir = *getHomeDir() + "/.djon"; std::string workspaceFile = homeDir + "/default.dwk"; _workspace = loadWorkspace(workspaceFile); _plugin = new Coreplugin(); }
/** * Fill in the x and y value containers (m_xData and m_yData) */ void TabulatedFunction::setupData() const { if (m_setupFinished) { g_log.debug() << "Re-setting isn't required."; return; } if (!m_workspace) { std::string wsName = getAttribute("Workspace").asString(); if (wsName.empty()) throw std::invalid_argument("Data not set for function " + this->name()); else loadWorkspace(wsName); } size_t index = static_cast<size_t>(getAttribute("WorkspaceIndex").asInt()); g_log.debug() << "Setting up " << m_workspace->name() << " index " << index << std::endl; const bool hist = m_workspace->isHistogramData(); const size_t nbins = m_workspace->blocksize(); m_xData.resize(nbins); m_yData.resize(nbins); for (size_t i = 0; i < nbins; i++) { double x = 0.0; m_yData[i] = m_workspace->readY(index)[i]; auto &xvec = m_workspace->readX(index); if (hist) x = (xvec[i] + xvec[i + 1]) / 2; else x = xvec[i]; m_xData[i] = x; } m_workspace.reset(); m_setupFinished = true; }
/// Handle notifications from the view. void WorkspacePresenter::notifyFromView(ViewNotifiable::Flag flag) { switch (flag) { case ViewNotifiable::Flag::LoadWorkspace: loadWorkspace(); break; case ViewNotifiable::Flag::LoadLiveDataWorkspace: loadLiveData(); break; case ViewNotifiable::Flag::RenameWorkspace: renameWorkspace(); break; case ViewNotifiable::Flag::GroupWorkspaces: groupWorkspaces(); break; case ViewNotifiable::Flag::UngroupWorkspaces: ungroupWorkspaces(); break; case ViewNotifiable::Flag::SortWorkspaces: sortWorkspaces(); break; case ViewNotifiable::Flag::DeleteWorkspaces: deleteWorkspaces(); break; case ViewNotifiable::Flag::SaveSingleWorkspace: saveSingleWorkspace(); break; case ViewNotifiable::Flag::SaveWorkspaceCollection: saveWorkspaceCollection(); break; case ViewNotifiable::Flag::FilterWorkspaces: filterWorkspaces(); break; case ViewNotifiable::Flag::PopulateAndShowWorkspaceContextMenu: populateAndShowWorkspaceContextMenu(); break; case ViewNotifiable::Flag::ShowWorkspaceData: showWorkspaceData(); break; case ViewNotifiable::Flag::ShowInstrumentView: showInstrumentView(); break; case ViewNotifiable::Flag::SaveToProgram: saveToProgram(); break; case ViewNotifiable::Flag::PlotSpectrum: plotSpectrum(); break; case ViewNotifiable::Flag::PlotSpectrumWithErrors: plotSpectrumWithErrors(); break; case ViewNotifiable::Flag::ShowColourFillPlot: showColourFillPlot(); break; case ViewNotifiable::Flag::ShowDetectorsTable: showDetectorsTable(); break; case ViewNotifiable::Flag::ShowBoxDataTable: showBoxDataTable(); break; case ViewNotifiable::Flag::ShowVatesGUI: showVatesGUI(); break; case ViewNotifiable::Flag::ShowMDPlot: showMDPlot(); break; case ViewNotifiable::Flag::ShowListData: showListData(); break; case ViewNotifiable::Flag::ShowSpectrumViewer: showSpectrumViewer(); break; case ViewNotifiable::Flag::ShowSliceViewer: showSliceViewer(); break; case ViewNotifiable::Flag::ShowLogs: showLogs(); break; case ViewNotifiable::Flag::ShowSampleMaterialWindow: showSampleMaterialWindow(); break; case ViewNotifiable::Flag::ShowAlgorithmHistory: showAlgorithmHistory(); break; case ViewNotifiable::Flag::ShowTransposed: showTransposed(); break; case ViewNotifiable::Flag::ConvertToMatrixWorkspace: convertToMatrixWorkspace(); break; case ViewNotifiable::Flag::ConvertMDHistoToMatrixWorkspace: convertMDHistoToMatrixWorkspace(); break; case ViewNotifiable::Flag::ClearUBMatrix: clearUBMatrix(); break; case ViewNotifiable::Flag::ShowSurfacePlot: showSurfacePlot(); break; case ViewNotifiable::Flag::ShowContourPlot: showContourPlot(); break; case ViewNotifiable::Flag::RefreshWorkspaces: refreshWorkspaces(); break; } }
void Config::load() { loadWorkspace(); loadPostprocessor(NULL); loadAdvanced(); }
/** * Load the points from a MatrixWorkspace * @param wsName :: The workspace to load from */ void TabulatedFunction::loadWorkspace(const std::string &wsName) const { auto ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(wsName); loadWorkspace(ws); }
void MainWindow::createActions() { //loadAct loadSceneAct = new QAction(tr("&Load Scene"), this); loadSceneAct->setShortcut(Qt::CTRL + Qt::Key_O); loadSceneAct->setStatusTip(tr("Load scene")); connect(loadSceneAct, SIGNAL(triggered()), this, SLOT(loadScene())); //quickLoadAct quickLoadAct = new QAction(tr("&Quick Load"), this); quickLoadAct->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_Q); quickLoadAct->setStatusTip(tr("Load last scene")); connect(quickLoadAct, SIGNAL(triggered()), this, SLOT(quickLoad())); //saveSceneAct saveSceneAct = new QAction(tr("&Save Scene"), this); saveSceneAct->setShortcut(Qt::CTRL + Qt::Key_S); saveSceneAct->setStatusTip(tr("Save Scene")); connect(saveSceneAct, SIGNAL(triggered()), this, SLOT(saveScene())); loadPluginFileAct = new QAction(tr("&Load Plugin"), this); loadPluginFileAct->setShortcut(Qt::CTRL + Qt::Key_L); loadPluginFileAct->setStatusTip(tr("Load plugin file")); connect(loadPluginFileAct, SIGNAL(triggered()), this, SLOT(loadPluginFileWithDialog())); loadPluginDirAct = new QAction(tr("&Load Plugin Directory"), this); loadPluginDirAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L); loadPluginDirAct->setStatusTip(tr("Load all plugins in directory")); connect(loadPluginDirAct, SIGNAL(triggered()), this, SLOT(loadPluginDirWithDialog())); /// save workspace configuration action saveWorkspaceConfigurationAct = new QAction(tr("Save Workspace"), this); saveWorkspaceConfigurationAct->setStatusTip(tr("Save the configuration of the workspace")); connect(saveWorkspaceConfigurationAct, SIGNAL(triggered()), this, SLOT(saveWorkspace())); /// save new workspace configuration action saveNewWorkspaceConfigurationAct = new QAction(tr("Save Workspace As..."), this); saveNewWorkspaceConfigurationAct->setStatusTip(tr("Save a new workspace configuration")); connect(saveNewWorkspaceConfigurationAct, SIGNAL(triggered()), this, SLOT(saveNewWorkspace())); /// load workspace configuration action loadWorkspaceConfigurationAct = new QAction(tr("Load Workspace"), this); loadWorkspaceConfigurationAct->setStatusTip(tr("Load a workspace configuration")); connect(loadWorkspaceConfigurationAct, SIGNAL(triggered()), this, SLOT(loadWorkspace())); //closeAct closeSceneAct = new QAction(tr("&Close"), this); closeSceneAct->setShortcut(Qt::CTRL + Qt::Key_W); closeSceneAct->setStatusTip(tr("Close Scene")); connect(closeSceneAct, SIGNAL(triggered()), this, SLOT(close())); //exitAct exitAct = new QAction(tr("&Exit"), this); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(exit())); //frontAct frontAct = new QAction(tr("Front"), this); frontAct->setStatusTip(tr("Camera Front View")); connect(frontAct, SIGNAL(triggered()), this, SLOT(front())); //topAct topAct = new QAction(tr("Top"), this); topAct->setStatusTip(tr("Camera Top View")); connect(topAct, SIGNAL(triggered()), this, SLOT(top())); //sideAct sideAct = new QAction(tr("Side"), this); sideAct->setStatusTip(tr("Camera Side View")); connect(sideAct, SIGNAL(triggered()), this, SLOT(side())); //startSimulationAct startSimulationAct = new QAction(tr("Start Simulation"), this); startSimulationAct->setShortcut(Qt::CTRL + Qt::Key_R); connect(startSimulationAct, SIGNAL(triggered()), this, SLOT(startSimulation())); //stopSimulationAct stopSimulationAct = new QAction(tr("Stop Simulation"), this); stopSimulationAct->setShortcut(Qt::CTRL + Qt::Key_C); connect(stopSimulationAct, SIGNAL(triggered()), this, SLOT(stopSimulation())); //simulateSingleStepAct simulateSingleStepAct = new QAction(tr("Simulate Single Step"), this); simulateSingleStepAct->setStatusTip(tr("Simulates one step at a time")); simulateSingleStepAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_R); connect(simulateSingleStepAct, SIGNAL(triggered()), this, SLOT(simulateSingleStep())); //renderDuringSimulationAct renderDuringSimulationAct = new QAction(tr("Render during Simulation"), this); connect(renderDuringSimulationAct, SIGNAL(triggered()), this, SLOT(renderDuringSimulation())); //whiteAct whiteAct = new QAction(tr("White"), this); connect(whiteAct, SIGNAL(triggered()), this, SLOT(white())); //grayAct grayAct = new QAction(tr("Gray"), this); connect(grayAct, SIGNAL(triggered()), this, SLOT(gray())); //BlackAct blackAct = new QAction(tr("Black"), this); connect(blackAct, SIGNAL(triggered()), this, SLOT(black())); //resetCameraAct resetCameraAct = new QAction(tr("Reset Camera"), this); resetCameraAct->setStatusTip(tr("Reset Camera Angle")); connect(resetCameraAct, SIGNAL(triggered()), this, SLOT(resetCamera())); //xga1024x768Act xga1024x768Act = new QAction(tr("XGA 1024 x 768"), this); xga1024x768Act->setCheckable(true); xga1024x768Act->setChecked(true); connect(xga1024x768Act, SIGNAL(triggered()), this, SLOT(xga1024x768())); //vga640x480Act vga640x480Act = new QAction(tr("VGA 640 x 768"), this); vga640x480Act->setCheckable(true); connect(vga640x480Act, SIGNAL(triggered()), this, SLOT(vga640x480())); //hd1280x720Act hd1280x720Act = new QAction(tr("HD 1280 x 720"), this); hd1280x720Act->setCheckable(true); connect(hd1280x720Act, SIGNAL(triggered()), this, SLOT(hd1280x720())); //aboutAct aboutAct = new QAction(tr("About"), this); aboutAct->setShortcut(Qt::Key_F1); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); }