Bug 120773 - Add datasource information in the data manager
Summary: Add datasource information in the data manager
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Solaris
: NOR wishlist
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-25 11:56 UTC by Nicolas Brisset
Modified: 2006-05-30 18:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Brisset 2006-01-25 11:56:50 UTC
Version:           1.2.0_devel (using KDE 3.4.0, compiled sources)
Compiler:          gcc version 3.4.3
OS:                SunOS (sun4u) release 5.8

[Idea already mentioned in bug #120749, but actually separate]

Currently, the only place you can see (pretty rough) information on currently loaded data sources is the debug log, or the filename indicated for each vector (most often too long to even be visible in the dialog unless you scroll laterally).

It would be nice to add one line for each loaded datasource instance in the data manager. The columns could be used to show a lot of useful information. For example (not sure how bugzilla wraps lines, I hope it will be readable):
Name | Type | Used | Samples (available fields/matrices) | Properties (Full path/valid or not/etc...)
mydata.txt | ASCII | 23/0 | 10/0 | /home/joe/data/01012006/mydata.txt, valid
Comment 1 Nicolas Brisset 2006-01-25 12:06:07 UTC
The RMB menu for datasource entries could be:
- Check updates
- Reload
- Change data file (this would call the change data file dialog, with the vectors coming from that datasource pre-selected)
- Show metadata (see also bug #120749)
- Change type (to be able to force the right type when the current heuristic gives the wrong result) : this would bring up a dialog with the list of available datasource plugins sorted by decreasing relevance, based on the values returned by understands...().
Comment 2 George Staikos 2006-05-30 16:12:11 UTC
SVN commit 546593 by staikos:

Add a dialog that shows metadata for datasources from the data manager.  It's
low impact here.  I haven't really tested displaying any data since I don't have
any datasource that has metadata right now.  If any source plugin wants to put
it into variables, it can do it itself.  Nothing ever precluded this.  I'm not
going to put anything inline in the data manager because it's just too much data
and the horizontal scroll bar will be quite large. Also we'd have to strip out
many characters (and newlines).
FEATURE: 120749, 120773



 M  +1 -0      Makefile.am  
 A             datasourcemetadatadialog.ui  
 A             datasourcemetadatadialog.ui.h   [License: no copyright]
 M  +36 -2     kstdatamanager_i.cpp  
 M  +1 -0      kstdatamanager_i.h  


--- trunk/extragear/graphics/kst/src/libkstapp/Makefile.am #546592:546593
@@ -70,6 +70,7 @@
 	kstfilterdialog_i.cpp \
 	extensionmgr.cpp \
 	ksteditviewobjectdialog_i.cpp \
+	datasourcemetadatadialog.ui \
 	kstdatamanager_i.cpp \
 	kstviewmanager_i.cpp \
 	kstvectordialog_i.cpp \
--- trunk/extragear/graphics/kst/src/libkstapp/kstdatamanager_i.cpp #546592:546593
@@ -27,6 +27,7 @@
 #include <kstandarddirs.h>
 
 // application specific includes
+#include "datasourcemetadatadialog.h"
 #include "kst2dplot.h"
 #include "kstcurvedialog_i.h"
 #include "kstcsddialog_i.h"
@@ -473,14 +474,44 @@
 }
 
 
+void KstObjectItem::showMetadata() {
+  if (_rtti == RTTI_OBJ_DATA_VECTOR) {
+    DataSourceMetaDataDialog *dlg = new DataSourceMetaDataDialog(_dm, 0, false, WDestructiveClose);
+    KstReadLocker vl(&KST::vectorList.lock());
+    KstVectorList::Iterator m = KST::vectorList.findTag(_name);
+    KstRVectorPtr r = kst_cast<KstRVector>(*m);
+    KstDataSourcePtr dsp;
+    if (r) {
+      r->readLock();
+      dsp = r->dataSource();
+      r->readUnlock();
+    }
+    dlg->setDataSource(dsp);
+    dlg->show();
+  } else if (_rtti == RTTI_OBJ_DATA_MATRIX) {
+    DataSourceMetaDataDialog *dlg = new DataSourceMetaDataDialog(_dm, 0, false, WDestructiveClose);
+    KstReadLocker ml(&KST::matrixList.lock());
+    KstMatrixList::Iterator m = KST::matrixList.findTag(_name);
+    KstRMatrixPtr r = kst_cast<KstRMatrix>(*m);
+    KstDataSourcePtr dsp;
+    if (r) {
+      r->readLock();
+      dsp = r->dataSource();
+      r->readUnlock();
+    }
+    dlg->setDataSource(dsp);
+    dlg->show();
+  }
+}
+
+
 void KstObjectItem::activateHint(int id) {
   KstDataObjectPtr d = dataObject();
   const KstCurveHintList* hints = d->curveHints();
   int cnt = 0;
   for (KstCurveHintList::ConstIterator i = hints->begin(); i != hints->end(); ++i) {
     if (cnt == id) {
-      KstBaseCurvePtr c = (*i)->makeCurve(KST::suggestCurveName(d->tagName(), false),
-          KstColorSequence::next());
+      KstBaseCurvePtr c = (*i)->makeCurve(KST::suggestCurveName(d->tagName(), false), KstColorSequence::next());
       if (c) {
         KST::dataObjectList.lock().writeLock();
         KST::dataObjectList.append(c.data());
@@ -917,6 +948,7 @@
     id = m->insertItem(i18n("Make Cumulative &Spectral Decay..."), koi, SLOT(makeCSD()));
     id = m->insertItem(i18n("Make &Histogram..."), koi, SLOT(makeHistogram()));
     id = m->insertItem(i18n("&Reload"), koi, SLOT(reload()));
+    id = m->insertItem(i18n("Meta &Data"), koi, SLOT(showMetadata()));
   } else if (koi->rtti() == RTTI_OBJ_VECTOR) {
     id = m->insertItem(i18n("&Make Curve..."), koi, SLOT(makeCurve()));
     id = m->insertItem(i18n("Make &Power Spectrum..."), koi, SLOT(makePSD()));
@@ -925,6 +957,7 @@
   } else if (koi->rtti() == RTTI_OBJ_DATA_MATRIX) {
     id = m->insertItem(i18n("Make &Image..."), koi, SLOT(makeImage()));  
     id = m->insertItem(i18n("&Reload"), koi, SLOT(reload()));
+    id = m->insertItem(i18n("Meta &Data"), koi, SLOT(showMetadata()));
   } else if (koi->rtti() == RTTI_OBJ_MATRIX || koi->rtti() == RTTI_OBJ_STATIC_MATRIX) {
     id = m->insertItem(i18n("Make &Image..."), koi, SLOT(makeImage()));
   } else if ((c = kst_cast<KstBaseCurve>(koi->dataObject()))) {
@@ -986,5 +1019,6 @@
   }
 }
 
+
 #include "kstdatamanager_i.moc"
 // vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/src/libkstapp/kstdatamanager_i.h #546592:546593
@@ -92,6 +92,7 @@
     void makePSD();
     void makeImage();
     void reload();
+    void showMetadata();
 
   signals:
     void updated();
Comment 3 Nicolas Brisset 2006-05-30 18:10:53 UTC
Why not add a checkbox to the ASCII datasource to put header lines into a "header" metadata variable ?
This would be a good starting point I think to show a concrete example of how data can be passed around.