[Qgis-developer] Saving expressions

Larry Shaffer larrys at dakotacarto.com
Fri Oct 19 18:52:53 PDT 2012


Hi Nathan,

On Fri, Oct 19, 2012 at 6:16 PM, Nathan Woodrow <madmanwoo at gmail.com> wrote:
> Saving with the layer isn't really that complicated as we already do
> it for the qml files so the code is already all there just needs to be
> tweaked for expressions.  Although I do see project based and
> application wide expressions to be of more use then per-layer.
>
> I'm really not a big fan of those back and forward buttons.  My idea
> is to have a save button with three options:
>
> Save as
> - Application favourite
> - Project favourite
> - File
>
> All just save out a key value pair of name : expression. The
> application one is stored in the QSettings for QGIS, the project one
> in the project file, and the File one writes a file out with name :
> expression in the file.
>
> When you open the expression builder it will load all the name and
> expressions from QSettings and show them in the tree on the left in a
> node called: Favourite Expressions (App wide).  It will then read the
> project file and do the same but put them under: Favourite Expressions
> (Project).  After that the user can then load an expression from the
> file using the Load button much like the new Python console.
>
> This way a user can open the expression builder and pick a saved
> expression by name and it will be loaded into the expression text
> area. When the user single clicks on the named expression the
> expression text will be show in the help section on the right so that
> the user can see what it is without loading it.

If the saved expressions were 'named' (as you suggested, Nathan), it
would go a long way towards realizing better, extensible tokens in the
Print Composer [0].

The only difference would be the pasting of a token, based upon the
name and storage location (qgis, project, and possibly file; e.g.
[%qgis:mypagecount%] or [%prj:mycrstxt%] ) instead of the expression
itself being hard-coded into the label text (though that's already
much better than before, thanks Hugo).

It would be handy to embed tokens inside of tokens, i.e. named
sub-expressions inside of other expressions, but that might be getting
a bit crazy.  :^)

Allowing the user to edit, or at least overwrite, a saved named
expression would also be a useful feature.

[0] http://hub.qgis.org/issues/6269

Larry

> - Nathan
>
> On Sat, Oct 20, 2012 at 12:18 AM, Anita Graser <anitagraser at gmx.at> wrote:
>> Maybe we could just have an interface similar to Spatialite GUI where
>> there are forward/backwards buttons besides the SQL input area. They
>> allow to go back in command history.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list