Bug 120331

Summary: More options to memorize in datawizard
Product: [Applications] kst Reporter: Nicolas Brisset <nicolas.brisset>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: HI    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Solaris   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Proposed patch

Description Nicolas Brisset 2006-01-17 17:25:19 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

Many people request the following options to be remembered in the datawizard:
- whether "use existing" or "create new" X vector was last used, and which vector it was (I think the vector name is already remembered, but not the radiobutton status). Warning: if there is no vector yet, it has to be set back to "create new" just for once...
- label generation and legend options last chosen
Comment 1 Andrew Walker 2006-01-18 20:51:27 UTC
At present none of the options on the Plot Layout page of the data wizard are remembered. Does it make sense to selectively remember some, while not remembering others? This would be confusing to people I think. We should either remember all of the settings on a given page, or none.
Comment 2 George Staikos 2006-01-18 21:05:04 UTC
On Wednesday 18 January 2006 14:51, Andrew Walker wrote:
> ------- At present none of the options on the Plot Layout page of the data
> wizard are remembered. Does it make sense to selectively remember some,
> while not remembering others? This would be confusing to people I think. We
> should either remember all of the settings on a given page, or none.


  We remember a couple of things actually, but we have requests to disable 
that because it's causing problems for some users.
Comment 3 Andrew Walker 2006-01-19 19:29:17 UTC
Given that the preference seems to be to move in the opposite direction to what this bug report is proposing shouldn't it be withdrawn?
Comment 4 George Staikos 2006-01-19 21:04:08 UTC
On Thursday 19 January 2006 13:29, Andrew Walker wrote:
> ------- Given that the preference seems to be to move in the opposite
> direction to what this bug report is proposing shouldn't it be withdrawn?


   Let's see what needs to be done for the other situation first.  I should 
know in 2 weeks.
Comment 5 Nicolas Brisset 2006-01-25 16:36:08 UTC
I believe usability needs live testing. It's not only a matter of principles like homogeneity and general guidelines (even though those are very important as well), but most importantly of workflow and user-centric considerations.
Please don't withdraw this bug too quickly, because in some of our use cases here (e.g. one data file with a few thousand variables, where we don't know at first which variables to look at), we invoke the data wizard a great number of times and improvements such as those requested here DO make a difference. 

To illustrate this request more precisely, just imagine you have already loaded 100 different vars. If you need to add one you currently have to click the "use existing" field for the X var (X very often being time, which does not need to be duplicated), then you must scroll through the dropdown list, which is sorted in a different order than the list on the left (neither alphabetically, nor according to position in the file), find your X var, click it and only then can you proceed to the relevant action: selecting the Y variable. This can and should really be improved.
I'd suggest a pragmatic approach: we try to build a list of options to remember and agree on it before implementing this feature. I'm pretty confident that we can find the right subset, and I'm sure users won't complain if they don't need to click time and again on the same options. They might not even notice that kst remembers only some of their settings until they need to do something very different from their usual workflow.
Comment 6 Andrew Walker 2006-01-25 20:26:18 UTC
I would suggest that if we are going to remember some settings that we remember all settings. The first page of the data wizard could then have a Reset button which would return all the settings to their default values.
Comment 7 Andrew Walker 2006-01-26 19:52:06 UTC
Should be fixed for 1.2.1 release
Comment 8 Andrew Walker 2006-03-15 22:48:59 UTC
Created attachment 15140 [details]
Proposed patch

Remember the settings that make sense to remember
Comment 9 Nicolas Brisset 2006-03-16 10:42:49 UTC
I haven't read the patch, but I think this should be held back a while until bug #120330 is closed, as the UI and hence available settings could be impacted.
Comment 10 Andrew Walker 2006-03-16 19:42:03 UTC
SVN commit 519273 by arwalker:

BUG:120331 Remember more settings. This can be modified as necessary for later UI changes.

 M  +2 -0      datawizard.ui  
 M  +105 -0    datawizard.ui.h  


--- trunk/extragear/graphics/kst/src/libkstapp/datawizard.ui #519272:519273
@@ -1369,6 +1369,8 @@
     <function returnType="bool">xVectorOk()</function>
     <function returnType="bool">yVectorsOk()</function>
     <function>showPage( QWidget * page )</function>
+    <function>loadSettings()</function>
+    <function>saveSettings()</function>
 </functions>
 <pixmapinproject/>
 <layoutdefaults spacing="6" margin="11"/>
--- trunk/extragear/graphics/kst/src/libkstapp/datawizard.ui.h #519272:519273
@@ -53,6 +53,8 @@
     _xVectorExisting->setEnabled(false);
     _xVectorExisting->_newVector->hide();
     _xVectorExisting->_editVector->hide();
+    
+    loadSettings();
 }
 
 
@@ -484,6 +486,8 @@
     int ptype = 0;
     int prg = 0;
   
+    saveSettings();
+    
     KstDataSourcePtr ds = *KST::dataSourceList.findReusableFileName(_file);
     if (!ds) {
 	ds = KstDataSource::loadSource(_file);
@@ -1028,4 +1032,105 @@
     sourceChanged(_url->url());
 }
 
