Sunday, 24 June 2018

pyqgis - Accessing QGIS program settings programmatically?


I am trying to temporarily enable the option in QGIS using PyQt4 to suppress the attribute dialog popup after a feature is added. I found an example in the cookbook but it doesn't indicate how to get to existing settings.




Answer



The procedure is exactly the same. The settings are not documented, so you have to look them up in the code. For your purpose this is /qgis/digitizing/disable_enter_attribute_values_dialog


from qgis.PyQt.QtCore import QSettings

# get user defined current setting
disableDialog = QSettings().value( '/qgis/digitizing/disable_enter_attribute_values_dialog')
# override setting
QSettings().setValue( '/qgis/digitizing/disable_enter_attribute_values_dialog', True )

# do your processing here...


# restore setting
QSettings().setValue( '/qgis/digitizing/disable_enter_attribute_values_dialog', disableDialog )

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...