void QFEHelpEditorWidget::on_btnOpen_clicked() { //openScript("last", true); if (maybeSave()) { openScript("last", true); } }
void QFEHelpEditorWidget::reloadLastAutosave() { QDir d(QFPluginServices::getInstance()->getConfigFileDirectory()); //if (QFile::exists(d.absoluteFilePath("helpeditor_autosave.html"))) { openScript(d.absolutePath(), false); setScriptFilename(""); //} }
void QFESPIMB040ScriptedAcquisition::on_btnOpenTemplate_clicked() { if (opticsSetup->getStopRelease(0)) opticsSetup->getStopRelease(0)->stop(); if (opticsSetup->getStopRelease(1)) opticsSetup->getStopRelease(1)->stop(); openScript(ProgramOptions::getInstance()->getAssetsDirectory()+"/plugins/spimb040/acquisitionScriptTemplates/", false); if (opticsSetup->getStopRelease(0)) opticsSetup->getStopRelease(0)->resume(); if (opticsSetup->getStopRelease(1)) opticsSetup->getStopRelease(1)->resume(); }
void MainWindow::openScriptDialog() { QUrl url = QFileDialog::getOpenFileUrl(this, QString(), QUrl(), "*.sql|SQL scripts\n*.txt|Text files\n*|All files"); if(!url.isEmpty()) if(openScript(url)) m_recent->addUrl(url); }
void QFESPIMB040ScriptedAcquisition::on_btnOpen_clicked() { if (opticsSetup->getStopRelease(0)) opticsSetup->getStopRelease(0)->stop(); if (opticsSetup->getStopRelease(1)) opticsSetup->getStopRelease(1)->stop(); openScript("last", true); if (opticsSetup->getStopRelease(0)) opticsSetup->getStopRelease(0)->resume(); if (opticsSetup->getStopRelease(1)) opticsSetup->getStopRelease(1)->resume(); }
void TIGLViewerWindow::openScript() { QString fileName; statusBar()->showMessage(tr("Invoked File|Open Script")); fileName = QFileDialog::getOpenFileName ( this, tr("Open File"), myLastFolder, tr( "Choose your script (*)" ) ); openScript(fileName); }
FilterScriptDialog::FilterScriptDialog(QWidget * parent) :QDialog(parent) { ui = new Ui::scriptDialog(); FilterScriptDialog::ui->setupUi(this); scriptPtr=0; connect(ui->okButton, SIGNAL(clicked()), this, SLOT(applyScript())); connect(ui->clearScriptButton,SIGNAL(clicked()), this, SLOT(clearScript())); connect(ui->saveScriptButton, SIGNAL(clicked()), this, SLOT(saveScript())); connect(ui->openScriptButton, SIGNAL(clicked()), this, SLOT(openScript())); connect(ui->moveUpButton,SIGNAL(clicked()), this, SLOT(moveSelectedFilterUp())); connect(ui->moveDownButton, SIGNAL(clicked()), this, SLOT(moveSelectedFilterDown())); connect(ui->removeFilterButton, SIGNAL(clicked()), this, SLOT(removeSelectedFilter())); connect(ui->editParameterButton, SIGNAL(clicked()), this, SLOT(editSelectedFilterParameters())); }
DumbTrajectory::DumbTrajectory(std::string cfg, std::string args) : Controller(cfg, args), scriptPath(args), scriptFile() { //Set the current state of the simulation to stopped simState = CTRL_HALT; //Make sure we have an existant script file openScript(scriptPath); this->addOperation("step", &DumbTrajectory::step, this, RTT::OwnThread).doc( "Advance the script by one step."); this->addOperation("run", &DumbTrajectory::run, this, RTT::OwnThread).doc( "Start the script (free running)."); this->addOperation("halt", &DumbTrajectory::halt, this, RTT::OwnThread).doc( "Halt the script."); this->addOperation("openScript", &DumbTrajectory::openScript, this, RTT::OwnThread).doc("Open a new trajectory file").arg( "sfile", "Script file path"); }
DlgPrefController::DlgPrefController(QWidget* parent, Controller* controller, ControllerManager* controllerManager, UserSettingsPointer pConfig) : DlgPreferencePage(parent), m_pConfig(pConfig), m_pControllerManager(controllerManager), m_pController(controller), m_pDlgControllerLearning(NULL), m_pInputTableModel(NULL), m_pInputProxyModel(NULL), m_pOutputTableModel(NULL), m_pOutputProxyModel(NULL), m_bDirty(false) { m_ui.setupUi(this); initTableView(m_ui.m_pInputMappingTableView); initTableView(m_ui.m_pOutputMappingTableView); initTableView(m_ui.m_pScriptsTableWidget); connect(m_pController, SIGNAL(presetLoaded(ControllerPresetPointer)), this, SLOT(slotPresetLoaded(ControllerPresetPointer))); // TODO(rryan): Eh, this really isn't thread safe but it's the way it's been // since 1.11.0. We shouldn't be calling Controller methods because it lives // in a different thread. Booleans (like isOpen()) are fine but a complex // object like a preset involves QHash's and other data structures that // really don't like concurrent access. ControllerPresetPointer pPreset = m_pController->getPreset(); slotPresetLoaded(pPreset); m_ui.labelDeviceName->setText(m_pController->getName()); QString category = m_pController->getCategory(); if (!category.isEmpty()) { m_ui.labelDeviceCategory->setText(category); } else { m_ui.labelDeviceCategory->hide(); } // When the user picks a preset, load it. connect(m_ui.comboBoxPreset, SIGNAL(activated(int)), this, SLOT(slotLoadPreset(int))); // When the user toggles the Enabled checkbox, toggle. connect(m_ui.chkEnabledDevice, SIGNAL(clicked(bool)), this, SLOT(slotEnableDevice(bool))); // Connect our signals to controller manager. connect(this, SIGNAL(openController(Controller*)), m_pControllerManager, SLOT(openController(Controller*))); connect(this, SIGNAL(closeController(Controller*)), m_pControllerManager, SLOT(closeController(Controller*))); connect(this, SIGNAL(loadPreset(Controller*, ControllerPresetPointer)), m_pControllerManager, SLOT(loadPreset(Controller*, ControllerPresetPointer))); // Input mappings connect(m_ui.btnAddInputMapping, SIGNAL(clicked()), this, SLOT(addInputMapping())); connect(m_ui.btnRemoveInputMappings, SIGNAL(clicked()), this, SLOT(removeInputMappings())); connect(m_ui.btnLearningWizard, SIGNAL(clicked()), this, SLOT(showLearningWizard())); connect(m_ui.btnClearAllInputMappings, SIGNAL(clicked()), this, SLOT(clearAllInputMappings())); // Output mappings connect(m_ui.btnAddOutputMapping, SIGNAL(clicked()), this, SLOT(addOutputMapping())); connect(m_ui.btnRemoveOutputMappings, SIGNAL(clicked()), this, SLOT(removeOutputMappings())); connect(m_ui.btnClearAllOutputMappings, SIGNAL(clicked()), this, SLOT(clearAllOutputMappings())); // Scripts connect(m_ui.m_pScriptsTableWidget, SIGNAL(cellChanged(int, int)), this, SLOT(slotDirty())); connect(m_ui.btnAddScript, SIGNAL(clicked()), this, SLOT(addScript())); connect(m_ui.btnRemoveScript, SIGNAL(clicked()), this, SLOT(removeScript())); connect(m_ui.btnOpenScript, SIGNAL(clicked()), this, SLOT(openScript())); }
void QFEHelpEditorWidget::on_btnOpenTemplate_clicked() { QDir d=QFileInfo(currentScript).absoluteDir(); openScript(ProgramOptions::getInstance()->getAssetsDirectory()+"/plugins/qfe_helpeditor/templates/", false); setScriptFilename(d.absoluteFilePath(QFileInfo(currentScript).fileName()), true, false); }
void QFEHelpEditorWidget::on_btnOpenExample_clicked() { openScript(ProgramOptions::getInstance()->getAssetsDirectory()+"/plugins/qfe_helpeditor/examples/", false); }
void MainWindow::setupActions() { // File menu actions KStandardAction::quit(qApp, SLOT(quit()), actionCollection()); m_recent = KStandardAction::openRecent(this, SLOT(openScript(QUrl)), 0); actionCollection()->addAction("openrecentscript", m_recent); QAction *newQueryTab= new QAction(QIcon::fromTheme("tab-new"), tr("New Query"), this); actionCollection()->addAction("newquerytab", newQueryTab); connect(newQueryTab, &QAction::triggered, this, &MainWindow::newQueryTab); QAction *newScriptTab = new QAction(QIcon::fromTheme("document-new"), tr("New Script"), this); actionCollection()->addAction("newscripttab", newScriptTab); connect(newScriptTab, &QAction::triggered, this, &MainWindow::newBlankScriptTab); QAction *openScript = new QAction(QIcon::fromTheme("document-open"), tr("Open Script..."), this); actionCollection()->addAction("openscript", openScript); connect(openScript, &QAction::triggered, this, &MainWindow::openScriptDialog); QAction *saveScript = new QAction(QIcon::fromTheme("document-save"), tr("Save Script"), this); actionCollection()->addAction("savescript", saveScript); connect(saveScript, &QAction::triggered, this, &MainWindow::saveScript); saveScript->setEnabled(false); QAction *saveScriptAs = new QAction(QIcon::fromTheme("document-save-as"), tr("Save Script As..."), this); actionCollection()->addAction("savescriptas", saveScriptAs); connect(saveScriptAs, &QAction::triggered, this, &MainWindow::saveScriptAs); saveScriptAs->setEnabled(false); // Export submenu KActionMenu *exportmenu = new KActionMenu(QIcon::fromTheme("document-export-table"), tr("Export results"), this); actionCollection()->addAction("resultexportmenu", exportmenu); QActionGroup *exportgroup = Exporters::instance().multiTableActions(this); for(QAction *a : exportgroup->actions()) exportmenu->addAction(a); connect(exportgroup, SIGNAL(triggered(QAction*)), this, SLOT(exportResults(QAction*))); // Edit menu actions KStandardAction::find(this, SLOT(search()), actionCollection()); KStandardAction::findNext(this, SLOT(findNext()), actionCollection()); KStandardAction::findPrev(this, SLOT(findPrev()), actionCollection()); QAction *clearResultView = new QAction(tr("Clear results"), this); actionCollection()->addAction("resultsclear", clearResultView); connect(clearResultView, &QAction::triggered, this, &MainWindow::clearResults); // Settings menu actions QAction *showTableDock = new QAction(tr("Show Tables"), this); showTableDock->setCheckable(true); actionCollection()->addAction("showtables", showTableDock); QAction *showDatabaseDock = new QAction(tr("Show Databases"), this); showDatabaseDock->setCheckable(true); actionCollection()->addAction("showdatabases", showDatabaseDock); // Other actions QAction *newConnection = new QAction(tr("New Connection"), this); actionCollection()->addAction("newconnection", newConnection); connect(newConnection, &QAction::triggered, this, &MainWindow::newConnection); }
void TIGLViewerWindow::connectSignals() { connect(newAction, SIGNAL(triggered()), this, SLOT(newFile())); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); connect(openScriptAction, SIGNAL(triggered()), this, SLOT(openScript())); connect(closeAction, SIGNAL(triggered()), this, SLOT(closeConfiguration())); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActions[i] = new QAction(this); recentFileActions[i]->setVisible(false); connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); connect(saveScreenshotAction, SIGNAL(triggered()), this, SLOT(makeScreenShot())); connect(setBackgroundAction, SIGNAL(triggered()), this, SLOT(setBackgroundImage())); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(aboutQtAction, SIGNAL(triggered()), this, SLOT(aboutQt())); // Misc drawing actions connect(drawPointAction, SIGNAL(triggered()), this, SLOT(drawPoint())); connect(drawVectorAction, SIGNAL(triggered()), this, SLOT(drawVector())); // view->actions menu connect(fitAction, SIGNAL(triggered()), myOCC, SLOT(fitExtents())); connect(fitAllAction, SIGNAL(triggered()), myOCC, SLOT(fitAll())); //connect(zoomAction, SIGNAL(triggered()), myOCC, SLOT(fitArea())); connect(zoomAction, SIGNAL(triggered()),myOCC, SLOT(zoom())); connect(panAction, SIGNAL(triggered()), myOCC, SLOT(pan())); connect(rotAction, SIGNAL(triggered()), myOCC, SLOT(rotation())); connect(selectAction, SIGNAL(triggered()), myOCC, SLOT(selecting())); // view->grid menu connect(gridOnAction, SIGNAL(toggled(bool)), myScene, SLOT(toggleGrid(bool))); connect(gridXYAction, SIGNAL(triggered()), myScene, SLOT(gridXY())); connect(gridXZAction, SIGNAL(triggered()), myScene, SLOT(gridXZ())); connect(gridYZAction, SIGNAL(triggered()), myScene, SLOT(gridYZ())); connect(gridRectAction, SIGNAL(triggered()), myScene, SLOT(gridRect())); connect(gridCircAction, SIGNAL(triggered()), myScene, SLOT(gridCirc())); // Standard View connect(viewFrontAction, SIGNAL(triggered()), myOCC, SLOT(viewFront())); connect(viewBackAction, SIGNAL(triggered()), myOCC, SLOT(viewBack())); connect(viewTopAction, SIGNAL(triggered()), myOCC, SLOT(viewTop())); connect(viewBottomAction, SIGNAL(triggered()), myOCC, SLOT(viewBottom())); connect(viewLeftAction, SIGNAL(triggered()), myOCC, SLOT(viewLeft())); connect(viewRightAction, SIGNAL(triggered()), myOCC, SLOT(viewRight())); connect(viewAxoAction, SIGNAL(triggered()), myOCC, SLOT(viewAxo())); connect(viewGridAction, SIGNAL(triggered()), myOCC, SLOT(viewGrid())); connect(viewResetAction, SIGNAL(triggered()), myOCC, SLOT(viewReset())); connect(viewZoomInAction, SIGNAL(triggered()), myOCC, SLOT(zoomIn())); connect(viewZoomOutAction, SIGNAL(triggered()), myOCC, SLOT(zoomOut())); connect(showConsoleAction, SIGNAL(toggled(bool)), consoleDockWidget, SLOT(setVisible(bool))); connect(consoleDockWidget, SIGNAL(visibilityChanged(bool)), showConsoleAction, SLOT(setChecked(bool))); connect(showWireframeAction, SIGNAL(toggled(bool)), myScene, SLOT(wireFrame(bool))); connect(openTimer, SIGNAL(timeout()), this, SLOT(reopenFile())); // The co-ordinates from the view connect( myOCC, SIGNAL(mouseMoved(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT(xyzPosition(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); // Add a point from the view connect( myOCC, SIGNAL(pointClicked(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT (addPoint (V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); connect( myOCC, SIGNAL(sendStatus(const QString)), this, SLOT (statusMessage(const QString)) ); connect(stdoutStream, SIGNAL(sendString(QString)), console, SLOT(output(QString))); connect(errorStream , SIGNAL(sendString(QString)), console, SLOT(output(QString))); connect(logDirect.get(), SIGNAL(newMessage(QString)), console, SLOT(output(QString))); connect(scriptEngine, SIGNAL(scriptResult(QString)), console, SLOT(output(QString))); connect(scriptEngine, SIGNAL(scriptError(QString)), console, SLOT(outputError(QString))); connect(scriptEngine, SIGNAL(evalDone()), console, SLOT(endCommand())); connect(console, SIGNAL(onChange(QString)), scriptEngine, SLOT(textChanged(QString))); connect(console, SIGNAL(onCommand(QString)), scriptEngine, SLOT(eval(QString))); connect(settingsAction, SIGNAL(triggered()), this, SLOT(changeSettings())); }
void PythonEditor::createWidgets() { runBt_ = new QToolButton(); runBt_->setIcon(QIcon(":/modules/python/python.png")); runBt_->setIconSize(QSize(24, 24)); runBt_->setShortcut(QKeySequence("Ctrl+R")); runBt_->setToolTip("Run Script (Ctrl+R)"); newBt_ = new QToolButton(); newBt_->setIcon(QIcon(":/modules/python/python_2.png")); newBt_->setIconSize(QSize(24, 24)); newBt_->setToolTip("New Script"); openBt_ = new QToolButton(); openBt_->setIcon(QIcon(":/qt/icons/open.png")); openBt_->setIconSize(QSize(24, 24)); openBt_->setToolTip("Load Script"); saveBt_ = new QToolButton(); saveBt_->setIcon(QIcon(":/qt/icons/save.png")); saveBt_->setIconSize(QSize(24, 24)); saveBt_->setToolTip("Save Script"); saveAsBt_ = new QToolButton(); saveAsBt_->setIcon(QIcon(":/qt/icons/saveas.png")); saveAsBt_->setIconSize(QSize(24, 24)); saveAsBt_->setToolTip("Save Script As"); increaseFontSizeBt_ = new QToolButton(); increaseFontSizeBt_->setIcon(QIcon(":/qt/icons/viewmag+.png")); increaseFontSizeBt_->setIconSize(QSize(24, 24)); increaseFontSizeBt_->setToolTip("Increase Font Size"); decreaseFontSizeBt_ = new QToolButton(); decreaseFontSizeBt_->setIcon(QIcon(":/qt/icons/viewmag_.png")); decreaseFontSizeBt_->setIconSize(QSize(24, 24)); decreaseFontSizeBt_->setToolTip("Decrease Font Size"); QHBoxLayout* hbox = new QHBoxLayout(); hbox->setContentsMargins(0,0,0,0); hbox->addWidget(runBt_); QFrame* sep = new QFrame(); sep->setFrameShape(QFrame::VLine); hbox->addWidget(sep); hbox->addWidget(newBt_); hbox->addWidget(openBt_); hbox->addWidget(saveBt_); hbox->addWidget(saveAsBt_); hbox->addStretch(); hbox->addWidget(increaseFontSizeBt_); hbox->addWidget(decreaseFontSizeBt_); QWidget* toolButtonBar = new QWidget(); toolButtonBar->setLayout(hbox); QFont font; font.setFamily("Courier"); font.setFixedPitch(true); font.setPointSize(fontSize_); codeEdit_ = new CodeEdit(); codeEdit_->setFont(font); highlighter_ = new PythonHighlighter(codeEdit_->document()); compilerLogWidget_ = new QTextEdit(); compilerLogWidget_->setFont(font); compilerLogWidget_->setReadOnly(true); compilerLogWidget_->setFixedHeight(150); QVBoxLayout* vbox = new QVBoxLayout(); vbox->addWidget(toolButtonBar); vbox->addWidget(codeEdit_); vbox->addWidget(compilerLogWidget_); setLayout(vbox); connect(runBt_, SIGNAL(clicked()), this, SLOT(runScript())); connect(newBt_, SIGNAL(clicked()), this, SLOT(newScript())); connect(openBt_, SIGNAL(clicked()), this, SLOT(openScript())); connect(saveBt_, SIGNAL(clicked()), this, SLOT(saveScript())); connect(saveAsBt_, SIGNAL(clicked()), this, SLOT(saveScriptAs())); connect(increaseFontSizeBt_, SIGNAL(clicked()), this, SLOT(increaseFontSize())); connect(decreaseFontSizeBt_, SIGNAL(clicked()), this, SLOT(decreaseFontSize())); connect(codeEdit_, SIGNAL(textChanged()), this, SIGNAL(modified())); setMinimumSize(300, 400); }