<commit_before>#include "vec3.h"

#include <QtWidgets/QHBoxLayout>

namespace properties {

vec3_ui::vec3_ui() {
	m_widget = new QWidget(NULL);

	QHBoxLayout* layout = new QHBoxLayout(m_widget);
	layout->setContentsMargins(0,0,0,0);

	for(unsigned a=0;a<3;++a) {
		m_values.push_back(new QDoubleSpinBox(NULL));
		layout->addWidget(m_values.back());

		m_connections.push_back(QObject::connect(
			m_values.back(),
			static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
			[this]() -> void {
				callValueChangedCallbacks();
			}
		));

		m_values.back()->setKeyboardTracking(false);
		m_values.back()->setRange(-1e13, 1e13);
	}
}

vec3_ui::~vec3_ui() {
	for(auto& c : m_connections)
		QObject::disconnect(c);
}

Imath::Vec3<float> vec3_ui::get() const {
	Imath::Vec3<float> result;
	for(unsigned a=0;a<3;++a)
		result[a] = m_values[a]->value();

	return result;
}

void vec3_ui::set(const Imath::Vec3<float>& value) {
	for(unsigned a=0;a<3;++a)
		if(m_values[a]->value() != value[a])
			m_values[a]->setValue(value[a]);
}

QWidget* vec3_ui::widget() {
	return m_widget;
}

void vec3_ui::onFlagsChanged(unsigned flags) {
	for(unsigned a=0;a<3;++a) {
		m_values[a]->setReadOnly(flags & kOutput);
		m_values[a]->setDisabled((flags & kDirty) || (flags & kDisabled));
	}
}

}
<commit_msg>Imath::Vec3 UI - block signals when reading the data from graph<commit_after>#include "vec3.h"

#include <QtWidgets/QHBoxLayout>

namespace properties {

vec3_ui::vec3_ui() {
	m_widget = new QWidget(NULL);

	QHBoxLayout* layout = new QHBoxLayout(m_widget);
	layout->setContentsMargins(0,0,0,0);

	for(unsigned a=0;a<3;++a) {
		m_values.push_back(new QDoubleSpinBox(NULL));
		layout->addWidget(m_values.back());

		m_connections.push_back(QObject::connect(
			m_values.back(),
			static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
			[this]() -> void {
				callValueChangedCallbacks();
			}
		));

		m_values.back()->setKeyboardTracking(false);
		m_values.back()->setRange(-1e13, 1e13);
	}
}

vec3_ui::~vec3_ui() {
	for(auto& c : m_connections)
		QObject::disconnect(c);
}

Imath::Vec3<float> vec3_ui::get() const {
	Imath::Vec3<float> result;
	for(unsigned a=0;a<3;++a)
		result[a] = m_values[a]->value();

	return result;
}

void vec3_ui::set(const Imath::Vec3<float>& value) {
	for(auto& v : m_values)
		v->blockSignals(true);

	for(unsigned a=0;a<3;++a)
		if(m_values[a]->value() != value[a])
			m_values[a]->setValue(value[a]);

	for(auto& v : m_values)
		v->blockSignals(false);
}

QWidget* vec3_ui::widget() {
	return m_widget;
}

void vec3_ui::onFlagsChanged(unsigned flags) {
	for(unsigned a=0;a<3;++a) {
		m_values[a]->setReadOnly(flags & kOutput);
		m_values[a]->setDisabled((flags & kDirty) || (flags & kDisabled));
	}
}

}

{'fraction_non_alphanumeric': 0.19032141567352834, 'fraction_numerical': 0.022029613578909354, 'mean_word_length': 5.822660098522167, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1331004', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1138, 'n_words': 155}