[Kst] branches/work/kst/portto4/kst

Barth Netterfield netterfield at astro.utoronto.ca
Mon May 25 16:42:32 CEST 2009


SVN commit 972743 by netterfield:

Add default X vector field for new vectors.
Fix some button activation bugs in the vector dialog.
Report a new bug.



 M  +5 -0      devel-docs/Kst2Specs/Bugs  
 M  +0 -6      devel-docs/Kst2Specs/Wishlist  
 M  +2 -0      src/libkstapp/curvedialog.cpp  
 M  +1 -0      src/libkstapp/datadialog.cpp  
 M  +3 -0      src/libkstapp/dialoglaunchergui.cpp  
 M  +2 -0      src/libkstapp/equationdialog.cpp  
 M  +10 -1     src/libkstapp/vectordialog.cpp  
 M  +4 -0      src/libkstapp/vectordialog.h  
 M  +5 -1      src/widgets/vectorselector.cpp  
 M  +2 -0      src/widgets/vectorselector.h  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #972742:972743
@@ -104,3 +104,8 @@
 17. There appears to be no way to change the colour of the plot border
 and tick marks from black.  I though the brush colour under "Stroke"
 might do it, but nope.
+
+----------
+
+Crash case: edit vector button is active in vector selectors
+for error bar vectors which aren't yet set.  Clicking crashes.
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Wishlist #972742:972743
@@ -28,13 +28,7 @@
 ---------
 When a new plot is added to an tab which already has plots in it (eg, from the Placement widget), then the label font sizes should be based on the label font sizes of the plots already in the tab.  (either 'vote' or use the first one).
 All font properties replicated.  Use the first one.
----------
 
-Default X vector should be remembered.
-  -A default X vector, which is the last vector to have been used as an X vector, should be remembered. 
-
-*cbn*
-
 ---------
 
 'I' key in a plot with an image should adjust the image color scale; see 1.x for correct behavior.  Consider <shift>I as doing smaller steps.
--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.cpp #972742:972743
@@ -52,6 +52,8 @@
   _xMinusErrorLabel->setBuddy(_xMinusError->_vector);
   _yMinusErrorLabel->setBuddy(_yMinusError->_vector);
 
