Summary: | Ability to display meta-info about a datasource | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Matthew Truch <matt> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Matthew Truch
2006-01-25 00:08:07 UTC
Thanks for the report :-) I was planning to do it, but never got around to it. When I brought this discussion to the list recently, George answered he'd be glad to add more support for metadata, but that we'd need a concrete idea of how it can be implemented/used. As this is currently pretty open, there certainly is a need to "standardize" a bit. My suggestion (essentially the same as Matt's) would be for the datasource to pass two lists to kst: - a list of string/numerical value pairs (e.g. Number of variables/500) - a list of string/string pairs (e.g. Author/Linus) The first list could be used to create new scalars, and the second would go into strings (which by the way implies the creation of a kst list of strings, hence bug #120772). That in itself would allow the user to display metadata easily (note that they'd need to update if used in a label and the datafile is changed, this is very important !). To extend the use of metadata further, I also like the idea of having: - a datasource-specific dialog with that information in tabular format, but I don't really see where this should go. Maybe add some lines in the data manager to list for each loaded datasource: filename, number of fields/matrices available, number used, and a tooltip with metadata or a link or RMB popup that would open up a specific dialog. - an optional window/page that would display all metadata for currently used datasources. I suppose we'll have to open separate reports for these last 2 ideas... 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(); |