[Kst] Adding a datasource ?

George Staikos staikos at kde.org
Wed Apr 14 15:11:42 CEST 2004

On April 14, 2004 09:39, Nicolas.Brisset at eurocopter.com wrote:
> I've looked at how datasources work, and I'd like to add one for a custom
> format. I found the template/ directory with all the files needed, but
> there are a couple of things that are not so clear to me:

  Great!  Feel free to post any questions you have to the list.

> 1) how do I add the new type (I believe it has to do with the .desktop
> file) so that the right datasource is used for this filetype (which is
> ASCII but with a special fixed format, so that the best way to recognize it
> is a filename pattern "*.see") ?

   Yes you have to install a .desktop file that implements the "Kst Data 
Source" ServiceType.  You should probably look at the ascii plugin since it 
will likely look very similar to your plugin.  In there you will see some 
static methods such as "create_<name>", "understands_<name>", and 
"provides_<name>".  You will identify your files in understands_<name> by 
contents and/or filename.  You may be the first person to trigger a design 
bug that we know about, where two files may look similar enough that they get 
accepted by more than one data source.  If this happens, you can uninstall 
the other datasource temporarily, please notify us, and we will implement a 
solution or two for this.  I have a few ideas of what I'd like to see.

> 2) how do I add the new datasource to the build list ? Is it enough to add
> the new directory in datasources/ and relaunch configure ?

   You don't need to use our build tree, but it does make things easier.  You 
can put your directory in datasources/ and add it to SUBDIRS of the 
Makefile.am in datasources/.  If you're working with a release package of Kst 
instead of our CVS repository, it's probably sufficient to edit the 
Makefile.in to list your subdirectory and rerun configure, but I haven't 
tried this.

> Once I've achieved this, I'll try to add support for rVars and zVars of
> appropriate dimensions in cdf files (http://nssdc.gsfc.nasa.gov/cdf/). And
> if I'm lucky and find some time (and get some positive feedback from you) I
> might want to have a look at the datawizard...

   The data wizard will automatically pick up your new data formats when you 
install them.  If you have suggestions for the data wizard, please give the 
KDE bugzilla a try (http://bugs.kde.org/), or feel free to start a discussion 
on the mailing list.

George Staikos
KDE Developer			http://www.kde.org/
Staikos Computing Services Inc.	http://www.staikos.net/

More information about the Kst mailing list