[Kst] branches/work/kst/portto4/kst/src/libkstapp
Barth Netterfield
netterfield at astro.utoronto.ca
Mon Sep 19 16:59:04 UTC 2011
SVN commit 1254509 by netterfield:
BUG:
with scripting, reading large matrixes didn't work bacause of a
timing error with the validator.
Wait for the validator to finish before jumping to any conclusions.
M +15 -3 matrixdialog.cpp
M +3 -1 matrixdialog.h
--- branches/work/kst/portto4/kst/src/libkstapp/matrixdialog.cpp #1254508:1254509
@@ -27,6 +27,7 @@
#include "objectstore.h"
#include "datasourcepluginmanager.h"
#include "dialogdefaults.h"
+#include <QTimer>
#include <QDir>
#include <QThreadPool>
@@ -34,7 +35,7 @@
namespace Kst {
MatrixTab::MatrixTab(ObjectStore *store, QWidget *parent)
- : DataTab(parent), _mode(DataMatrix), _store(store), _initField(QString()), _requestID(0) {
+ : DataTab(parent), validating(false), _mode(DataMatrix), _store(store), _initField(QString()), _requestID(0) {
setupUi(this);
setTabTitle(tr("Matrix"));
@@ -545,6 +546,8 @@
_dataSource->unlock();
+ validating = false;
+
emit sourceChanged();
}
@@ -558,6 +561,7 @@
_requestID += 1;
ValidateDataSourceThread *validateDSThread = new ValidateDataSourceThread(file, _requestID);
connect(validateDSThread, SIGNAL(dataSourceValid(QString, int)), this, SLOT(sourceValid(QString, int)));
+ validating = true;
QThreadPool::globalInstance()->start(validateDSThread);
}
@@ -733,11 +737,19 @@
ObjectPtr MatrixDialog::createNewDataMatrix() {
+
+ // wait for the validation thread to finish
+ // should only happen with scripting
+ while (_matrixTab->validating) {
+ usleep(10000);
+ QApplication::processEvents();
+ }
+
const DataSourcePtr dataSource = _matrixTab->dataSource();
- //FIXME better validation than this please...
- if (!dataSource)
+ if (!dataSource) {
return 0;
+ }
const QString field = _matrixTab->field();
const int skip = _matrixTab->skip();
--- branches/work/kst/portto4/kst/src/libkstapp/matrixdialog.h #1254508:1254509
@@ -136,6 +136,8 @@
void enableSingleEditOptions(bool enabled);
void clearTabValues();
+ bool validating;
+
Q_SIGNALS:
void sourceChanged();
@@ -172,8 +174,8 @@
virtual ObjectPtr editExistingDataObject() const;
private:
+ ObjectPtr createNewGeneratedMatrix();
ObjectPtr createNewDataMatrix();
- ObjectPtr createNewGeneratedMatrix();
void configureTab(ObjectPtr vector);
private Q_SLOTS:
More information about the Kst
mailing list