1

I'm using QGIS 2.14.0. I have a custom python script that shows a form and then creates some layers from supplied parameters, but I want to save them on running/closing the form, but cannot figure it out (not default parameters, but persistent data from the last dialog).

I saw another kind of similar question and it said in settings/options tick 'reuse last entered attribute values', but this does nothing. I've a feeling it only works for built in forms.

this is the start of my code, can anyone offer a solution to this?

##NameArea=string
##ShowBoundary=boolean
##ShowRoads=boolean
##ShowStructures=boolean
from qgis.core import *
from qgis.gui import *
from qgis.utils import *
import processing
import os

If the solution is to somehow read/write data to a form I can do this but don't know where to start. I just figured this feature was pretty much a pre-requisite for most forms so has a simple solution.

asked Nov 6, 2018 at 10:14

1 Answer 1

1

Not sure if you can control the parameters that way as they are immediately created when the script is read. You could set default values so that they are shown to the user when the script is executed:

##NameArea=string PlaceName
##ShowBoundary=boolean True

If you want to keep the interface open, go to:

Processing > Options > General > Keep dialog open after running an algorithm

And enable this option. That way when you run your script, the interface will remain and the parameters should retain the values previously selected.

answered Nov 6, 2018 at 11:01
2
  • Yes, I can do that, but I'd like to have it for clicking it again after running it and closing the form. I was thinking there was maybe a pre and post run hook and I could run sql to save/get data from a table into the parameters? Commented Nov 6, 2018 at 11:23
  • @NeilWalker - Sorry but I'm unsure how this could be achieved. Hopefully others can provide an answer ^^ Commented Nov 6, 2018 at 11:36

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.