1,994 changes: 365 additions & 1,629 deletions pyKst/pykst.py

Large diffs are not rendered by default.

2,478 changes: 2,478 additions & 0 deletions pyKst/pykst_old.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/datasources/ascii/asciiplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <QButtonGroup>
#include <QPlainTextEdit>
#include <QMessageBox>
QString AsciiPlugin::pluginName() const { return "ASCII File Reader"; }
QString AsciiPlugin::pluginDescription() const { return "ASCII File Reader"; }
QString AsciiPlugin::pluginName() const { return tr("ASCII File Reader"); }
QString AsciiPlugin::pluginDescription() const { return tr("ASCII File Reader"); }


Kst::DataSource *AsciiPlugin::create(Kst::ObjectStore *store, QSettings *cfg,
Expand Down
3 changes: 2 additions & 1 deletion src/datasources/ascii/asciisource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ int AsciiSource::readField(double *v, const QString& field, int s, int n)
_actualField = field;
updateFieldMessage(tr("Reading field: "));

// Debug::trace(QString("AsciiSource::readField() %1 s=%2 n=%3").arg(field.leftJustified(15)).arg(QString("%1").arg(s, 10)).arg(n));
// TODO multi threading problem: could trigger a dead-lock
//Debug::trace(QString("AsciiSource::readField() %1 s=%2 n=%3").arg(field.leftJustified(15)).arg(QString("%1").arg(s, 10)).arg(n));

int read = tryReadField(v, field, s, n);

Expand Down
4 changes: 3 additions & 1 deletion src/datasources/ascii/kstdata_ascii.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Name[es]=Lector de archivos ASCII
Name[fr]=Lecteur de fichier ASCII
Name[hu]=ASCII fájlolvasó
Name[it]=Lettore di file ASCII
Name[nl]=Lezer voor ASCII-bestand
Name[nb]=ASCI filleser
Name[nl]=ASCII File Reader
Name[pl]=Czytnik plików ASCII
Name[pt]=Leitor de Ficheiros ASCII
Name[pt_BR]=Leitor de arquivos ASCII
Expand All @@ -28,6 +29,7 @@ Comment[es]=Implementa la lectura de archivos ASCII en Kst.
Comment[fr]=Implémente la prise en charge de la lecture de fichiers ASCII dans Kst.
Comment[hu]=Támogatást valósít meg az ASCII fájlok olvasásához a Kst-be.
Comment[it]=Implementa il supporto per la lettura di file ASCII con Kst.
Comment[nb]=Legger til støtte for å lese ASCII-filer i Kst.
Comment[nl]=Implementeert ondersteuning voor het lezen van ASCII-bestanden in Kst.
Comment[pl]=Implementuj obsługę odczytu plików ASCII w Kst.
Comment[pt]=Implementa o suporte para ler ficheiros ASCII para o Kst.
Expand Down
5 changes: 3 additions & 2 deletions src/datasources/dirfilesource/dirfilesource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ bool DirFileSource::init() {
Kst::Object::UpdateType DirFileSource::internalDataSourceUpdate() {
int newNF = _dirfile->NFrames();
bool isnew = newNF != _frameCount;

_resetNeeded |= (_frameCount>newNF);

_frameCount = newNF;
Expand Down Expand Up @@ -437,8 +438,8 @@ int DirFileSource::readFieldStrings(QStringList &v, const QString& field, bool i
}


QString DirFilePlugin::pluginName() const { return "DirFile Reader"; }
QString DirFilePlugin::pluginDescription() const { return "DirFile Reader"; }
QString DirFilePlugin::pluginName() const { return tr("DirFile Reader"); }
QString DirFilePlugin::pluginDescription() const { return tr("DirFile Reader"); }


Kst::DataSource *DirFilePlugin::create(Kst::ObjectStore *store,
Expand Down
4 changes: 3 additions & 1 deletion src/datasources/dirfilesource/kstdata_dirfilesource.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Name[de]=DirFile-Leser
Name[es]=Lector DirFile
Name[fr]=Lecteur DirFile
Name[it]=Lettore file .dir
Name[nl]=Lezer van DirFile-bestand
Name[nb]=DirFile-leser
Name[nl]=DirFile Reader
Name[pl]=Czytnik DirFile
Name[pt]=Leitor do 'DirFile'
Name[pt_BR]=Leitor do DirFile
Expand All @@ -26,6 +27,7 @@ Comment[de]=Modul zum Lesen des DirFile-Formats
Comment[es]=Complemento para leer el formato dirfile.
Comment[fr]=Module pour lire le format dirfile.
Comment[it]=Estensione per leggere il formato file .dir.
Comment[nb]=Programtillegg som leser dirfile-formatet.
Comment[nl]=Plugin voor het lezen van het dirfile-formaat.
Comment[pl]=Wtyczka do odczytywania formatu dirfile.
Comment[pt]=Um 'plugin' para ler o formato 'dirfile'.
Expand Down
4 changes: 2 additions & 2 deletions src/datasources/fitsimage/fitsimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ void FitsImageSource::save(QXmlStreamWriter &streamWriter) {
}


QString FitsImagePlugin::pluginName() const { return "FITS Image Source Reader"; }
QString FitsImagePlugin::pluginDescription() const { return "FITS Image Source Reader"; }
QString FitsImagePlugin::pluginName() const { return tr("FITS Image Source Reader"); }
QString FitsImagePlugin::pluginDescription() const { return tr("FITS Image Source Reader"); }


Kst::DataSource *FitsImagePlugin::create(Kst::ObjectStore *store,
Expand Down
6 changes: 4 additions & 2 deletions src/datasources/fitsimage/kstdata_fitsimage.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Name[es]=fitsimage
Name[fr]=fitsimage
Name[hu]=fitsimage
Name[it]=immagine fits
Name[nl]=fitsimage
Name[nb]=fitsimage
Name[nl]=fits-afbeelding
Name[pl]=fitsimage
Name[pt]=Imagem FITS
Name[pt_BR]=Imagem FITS
Expand All @@ -27,7 +28,8 @@ Comment[de]=Modul zum Lesen von FITS-Bildern
Comment[es]=Complemento para leer imágenes FITS.
Comment[fr]=Module pour lire une image FITS.
Comment[it]=Estensione per leggere un'immagine FITS.
Comment[nl]=Plugin voor het lezen van FITS-afbeelding.
Comment[nb]=Programtillegg som leser et FITS-bilde.
Comment[nl]=Plugin voor het inlezen van FITS-afbeeldingen.
Comment[pl]=Wtyczka do odczytywania obrazów FITS.
Comment[pt]=Um 'plugin' para ler uma imagem do FITS.
Comment[pt_BR]=Plugin para ler uma imagem do FITS.
Expand Down
6 changes: 4 additions & 2 deletions src/datasources/matlab/kstdata_matlab.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Name[ca@valencia]=Lector de .mat de Matlab
Name[de]=Matlab-Dateileser-Modul
Name[fr]=Lecteur de *.mat de Matlab
Name[it]=Lettore di file .mat di Matlab
Name[nl]=Lezer voor .mat van Matlab
Name[nb]=Matlabs .mat-leser
Name[nl]=Matlab's .mat reader
Name[pl]=Czytnik Matlabowych .mat
Name[pt]=Leitor de .mat do Matlab
Name[pt_BR]=Leitor de .mat do Matlab
Expand All @@ -23,7 +24,8 @@ Comment[ca@valencia]=Connector de lector de fitxers Matlab pel Kst
Comment[de]=Matlab-Dateileser-Modul für Kst
Comment[fr]=Module de lecture de fichiers Matlab pour Kst
Comment[it]=Estensione del lettore di file Matlab per Kst
Comment[nl]=Plug-in van lezer voor Matlab voor Kst
Comment[nb]=Kst programtillegg som leser Matlab-filer
Comment[nl]=Plugin voor lezen van Matlab-bestanden voor Kst
Comment[pl]=Wtyczka czytnika plików Matlaba dla Kst
Comment[pt]=Um 'plugin' de leitura de ficheiros do Matlab no Kst
Comment[pt_BR]=Plugin para leitura de arquivos do Matlab no Kst
Expand Down
4 changes: 2 additions & 2 deletions src/datasources/matlab/matlab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,8 @@ int MatlabSource::samplesPerFrame(const QString& field) {


// Name used to identify the plugin. Used when loading the plugin.
QString MatlabSourcePlugin::pluginName() const { return "Matlab Datasource Reader"; }
QString MatlabSourcePlugin::pluginDescription() const { return "Matlab's .mat Datasource Reader"; }
QString MatlabSourcePlugin::pluginName() const { return tr("Matlab Datasource Reader"); }
QString MatlabSourcePlugin::pluginDescription() const { return tr("Matlab's .mat Datasource Reader"); }

/**********************
MatlabDatasourcePlugin - This class defines the plugin interface to the DataSource defined by the plugin.
Expand Down
4 changes: 3 additions & 1 deletion src/datasources/netcdf/kstdata_netcdf.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Name[ca@valencia]=Lector de fitxers netCDF
Name[de]=netCDF-Dateileser
Name[fr]=Lecteur de fichier netCDF
Name[it]=Lettore di file netCDF
Name[nl]=Lezer voor netCDF-bestand
Name[nb]=netCDF filleser
Name[nl]=netCDF File Reader
Name[pl]=Czytnik plików netCDF
Name[pt]=Leitor de Ficheiros do netCDF
Name[pt_BR]=Leitor de arquivos do netCDF
Expand All @@ -24,6 +25,7 @@ Comment[ca@valencia]=Implementació que permet llegir fitxers netCDF en el Kst.
Comment[de]=Unterstützung für das Einlesen von netCDF-Dateien in Kst
Comment[fr]=Implémente la prise en charge de la lecture de fichiers netCDF dans Kst.
Comment[it]=Implementa il supporto per la lettura di file netCDF con Kst.
Comment[nb]=Legger til støtte for å lese netCDF-filer i Kst.
Comment[nl]=Implementeert ondersteuning voor het lezen van netCDF-bestanden in Kst.
Comment[pl]=Implementuj obsługę odczytu plików netCDF w Kst.
Comment[pt]=Implementa o suporte para ler os ficheiros do netCDF no Kst.
Expand Down
5 changes: 2 additions & 3 deletions src/datasources/netcdf/netcdfplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
// NetCdfPlugin
//

static const char* plugin_name = "netCDF Reader";
QString NetCdfPlugin::pluginName() const { return plugin_name; }
QString NetCdfPlugin::pluginDescription() const { return plugin_name; }
QString NetCdfPlugin::pluginName() const { return tr("netCDF Reader"); }
QString NetCdfPlugin::pluginDescription() const { return tr("netCDF Reader"); }


Kst::DataSource *NetCdfPlugin::create(Kst::ObjectStore *store,
Expand Down
4 changes: 3 additions & 1 deletion src/datasources/qimagesource/kstdata_qimagesource.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Name[ca@valencia]=Font QImage
Name[de]=QImagesource
Name[fr]=qimagesource
Name[it]=qimagesource
Name[nb]=qimagesource
Name[nl]=qimagesource
Name[pl]=qimagesource
Name[pt]=Fonte QImage
Expand All @@ -24,7 +25,8 @@ Comment[ca@valencia]=Connector per llegir una imatge compatible amb QImage.
Comment[de]=Modul zum Lesen von QImage-kompatiblen Bildern
Comment[fr]=Module pour lire une image compatible qimage.
Comment[it]=Esrensione per leggere un'immagine qimage compatibile.
Comment[nl]=Plug-in voor het lezen van afbeelding compatibel met gimage.
Comment[nb]=Programtillegg som leser et bilde kompatibelt med qimage.
Comment[nl]=Plugin voor het lezen van afbeeldingen die compatibel zijn met gimage.
Comment[pl]=Wtyczka do odczytywania obrazów zgodnych z qimage.
Comment[pt]=Um 'plugin' para ler uma imagem compatível com a QImage.
Comment[pt_BR]=Plugin para ler uma imagem compatível com a QImage.
Expand Down
4 changes: 2 additions & 2 deletions src/datasources/qimagesource/qimagesource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ int QImageSource::readString(QString &S, const QString& string) {
// QImageSourcePlugin
//

QString QImageSourcePlugin::pluginName() const { return "QImage Source Reader"; }
QString QImageSourcePlugin::pluginDescription() const { return "QImage Source Reader"; }
QString QImageSourcePlugin::pluginName() const { return tr("QImage Source Reader"); }
QString QImageSourcePlugin::pluginDescription() const { return tr("QImage Source Reader"); }


Kst::DataSource *QImageSourcePlugin::create(Kst::ObjectStore *store,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Name[ca@valencia]=Plantilla de lector de fitxer
Name[de]=Vorlage für Dateileser
Name[fr]=Modèle de lecteur de fichier
Name[it]=Modello lettore di file
Name[nl]=Sjabloon voor bestandslezer
Name[nb]=Filleser-mal
Name[nl]=File Reader Template
Name[pl]=Szablon czytnika plików
Name[pt]=Modelo de Leitor de Ficheiros
Name[pt_BR]=Modelo de leitor de arquivos
Expand All @@ -24,7 +25,8 @@ Comment[ca@valencia]=Plantilla de codi per un connector de lector de fitxer.
Comment[de]=Quelltext-Vorlage für Dateileser-Module
Comment[fr]=Modèle de code pour un module de lecture de fichiers.
Comment[it]=Modello codice per un'estensione del lettore file.
Comment[nl]=Sjabloon voor code voor plug-in voor bestandslezer.
Comment[nb]=Kodemal for et tillegg som leser filer.
Comment[nl]=Sjabloon voor code voor een plugin voor het lezen van bestanden.
Comment[pl]=Szablon kodu dla wtyczki czytnika plików.
Comment[pt]=Um modelo de código para um 'plugin' de leitura de ficheiros.
Comment[pt_BR]=Modelo de código para um plugin de leitura de arquivos.
Expand Down
4 changes: 2 additions & 2 deletions src/datasources/sampledatasource/sampledatasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ void SampleDatasourceSource::save(QXmlStreamWriter &streamWriter) {


// Name used to identify the plugin. Used when loading the plugin.
QString SampleDatasourcePlugin::pluginName() const { return "Sample Datasource Reader"; }
QString SampleDatasourcePlugin::pluginDescription() const { return "Sample Datasource Reader"; }
QString SampleDatasourcePlugin::pluginName() const { return tr("Sample Datasource Reader"); }
QString SampleDatasourcePlugin::pluginDescription() const { return tr("Sample Datasource Reader"); }

/**********************
SampleDatasourcePlugin - This class defines the plugin interface to the DataSource defined by the plugin.
Expand Down
1 change: 1 addition & 0 deletions src/datasources/sourcelist/kstdata_sourcelist.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Name[ca@valencia]=Llista de fonts de les dades
Name[de]=Datenquellenliste
Name[fr]=Liste de sources de données
Name[it]=Elenco fonte dati
Name[nb]=Datakilde-liste
Name[nl]=Lijst met gegevensbronnen
Name[pl]=Wykaz danych źródłowych
Name[pt]=Lista de Fontes de Dados
Expand Down
4 changes: 2 additions & 2 deletions src/datasources/sourcelist/sourcelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ int SourceListSource::readField(const QString& field, DataVector::ReadInfo& p) {


// Name used to identify the plugin. Used when loading the plugin.
QString SourceListPlugin::pluginName() const { return "Source List Reader"; }
QString SourceListPlugin::pluginDescription() const { return "Source List Reader"; }
QString SourceListPlugin::pluginName() const { return tr("Source List Reader"); }
QString SourceListPlugin::pluginDescription() const { return tr("Source List Reader"); }

/**********************
SourceListPlugin - This class defines the plugin interface to the DataSource defined by the plugin.
Expand Down
1 change: 0 additions & 1 deletion src/kst/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ if(WIN32)
endif()

kst_add_resources(src/images/icons.qrc)
kst_add_resources(src/libkstapp/script.qrc)

kst_find_info_files(KstCMakeFiles ${kst_dir}/cmake/*)
kst_find_info_files(KstCMakeFiles ${kst_dir}/cmake/modules/*)
Expand Down
4 changes: 3 additions & 1 deletion src/kst/kst2.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Name[cs]=Kst2
Name[de]=Kst2
Name[fr]=Kst2
Name[it]=Kst2
Name[nb]=Kst2
Name[nl]=Kst2
Name[pl]=Kst2
Name[pt]=Kst2
Expand All @@ -28,7 +29,8 @@ GenericName[cs]=Prohlížeč dat
GenericName[de]=Daten-Betrachter
GenericName[fr]=Afficheur de données
GenericName[it]=Visore dati
GenericName[nl]=Viewer van gegevens
GenericName[nb]=Dataviser
GenericName[nl]=Bekijken van gegevens
GenericName[pl]=Przeglądarka danych
GenericName[pt]=Visualizador de Dados
GenericName[pt_BR]=Visualizador de dados
Expand Down
4 changes: 3 additions & 1 deletion src/kst/x-kst2.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Name[cs]=Kst2
Name[de]=Kst2
Name[fr]=Kst2
Name[it]=Kst2
Name[nb]=Kst2
Name[nl]=Kst2
Name[pl]=Kst2
Name[pt]=Kst2
Expand All @@ -26,7 +27,8 @@ Comment[cs]=Soubor sezení Kst
Comment[de]=Kst-Sitzungsdatei
Comment[fr]=Fichier de s session Kst
Comment[it]=File di sessione Kst
Comment[nl]=Kst sessiebestand
Comment[nb]=Kst øktfil
Comment[nl]=Sessiebestand in Kst
Comment[pl]=Plik sesji Kst
Comment[pt]=Ficheiro de Sessão do Kst
Comment[pt_BR]=Arquivo de sessão do Kst
Expand Down
11 changes: 10 additions & 1 deletion src/libkst/datamatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "datacollection.h"
#include "debug.h"
#include "objectstore.h"
#include "matrixscriptinterface.h"


// xStart, yStart < 0 count from end
Expand Down Expand Up @@ -85,6 +86,10 @@ void DataMatrix::save(QXmlStreamWriter &xml) {
DataMatrix::~DataMatrix() {
}

ScriptInterface* DataMatrix::createScriptInterface() {
return new MatrixDataSI(this);
}


void DataMatrix::change(DataSourcePtr file, const QString &field,
int xStart, int yStart,
Expand Down Expand Up @@ -677,7 +682,11 @@ QString DataMatrix::descriptionTip() const {
}

QString DataMatrix::propertyString() const {
return tr("%1 of %2", "field %1 from file %2").arg(field()).arg(dataSource()->fileName());
if (dataSource().isPtrValid()) {
return tr("%1 of %2", "field %1 from file %2").arg(field()).arg(dataSource()->fileName());
} else {
return QString();
}
}


Expand Down
2 changes: 2 additions & 0 deletions src/libkst/datamatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class KSTCORE_EXPORT DataMatrix : public Matrix, public DataPrimitive
virtual LabelInfo yLabelInfo() const;
virtual LabelInfo titleInfo() const;

virtual ScriptInterface* createScriptInterface();

protected:
DataMatrix(ObjectStore *store);
virtual ~DataMatrix();
Expand Down
5 changes: 5 additions & 0 deletions src/libkst/datascalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "debug.h"
#include "objectstore.h"
#include "scalarscriptinterface.h"

namespace Kst {

Expand Down Expand Up @@ -57,6 +58,10 @@ const QString& DataScalar::typeString() const {
return staticTypeString;
}

ScriptInterface* DataScalar::createScriptInterface() {
return new ScalarDataSI(this);
}


/** return true if it has a valid file and field, or false otherwise */
bool DataScalar::isValid() const {
Expand Down
2 changes: 2 additions & 0 deletions src/libkst/datascalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class KSTCORE_EXPORT DataScalar : public Scalar, public DataPrimitive
virtual void reset();
void reload();

virtual ScriptInterface* createScriptInterface();

private:
/** make a copy of the DataScalar */
virtual PrimitivePtr makeDuplicate() const;
Expand Down
5 changes: 5 additions & 0 deletions src/libkst/datastring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* *
***************************************************************************/
#include "datastring.h"
#include "stringscriptinterface.h"

#include <QDebug>
#include <QTextDocument>
Expand All @@ -39,6 +40,10 @@ DataString::DataString(ObjectStore *store)
DataString::~DataString() {
}

ScriptInterface* DataString::createScriptInterface() {
return new StringDataSI(this);
}


QString DataString::_automaticDescriptiveName() const {
QString name = _field;
Expand Down
1 change: 1 addition & 0 deletions src/libkst/datastring.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class KSTCORE_EXPORT DataString : public String, public DataPrimitive

bool isValid() const;

virtual ScriptInterface* createScriptInterface();
private:
/** make a copy of the DataString */
virtual PrimitivePtr makeDuplicate() const;
Expand Down
6 changes: 6 additions & 0 deletions src/libkst/datavector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "math_kst.h"
#include "objectstore.h"
#include "updatemanager.h"
#include "vectorscriptinterface.h"

// ReqNF <=0 means read from ReqF0 to end of File
// ReqF0 < means start at EndOfFile-ReqNF.
Expand Down Expand Up @@ -102,6 +103,11 @@ bool DataVector::isValid() const {
}


ScriptInterface* DataVector::createScriptInterface() {
return new VectorDataSI(this);
}


bool DataVector::checkValidity(const DataSourcePtr& ds) const {
if (ds) {
ds->readLock();
Expand Down
2 changes: 2 additions & 0 deletions src/libkst/datavector.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class KSTCORE_EXPORT DataVector : public Vector, public DataPrimitive
/** does the vector represent time? */
virtual bool isTime() const;

virtual ScriptInterface* createScriptInterface();

protected:
DataVector(ObjectStore *store);
virtual ~DataVector();
Expand Down
6 changes: 6 additions & 0 deletions src/libkst/generatedvector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* *
***************************************************************************/
#include "generatedvector.h"
#include "vectorscriptinterface.h"

#include <QDebug>
#include <QXmlStreamWriter>
Expand All @@ -37,6 +38,11 @@ const QString& GeneratedVector::typeString() const {
}


ScriptInterface* GeneratedVector::createScriptInterface() {
return new VectorGenSI(this);
}


void GeneratedVector::save(QXmlStreamWriter &s) {
s.writeStartElement("generatedvector");
s.writeAttribute("min", QString::number(min()));
Expand Down
2 changes: 2 additions & 0 deletions src/libkst/generatedvector.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class KSTCORE_EXPORT GeneratedVector : public Vector {
virtual QString descriptionTip() const;
virtual QString propertyString() const;

virtual ScriptInterface* createScriptInterface();

protected:
GeneratedVector(ObjectStore *store);

Expand Down
132 changes: 132 additions & 0 deletions src/libkst/matrixscriptinterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/***************************************************************************
* *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "matrixscriptinterface.h"

#include "objectstore.h"
#include "datasourcepluginmanager.h"
#include "updatemanager.h"
#include "updateserver.h"

#include <QStringBuilder>


namespace Kst {

QString doMatrixScriptCommand(QString command,Matrix *matrix) {

QString v=ScriptInterface::doNamedObjectCommand(command, matrix);
if (!v.isEmpty()) {
return v;
}

if (command.startsWith("value(")) {
command.remove("value(").chop(1);
QStringList p = command.split(',');
return QString::number(matrix->value(p[0].toDouble(), p[1].toDouble()));
} else if (command.startsWith("length(")) {
return QString::number(matrix->sampleCount());
} else if (command.startsWith("min(")) {
return QString::number(matrix->minValue());
} else if (command.startsWith("max(")) {
return QString::number(matrix->maxValue());
} else if (command.startsWith("mean(")) {
return QString::number(matrix->meanValue());
} else if (command.startsWith("width(")) {
return QString::number(matrix->xNumSteps());
} else if (command.startsWith("height(")) {
return QString::number(matrix->yNumSteps());
} else if (command.startsWith("dX(")) {
return QString::number(matrix->xStepSize());
} else if (command.startsWith("dY(")) {
return QString::number(matrix->yStepSize());
} else if (command.startsWith("minX(")) {
return QString::number(matrix->minX());
} else if (command.startsWith("minY(")) {
return QString::number(matrix->minY());
} else if (command.startsWith("descriptionTip(")) {
return matrix->descriptionTip();
}

return QString();
}


/******************************************************/
/* Data Matrixs */
/******************************************************/
MatrixDataSI::MatrixDataSI(DataMatrixPtr it) {
matrix=it;
}

QString MatrixDataSI::doCommand(QString command) {

QString v=doMatrixScriptCommand(command, matrix);
if (!v.isEmpty()) {
return v;
}


if (command.startsWith(QLatin1String("change("))) {
command.remove("change(").remove(')');
QStringList p = command.split(',');
DataSourcePtr ds = DataSourcePluginManager::findOrLoadSource(
matrix->store(), p.at(0));

matrix->writeLock();
matrix->change(ds,
p.at(1), // field
p.at(2).toInt(), // x start
p.at(3).toInt(), // y start
p.at(4).toInt(), // num x steps
p.at(5).toInt(), // num y steps

false, false, 0,

p.at(6).toDouble(), // min x
p.at(7).toDouble(), // min y
p.at(8).toDouble(), // step x
p.at(9).toDouble() // step y
);
matrix->unlock();
return "Done";
} else if (command.startsWith("field(")) {
return matrix->field();
} else if (command.startsWith("filename(")) {
return matrix->filename();
} else if (command.startsWith("startX(")) {
return QString::number(matrix->reqXStart());
} else if (command.startsWith("startY(")) {
return QString::number(matrix->reqYStart());
}

return "No such command";
}

bool MatrixDataSI::isValid() {
return matrix.isPtrValid();
}

ScriptInterface* MatrixDataSI::newMatrix(ObjectStore *store) {
DataMatrixPtr matrix;
matrix = store->createObject<DataMatrix>();
return new MatrixDataSI(matrix);
}

QByteArray MatrixDataSI::endEditUpdate() {
matrix->registerChange();
UpdateManager::self()->doUpdates(true);
UpdateServer::self()->requestUpdateSignal();
return ("Finished editing "+matrix->Name()).toLatin1();
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/***************************************************************************
* *
* copyright : (C) 2011 Joshua Netterfield *
* joshua.netterfield@gmail.com *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand All @@ -10,8 +10,28 @@
* *
***************************************************************************/

#ifndef MATRIXSCRIPTINTERFACE_H
#define MATRIXSCRIPTINTERFACE_H

#include <QString>

#include "scriptinterface.h"
#include "datamatrix.h"

namespace Kst {

class KSTCORE_EXPORT MatrixDataSI : public ScriptInterface
{
Q_OBJECT
DataMatrixPtr matrix;
public:
explicit MatrixDataSI(DataMatrixPtr it);
QString doCommand(QString);
bool isValid();
QByteArray endEditUpdate();

static ScriptInterface* newMatrix(ObjectStore *store);
};

}
#endif // MATRIXSCRIPTINTERFACE_H
14 changes: 13 additions & 1 deletion src/libkst/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "object.h"

class ScriptInterface;

#include "objectstore.h"

Expand All @@ -26,7 +27,7 @@ const QString Object::staticTypeString = "Object";

Object::Object() :
Shared(), KstRWLock(), NamedObject(),
_store(0L), _serial(0), _serialOfLastChange(0)
_store(0L), _serial(0), _serialOfLastChange(0), _interface(0)
{
}

Expand All @@ -47,6 +48,17 @@ const QString& Object::typeString() const {
return staticTypeString;
}

ScriptInterface* Object::createScriptInterface() {
return NULL;
}

ScriptInterface* Object::scriptInterface() {
if (!_interface) {
_interface = createScriptInterface();
}
return _interface;
}


// Returns count - 1 to account for "this" and the list pointer, therefore
// you MUST have a reference-counted pointer to call this function
Expand Down
7 changes: 7 additions & 0 deletions src/libkst/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace Kst {

class ObjectStore;
class Object;
class ScriptInterface;

typedef SharedPtr<Object> ObjectPtr;

Expand Down Expand Up @@ -77,6 +78,9 @@ class KSTCORE_EXPORT Object : public QObject, public Shared, public KstRWLock, p

virtual bool uses(ObjectPtr p) const;

virtual ScriptInterface* createScriptInterface();
ScriptInterface *scriptInterface();

protected:
Object();
virtual ~Object();
Expand All @@ -90,6 +94,9 @@ class KSTCORE_EXPORT Object : public QObject, public Shared, public KstRWLock, p
qint64 _serial;
qint64 _serialOfLastChange;
bool _used;
private:
ScriptInterface *_interface;

signals:
void dirty();
};
Expand Down
5 changes: 5 additions & 0 deletions src/libkst/scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
***************************************************************************/

#include "scalar.h"
#include "scalarscriptinterface.h"

#include <QDebug>
#include <QTextDocument>
Expand Down Expand Up @@ -52,6 +53,10 @@ const QString& Scalar::typeString() const {
return staticTypeString;
}

ScriptInterface* Scalar::createScriptInterface() {
return new ScalarGenSI(this);
}


void Scalar::internalUpdate() {
// do nothing
Expand Down
1 change: 1 addition & 0 deletions src/libkst/scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class KSTCORE_EXPORT Scalar : public Primitive

virtual ObjectList<Primitive> outputPrimitives() const { return ObjectList<Primitive>(); }
virtual PrimitiveMap metas() const { return PrimitiveMap(); }
virtual ScriptInterface* createScriptInterface();

public slots:
double value() const;
Expand Down
170 changes: 170 additions & 0 deletions src/libkst/scalarscriptinterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
/***************************************************************************
* *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "scalarscriptinterface.h"

#include "objectstore.h"
#include "datasourcepluginmanager.h"
#include "updatemanager.h"
#include "updateserver.h"

#include <QStringBuilder>


namespace Kst {

/******************************************************/
/* Generated Scalars */
/******************************************************/
ScalarGenSI::ScalarGenSI(ScalarPtr it) {
scalar=it;
}

QString ScalarGenSI::doCommand(QString x) {

QString v=doNamedObjectCommand(x, scalar);
if (!v.isEmpty()) {
return v;
}

if (x.startsWith(QLatin1String("setValue("))) {
scalar->writeLock();
scalar->setValue(x.remove("setValue(").remove(')').toDouble());
scalar->unlock();
return "Done";
} else if (x.startsWith(QLatin1String("value()"))) {
return QString::number(scalar->value());
}
return "No such command";
}

bool ScalarGenSI::isValid() {
return scalar.isPtrValid();
}

ScriptInterface* ScalarGenSI::newScalar(ObjectStore *store) {
ScalarPtr scalar;
scalar = store->createObject<Scalar>();
scalar->setOrphan(true);
scalar->setEditable(true);
return new ScalarGenSI(scalar);
}

QByteArray ScalarGenSI::endEditUpdate() {
UpdateManager::self()->doUpdates(true);
UpdateServer::self()->requestUpdateSignal();
return ("Finished editing "+scalar->Name()).toLatin1();
}

/******************************************************/
/* Data Scalars */
/******************************************************/
ScalarDataSI::ScalarDataSI(DataScalarPtr it) {
scalar=it;
}

QString ScalarDataSI::doCommand(QString x) {

QString v=doNamedObjectCommand(x, scalar);
if (!v.isEmpty()) {
return v;
}

if (x.startsWith(QLatin1String("change("))) {
x.remove("change(").remove(')');
QStringList p = x.split(',');
DataSourcePtr ds = DataSourcePluginManager::findOrLoadSource(
scalar->store(), p.at(0));
scalar->writeLock();
scalar->change(ds,p.at(1));
scalar->unlock();
return "Done";
} else if (x.startsWith(QLatin1String("file()"))) {
return scalar->filename();
} else if (x.startsWith(QLatin1String("field()"))) {
return scalar->field();
} else if (x.startsWith(QLatin1String("value()"))) {
return QString::number(scalar->value());
}
return "No such command";
}

bool ScalarDataSI::isValid() {
return scalar.isPtrValid();
}

ScriptInterface* ScalarDataSI::newScalar(ObjectStore *store) {
DataScalarPtr scalar;
scalar = store->createObject<DataScalar>();
return new ScalarDataSI(scalar);
}

QByteArray ScalarDataSI::endEditUpdate() {
scalar->registerChange();
UpdateManager::self()->doUpdates(true);
UpdateServer::self()->requestUpdateSignal();
return ("Finished editing "+scalar->Name()).toLatin1();
}

/******************************************************/
/* Vector Scalars */
/******************************************************/
ScalarVectorSI::ScalarVectorSI(VScalarPtr it) {
scalar=it;
}

QString ScalarVectorSI::doCommand(QString x) {

QString v=doNamedObjectCommand(x, scalar);
if (!v.isEmpty()) {
return v;
}

if (x.startsWith(QLatin1String("change("))) {
x.remove("change(").remove(')');
QStringList p = x.split(',');
DataSourcePtr ds = DataSourcePluginManager::findOrLoadSource(
scalar->store(), p.at(0));
scalar->writeLock();
scalar->change(ds,p.at(1), p.at(2).toInt());
scalar->unlock();
return "Done";
} else if (x.startsWith(QLatin1String("value()"))) {
return QString::number(scalar->value());
} else if (x.startsWith(QLatin1String("file()"))) {
return scalar->filename();
} else if (x.startsWith(QLatin1String("field()"))) {
return scalar->field();
} else if (x.startsWith(QLatin1String("frame()"))) {
return QString::number(scalar->F0());
}
return "No such command";
}

bool ScalarVectorSI::isValid() {
return scalar.isPtrValid();
}

ScriptInterface* ScalarVectorSI::newScalar(ObjectStore *store) {
VScalarPtr scalar;
scalar = store->createObject<VScalar>();
return new ScalarVectorSI(scalar);
}

QByteArray ScalarVectorSI::endEditUpdate() {
scalar->registerChange();
UpdateManager::self()->doUpdates(true);
UpdateServer::self()->requestUpdateSignal();
return ("Finished editing "+scalar->Name()).toLatin1();
}

}
69 changes: 69 additions & 0 deletions src/libkst/scalarscriptinterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/***************************************************************************
* *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef SCALARSCRIPTINTERFACE_H
#define SCALARSCRIPTINTERFACE_H

#include <QString>

#include "scriptinterface.h"
#include "datascalar.h"
#include "vscalar.h"

namespace Kst {

class KSTCORE_EXPORT ScalarGenSI : public ScriptInterface
{
Q_OBJECT
ScalarPtr scalar;
public:
explicit ScalarGenSI(ScalarPtr it);
QString doCommand(QString);
bool isValid();
QByteArray endEditUpdate();

static ScriptInterface* newScalar(ObjectStore *store);

};


class KSTCORE_EXPORT ScalarDataSI : public ScriptInterface
{
Q_OBJECT
DataScalarPtr scalar;
public:
explicit ScalarDataSI(DataScalarPtr it);
QString doCommand(QString);
bool isValid();
QByteArray endEditUpdate();

static ScriptInterface* newScalar(ObjectStore *store);

};


class KSTCORE_EXPORT ScalarVectorSI : public ScriptInterface
{
Q_OBJECT
VScalarPtr scalar;
public:
explicit ScalarVectorSI(VScalarPtr it);
QString doCommand(QString);
bool isValid();
QByteArray endEditUpdate();

static ScriptInterface* newScalar(ObjectStore *store);

};

}
#endif // SCALARSCRIPTINTERFACE_H
53 changes: 53 additions & 0 deletions src/libkst/scriptinterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/***************************************************************************
* *
* copyright : (C) 2011 Joshua Netterfield *
* joshua.netterfield@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "scriptinterface.h"

#include "namedobject.h"

#include <QStringList>

namespace Kst {

QString ScriptInterface::doNamedObjectCommand(QString command, NamedObject *n) {
if (command.startsWith("setName(")) {
command.remove("setName(").chop(1);
n->setDescriptiveName(command);
return QString("Done");
} else if (command.startsWith("name(")) {
return n->Name();
}

return QString();
}

// convenience functions... for parsing commands.
QStringList ScriptInterface::getArgs(const QString &command) {
int i0 = command.indexOf('(')+1;
int i1 = command.lastIndexOf(')');
int n = i1-i0;

QString x = command.mid(i0,n);
return x.split(',');
}

QString ScriptInterface::getArg(const QString &command) {
int i0 = command.indexOf('(')+1;
int i1 = command.lastIndexOf(')');
int n = i1-i0;

QString x = command.mid(i0,n);
return x;

}

}
35 changes: 10 additions & 25 deletions src/libkstapp/scriptinterface.h → src/libkst/scriptinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,31 @@
#include <QString>
#include <QList>
#include <QObject>

#include "kst_export.h"

typedef QList<QByteArray> QByteArrayList;

namespace Kst {

class NamedObject;

/** A script interface represents an object exposed through the scripting interface.
* (ex., dialog, primitive, etc.)
*/
class ScriptInterface : public QObject
class KSTCORE_EXPORT ScriptInterface : public QObject
{
Q_OBJECT
public:
virtual QByteArrayList commands()=0;
virtual QString doCommand(QString)=0;
virtual bool isValid()=0;
virtual QByteArray getHandle()=0;
virtual void endEditUpdate()=0;
};
virtual QByteArray endEditUpdate()=0;
static QString doNamedObjectCommand(QString command, NamedObject *n);

/** Enables recursive if statements in scripting. The syntax for if statements is 'if(...)' to begin a statement and 'fi()' to end.*/
struct IfSI {
IfSI* parent;
bool on;
int recurse;
IfSI(IfSI*p,bool isTrue) : parent(p),on(isTrue),recurse(0) {}
};

/** Enables variables in scripting. Variables begin with the prefix '$' */
struct VarSI {
QByteArray handle;
QByteArray val;
VarSI(QByteArray v,QByteArray e) : handle(v), val(e) {}
};
QStringList getArgs(const QString &command);
QString getArg(const QString &command);

/** Enables macros (lists of commands to be executed) in scripting. Macro names begin with the prefix '#' */
struct MacroSI {
MacroSI* parent;
QByteArray handle;
QByteArrayList args;
QByteArrayList commands;
MacroSI(MacroSI*p,QByteArray h,QByteArrayList v,QByteArrayList c) : parent(p), handle(h), args(v), commands(c) {}
};

}
Expand Down
7 changes: 7 additions & 0 deletions src/libkst/string_kst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
***************************************************************************/

#include "string_kst.h"
#include "stringscriptinterface.h"

#include <QTextDocument>
#include <QXmlStreamWriter>
Expand All @@ -34,6 +35,12 @@ String::String(ObjectStore *store)

}


ScriptInterface* String::createScriptInterface() {
return new StringGenSI(this);
}


void String::_initializeShortName() {
_shortName = 'T'+QString::number(_tnum);
if (_tnum>max_tnum)
Expand Down
4 changes: 4 additions & 0 deletions src/libkst/string_kst.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class QXmlStreamWriter;

namespace Kst {

class ScriptInterface;

class KSTCORE_EXPORT String : public Primitive
{
Q_OBJECT
Expand All @@ -38,6 +40,8 @@ class KSTCORE_EXPORT String : public Primitive
virtual QString sizeString() const;
virtual QString propertyString() const;

virtual ScriptInterface* createScriptInterface();

protected:
String(ObjectStore *store);

Expand Down
109 changes: 109 additions & 0 deletions src/libkst/stringscriptinterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/***************************************************************************
* *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "stringscriptinterface.h"

#include "objectstore.h"
#include "datasourcepluginmanager.h"
#include "updatemanager.h"
#include "updateserver.h"

#include <QStringBuilder>

namespace Kst {

StringGenSI::StringGenSI(StringPtr it) {
str=it;
}

QString StringGenSI::doCommand(QString x) {

QString v=doNamedObjectCommand(x, str);
if (!v.isEmpty()) {
return v;
}

if (x.startsWith(QLatin1String("setValue("))) {
str->writeLock();
str->setValue(x.remove("setValue(").remove(')'));
str->unlock();
return "Done";
} else if (x.startsWith(QLatin1String("value()"))) {
return str->value();
}
return "No such command";
}

bool StringGenSI::isValid() {
return str.isPtrValid();
}

ScriptInterface* StringGenSI::newString(ObjectStore *store) {
StringPtr string;
string = store->createObject<String>();
string->setOrphan(true);
string->setEditable(true);
return new StringGenSI(string);
}

QByteArray StringGenSI::endEditUpdate() {
UpdateManager::self()->doUpdates(true);
UpdateServer::self()->requestUpdateSignal();
return ("Finished editing "+str->Name()).toLatin1();
}

/////////////////////////////////////////////////////////////////////////////////////

StringDataSI::StringDataSI(DataStringPtr it) {
str=it;
}

QString StringDataSI::doCommand(QString x) {

QString v=doNamedObjectCommand(x, str);
if (!v.isEmpty()) {
return v;
}

if(x.startsWith(QLatin1String("change("))) {
x.remove("change(").remove(')');
QStringList p = x.split(',');
DataSourcePtr ds = DataSourcePluginManager::findOrLoadSource(
str->store(), p.at(0));
str->writeLock();
str->change(ds,p.at(1));
str->unlock();
return "Done";
} else if (x.startsWith(QLatin1String("value()"))) {
return str->value();
}
return "No such command";
}

bool StringDataSI::isValid() {
return str.isPtrValid();
}

ScriptInterface* StringDataSI::newString(ObjectStore *store) {
DataStringPtr string;
string = store->createObject<DataString>();

return new StringDataSI(string);
}

QByteArray StringDataSI::endEditUpdate() {
UpdateManager::self()->doUpdates(true);
UpdateServer::self()->requestUpdateSignal();
return ("Finished editing "+str->Name()).toLatin1();
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/***************************************************************************
* *
* copyright : (C) 2011 Joshua Netterfield *
* joshua.netterfield@gmail.com *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand All @@ -13,30 +13,39 @@
#ifndef STRINGSCRIPTINTERFACE_H
#define STRINGSCRIPTINTERFACE_H

#include <QByteArray>
#include <QString>
#include <QList>
#include <QObject>

#include "scriptinterface.h"
#include "string_kst.h"
#include "updatemanager.h"
#include "updateserver.h"
typedef QList<QByteArray> QByteArrayList;
#include "datastring.h"

namespace Kst {

class StringGenSI : public ScriptInterface
class KSTCORE_EXPORT StringGenSI : public ScriptInterface
{
Q_OBJECT
StringPtr str;
public:
explicit StringGenSI(StringPtr it);
QByteArrayList commands();
QString doCommand(QString);
bool isValid();
QByteArray getHandle();
void endEditUpdate() { UpdateManager::self()->doUpdates(true); UpdateServer::self()->requestUpdateSignal();}
QByteArray endEditUpdate();

static ScriptInterface* newString(ObjectStore *store);

};

class KSTCORE_EXPORT StringDataSI : public ScriptInterface
{
Q_OBJECT
DataStringPtr str;
public:
explicit StringDataSI(DataStringPtr it);
QString doCommand(QString);
bool isValid();
QByteArray endEditUpdate();

static ScriptInterface* newString(ObjectStore *store);

};

}
Expand Down
165 changes: 165 additions & 0 deletions src/libkst/vectorscriptinterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/***************************************************************************
* *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "vectorscriptinterface.h"

#include "objectstore.h"
#include "datasourcepluginmanager.h"
#include "updatemanager.h"
#include "updateserver.h"

#include <QStringBuilder>


namespace Kst {

QString doVectorScriptCommand(QString command,Vector *vector) {

QString v=ScriptInterface::doNamedObjectCommand(command, vector);
if (!v.isEmpty()) {
return v;
}

if (command.startsWith("value(")) {
command.remove("value(").chop(1);
return QString::number(vector->value(command.toInt()));
} else if (command.startsWith("length(")) {
return QString::number(vector->length());
} else if (command.startsWith("min(")) {
return QString::number(vector->min());
} else if (command.startsWith("max(")) {
return QString::number(vector->max());
} else if (command.startsWith("mean(")) {
return QString::number(vector->mean());
} else if (command.startsWith("descriptionTip(")) {
return vector->descriptionTip();
}

return QString();
}


/******************************************************/
/* Data Vectors */
/******************************************************/
VectorDataSI::VectorDataSI(DataVectorPtr it) {
vector=it;
}

QString VectorDataSI::doCommand(QString command) {

QString v=doVectorScriptCommand(command, vector);
if (!v.isEmpty()) {
return v;
}

if (command.startsWith(QLatin1String("change("))) {
command.remove("change(").remove(')');
QStringList p = command.split(',');
DataSourcePtr ds = DataSourcePluginManager::findOrLoadSource(
vector->store(), p.at(0));
vector->writeLock();
vector->change(ds,
p.at(1), // field
p.at(2).toInt(), // f0
p.at(3).toInt(), // n
p.at(4).toInt(), // skip
p.at(4).toInt() > 0, // do skip
p.at(5) == "True" // do average
);
vector->unlock();
return "Done";
} else if (command.startsWith("field(")) {
return vector->field();
} else if (command.startsWith("filename(")) {
return vector->filename();
} else if (command.startsWith("start(")) {
return QString::number(vector->startFrame());
} else if (command.startsWith("NFrames(")) {
return QString::number(vector->numFrames());
} else if (command.startsWith("skip(")) {
return QString::number(vector->skip());
} else if (command.startsWith("boxcarFirst(")) {
return vector->doAve()?"True":"False";
}

return "No such command";
}

bool VectorDataSI::isValid() {
return vector.isPtrValid();
}

ScriptInterface* VectorDataSI::newVector(ObjectStore *store) {
DataVectorPtr vector;
vector = store->createObject<DataVector>();
return new VectorDataSI(vector);
}

QByteArray VectorDataSI::endEditUpdate() {
vector->registerChange();
UpdateManager::self()->doUpdates(true);
UpdateServer::self()->requestUpdateSignal();
return ("Finished editing "+vector->Name()).toLatin1();
}

/******************************************************/
/* Generated Vectors */
/******************************************************/
VectorGenSI::VectorGenSI(GeneratedVectorPtr it) {
vector=it;
}

QString VectorGenSI::doCommand(QString command) {

QString v=doVectorScriptCommand(command, vector);
if (!v.isEmpty()) {
return v;
}

if (command.startsWith(QLatin1String("change("))) {
command.remove("change(").remove(')');
QStringList p = command.split(',');

vector->writeLock();

vector->changeRange(
p.at(0).toDouble(), // start
p.at(1).toDouble(), // end
p.at(2).toInt() // number of points
);
vector->unlock();
return "Done";
}

return "No such command";
}

bool VectorGenSI::isValid() {
return vector.isPtrValid();
}

ScriptInterface* VectorGenSI::newVector(ObjectStore *store) {
GeneratedVectorPtr vector;
vector = store->createObject<GeneratedVector>();
return new VectorGenSI(vector);
}

QByteArray VectorGenSI::endEditUpdate() {
vector->registerChange();
UpdateManager::self()->doUpdates(true);
UpdateServer::self()->requestUpdateSignal();
return ("Finished editing "+vector->Name()).toLatin1();
}


}
51 changes: 51 additions & 0 deletions src/libkst/vectorscriptinterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/***************************************************************************
* *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef VECTORSCRIPTINTERFACE_H
#define VECTORSCRIPTINTERFACE_H

#include <QString>

#include "scriptinterface.h"
#include "datavector.h"
#include "generatedvector.h"

namespace Kst {

class KSTCORE_EXPORT VectorDataSI : public ScriptInterface
{
Q_OBJECT
DataVectorPtr vector;
public:
explicit VectorDataSI(DataVectorPtr it);
QString doCommand(QString);
bool isValid();
QByteArray endEditUpdate();

static ScriptInterface* newVector(ObjectStore *store);
};

class KSTCORE_EXPORT VectorGenSI : public ScriptInterface
{
Q_OBJECT
GeneratedVectorPtr vector;
public:
explicit VectorGenSI(GeneratedVectorPtr it);
QString doCommand(QString);
bool isValid();
QByteArray endEditUpdate();

static ScriptInterface* newVector(ObjectStore *store);
};

}
#endif // VECTORSCRIPTINTERFACE_H
5 changes: 5 additions & 0 deletions src/libkst/vscalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "debug.h"
#include "objectstore.h"
#include "updatemanager.h"
#include "vscalar.h"
#include "scalarscriptinterface.h"

namespace Kst {

Expand Down Expand Up @@ -56,6 +58,9 @@ const QString& VScalar::typeString() const {
return staticTypeString;
}

ScriptInterface* VScalar::createScriptInterface() {
return new ScalarVectorSI(this);
}

void VScalar::change(DataSourcePtr in_file, const QString &in_field, int in_f0) {
Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);
Expand Down
2 changes: 2 additions & 0 deletions src/libkst/vscalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class KSTCORE_EXPORT VScalar : public Scalar {

virtual QString propertyString() const;

virtual ScriptInterface* createScriptInterface();

private:
/** file to read for rvectors */
DataSourcePtr _file;
Expand Down
4 changes: 2 additions & 2 deletions src/libkstapp/aboutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ AboutDialog::AboutDialog(QWidget *parent)
authors.replaceInStrings(QRegExp("^(.*)"), "<li>\\1</li>");

QStringList msg = QStringList()
<< tr("<qt><h2>Kst "KSTVERSION" - A data viewing program.</h2>")
<< tr("<qt><h2>Kst %1 - A data viewing program.</h2>").arg(KSTVERSION)
#ifdef KST_REVISION
<< tr("Revision "KST_REVISION"<br><hr>")
<< tr("Revision %1<br><hr>").arg(KST_REVISION)
#endif
<< tr("Copyright &copy; 2000-2014 Barth Netterfield<br><hr>")
<< tr("Homepage: <a href=\"http://kst-plot.kde.org/\">http://kst-plot.kde.org/</a><br>")
Expand Down
4 changes: 2 additions & 2 deletions src/libkstapp/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "datasource.h"
#include "dialogdefaults.h"
#include "datasourcepluginmanager.h"
#include "dialogscriptinterface.h"
//#include "dialogscriptinterface.h"
#include "settings.h"

#include <QIcon>
Expand Down Expand Up @@ -55,7 +55,7 @@ Application::Application(int &argc, char **argv)
DialogLauncher::replaceSelf(new DialogLauncherGui);

//Also give us dialog-script scripting functionality
DialogLauncherSI::self = new DialogLauncherSI;
//DialogLauncherSI::self = new DialogLauncherSI;

//_mainWindow->show();
//_mainWindow->hide();
Expand Down
6 changes: 6 additions & 0 deletions src/libkstapp/arrowitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include "math_kst.h"

#include "arrowscriptinterface.h"

#include <debug.h>

#include <QDebug>
Expand Down Expand Up @@ -47,6 +49,10 @@ ArrowItem::ArrowItem(View *parent)
ArrowItem::~ArrowItem() {
}

ScriptInterface* ArrowItem::createScriptInterface() {
return new ArrowSI(this);
}


void ArrowItem::paint(QPainter *painter) {
painter->drawLine(line());
Expand Down
4 changes: 4 additions & 0 deletions src/libkstapp/arrowitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

namespace Kst {

class ScriptInterface;

class ArrowItem : public LineItem
{
Q_OBJECT
Expand Down Expand Up @@ -52,6 +54,8 @@ class ArrowItem : public LineItem
virtual bool customDimensionsTab() {return true;}
void applyDialogDefaultsHeads();

virtual ScriptInterface *createScriptInterface();

public Q_SLOTS:
virtual void edit();

Expand Down
15 changes: 6 additions & 9 deletions src/libkstapp/arrowscriptinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ ArrowSI::ArrowSI(ArrowItem *it) : _dim(new DimensionTabSI), _fill(new FillTabSI)
_arrow->item=it;
}

QByteArrayList ArrowSI::commands() {
return _dim->commands()<<_fill->commands()<<_stroke->commands()<<_arrow->commands();
}

QString ArrowSI::doCommand(QString x) {
QString v =_dim->doCommand(x);

QString v=doNamedObjectCommand(x, _dim->item);

if(v.isEmpty()) {
v =_dim->doCommand(x);
}
if(v.isEmpty()) {
v=_fill->doCommand(x);
}
Expand All @@ -72,10 +73,6 @@ bool ArrowSI::isValid() {
return _dim->item;
}

QByteArray ArrowSI::getHandle() {
return ("Finished editing "%_dim->item->Name()).toLatin1();
}

ScriptInterface* ArrowSI::newArrow() {
ArrowItem* bi=new ArrowItem(kstApp->mainWindow()->tabWidget()->currentView());
kstApp->mainWindow()->tabWidget()->currentView()->scene()->addItem(bi);
Expand Down
4 changes: 1 addition & 3 deletions src/libkstapp/arrowscriptinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ class ArrowSI : public ScriptInterface
Q_OBJECT
public:
explicit ArrowSI(ArrowItem* it);
QByteArrayList commands();
QString doCommand(QString);
bool isValid();
QByteArray getHandle();
void endEditUpdate() {if (_dim->item) _dim->item->update();}
QByteArray endEditUpdate() {if (_dim->item) _dim->item->update();return ("Finished editing "+_dim->item->Name()).toLatin1();}

static ScriptInterface* newArrow();

Expand Down
2 changes: 1 addition & 1 deletion src/libkstapp/baddatasourcedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ BadDatasourceDialog::BadDatasourceDialog(QString *filename, ObjectStore *store,
connect(_skip, SIGNAL(clicked()), this, SLOT(skip()));
connect(_change, SIGNAL(clicked()), this, SLOT(change()));

_label->setText(*filename + tr(": File not found. "));
_label->setText(tr("%1: File not found. ").arg(*filename));
_url->setFile(*filename);
filename->clear();
QApplication::restoreOverrideCursor();
Expand Down
4 changes: 2 additions & 2 deletions src/libkstapp/basicplugindialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ BasicPluginDialog::BasicPluginDialog(QString& pluginName, ObjectPtr dataObject,

QString title;
if (editMode() == Edit)
title = tr("Edit ") + pluginName + tr(" Plugin");
title = tr("Edit %1 Plugin", "arg1 is a plugin name").arg(pluginName);
else
title = tr("New ") + pluginName + tr(" Plugin");
title = tr("New %1 Plugin", "arg1 is a plugin name").arg(pluginName);
setWindowTitle(title);

_basicPluginTab = new BasicPluginTab(pluginName, this);
Expand Down
6 changes: 3 additions & 3 deletions src/libkstapp/datawizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void DataWizardPageVectors::updateVectors() {
_vectorsToPlot->clear();

_vectors->addItems(((DataWizard*)wizard())->dataSourceFieldList());
_availableLabel->setText(QString::number(_vectors->count()) + tr(" vector(s) available"));
_availableLabel->setText(tr("%1 vector(s) available").arg(_vectors->count()));
}


Expand All @@ -243,7 +243,7 @@ void DataWizardPageVectors::remove() {
}
_vectors->clearSelection();

_selectedLabel->setText(QString::number(_vectorsToPlot->count()) + tr(" vector(s) selected"));
_selectedLabel->setText(tr("%1 vector(s) selected").arg(_vectorsToPlot->count()));

emit completeChanged();
}
Expand All @@ -259,7 +259,7 @@ void DataWizardPageVectors::add() {
}

_vectorsToPlot->setCurrentRow(_vectorsToPlot->count() - 1);
_selectedLabel->setText(QString::number(_vectorsToPlot->count()) + tr(" vector(s) selected"));
_selectedLabel->setText(tr("%1 vector(s) selected").arg(_vectorsToPlot->count()));
emit completeChanged();
}

Expand Down
895 changes: 0 additions & 895 deletions src/libkstapp/dialogscriptinterface.cpp

This file was deleted.

169 changes: 0 additions & 169 deletions src/libkstapp/dialogscriptinterface.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/libkstapp/filterfitdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ FilterFitDialog::FilterFitDialog(QString& pluginName, ObjectPtr dataObject, QWid

QString title;
if (editMode() == Edit)
title = tr("Edit ") + pluginName + tr(" Plugin");
title = tr("Edit %1 Plugin", "Arg1 is a plugin").arg(pluginName);
else
title = tr("New ") + pluginName + tr(" Plugin");
title = tr("New %1 Plugin", "Arg1 is a plugin").arg(pluginName);
setWindowTitle(title);

_filterFitTab = new FilterFitTab(pluginName, this);
Expand Down
713 changes: 0 additions & 713 deletions src/libkstapp/kstScript.txt

This file was deleted.

7 changes: 7 additions & 0 deletions src/libkstapp/labelitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "plotitem.h"
#include "cartesianrenderitem.h"

#include "labelscriptinterface.h"

#include <QDebug>
#include <QInputDialog>
#include <QGraphicsItem>
Expand All @@ -42,6 +44,11 @@ LabelItem::LabelItem(View *parent, const QString& txt)
applyDefaults();
}

ScriptInterface* LabelItem::createScriptInterface() {
return new LabelSI(this);
}


bool LabelItem::inputsChanged(qint64 serial) {
bool no_change = true;

Expand Down
3 changes: 3 additions & 0 deletions src/libkstapp/labelitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ namespace Label {

namespace Kst {

class ScriptInterface;

class LabelItem : public ViewItem {
Q_OBJECT
public:
Expand Down Expand Up @@ -71,6 +73,7 @@ class LabelItem : public ViewItem {

bool inputsChanged(qint64 serial);

virtual ScriptInterface *createScriptInterface();
public Q_SLOTS:
virtual void edit();
void setDirty() { _dirty = true; }
Expand Down
29 changes: 13 additions & 16 deletions src/libkstapp/labelscriptinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,26 @@ LabelSI::LabelSI(LabelItem *it) : layout(new LayoutTabSI), dim(new DimensionTabS
lab->item=it;
}

QByteArrayList LabelSI::commands() {
return layout->commands()<<dim->commands()<<lab->commands();
}

QString LabelSI::doCommand(QString x) {
QString v=layout->doCommand(x);
if(v.isEmpty()) {
v=dim->doCommand(x);
}
if(v.isEmpty()) {
v=lab->doCommand(x);
}
return v.isEmpty()?"No command":v;

QString v=doNamedObjectCommand(x, dim->item);

if (v.isEmpty()) {
v=layout->doCommand(x);
}
if (v.isEmpty()) {
v=dim->doCommand(x);
}
if (v.isEmpty()) {
v=lab->doCommand(x);
}
return v.isEmpty()?"No command":v;
}

bool LabelSI::isValid() {
return dim->item;
}

QByteArray LabelSI::getHandle() {
return ("Finished editing "%dim->item->Name()).toLatin1();
}

ScriptInterface* LabelSI::newLabel() {
LabelItem* bi=new LabelItem(kstApp->mainWindow()->tabWidget()->currentView(),"");
kstApp->mainWindow()->tabWidget()->currentView()->scene()->addItem(bi);
Expand Down
4 changes: 1 addition & 3 deletions src/libkstapp/labelscriptinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ class LabelSI : public ScriptInterface
Q_OBJECT
public:
explicit LabelSI(LabelItem* it);
QByteArrayList commands();
QString doCommand(QString);
bool isValid();
QByteArray getHandle();
void endEditUpdate() {if (dim->item) dim->item->update();}
QByteArray endEditUpdate() {if (dim->item) dim->item->update();return ("Finished editing "+dim->item->Name()).toLatin1();}
static ScriptInterface* newLabel();

private:
Expand Down
7 changes: 6 additions & 1 deletion src/libkstapp/plotitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#include "applicationsettings.h"
#include "updatemanager.h"

#include "plotscriptinterface.h"
#include "math_kst.h"

#include "dialogdefaults.h"
Expand Down Expand Up @@ -153,6 +153,11 @@ PlotItem::PlotItem(View *parent)
applyDialogDefaultsLockPosToData();
}

ScriptInterface* PlotItem::createScriptInterface() {
return new PlotSI(this);
}


void PlotItem::applyDefaults() {
QFont font;

Expand Down
3 changes: 3 additions & 0 deletions src/libkstapp/plotitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace Kst {
class PlotItem;
class PlotAxis;
class SharedAxisBoxItem;
class ScriptInterface;

struct ZoomState {
QPointer<PlotItem> item;
Expand Down Expand Up @@ -280,6 +281,8 @@ class PlotItem : public ViewItem, public PlotItemInterface

bool maskedByMaximization() {return (view()->childMaximized() && !_plotMaximized);}

virtual ScriptInterface *createScriptInterface();

protected:
virtual QString _automaticDescriptiveName() const;
virtual void _initializeShortName();
Expand Down
50 changes: 20 additions & 30 deletions src/libkstapp/plotscriptinterface.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/***************************************************************************
* *
* copyright : (C) 2011 Barth Netterfield *
* copyright : (C) 2012 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -14,6 +14,8 @@
#include "plotscriptinterface.h"
#include "plotitem.h"
#include "plotaxis.h"
#include "document.h"
#include "objectstore.h"

#include <QStringBuilder>

Expand All @@ -26,6 +28,8 @@ PlotSI::PlotSI(PlotItem *it) : _layout(new LayoutTabSI), _dim(new DimensionTabSI
_stroke->item=it;
_item = it;

_fnMap.insert("addRelation", &PlotSI::addRelation);

_fnMap.insert("setXRange",&PlotSI::setXRange);
_fnMap.insert("setYRange",&PlotSI::setYRange);
_fnMap.insert("setXAuto",&PlotSI::setXAuto);
Expand Down Expand Up @@ -64,10 +68,6 @@ ScriptInterface* PlotSI::newPlot() {
}


QByteArrayList PlotSI::commands() {
return _layout->commands()<<_dim->commands()<<_stroke->commands()<<_fill->commands();
}

QString PlotSI::doCommand(QString x) {
QString command = x.left(x.indexOf('('));

Expand All @@ -77,7 +77,10 @@ QString PlotSI::doCommand(QString x) {
return CALL_MEMBER_FN(*this,fn)(x);
}

QString v=_layout->doCommand(x);
QString v=doNamedObjectCommand(x, _dim->item);
if(v.isEmpty()) {
v = _layout->doCommand(x);
}
if(v.isEmpty()) {
v=_dim->doCommand(x);
}
Expand All @@ -94,33 +97,20 @@ bool PlotSI::isValid() {
return _dim->item;
}

QByteArray PlotSI::getHandle() {
return ("Finished editing " % _dim->item->Name()).toLatin1();
}

QStringList PlotSI::getArgs(const QString &command) {
int i0 = command.indexOf('(')+1;
int i1 = command.lastIndexOf(')');
int n = i1-i0;

QString x = command.mid(i0,n);
return x.split(',');

}

QString PlotSI::getArg(const QString &command) {
int i0 = command.indexOf('(')+1;
int i1 = command.lastIndexOf(')');
int n = i1-i0;

QString x = command.mid(i0,n);
return x;

}

/***************************/
/* commands */
/***************************/
QString PlotSI::addRelation(QString& command) {
QString rname = getArg(command);
RelationPtr relation = kst_cast<Relation>(
kstApp->mainWindow()->document()->objectStore()->retrieveObject(rname));
if (relation) {
_item->renderItem(PlotRenderItem::Cartesian)->addRelation(relation);
return "Done";
} else {
return QString("Could not find curve/image %1").arg(rname);
}
}

QString PlotSI::setXRange(QString &command) {

Expand Down
7 changes: 2 additions & 5 deletions src/libkstapp/plotscriptinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ class PlotSI : public ScriptInterface
Q_OBJECT
public:
explicit PlotSI(PlotItem* it);
QByteArrayList commands();
QString doCommand(QString);
bool isValid();
QByteArray getHandle();
void endEditUpdate() {if (_item) _item->update();}
QByteArray endEditUpdate() {if (_item) _item->update();return ("Finished editing "+_item->Name()).toLatin1();}

static ScriptInterface* newPlot();

Expand All @@ -53,8 +51,7 @@ class PlotSI : public ScriptInterface
PlotItem *_item;
QMap<QString,InterfaceMemberFn> _fnMap;

QStringList getArgs(const QString &command);
QString getArg(const QString &command);
QString addRelation(QString& command);

QString setXRange(QString& command);
QString setYRange(QString& command);
Expand Down
11 changes: 1 addition & 10 deletions src/libkstapp/pluginscriptinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,11 @@ PluginSI::PluginSI(BasicPluginPtr plugin, ObjectStore *store) {
}
}

QByteArrayList PluginSI::commands() {

QByteArrayList ba;
ba<< "setInputVector()" << "setInputScalar()" << "setInputMatrix()" <<
"inputVector()" << "inputScalar()" << "inputMatrix()";

return ba;
}

bool PluginSI::isValid() {
return _plugin;
}

QByteArray PluginSI::getHandle() {
QByteArray PluginSI::endEditUpdate() {
if (_plugin) {
return ("Finished editing "%_plugin->Name()).toLatin1();
} else {
Expand Down
4 changes: 1 addition & 3 deletions src/libkstapp/pluginscriptinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ class PluginSI : public ScriptInterface
Q_OBJECT
public:
PluginSI(BasicPluginPtr plugin, ObjectStore *store);
QByteArrayList commands();
QString doCommand(QString);
bool isValid();
QByteArray getHandle();
void endEditUpdate() {}
QByteArray endEditUpdate();
private:
BasicPluginPtr _plugin;
ObjectStore *_store;
Expand Down
5 changes: 0 additions & 5 deletions src/libkstapp/script.qrc

This file was deleted.

1,093 changes: 366 additions & 727 deletions src/libkstapp/scriptserver.cpp

Large diffs are not rendered by default.

190 changes: 85 additions & 105 deletions src/libkstapp/scriptserver.h

Large diffs are not rendered by default.

55 changes: 0 additions & 55 deletions src/libkstapp/stringscriptinterface.cpp

This file was deleted.

18 changes: 16 additions & 2 deletions src/libkstapp/viewitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "formatgridhelper.h"
#include "dialogdefaults.h"
#include "cartesianrenderitem.h"
#include "viewitemscriptinterface.h"

#include "layoutboxitem.h"

Expand Down Expand Up @@ -82,7 +83,8 @@ ViewItem::ViewItem(View *parentView) :
_allowedGrips(TopLeftGrip | TopRightGrip | BottomRightGrip | BottomLeftGrip |
TopMidGrip | RightMidGrip | BottomMidGrip | LeftMidGrip),
_lockPosToData(false),
_editDialog(0)
_editDialog(0),
_interface(0)
{
_initializeShortName();
setZValue(DRAWING_ZORDER);
Expand Down Expand Up @@ -1184,7 +1186,7 @@ void ViewItem::addTitle(QMenu *menu) const {
QWidgetAction *action = new QWidgetAction(menu);
action->setEnabled(false);

QLabel *label = new QLabel(typeName() + tr(" Menu"), menu);
QLabel *label = new QLabel(tr("%1 Menu", "title of menu for object type arg1").arg(typeName()), menu);
label->setAlignment(Qt::AlignCenter);
label->setStyleSheet("QLabel {"
"border-bottom: 2px solid lightGray;"
Expand Down Expand Up @@ -2361,6 +2363,17 @@ QString ViewItem::descriptionTip() const {
return typeName();
}

ScriptInterface* ViewItem::createScriptInterface() {
return new ViewItemSI(this);
}

ScriptInterface* ViewItem::scriptInterface() {
if (!_interface) {
_interface = createScriptInterface();
}
return _interface;
}

#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, ViewItem *viewItem) {
dbg.nospace() << viewItem->typeName();
Expand All @@ -2380,6 +2393,7 @@ ViewItemCommand::~ViewItemCommand() {
}



CreateCommand::CreateCommand(const QString &text, QUndoCommand *parent)
: ViewCommand(text, false, parent) {
}
Expand Down
5 changes: 5 additions & 0 deletions src/libkstapp/viewitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class DialogPage;
class ViewGridLayout;
class ViewItem;
class ViewItemDialog;
class ScriptInterface;

typedef QList<ViewItem *> ViewItemList;

Expand Down Expand Up @@ -254,6 +255,9 @@ class ViewItem : public QObject, public NamedObject, public QGraphicsRectItem
void storePen(const QPen &pen) {_storedPen = pen; setPen(pen);}
QPen storedPen() const { return _storedPen;}

virtual ScriptInterface *createScriptInterface();

ScriptInterface *scriptInterface();
Q_SIGNALS:
void geometryChanged();
void creationComplete();
Expand Down Expand Up @@ -403,6 +407,7 @@ class ViewItem : public QObject, public NamedObject, public QGraphicsRectItem

ViewItemDialog *_editDialog;
QPen _storedPen;
ScriptInterface *_interface;
};

Q_DECLARE_OPERATORS_FOR_FLAGS(ViewItem::GripModes)
Expand Down
77 changes: 24 additions & 53 deletions src/libkstapp/viewitemscriptinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@

namespace Kst {

QByteArrayList LayoutTabSI::commands() {
QByteArrayList ba;
ba<<"setLayoutHorizontalMargin("<<"getLayoutHorizontalMargin()"<<"setLayoutVerticalMargin("<<
"getLayoutVerticalMargin()"<<"setLayoutHorizontalSpacing("<<"getLayoutHorizontalSpacing()"<<
"setLayoutVerticalSpacing("<<"getLayoutVerticalSpacing()";
return ba;
}
QString LayoutTabSI::doCommand(QString x) {
if(x.startsWith("getLayout")) {
x.remove(0,9);
Expand Down Expand Up @@ -74,11 +67,6 @@ QString LayoutTabSI::doCommand(QString x) {
return "";
}

QByteArrayList FillTabSI::commands() {
QByteArrayList ba;
ba<<"setFillColor("<<"setIndexOfFillStyle(";
return ba;
}
QString FillTabSI::doCommand(QString x) {
if(!x.startsWith("setFillColor")&&!x.startsWith("setIndexOfFillStyle(")) {
return "";
Expand All @@ -99,12 +87,6 @@ QString FillTabSI::doCommand(QString x) {
return "Done";
}

QByteArrayList StrokeTabSI::commands() {
QByteArrayList ba;
ba<<"setIndexOfStrokeStyle("<<"setIndexOfStrokeBrushStyle("<<"setIndexOfStrokeJoinStyle("<<"setIndexOfStrokeCapStyle("<<
"setStrokeWidth("<<"setStrokeBrushColor(";
return ba;
}
QString StrokeTabSI::doCommand(QString x) {
if(!x.startsWith("setIndexOfStrokeStyle")&&!x.startsWith("setIndexOfStrokeBrushStyle(")&&!x.startsWith("setIndexOfStrokeJoinStyle")&&
!x.startsWith("setIndexOfStrokeCapStyle")&&!x.startsWith("setStrokeWidth")&&!x.startsWith("setStrokeBrushColor")) {
Expand Down Expand Up @@ -165,14 +147,6 @@ QString StrokeTabSI::doCommand(QString x) {
return "Done";
}

QByteArrayList DimensionTabSI::commands() {
QByteArrayList ba;
ba<<"setRotation("<<"getRotation()"<<"setGeoX("<<"getGeoX()"<<"setGeoY("<<"getGeoY()"<<
"setPosX("<<"getPosX()"<<"setPosY("<<"getPosY()"<<"checkFixAspectRatio()"<<
"uncheckFixAspectRatio()"<<"fixAspectRatioIsChecked()";
return ba;
}

QString DimensionTabSI::doCommand(QString x) {

QString command = x.left(x.indexOf('('));
Expand Down Expand Up @@ -244,41 +218,38 @@ ViewItemSI::ViewItemSI(ViewItem *it) : layout(new LayoutTabSI), dim(new Dimensio
stroke->item=it;
}

QByteArrayList ViewItemSI::commands() {
return layout->commands()<<dim->commands()<<fill->commands()<<stroke->commands()<<(qobject_cast<LineEditItem*>(layout->vi)||qobject_cast<ButtonItem*>(layout->vi)?"setText(":"");
}

QString ViewItemSI::doCommand(QString x) {
QString v=layout->doCommand(x);
if(v.isEmpty()) {
v=dim->doCommand(x);
}
if(v.isEmpty()) {
v=fill->doCommand(x);
}
if(v.isEmpty()) {
v=stroke->doCommand(x);
}
if(v.isEmpty()&&x.startsWith("setText(")) {
if(qobject_cast<ButtonItem*>(layout->vi)) {
qobject_cast<ButtonItem*>(layout->vi)->setText(x.remove("setText(").remove(')'));
v="Done";
} else if(qobject_cast<LineEditItem*>(layout->vi)) {
qobject_cast<LineEditItem*>(layout->vi)->setText(x.remove("setText(").remove(')'));
v="Done";
}

QString v=doNamedObjectCommand(x, dim->item);

if (v.isEmpty()) {
v=layout->doCommand(x);
}
if (v.isEmpty()) {
v=dim->doCommand(x);
}
if (v.isEmpty()) {
v=fill->doCommand(x);
}
if (v.isEmpty()) {
v=stroke->doCommand(x);
}
if (v.isEmpty()&&x.startsWith("setText(")) {
if(qobject_cast<ButtonItem*>(layout->vi)) {
qobject_cast<ButtonItem*>(layout->vi)->setText(x.remove("setText(").remove(')'));
v="Done";
} else if(qobject_cast<LineEditItem*>(layout->vi)) {
qobject_cast<LineEditItem*>(layout->vi)->setText(x.remove("setText(").remove(')'));
v="Done";
}
return v.isEmpty()?"No command":v;
}
return v.isEmpty()?"No command":v;
}

bool ViewItemSI::isValid() {
return dim->item;
}

QByteArray ViewItemSI::getHandle() {
return ("Finished editing "%dim->item->Name()).toLatin1();
}

ScriptInterface* ViewItemSI::newBox() {
BoxItem* bi=new BoxItem(kstApp->mainWindow()->tabWidget()->currentView());
kstApp->mainWindow()->tabWidget()->currentView()->scene()->addItem(bi);
Expand Down
8 changes: 1 addition & 7 deletions src/libkstapp/viewitemscriptinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,21 @@ class ViewItem;

struct LayoutTabSI {
ViewItem* vi;
QByteArrayList commands();
QString doCommand(QString x);
};

struct FillTabSI {
ViewItem* item;
QByteArrayList commands();
QString doCommand(QString x);
};

struct StrokeTabSI {
ViewItem* item;
QByteArrayList commands();
QString doCommand(QString x);
};

struct DimensionTabSI {
ViewItem* item;
QByteArrayList commands();
QString doCommand(QString x);
};

Expand All @@ -62,11 +58,9 @@ class ViewItemSI : public ScriptInterface
Q_OBJECT
public:
explicit ViewItemSI(ViewItem* it);
QByteArrayList commands();
QString doCommand(QString);
bool isValid();
QByteArray getHandle();
void endEditUpdate() {if (dim->item) dim->item->update();}
QByteArray endEditUpdate() {if (dim->item) dim->item->update();return ("Finished editing "+dim->item->Name()).toLatin1();}

static ScriptInterface* newBox();
static ScriptInterface* newButton();
Expand Down
5 changes: 5 additions & 0 deletions src/libkstmath/curve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "datavector.h"
#include "ksttimers.h"
#include "objectstore.h"
#include "relationscriptinterface.h"

#include <time.h>
#include <iostream>
Expand Down Expand Up @@ -99,6 +100,10 @@ void Curve::_initializeShortName() {
Curve::~Curve() {
}

ScriptInterface* Curve::createScriptInterface() {
return new CurveSI(this);
}


void Curve::internalUpdate() {
Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);
Expand Down
1 change: 1 addition & 0 deletions src/libkstmath/curve.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class KSTMATH_EXPORT Curve: public Relation
virtual LabelInfo yLabelInfo() const;
virtual LabelInfo titleInfo() const;

virtual ScriptInterface* createScriptInterface();

protected:
Curve(ObjectStore *store);
Expand Down
267 changes: 267 additions & 0 deletions src/libkstmath/relationscriptinterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
/***************************************************************************
* *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "relationscriptinterface.h"

#include "objectstore.h"
#include "datasourcepluginmanager.h"
#include "updatemanager.h"
#include "updateserver.h"
#include "vector.h"
#include "colorsequence.h"

#include <QStringBuilder>


namespace Kst {

QString doRelationScriptCommand(QString command,Relation *relation) {

QString v=ScriptInterface::doNamedObjectCommand(command, relation);
if (!v.isEmpty()) {
return v;
}

if (command.startsWith("maxX(")) {
return QString::number(relation->maxX());
} // FIXME the rest...

return QString();
}


/******************************************************/
/* Curves */
/******************************************************/
CurveSI::CurveSI(CurvePtr it) {
curve=it;

_fnMap.insert("setXVector",&CurveSI::setXVector);
_fnMap.insert("setYVector",&CurveSI::setYVector);
_fnMap.insert("setXError",&CurveSI::setXError);
_fnMap.insert("setYError",&CurveSI::setYError);
_fnMap.insert("setXMinusError",&CurveSI::setXMinusError);
_fnMap.insert("setYMinusError",&CurveSI::setYMinusError);

_fnMap.insert("setColor",&CurveSI::setColor);
_fnMap.insert("setHeadColor",&CurveSI::setHeadColor);
_fnMap.insert("setBarFillColor",&CurveSI::setBarFillColor);
_fnMap.insert("setHasPoints",&CurveSI::setHasPoints);
_fnMap.insert("setHasLines",&CurveSI::setHasLines);
_fnMap.insert("setHasBars",&CurveSI::setHasBars);
_fnMap.insert("setHasHead",&CurveSI::setHasHead);

_fnMap.insert("setLineWidth",&CurveSI::setLineWidth);
_fnMap.insert("setPointSize",&CurveSI::setPointSize);

}

QString CurveSI::doCommand(QString command_in) {
QString command = command_in.left(command_in.indexOf('('));

CurveInterfaceMemberFn fn=_fnMap.value(command,&CurveSI::noSuchFn);

if(fn!=&CurveSI::noSuchFn) {
return CALL_MEMBER_FN(*this,fn)(command_in);
}


QString v=doRelationScriptCommand(command_in, curve);
if (!v.isEmpty()) {
return v;
}

return "No such command";
}

bool CurveSI::isValid() {
return curve.isPtrValid();
}

ScriptInterface* CurveSI::newCurve(ObjectStore *store) {
CurvePtr curve;
curve = store->createObject<Curve>();
curve->setColor(ColorSequence::self().next());

return new CurveSI(curve);
}

QByteArray CurveSI::endEditUpdate() {
curve->registerChange();
UpdateManager::self()->doUpdates(true);
UpdateServer::self()->requestUpdateSignal();
return ("Finished editing "+curve->Name()).toLatin1();
}

/***************************/
/* commands */
/***************************/
QString CurveSI::setXVector(QString& command) {
QString parameter = getArg(command);

VectorPtr v = kst_cast<Vector>(curve->store()->retrieveObject(parameter));
if (v) {
curve->setXVector(v);
return "Done";
} else {
return QString("Vector %1 not found").arg(parameter);
}

}

QString CurveSI::setYVector(QString& command) {
QString parameter = getArg(command);

VectorPtr v = kst_cast<Vector>(curve->store()->retrieveObject(parameter));
if (v) {
curve->setYVector(v);
return "Done";
} else {
return QString("Vector %1 not found").arg(parameter);
}
}

QString CurveSI::setXError(QString& command) {
QString parameter = getArg(command);

VectorPtr v = kst_cast<Vector>(curve->store()->retrieveObject(parameter));
if (v) {
curve->setXError(v);
return "Done";
} else {
return QString("Vector %1 not found").arg(parameter);
}
}

QString CurveSI::setYError(QString& command) {
QString parameter = getArg(command);

VectorPtr v = kst_cast<Vector>(curve->store()->retrieveObject(parameter));
if (v) {
curve->setYError(v);
return "Done";
} else {
return QString("Vector %1 not found").arg(parameter);
}
}

QString CurveSI::setXMinusError(QString& command) {
QString parameter = getArg(command);

VectorPtr v = kst_cast<Vector>(curve->store()->retrieveObject(parameter));
if (v) {
curve->setXMinusError(v);
return "Done";
} else {
return QString("Vector %1 not found").arg(parameter);
}

}

QString CurveSI::setYMinusError(QString& command) {
QString parameter = getArg(command);

VectorPtr v = kst_cast<Vector>(curve->store()->retrieveObject(parameter));
if (v) {
curve->setYMinusError(v);
return "Done";
} else {
return QString("Vector %1 not found").arg(parameter);
}
}

QString CurveSI::setColor(QString& command) {
QString parameter = getArg(command);
curve->setColor(QColor(parameter));
return "Done";
}

QString CurveSI::setHeadColor(QString& command) {
QString parameter = getArg(command);
curve->setHeadColor(QColor(parameter));
return "Done";
}

QString CurveSI::setBarFillColor(QString& command) {
QString parameter = getArg(command);
curve->setBarFillColor(QColor(parameter));
return "Done";
}

QString CurveSI::setHasPoints(QString& command) {
QString parameter = getArg(command);

if (parameter.toLower() == "true") {
curve->setHasPoints(true);
} else {
curve->setHasPoints(false);
}
return "Done";
}

QString CurveSI::setHasLines(QString& command) {
QString parameter = getArg(command);

if (parameter.toLower() == "true") {
curve->setHasLines(true);
} else {
curve->setHasLines(false);
}
return "Done";
}

QString CurveSI::setHasBars(QString& command) {
QString parameter = getArg(command);

if (parameter.toLower() == "true") {
curve->setHasBars(true);
} else {
curve->setHasBars(false);
}
return "Done";
}

QString CurveSI::setHasHead(QString& command) {
QString parameter = getArg(command);

if (parameter.toLower() == "true") {
curve->setHasHead(true);
} else {
curve->setHasHead(false);
}
return "Done";
}

QString CurveSI::setLineWidth(QString& command) {
QString parameter = getArg(command);
int x = parameter.toInt();

if (x<0) x = 0;
if (x>100) x = 100;

curve->setLineWidth(x);
return "Done";
}

QString CurveSI::setPointSize(QString& command) {
QString parameter = getArg(command);
int x = parameter.toInt();

if (x<0) x = 0;
if (x>100) x = 100;

curve->setPointSize(x);
return "Done";
}


}
67 changes: 67 additions & 0 deletions src/libkstmath/relationscriptinterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/***************************************************************************
* *
* copyright : (C) 2014 Barth Netterfield *
* netterfield@astro.utoronto.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef RELATIONSCRIPTINTERFACE_H
#define RELATIONSCRIPTINTERFACE_H

#include <QString>

#include "scriptinterface.h"
#include "curve.h"

namespace Kst {

class CurveSI;
typedef QString (CurveSI::*CurveInterfaceMemberFn)(QString& command);

class KSTMATH_EXPORT CurveSI : public ScriptInterface
{
Q_OBJECT
public:
explicit CurveSI(CurvePtr it);
QString doCommand(QString);
bool isValid();
QByteArray endEditUpdate();

static ScriptInterface* newCurve(ObjectStore *store);

protected:
QString noSuchFn(QString&) {return ""; }

private:
CurvePtr curve;

QMap<QString,CurveInterfaceMemberFn> _fnMap;

QString setXVector(QString& command);
QString setYVector(QString& command);
QString setXError(QString& command);
QString setYError(QString& command);
QString setXMinusError(QString& command);
QString setYMinusError(QString& command);

QString setColor(QString& command);
QString setHeadColor(QString& command);
QString setBarFillColor(QString& command);
QString setHasPoints(QString& command);
QString setHasLines(QString& command);
QString setHasBars(QString& command);
QString setHasHead(QString& command);

QString setLineWidth(QString& command);
QString setPointSize(QString& command);

};

}

#endif // RELATIONSCRIPTINTERFACE_H
8 changes: 4 additions & 4 deletions src/plugins/dataobject/activitylevel/activitylevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ ActivityLevelSource::~ActivityLevelSource() {

QString ActivityLevelSource::_automaticDescriptiveName() const {
if (vector()) {
return QString(vector()->descriptiveName() + " Activity Level");
return tr("%1 Activity Level").arg(vector()->descriptiveName());
} else {
return QString("Actvity Level");
return tr("Activity Level");
}
}

Expand Down Expand Up @@ -401,8 +401,8 @@ void ActivityLevelSource::saveProperties(QXmlStreamWriter &s) {
}


QString ActivityLevelPlugin::pluginName() const { return "Activity Level"; }
QString ActivityLevelPlugin::pluginDescription() const { return "Computes the activity level of a signal as the product of standard deviation and number of reversals over a sliding window."; }
QString ActivityLevelPlugin::pluginName() const { return tr("Activity Level"); }
QString ActivityLevelPlugin::pluginDescription() const { return tr("Computes the activity level of a signal as the product of standard deviation and number of reversals over a sliding window."); }


Kst::DataObject *ActivityLevelPlugin::create(Kst::ObjectStore *store, Kst::DataObjectConfigWidget *configWidget, bool setupInputsOutputs) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Name[ca@valencia]=Connector d'objecte de dades de nivell d'activitat
Name[de]=Aktivitätsstufen-Datenobjekt-Modul
Name[fr]=Module de niveau d'activité
Name[it]=Estensione oggetto dati di livello attività
Name[nl]=Plug-in voor gegevensobject van niveau van activiteit
Name[nl]=Activity Level Data Object Plugin
Name[pl]=Wtyczka obiektu danych poziomu aktywności
Name[pt]='Plugin' de Objecto de Dados ao Nível da Actividade
Name[pt_BR]=Plugin de objeto de dados ao nível de atividade
Expand All @@ -23,7 +23,7 @@ Comment[ca@valencia]=Calcula un nivell d'activitat (càrrega de treball) basat l
Comment[de]=Berechnet eine Aktivitätsstufe (Arbeitsbelastung) auf der Grundlage von Signalumkehrung und der Amplitude von Änderungen.
Comment[fr]=Calcule un niveau d'activité (charge de travail) basé sur les inversions de signaux et l'amplitude des changements.
Comment[it]=Calcola un livello attività (carico lavoro) basato su storni di segnali e ampiezza di modifiche.
Comment[nl]=Berekent een niveau van activiteit (workload) gebaseerd op omkeringen van signalen en amplitude van wijzigingen.
Comment[nl]=Berekent een activiteitsniveau (workload) gebaseerd op omkeringen van signalen en amplitude van wijzigingen.
Comment[pl]=Oblicz poziom aktywności (obłożenie) na podstawie odwrócenia sygnałów i zmian amplitud.
Comment[pt]=Calcula um nível de actividade (carga) com base nas inversões de sinal e na amplitude das alterações.
Comment[pt_BR]=Calcula um nível de atividade (carga) com base nas inversões de sinal e na amplitude das alterações.
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/dataobject/bin/bin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ BinSource::~BinSource() {


QString BinSource::_automaticDescriptiveName() const {
return QString("Bin Plugin Object");
return tr("Bin Plugin Object");
}


Expand Down Expand Up @@ -215,8 +215,8 @@ void BinSource::saveProperties(QXmlStreamWriter &s) {
}


QString BinPlugin::pluginName() const { return "Bin"; }
QString BinPlugin::pluginDescription() const { return "Bins data into the given size bins. Each bin contains the mean of the elements belonging to the bin."; }
QString BinPlugin::pluginName() const { return tr("Bin"); }
QString BinPlugin::pluginDescription() const { return tr("Bins data into the given size bins. Each bin contains the mean of the elements belonging to the bin."); }


Kst::DataObject *BinPlugin::create(Kst::ObjectStore *store, Kst::DataObjectConfigWidget *configWidget, bool setupInputsOutputs) const {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/dataobject/bin/kstplugin_bin.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Name[ca@valencia]=Connector d'objecte de dades classificades
Name[de]=Binär-Datenobjekt-Modul
Name[fr]=Module DataObject de classement (Bin)
Name[it]=Estensione oggetto dati di collocazione
Name[nl]=Plug-in voor object met binaire gegevens
Name[nl]=Bin Data Object Plugin
Name[pl]=Wtyczka obiektu danych przedziału
Name[pt]='Plugin' de Objecto de Dados Compartimentados
Name[pt_BR]=Plugin de objeto de dados compartimentados
Expand All @@ -23,7 +23,7 @@ Comment[ca@valencia]=Implementa un connector d'objecte de dades classificades pe
Comment[de]=Implementiert ein binäres Datenobjekt-Modul für Kst.
Comment[fr]=Implémente un module DataObject de classement (Bin) pour Kst.
Comment[it]=Implementa un'estensione oggetto dati di collocazione per Kst.
Comment[nl]=Implementeert een plug-in voor object met binaire gegevens voor Kst.
Comment[nl]=Implementeert een plugin voor een gegevensobject in Kst voor klassenindeling
Comment[pl]=Implementuje wtyczkę obiektu danych przedziału dla Kst.
Comment[pt]=Implementa um 'plugin' de objecto de dados compartimentados para o Kst.
Comment[pt_BR]=Implementa um plugin de objeto de dados compartimentados para o Kst.
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/dataobject/chop/chop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ ChopSource::~ChopSource() {


QString ChopSource::_automaticDescriptiveName() const {
return QString("Chop Plugin Object");
return tr("Chop Plugin Object");
}


Expand Down Expand Up @@ -206,8 +206,8 @@ void ChopSource::saveProperties(QXmlStreamWriter &s) {
}


QString ChopPlugin::pluginName() const { return "Chop"; }
QString ChopPlugin::pluginDescription() const { return "Chops a given data set into odd, even, difference, and Index data sets."; }
QString ChopPlugin::pluginName() const { return tr("Chop"); }
QString ChopPlugin::pluginDescription() const { return tr("Chops a given data set into odd, even, difference, and Index data sets."); }


Kst::DataObject *ChopPlugin::create(Kst::ObjectStore *store, Kst::DataObjectConfigWidget *configWidget, bool setupInputsOutputs) const {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/dataobject/chop/kstplugin_chop.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Name[ca@valencia]=Connector d'objecte de dades de retall
Name[de]=Teilungs-Datenobjekt-Modul
Name[fr]=Module DataObject de découpage (Chop)
Name[it]=Estensione oggetto dati di ritaglio
Name[nl]=Plug-in voor object met chop-gegevens
Name[nl]=Chop Data Object Plugin
Name[pl]=Wtyczka obiektu danych Chop
Name[pt]='Plugin' de Objecto de Dados com Recorte
Name[pt_BR]=Plugin de objeto de dados com recorte
Expand All @@ -23,7 +23,7 @@ Comment[ca@valencia]=Implementa un connector d'objecte de dades de retall pel Ks
Comment[de]=Implementiert ein Datenobjekt-Modul zur Aufteilung für Kst.
Comment[fr]=Implémente un module DataObject de découpage (Chop) pour Kst.
Comment[it]=Implementa un'estensione oggetto dati di ritaglio per Kst.
Comment[nl]=Implementeert een plug-in voor object met chop-gegevens voor Kst.
Comment[nl]=Implementeert een plugin voor een gegevensobject in Kst voor in in stukjes hakken.
Comment[pl]=Implementuje wtyczkę obiektu danych Chop dla Kst.
Comment[pt]=Implementa um 'plugin' de objecto de dados com recorte para o Kst.
Comment[pt_BR]=Implementa um plugin de objeto de dados com recorte para o Kst.
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/dataobject/convolution/convolve/convolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ConvolveSource::~ConvolveSource() {


QString ConvolveSource::_automaticDescriptiveName() const {
return QString("Convolve Plugin Object");
return tr("Convolve Plugin Object");
}


Expand Down Expand Up @@ -308,8 +308,8 @@ void ConvolveSource::saveProperties(QXmlStreamWriter &s) {
}


QString ConvolvePlugin::pluginName() const { return "Convolve"; }
QString ConvolvePlugin::pluginDescription() const { return "Generates the convolution of one vector with another."; }
QString ConvolvePlugin::pluginName() const { return tr("Convolve"); }
QString ConvolvePlugin::pluginDescription() const { return tr("Generates the convolution of one vector with another."); }


Kst::DataObject *ConvolvePlugin::create(Kst::ObjectStore *store, Kst::DataObjectConfigWidget *configWidget, bool setupInputsOutputs) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Name[ca@valencia]=Connector d'objecte de dades de convolució
Name[de]=Konvolutions-Datenobjekt-Modul
Name[fr]=Module DataObject de convolution
Name[it]=Estensione oggetto dati di convoluzione
Name[nl]=Plug-in voor object met convolve-gegevens
Name[nl]=Convolve Data Object Plugin
Name[pl]=Wtyczka obiektu danych splotu
Name[pt]='Plugin' de Objectos de Dados de Convolução
Name[pt_BR]=Plugin de objetos de dados de convolução
Expand All @@ -23,7 +23,7 @@ Comment[ca@valencia]=Implementa un connector d'objecte de dades de convolució p
Comment[de]=Implementiert ein Konvolutions-Datenobjekt-Modul für Kst.
Comment[fr]=Implémente un module DataObject de convolution pour Kst.
Comment[it]=Implementa un'estensione oggetto dati di convoluzione per Kst.
Comment[nl]=Implementeert een plug-in voor object met convolve-gegevens voor Kst.
Comment[nl]=Implementeert een plugin voor een gegevensobject in Kst voor convolutie.
Comment[pl]=Implementuje wtyczkę obiektu danych splotu dla Kst.
Comment[pt]=Implementa um 'plugin' de objectos de dados de convolução para o Kst.
Comment[pt_BR]=Implementa um plugin de objeto de dados de convolação para o Kst.
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/dataobject/convolution/deconvolve/deconvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ DeconvolveSource::~DeconvolveSource() {


QString DeconvolveSource::_automaticDescriptiveName() const {
return QString("Deconvolve Plugin Object");
return tr("Deconvolve Plugin Object");
}


Expand Down Expand Up @@ -314,8 +314,8 @@ void DeconvolveSource::saveProperties(QXmlStreamWriter &s) {
}


QString DeconvolvePlugin::pluginName() const { return "Deconvolve"; }
QString DeconvolvePlugin::pluginDescription() const { return "Generates the deconvolution of one vector with another."; }
QString DeconvolvePlugin::pluginName() const { return tr("Deconvolve"); }
QString DeconvolvePlugin::pluginDescription() const { return tr("Generates the deconvolution of one vector with another."); }


Kst::DataObject *DeconvolvePlugin::create(Kst::ObjectStore *store, Kst::DataObjectConfigWidget *configWidget, bool setupInputsOutputs) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Name[ca@valencia]=Connector d'objecte de dades de desconvolució
Name[de]=Dekonvolutions-Datenobjekt-Modul
Name[fr]=Module DataObject de déconvolution
Name[it]=Estensione oggetto dati di deconvoluzione
Name[nl]=Plug-in voor object met deconvolve-gegevens
Name[nl]=Deconvolve Data Object Plugin
Name[pl]=Wtyczka obiektu danych odplatania
Name[pt]='Plugin' de Objectos de Dados de Desconvolução
Name[pt_BR]=Plugin de objeto de dados de desconvolução
Expand All @@ -23,7 +23,7 @@ Comment[ca@valencia]=Implementa un connector d'objecte de dades de desconvoluci
Comment[de]=Implementiert ein Dekonvolutions-Datenobjekt-Modul für Kst.
Comment[fr]=Implémente un module DataObject de déconvolution pour Kst.
Comment[it]=Implementa un'estensione oggetto dati di deconvoluzione per Kst.
Comment[nl]=Implementeert een plug-in voor object met deconvolve-gegevens voor Kst.
Comment[nl]=Implementeert een plugin voor een gegevensobject in Kst voor deconvolutie.
Comment[pl]=Implementuje wtyczkę obiektu danych odplatania dla Kst.
Comment[pt]=Implementa um 'plugin' de objectos de dados de desconvolução para o Kst.
Comment[pt_BR]=Implementa um plugin de objeto de dados de desconvolução para o Kst.
Expand Down
Loading