Version: 1.2.0_devel (using KDE 3.4.0, compiled sources) Compiler: gcc version 3.4.3 OS: SunOS (sun4u) release 5.8 Currently, if you want to work on a file named "mydata.cdf", you have to: 1) start kst 2) launch the datawizard (one click) 3) select the right file in the first page (can be many clicks) before you can start working on it (I consider the command line switches "kst -F datafile -x foo -y bar ..." too long to type be used for normal interactive use when you want to plot many variables) I think "kst mydata.cdf" should see that mydata.cdf is not a valid kst file (which it already sees), and instead of complaining about it, open the datawizard initialized on that file.
There are problems with doing this, as if we suppress the error message if we don't have a valid kst file and also attempt to open the file in the data wizard then the user who actually does have an invalid kst file will be confused. The better option would probably be to add another command line setting that would take a datafile name to be loaded directly into the data wizard. Something like: kst -w mydata.cdf This is only slightly more to type with a much clearer intent.
Something like that would be OK :-)
Actually it's even worse than Andrew says, because Kst will think that all files passed to it and don't look like .kst files are ASCII files, basically. At best we could add a new command-line option.
You are right, so let's go for a new command line switch (-w for wizard ?) :-)
SVN commit 440041 by arwalker: BUG:109460 Allow user to specify data file to be loaded into data wizard on the command line. M +1 -0 datawizard.ui M +5 -0 datawizard.ui.h M +16 -0 kst.cpp M +1 -0 kst.h M +11 -1 main.cpp --- trunk/extragear/graphics/kst/kst/datawizard.ui #440040:440041 @@ -1397,6 +1397,7 @@ <variable access="private">QGuardedPtr<QWidget> _configWidget;</variable> </variables> <slots> + <slot access="public">setInput( const QString & input )</slot> <slot access="private">init()</slot> <slot access="private">xChanged()</slot> <slot access="private">sourceChanged( const QString & txt )</slot> --- trunk/extragear/graphics/kst/kst/datawizard.ui.h #440040:440041 @@ -56,6 +56,11 @@ } +void DataWizard::setInput(const QString &input) { + _url->setURL(input); +} + + void DataWizard::plotColsChanged() { _reGrid->setChecked(true); } --- trunk/extragear/graphics/kst/kst/kst.cpp #440040:440041 @@ -2000,6 +2000,22 @@ } } + +void KstApp::showDataWizardWithFile(const QString &input) { + DataWizard *dw = new DataWizard(this, "DataWizard"); + dw->setInput(input); + dw->exec(); + if (dw->result() == QDialog::Accepted) { + delete dw; // leave this here - releases references + forceUpdate(); + doc->setModified(); + updateDialogs(); + } else { + delete dw; + } +} + + void KstApp::registerDocChange() { kdDebug() << "register doc changed" << endl; forceUpdate(); --- trunk/extragear/graphics/kst/kst/kst.h #440040:440041 @@ -323,6 +323,7 @@ void showExtensionManager(); /** creates the data wizard */ + void showDataWizardWithFile(const QString &input); void showDataWizard(); //show the quickstart dialog, but only if specified so in the KstSettings --- trunk/extragear/graphics/kst/kst/main.cpp #440040:440041 @@ -69,6 +69,7 @@ { "m <NC>", I18N_NOOP("Separate plots arranged in <NC> columns"),0}, { "d", I18N_NOOP("Display as points rather than curves"),0}, { "g", I18N_NOOP("Provide a legend box"),0}, + { "w <file>", I18N_NOOP("Display the data wizard"),"<none>"}, { "print <file>", I18N_NOOP("Print to file and exit"),"<none>"}, { "png <file>", I18N_NOOP("Save as a png file and exit"),"<none>"}, { "nq", I18N_NOOP("Bypass the quickstart dialog"), 0}, @@ -373,12 +374,14 @@ QCStringList::Iterator hs_string; QCStringList::Iterator eq_i; bool showQuickStart = false; + bool showDataWizard = false; bool nOK; int n_y = 0; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); CheckForCMDErrors(args); + QString wizardfile = args->getOption("w"); QString printfile = args->getOption("print"); QString pngfile = args->getOption("png"); bool print_and_exit = false; @@ -718,7 +721,11 @@ if (args->isSet("nq")) { showQuickStart = false; } - + if (args->isSet("w")) { + showDataWizard = true; + showQuickStart = false; + } + if (printfile != "<none>") { kst->forceUpdate(); kst->immediatePrintToFile(printfile); @@ -740,6 +747,9 @@ if (showQuickStart) { kst->showQuickStartDialog(); } + if (showDataWizard) { + kst->showDataWizardWithFile(wizardfile); + } for (size_t i=0; i<strErrors.size(); i++) { KstDebug::self()->log(strErrors[i], KstDebug::Warning); }