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

Barth Netterfield netterfield at astro.utoronto.ca
Fri Dec 11 17:34:18 CET 2009


SVN commit 1061398 by netterfield:

Get rid of unwanted top labels
BUG: 216736

Get rid of unwanted 'column' from ascii file column names
BUG: 216735

Convince Curve Dialog's edit multiple to not mess up.
BUG: 216740



 M  +1 -1      datasources/ascii/ascii.cpp  
 M  +2 -18     libkst/datavector.cpp  
 M  +9 -1      libkstapp/commandlineparser.cpp  
 M  +0 -1      libkstapp/curvedialog.cpp  
 M  +5 -2      widgets/vectorselector.cpp  


--- branches/work/kst/portto4/kst/src/datasources/ascii/ascii.cpp #1061397:1061398
@@ -751,7 +751,7 @@
 
   file.close();
   for (int i = 1; i <= maxcnt; ++i) {
-    rc += QString::number(i);
+    rc += i18n("Column %1").arg(i);
   }
 
   return rc;
--- branches/work/kst/portto4/kst/src/libkst/datavector.cpp #1061397:1061398
@@ -282,7 +282,6 @@
 
 
 QString DataVector::label() const {
-  bool ok;
   QString label;
 
   if (_fieldStrings.contains("quantity")) {
@@ -297,18 +296,7 @@
       }
     }
   } else {
-    _field.toInt(&ok);
-    if (ok && _file) {
-      _file->readLock();
-      if (_file->fileType() == "ASCII file") {
-        label = i18n("Column %1", _field);
-      } else {
-        label = _field;
-      }
-      _file->unlock();
-    } else {
-      label = _field;
-    }
+    label = _field;
     label.replace('_', "\\_");
   }
 
@@ -725,11 +713,7 @@
 
 QString DataVector::_automaticDescriptiveName() const {
   QString name;
-  if (_file->fileType() == "ASCII file") {
-    name = i18n("Column %1", _field);
-  } else {
-    name = _field;
-  }
+  name = _field;
   return name.replace("_", "\\_");
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/commandlineparser.cpp #1061397:1061398
@@ -201,7 +201,15 @@
     if ((_startFrame==-1) && (_numFrames==-1)) { // count from end and read to end
       _startFrame = 0;
     }
-
+    // Flaky magic: if ds is an ascii file, change fields named 0 to 99 to
+    // Column xx.  This allows "-y 2" but prevents ascii files with fields
+    // actually named "0 to 99" from being read from the command line.
+    if (ds->fileType() == "ASCII file") {
+      QRegExp num("^[0-9]{1,2}$");
+      if (num.exactMatch(field)) {
+        field = i18n("Column %1", field);
+      }
+    }
     // check to see if an identical vector already exists.  If so, use it.
     for (int i=0; i<_vectors.count(); i++) {
       xv = _vectors.at(i);
--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.cpp #1061397:1061398
@@ -306,7 +306,6 @@
   _curveTab->clearTabValues();
 }
 
-
 void CurveDialog::editSingleMode() {
    configureTab(dataObject());
 }
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.cpp #1061397:1061398
@@ -183,6 +183,7 @@
 
   qSort(list);
 
+  int current_index = _vector->currentIndex();
   VectorPtr current = selectedVector();
 
   _vector->clear();
@@ -195,9 +196,11 @@
   if (_allowEmptySelection) //reset the <None>
     setAllowEmptySelection(true);
 
-  if (current)
+  if (current_index==-1) {
+    _vector->setCurrentIndex(current_index);
+  } else if (current) {
     setSelectedVector(current);
-
+  }
 }
 
 


More information about the Kst mailing list