+void DataWizard::saveSettings()
+{
+  KConfig cfg("kstrc", false, false);
+
+  cfg.setGroup("DataWizard");
+
+  cfg.writeEntry("PlotXY", _radioButtonPlotData->isChecked());
+  cfg.writeEntry("PlotPS", _radioButtonPlotPSD->isChecked());
+  cfg.writeEntry("PlotBoth", _radioButtonPlotDataPSD->isChecked());
+  
+  cfg.writeEntry("XCreate", _xAxisCreateFromField->isChecked());
+  cfg.writeEntry("XFieldCreate", _xVector->currentText());
+  cfg.writeEntry("XExists", _xAxisUseExisting->isChecked());
+  cfg.writeEntry("XFieldExists", _xVectorExisting->selectedVector());
+  
+  cfg.writeEntry("Lines", _drawLines->isChecked());
+  cfg.writeEntry("Points", _drawPoints->isChecked());
+  cfg.writeEntry("Both", _drawBoth->isChecked());
+  
+  cfg.writeEntry("LogX", _psdLogX->isChecked());
+  cfg.writeEntry("LogY", _psdLogY->isChecked());
+  cfg.writeEntry("XAxisLabel", _xAxisLabels->isChecked());
+  cfg.writeEntry("YAxisLabel", _yAxisLabels->isChecked());
+  cfg.writeEntry("TitleLabel", _plotTitles->isChecked());
+  
+  cfg.writeEntry("LegendsOn", _legendsOn->isChecked());
+  cfg.writeEntry("LegendsOff", _legendsOff->isChecked());
+  cfg.writeEntry("LegendsAuto", _legendsAuto->isChecked());
+  
+  cfg.writeEntry("OnePlot", _onePlot->isChecked());
+  cfg.writeEntry("MultiplePlots", _multiplePlots->isChecked());
+  cfg.writeEntry("CycleThrough", _cycleThrough->isChecked());
+  cfg.writeEntry("CycleExisting", _cycleExisting->isChecked());
+  cfg.writeEntry("PlotNumber", _plotNumber->value());
+}
+
+
+void DataWizard::loadSettings()
+{
+  KConfig cfg("kstrc");
+  QListBoxItem* pItem;
+  QString str;
+  
+  cfg.setGroup("DataWizard");
+    
+  if (cfg.readBoolEntry("PlotXY", true)) {
+    _radioButtonPlotData->setChecked(true);
+  } else if (cfg.readBoolEntry("PlotPS", true)) {
+    _radioButtonPlotPSD->setChecked(true);
+  } else {
+    _radioButtonPlotDataPSD->setChecked(true);
+  }
+  
+  if (cfg.readBoolEntry("XCreate", true) || _xVectorExisting->_vector->count() == 0) {
+    _xAxisCreateFromField->setChecked(true);
+    str = cfg.readEntry("XFieldCreate", "");
+    if (_xVector->listBox()) {
+      pItem = _xVector->listBox()->findItem(str, Qt::ExactMatch);
+      if (pItem) {
+        _xVector->listBox()->setSelected(pItem, true);
+      }
+    }
+  } else {
+    _xAxisUseExisting->setChecked(true);
+    str = cfg.readEntry("XFieldExists", "");
+    if (_xVectorExisting->_vector->listBox()) {
+      if (_xVectorExisting->_vector->listBox()->findItem(str, Qt::ExactMatch)) {
+        _xVectorExisting->setSelection(str);
+      }
+    }
+  }
+  
+  if (cfg.readBoolEntry("Lines", true)) {
+    _drawLines->setChecked(true);
+  } else if (cfg.readBoolEntry("Points", true)) {
+    _drawPoints->setChecked(true);
+  } else {
+    _drawBoth->setChecked(true);
+  }
+  
+  _psdLogX->setChecked( cfg.readBoolEntry("LogX", false));
+  _psdLogY->setChecked( cfg.readBoolEntry("LogY", false));
+  _xAxisLabels->setChecked( cfg.readBoolEntry("XAxisLabel", true));
+  _yAxisLabels->setChecked( cfg.readBoolEntry("YAxisLabel", true));
+  _plotTitles->setChecked( cfg.readBoolEntry("TitleLabel", true));
+  
+  if (cfg.readBoolEntry("LegendsAuto", true)) {
+    _legendsAuto->setChecked(true);
+  } else if(cfg.readBoolEntry("LegendsOn", true)) {
+    _legendsOn->setChecked(true);
+  } else {
+    _legendsOff->setChecked(true);
+  }
+
+  _onePlot->setChecked(cfg.readBoolEntry("OnePlot", true));
+  _multiplePlots->setChecked(cfg.readBoolEntry("MultiplePlots", false));
+  _cycleThrough->setChecked(cfg.readBoolEntry("CycleThrough", false));
+  _cycleExisting->setChecked(cfg.readBoolEntry("CycleExisting", false));
+  _plotNumber->setValue(cfg.readNumEntry("PlotNumber", 2));
+}
+
 // vim: ts=8 sw=4 noet