[Qgis-developer] [Qgis-user] Processing Feature Request(?): 'sticky parameters' AND generic settings....

Alexander Bruy alexander.bruy at gmail.com
Sat Oct 17 02:40:18 PDT 2015


Hi Richard,

I think your question is more suitable for developers list (cc-ing).

AFAIK, such behavior currently not available in Processing, but
I think this is good addition. If I'm not wrong we already even have
similar feature request.

Also I agree that having some utilities class for common operations
in C++ code with Python bindings will be useful.


2015-10-17 11:45 GMT+03:00 Richard Duivenvoorde <rdmailings at duif.net>:
>
> Hi, not sure if I ask something which is already available (then please
> let me know how), or else I ask for the following:
>
> I have a model which runs some scripts.
> This model takes as input some x,y,value file coming from an external
> appliation.
> For a given area this external app (actually a real mathamatical
> 'model') is ran several times given different parameters and the result
> is visualized in QGIS by showing the xy values, creating contours and
> styling it in some ways.
> So the scripts in the processing model for given area has several
> 'fixed' parameters. Eg the boundaries in the contour script for a given
> area are always the same. Or the 'load script' also has some inputs
> which are always the same.
>
> So in the different script you have input variables like:
>
> ##minval=number 0
> ##maxval=number 3000
>
> BUT using this script in a model, I do not want to set the values
> everytime. In the model it is exactly the same: I can set input values,
> but they are not 'remembered' in between following runs.
>
> So my idea (as said: please tell me if it is already there):
> Can we have something like
>
>
> ##minval=number 0 sticky
> ##maxval=number 3000 sticky
>
> My idea is that as soon as this script is ran, the 'default values' are
> set to the last used values.
> So NO value availabe: use the default one (eg 3000 for maxval), but as
> soon as the user has changed this to say 2500, that value is saved in
> the QSettings somewhere, and next time the script (or model) is ran, the
> default value will be 2500
>
> Idea? Or already available?
>
> Which brings me to the following, which I think is usefull for python
> devs, but I think also for cpp code.
>
> Why do we not have some utils class which holds some pretty often used
> code. What I now think of:
>
> - save a value in settings with given key
> - load a (cast to certain type) value from setting with given key and if
> not available provide a default something like (the type part not yet in
> it):
>
>     def get_settings_value(self, key, default=''):
>         if QSettings().contains(self.SETTINGS_SECTION + key):
>             key = self.SETTINGS_SECTION + key
>             val = QSettings().value(key)
>             return val
>         else:
>             return default
>
>     def set_settings_value(self, key, value):
>         key = self.SETTINGS_SECTION + key
>         QSettings().setValue(key, value)
>
> I see know so many places where there this is implemented...
>
>
> Or another one which I think should be centralized:
> - the saving and opening of 'current directory'...
> We have a lot of dialogs which open a file manager, but a lot of them
> open in pretty weird places (like some directory in the installation
> folder).
> I think it is better if we come up with some 'reasonable' places like:
> - current project folder
> - last data folder
> And implement those as util methods like to be used as opening places
> for the file dialogs.
>
> Opinions and or other ideas?
>
> Regards,
>
> Richard Duivenvoorde
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user



-- 
Alexander Bruy


More information about the Qgis-developer mailing list