Ejemplo n.º 1
0
ModelFixForm::ModelFixForm(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{
	map<QString, attribs_map> confs=GeneralConfigWidget::getConfigurationParams();

	setupUi(this);
	hideEvent(nullptr);

	PgModelerUiNS::configureWidgetFont(invalid_cli_lbl, PgModelerUiNS::MEDIUM_FONT_FACTOR);
	PgModelerUiNS::configureWidgetFont(message_lbl, PgModelerUiNS::MEDIUM_FONT_FACTOR);
	PgModelerUiNS::configureWidgetFont(not_found_lbl, PgModelerUiNS::MEDIUM_FONT_FACTOR);

	//Configuring font style for output widget
	if(!confs[ParsersAttributes::CONFIGURATION][ParsersAttributes::CODE_FONT].isEmpty())
	{
		double size=confs[ParsersAttributes::CONFIGURATION][ParsersAttributes::CODE_FONT_SIZE].toDouble();
		if(size < 5.0f) size=5.0f;

		output_txt->setFontFamily(confs[ParsersAttributes::CONFIGURATION][ParsersAttributes::CODE_FONT]);
		output_txt->setFontPointSize(size);
	}

	connect(&pgmodeler_cli_proc, SIGNAL(readyReadStandardOutput()), this, SLOT(updateOutput()));
	connect(&pgmodeler_cli_proc, SIGNAL(readyReadStandardError()), this, SLOT(updateOutput()));
	connect(&pgmodeler_cli_proc, SIGNAL(finished(int)), this, SLOT(handleProcessFinish(int)));
	connect(fix_btn, SIGNAL(clicked()), this, SLOT(fixModel()));
	connect(sel_cli_exe_tb, SIGNAL(clicked()), this, SLOT(selectFile()));
	connect(sel_in_file_tb, SIGNAL(clicked()), this, SLOT(selectFile()));
	connect(sel_out_file_tb, SIGNAL(clicked()), this, SLOT(selectFile()));
	connect(input_file_edt, SIGNAL(textChanged(QString)), this, SLOT(enableFix()));
	connect(output_file_edt, SIGNAL(textChanged(QString)), this, SLOT(enableFix()));
	connect(pgmodeler_cli_edt, SIGNAL(textChanged(QString)), this, SLOT(enableFix()));
	connect(close_btn, SIGNAL(clicked()), this, SLOT(reject()));
}
Ejemplo n.º 2
0
void CopyPose::updateControlOutput(const Timestamp& timestamp)
{
    //IMO this should be done, no idea if it is enough (wrt Distance impl)
	Twist y = diff(F_identity, m_internalPose);
	bool found = true;
	if (!timestamp.substep) {
		if (!timestamp.reiterate) {
			found = popPose(timestamp.cacheTimestamp);
		}
	}
	if (m_constraintCallback && (m_substep || (!timestamp.reiterate && !timestamp.substep))) {
		// initialize first callback the application to get the current values
		int i=0;
		if (m_outputControl & CTL_POSITION) {
			updateValues(y.vel, &m_values[i++], &m_pos, CTL_POSITIONX);
		}
		if (m_outputControl & CTL_ROTATION) {
			updateValues(y.rot, &m_values[i++], &m_rot, CTL_ROTATIONX);
		}
		if ((*m_constraintCallback)(timestamp, m_values, m_nvalues, m_constraintParam)) {
			setControlParameters(m_values, m_nvalues, (found && timestamp.interpolate)?timestamp.realTimestep:0.0);
		}
	}
	if (m_outputControl & CTL_POSITION) {
		updateOutput(y.vel, &m_pos, CTL_POSITIONX);
	}
	if (m_outputControl & CTL_ROTATION) {
		updateOutput(y.rot, &m_rot, CTL_ROTATIONX);
	}
}
void BasicPlugin::internalUpdate() {

  //Make sure we have all the necessary inputs
  if (!inputsExist())
    return;

  writeLockInputsAndOutputs();

  //Call the plugins algorithm to operate on the inputs
  //and produce the outputs
  if ( !algorithm() ) {
    Debug::self()->log(i18n("There is an error in the %1 algorithm.").arg(propertyString()), Debug::Error);
    unlockInputsAndOutputs();
    return;
  }

  //Perform update on the outputs
  updateOutput();

  createScalars();

  unlockInputsAndOutputs();

  return;
}
Ejemplo n.º 4
0
TripleID *BitmapTriplesSearchIterator::next()
{
#if 0
    cout << "FWD posZ: " << posZ << " posY: " << posY << endl;
    cout << "\tFWD nextZ: " << nextZ << " nextY: " << nextY << endl;
    cout << "\tTriple: " << x << ", " << y << ", " << z << endl;
#endif

    z = adjZ.get(posZ);

    if(posZ==nextZ) {
        posY++;
        y = adjY.get(posY);
        nextZ = adjZ.find(posY+1);
        //nextZ = adjZ.findNext(nextZ)+1;

        if(posY==nextY) {
            x++;
            nextY = adjY.find(x);
            //nextY = adjY.findNext(nextY)+1;
        }
    }

    posZ++;

    updateOutput();

    return &returnTriple;
}
Ejemplo n.º 5
0
void
HalfAdder::executeProcess() {
  HalfAdderState *state = (HalfAdderState *) getState();
  LogicEvent *bitEvent  = NULL;
  int updateFlag = 0;
  
  do {
    bitEvent = (LogicEvent *) getEvent();
    switch (bitEvent->destinationPort) {
    case 1:
      state->inputBit1 = bitEvent->bitValue;
      updateFlag       = 1;
      break;
      
    case 2:
      state->inputBit2 = bitEvent->bitValue;
      updateFlag       = 1;
      break;
      
    default:
      cout << "Warning : HalfAdder::executeProcess() - "
           << "Received an event that I don't know how to handle.\n";
    }
  } while (haveMoreEvents() == true);
  
  if (updateFlag == 1) {
    updateOutput();
  }
}
Ejemplo n.º 6
0
bool KeySequenceWidget::event(QEvent* event)
{
	if (status() == Recording)
	{
		switch(event->type())
		{
			case QEvent::KeyPress:
				keyPressEvent(static_cast<QKeyEvent*>(event));
				return true;

			case QEvent::MouseButtonRelease:
				event->accept();
				return true;

			case QEvent::ShortcutOverride:
				event->accept();
				return true;

			case QEvent::FocusOut:
				stopRecording();
				if (!valid())
				{
					keySequence() = backupSequence();
					updateOutput();
				}
				break;

			default:
				break;
		}
	}

	return QPushButton::event(event);
}
Ejemplo n.º 7
0
void loop() {
	MIDI.read();
	debug_led();
	handlePluck();
	updateOutput();
	autoPluck();
}
Ejemplo n.º 8
0
void Python3Session::onResultReady()
{
    m_output = getOutput();
    m_error = getError();

    updateOutput();
}
Ejemplo n.º 9
0
void MainWindow::model_executionStateChanged(bool running)
{
    bool hasSelection = _ui->testsTree->selectionModel()->selectedIndexes().count() > 0;

    _ui->actionNew->setEnabled(!running);
    _ui->actionOpen->setEnabled(!running);
    _ui->actionSave->setEnabled(!running);
    _ui->actionSave_As->setEnabled(!running);

    _ui->actionAdd_test_executable->setEnabled(!running);
    _ui->actionRemove_test_executable->setEnabled(!running && hasSelection);
    _ui->actionRun_selected->setEnabled(!running);
    _ui->actionRefresh_tests->setEnabled(!running && hasSelection);
    _ui->actionTerminate->setEnabled(running);

    if (!running) {
        _ui->progressBar->setValue(0);
        _ui->statusBar->clearMessage();
        if (hasSelection) {
            updateOutput(static_cast<TestItemBase*>(
                             _ui->testsTree->selectionModel()->selectedIndexes().first().internalPointer()
                         ));
        }

        emit SetErrorCount(this, _model.rootItem()->getErrorCount());
        emit ClearProgress(this);
    } else {
        _ui->outputEdit->setText(QString());
    }
}
CountingSourceLinesWidget::CountingSourceLinesWidget(const QString &folderName, TextEditor *given_editor, QWidget *parent) : QWidget(parent)
{
    QSplitter *new_splitter = new QSplitter;
    new_splitter->setChildrenCollapsible(false);
    new_splitter->setObjectName("Main Second Splitter");

    QVBoxLayout *container_layout = new QVBoxLayout;
    container_layout->addWidget(new_splitter);
    container_layout->setContentsMargins(0, 0, 0, 0);
    container_layout->setSpacing(0);
    setLayout(container_layout);

    output = given_editor;
    new_splitter->addWidget(output);

    output->createModeLine();
    output->setObjectName(tr("*Counter*"));
    output->set_current_file_name(tr("*Counter*"));
    output->textEdit->setFocus();

    myProcess = new QProcess(this);
    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
    myProcess->setProcessEnvironment(env);
    myProcess->setWorkingDirectory("/home/zak/Qt/Redactor/ConsoleTools");

    name_of_the_source = folderName;

    connect(myProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
    connect(myProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError)));
    connect(myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(updateOutput()));

    startExecution();
}
static void pcIntCallback(uint8_t id, uint8_t status) {
	// new state of the DIAG pin?
	if (id == act_protectedOutput_DIAG_PIN_PCINT) {
		//diagState = status;
		readDiagPin();
		updateOutput(0);
		// DIAG asserted?
		if (diagState == DIAG_ASSERTED) {
			// if retry-timer mechanism is enabled, initiate timer
			if (act_protectedOutput_RETRY_TIMER_TIME_S > 0) {
				Timer_SetTimeout(act_protectedOutput_RETRY_TIMER, act_protectedOutput_RETRY_TIMER_TIME_S*1000, TimerTypeOneShot, 0);
			}
			// if the retry-mechanism is disabled, change the target output state to OFF
			else {
				for (uint8_t i=0; i<act_protectedOutput_CH_COUNT; i++) {
					chTargetState[i] = 0;
				}
#if act_protectedOutput_EEPROM_ENABLED == 1
				// output states changed, store to EE after this timer delay
				Timer_SetTimeout(act_protectedOutput_STORE_VALUE_TIMEOUT, act_protectedOutput_STORE_VALUE_TIMEOUT_TIME_S*1000, TimerTypeOneShot, 0);
#endif
			}
		}
		// something interesting obviously happened. let's report it
		diagReportPending = 1;
	}
}
Ejemplo n.º 12
0
void KeySequenceWidget::setKeySequence(const KeySequence& seq)
{
	keySequence() = seq;
	backupSequence() = seq;

	setStatus(Stopped);
	updateOutput();
}
Ejemplo n.º 13
0
    //*** Start: UpdatableState implementation ***//
    virtual void reset() override
    {
        last_time_ = clock()->nowNanos();

        state_.gyroscope_bias = params_.gyro.turn_on_bias;
        state_.accelerometer_bias = params_.accel.turn_on_bias;
        gauss_dist.reset();
        updateOutput();
    }