+  _xVector->setIsX(true);
+
   connect(_xVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(vectorsChanged()));
   connect(_yVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(vectorsChanged()));
   connect(_xMinusSameAsPlus, SIGNAL(toggled(bool)), this, SLOT(xCheckboxClicked()));
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.cpp #972742:972743
@@ -171,6 +171,7 @@
 
 void DataDialog::updateApplyButton() {
   _buttonBox->button(QDialogButtonBox::Apply)->setEnabled(_modified);
+  _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(_modified);
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/dialoglaunchergui.cpp #972742:972743
@@ -49,6 +49,9 @@
 
 void DialogLauncherGui::showVectorDialog(QString &vectorname, ObjectPtr objectPtr) {
   VectorDialog dialog(objectPtr, kstApp->mainWindow());
+  if (!vectorname.isEmpty()) {
+    dialog.setField(vectorname);
+  }
   dialog.exec();
   vectorname = dialog.dataObjectName();
 }
--- branches/work/kst/portto4/kst/src/libkstapp/equationdialog.cpp #972742:972743
@@ -36,6 +36,8 @@
 
   _curvePlacement->setExistingPlots(Data::self()->plotList());
 
+  _xVectors->setIsX(true);
+
   _xVectorLabel->setBuddy(_xVectors->_vector);
   _scalarsLabel->setBuddy(_scalars->_scalar);
   _vectorsLabel->setBuddy(_vectors->_vector);
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #972742:972743
@@ -30,7 +30,7 @@
 namespace Kst {
 
 VectorTab::VectorTab(ObjectStore *store, QWidget *parent)
-  : DataTab(parent), _mode(DataVector), _store(store), _requestID(0) {
+  : DataTab(parent), _mode(DataVector), _store(store), _initField(QString()), _requestID(0) {
 
   setupUi(this);
   setTabTitle(tr("Vector"));
@@ -39,6 +39,7 @@
   connect(_dataVectorGroup, SIGNAL(clicked(bool)), this, SLOT(readFromSourceClicked()));
   connect(_fileName, SIGNAL(changed(const QString &)), this, SLOT(fileNameChanged(const QString &)));
   connect(_configure, SIGNAL(clicked()), this, SLOT(showConfigWidget()));
+  connect(_field, SIGNAL(editTextChanged(const QString &)), this, SIGNAL(fieldChanged()));
 
   connect(_dataRange, SIGNAL(modified()), this, SIGNAL(modified()));
   connect(_numberOfSamples, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
@@ -95,6 +96,7 @@
 
 
 void VectorTab::setField(const QString &field) {
+  _initField = field; // for delayed index setting
   _field->setCurrentIndex(_field->findText(field));
 }
 
@@ -218,6 +220,9 @@
   _dataSource->readLock();
 
   _field->addItems(_dataSource->fieldList());
+  if (!_initField.isEmpty()) {
+    setField(_initField);
+  }
   _field->setEditable(!_dataSource->fieldListIsComplete());
   _configure->setEnabled(_dataSource->hasConfigWidget());
 
@@ -265,6 +270,8 @@
   }
 
   connect(_vectorTab, SIGNAL(sourceChanged()), this, SLOT(updateButtons()));
+  connect(_vectorTab, SIGNAL(fieldChanged()), this, SLOT(updateButtons()));
+
   connect(this, SIGNAL(editMultipleMode()), this, SLOT(editMultipleMode()));
   connect(this, SIGNAL(editSingleMode()), this, SLOT(editSingleMode()));
 
@@ -290,7 +297,9 @@
 
 
 void VectorDialog::updateButtons() {
+
   bool valid = _vectorTab->vectorMode() == VectorTab::GeneratedVector || !_vectorTab->field().isEmpty();
+  // FIXME: add stricter validity testing.
   _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
   _buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
 }
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.h #972742:972743
@@ -73,6 +73,7 @@
 
   Q_SIGNALS:
     void sourceChanged();
+    void fieldChanged();
 
   private Q_SLOTS:
     void readFromSourceClicked();
@@ -85,6 +86,7 @@
     VectorMode _mode;
     ObjectStore *_store;
     DataSourcePtr _dataSource;
+    QString _initField;
     int _requestID;
 };
 
@@ -94,6 +96,8 @@
     VectorDialog(ObjectPtr dataObject, QWidget *parent = 0);
     virtual ~VectorDialog();
 
+    void setField(QString field) {_vectorTab->setField(field);}
+
   protected:
 //     virtual QString tagString() const;
     virtual ObjectPtr createNewDataObject();
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.cpp #972742:972743
@@ -14,11 +14,12 @@
 #include "dialoglauncher.h"
 #include "datacollection.h"
 #include "objectstore.h"
+#include "dialogdefaults.h"
 
 namespace Kst {
 
 VectorSelector::VectorSelector(QWidget *parent, ObjectStore *store)
-  : QWidget(parent), _allowEmptySelection(false), _store(store) {
+  : QWidget(parent), _allowEmptySelection(false), _isX(false), _store(store)  {
 
   setupUi(this);
 
@@ -113,6 +114,9 @@
 
 void VectorSelector::newVector() {
   QString newName;
+  if (_isX) {
+    newName = _dialogDefaults->value("curve/xvectorfield","INDEX").toString();
+  }
   DialogLauncher::self()->showVectorDialog(newName);
   fillVectors();
   VectorPtr vector = kst_cast<Vector>(_store->retrieveObject(newName));
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.h #972742:972743
@@ -41,6 +41,7 @@
     void clearSelection();
 
     void fillVectors();
+    void setIsX(bool is_x) {_isX = is_x;}
 
   Q_SIGNALS:
     void selectionChanged(const QString&);
@@ -54,6 +55,7 @@
 
   private:
     bool _allowEmptySelection;
+    bool _isX;
 
     ObjectStore *_store;
 };


More information about the Kst mailing list