Ejemplo n.º 14
0
void FloatLatch::reset()
{
	Component::reset();
	
	m_values.resize(QMAX(getInputPack()->getConnectorCount(),getOutputPack()->getConnectorCount()));
	m_values.fill(getResetValue());
	
	updateOutput();
}
Ejemplo n.º 15
0
JobBurner::JobBurner( const JobAssignment & jobAssignment, Slave * slave, int options )
: QObject( slave )
, mSlave( slave )
, mCmd( 0 )
, mJobAssignment( jobAssignment )
, mJob( jobAssignment.job() )
, mLoaded( false )
, mOutputTimer( 0 )
, mMemTimer( 0 )
, mLogFlushTimer( 0 )
, mCheckupTimer( 0 )
, mState( StateNew )
, mOptions( Options(options) )
, mCurrentCopy( 0 )
, mLogFilesReady( false )
, mLogFile( 0 )
, mLogStream( 0 )
, mCmdPid( 0 )
{
	mOutputTimer = new QTimer( this );
	connect( mOutputTimer, SIGNAL( timeout() ), SLOT( updateOutput() ) );

	mMemTimer = new QTimer( this );
	connect( mMemTimer, SIGNAL( timeout() ), SLOT( checkMemory() ) );

	mCheckupTimer = new QTimer( this );
	connect( mCheckupTimer, SIGNAL( timeout() ), SLOT( checkup() ) );
    mCheckupTimer->start(30000);
	
	/* Ensure we are actually assigned some tasks to work on */
	mTaskAssignments = mJobAssignment.jobTaskAssignments();
	if( mTaskAssignments.isEmpty() ) {
		jobErrored( QString("JobAssignment has no assigned tasks, Job Assignment key: %1").arg(mJobAssignment.key()) );
		return;
	}

	// Double check that we are still assigned
	mJobAssignment.reload();
	if( mJobAssignment.jobAssignmentStatus().status() != "ready" ) {
		LOG_1( "JobAssignment no longer ready, cancelling the burn" );
		cancel();
		return;
	}

	/* Make sure each of the tasks are still valid, some could have already been unassigned or cancelled */
	/* Also verify that the jobtask record matches the assignment */
	mTasks = JobTask::table()->records( mTaskAssignments.keys( JobTaskAssignment::schema()->field("fkeyjobtask")->pos() ), /*select=*/true, /*useCache=*/false );
	foreach( JobTaskAssignment jta, mTaskAssignments ) {
		JobTask task = jta.jobTask();
		if( jta.jobAssignmentStatus().status() != "ready" || task.status() != "assigned" || task.host() != Host::currentHost() ) {
			LOG_1( QString("JobTask no longer assigned, discarding. keyJobTask: %1  keyJobTaskAssignment: %2  jobtask status: %3 jobtaskassignment status: %4")
				.arg(task.key()).arg(jta.key()).arg(task.status()).arg(jta.jobAssignmentStatus().status()) );
			mTaskAssignments -= jta;
			mTasks -= task;
		}
	}
Ejemplo n.º 16
0
void MainWindow::testsTree_selectionChanged(QItemSelection newSel, QItemSelection /*oldSel*/)
{
    bool enabled = newSel.count() > 0 && !_model.isRunning();

    _ui->actionRemove_test_executable->setEnabled(enabled);
    _ui->actionRefresh_tests->setEnabled(enabled);

    if (newSel.count() > 0) {
        updateOutput(static_cast<TestItemBase*>(newSel.first().indexes().first().internalPointer()));
    }
}
Ejemplo n.º 17
0
void KeySequenceWidget::keyPressEvent(QKeyEvent* event)
{
	event->accept();

	if (status() == Stopped)
		return;

	if (m_KeySequence.appendKey(event->key(), event->modifiers()))
		stopRecording();

	updateOutput();
}
void VerticalPatchBlock::updateRequestedSize() {
    Size requestedSize = m_outputNode1->getRequestedSize();
    Size requestedSize2 = m_outputNode2->getRequestedSize();
    requestedSize.width = qMax(requestedSize.width, requestedSize2.width);
    requestedSize.height += requestedSize2.height;
    Size oldSize = m_inputNode->getRequestedSize();
    if (oldSize.width != requestedSize.width || oldSize.height != requestedSize.height) {
        m_inputNode->setRequestedSize(requestedSize);
    }
    // at least one output changed (even if not total size) -> update it:
    updateOutput();
}
Ejemplo n.º 19
0
KeySequenceWidget::KeySequenceWidget(QWidget* parent, const KeySequence& seq) :
	QPushButton(parent),
	m_KeySequence(seq),
	m_BackupSequence(seq),
	m_Status(Stopped),
	m_MousePrefix("mousebutton("),
	m_MousePostfix(")"),
	m_KeyPrefix("keystroke("),
	m_KeyPostfix(")")
{
	setFocusPolicy(Qt::NoFocus);
	updateOutput();
}
Ejemplo n.º 20
0
CompileDialog::CompileDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CompileDialog),compileStatus(false)
{
    ui->setupUi(this);
    ui->pushButton->setEnabled(false);
    ui->checkBox->setChecked(true);
    connect(ui->plainTextEdit,SIGNAL(textChanged()),this,SLOT(moveToEnd()));
    connect(&process,SIGNAL(readyRead()),this,SLOT(updateOutput()));
    connect(&process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(processFinished(int,QProcess::ExitStatus)));
    connect(&process,SIGNAL(error(QProcess::ProcessError)),this,SLOT(processError(QProcess::ProcessError)));
    compile(&process);
}
Ejemplo n.º 21
0
TripleID *ObjectIndexIterator::previous()
{
    posIndex--;

    unsigned int posY = adjIndex.get(posIndex);

    z = patZ;
    y = patY!=0 ? patY : adjY.get(posY);
    x = adjY.findListIndex(posY)+1;

    updateOutput();
    return &returnTriple;
}
Ejemplo n.º 22
0
void KeySequenceWidget::stopRecording()
{
	if (!keySequence().valid())
	{
		keySequence() = backupSequence();
		updateOutput();
	}

	setDown(false);
	focusNextChild();
	releaseKeyboard();
	setStatus(Stopped);
	emit keySequenceChanged();
}
void act_protectedOutput_HandleMessage(StdCan_Msg_t *rxMsg) {
	if (	StdCan_Ret_class(rxMsg->Header) == CAN_MODULE_CLASS_ACT &&
		StdCan_Ret_direction(rxMsg->Header) == DIRECTIONFLAG_TO_OWNER &&
		rxMsg->Header.ModuleType == CAN_MODULE_TYPE_SNS_PROTECTEDOUTPUT && 
		rxMsg->Header.ModuleId == act_protectedOutput_ID)
	{
		switch (rxMsg->Header.Command) {
			
			case CAN_MODULE_CMD_PHYSICAL_SETPIN:
				/*
				 * This message is used to activate/deactivate
				 * an output channel.
				 */
				if (rxMsg->Length == 2) {
					uint8_t channel = rxMsg->Data[0];
					if (channel >= 0 && channel < act_protectedOutput_CH_COUNT) {
						chTargetState[channel] = rxMsg->Data[1];
						readDiagPin();
#if act_protectedOutput_FORCED_RETRIES == 1
						updateOutput(1);
#else
						updateOutput(0);
#endif
#if act_protectedOutput_EEPROM_ENABLED == 1
						// output states changed, store to EE after this timer delay
						Timer_SetTimeout(act_protectedOutput_STORE_VALUE_TIMEOUT, act_protectedOutput_STORE_VALUE_TIMEOUT_TIME_S*1000, TimerTypeOneShot, 0);
#endif
					}
					StdCan_Set_direction(rxMsg->Header, DIRECTIONFLAG_FROM_OWNER);
					rxMsg->Length = 2;
					while (StdCan_Put(rxMsg) != StdCan_Ret_OK);
				}
				break;
		}
	}
}
Ejemplo n.º 24
0
void KeySequenceWidget::mousePressEvent(QMouseEvent* event)
{
	event->accept();

	if (status() == Stopped)
	{
		startRecording();
		return;
	}

	if (m_KeySequence.appendMouseButton(event->button()))
		stopRecording();

	updateOutput();
}
Ejemplo n.º 25
0
void NesApuEnvelope::clock()
{
	if (!m_reset) {
		if (m_count) {
			m_count--;
			return;
		}
		if (m_regs[0] | (m_regs[1] & 0x20))
			m_regs[0] = (m_regs[0]-1) & 0xF;
	} else {
		m_reset = false;
		m_regs[0] = 0xF;
	}
	m_count = m_regs[1] & 0x0F;
	updateOutput();
}
VerticalPatchBlock::VerticalPatchBlock(MainController* controller, QString uid)
    : BlockBase(controller, uid)
{
    // prepare nodes:
    m_inputNode = createInputNode("inputNode");
    m_outputNode1 = createOutputNode("outputNode1");
    m_outputNode2 = createOutputNode("outputNode2");

    // set initial requested size:
    updateRequestedSize();

    // connect signals and slots:
    connect(m_outputNode1, SIGNAL(requestedSizeChanged()), this, SLOT(updateRequestedSize()));
    connect(m_outputNode2, SIGNAL(requestedSizeChanged()), this, SLOT(updateRequestedSize()));

    connect(m_inputNode, SIGNAL(dataChanged()), this, SLOT(updateOutput()));
}
KstObject::UpdateType KstBasicPlugin::update(int updateCounter) {
    Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);

    if (recursed()) {
        return setLastUpdateResult(NO_CHANGE);
    }

    bool force = dirty();
    setDirty(false);

    if (KstObject::checkUpdateCounter(updateCounter) && !force) {
        return lastUpdateResult();
    }

    //Make sure we have all the necessary inputs
    if (!inputsExist()) {
        return setLastUpdateResult(NO_CHANGE);
    }

    writeLockInputsAndOutputs();

    //Update the dependent inputs
    bool depUpdated = updateInput(updateCounter, force);

    //Call the plugins algorithm to operate on the inputs
    //and produce the outputs
    if ( !algorithm() ) {
        KstDebug::self()->log(i18n("There is an error in the %1 algorithm.").arg(propertyString()), KstDebug::Error);
        unlockInputsAndOutputs();
        return lastUpdateResult();
    }

    //Perform update on the outputs
    updateOutput(updateCounter);

    createFitScalars();

    unlockInputsAndOutputs();

    return setLastUpdateResult(depUpdated ? UPDATE : NO_CHANGE);
}
Ejemplo n.º 28
0
TripleID *MiddleWaveletIterator::previous()
{
    //cout << "previousTriple: " << predicateOcurrence << ", " << prevZ << ", " << posZ << ", " << nextZ << endl;
    if(posZ<=prevZ) {
        predicateOcurrence--;
        posY = predicateIndex->getAppearance(patY, predicateOcurrence);

        prevZ = adjZ.find(posY);
        posZ = nextZ = adjZ.last(posY);
        //nextZ = adjZ.findNext(prevZ)-1;

        x = adjY.findListIndex(posY)+1;
        y = adjY.get(posY);
        z = adjZ.get(posZ);
    } else {
        z = adjZ.get(posZ);
        posZ--;
    }
    updateOutput();
    return &returnTriple;
}
Ejemplo n.º 29
0
TripleID *IteratorY::previous()
{
    if(posZ<=prevZ) {
        nextY = posY;
        posY = prevY;
        prevY = adjY.findPreviousAppearance(prevY-1, patY);

        posZ = prevZ = adjZ.find(posY);
        nextZ = adjZ.last(posY);

        x = adjY.findListIndex(posY)+1;
        y = adjY.get(posY);
        z = adjZ.get(posZ);
    } else {
        posZ--;
        z = adjZ.get(posZ);
    }

    updateOutput();

    return &returnTriple;
}
Ejemplo n.º 30
0
TripleID *IteratorY::next()
{
    if(posZ>nextZ) {
        prevY = posY;
        posY = nextY;
        nextY = adjY.findNextAppearance(nextY+1, patY);

        posZ = prevZ = adjZ.find(posY);
        nextZ = adjZ.last(posY);

        x = adjY.findListIndex(posY)+1;
        y = adjY.get(posY);
        z = adjZ.get(posZ);
    } else {
        z = adjZ.get(posZ);
    }
    posZ++;

    updateOutput();

    return &returnTriple;
}