[Qgis-developer] How to stopediting/rollback in a plugin before
changing the project-file
bjsvwpfe
Michael.Pfeiffer at bd.so.ch
Fri Dec 5 01:49:36 EST 2008
Hi everybody,
I'm working on a plugin in which the user is editing a database-layer.
So I'm loading automatically a project with all the necessary layers.
The layer to be edited is already switched editable.
When the user closes the plugin the changes in the edited layer are saved
automatically.
You see we are doing everything for our users :-)
But now my problem. If the user clicks by mistake the "load new Project"
button and then doesn't save the project (I know this is not very supposable
:thinking:) I want to rollback the edited layer or save the changes.
But how to do this? The only possibility I found is to listen on the
triggered() SIGNAL of the actionNewProject().
QObject.connect(self.iface.actionNewProject(),SIGNAL("triggered(bool)"),self.deleteRubberBand)
# Entfernt das RubberBand
def deleteRubberBand(self,rubberLayer="default"):
if (rubberLayer == False): # The triggered Signal sents False
self.layer.rollBack() #This is the layer I want to save/rollback
for value in self.mRubberBand:
value.reset()
But when the signal was sent, it is to late, my QgsVectorLayer doesn't exist
anymore.
So how can I save/rollback the edited layer before everything is deleted?
Maybe there is sth like a closeProject Signal respectively what happens when
the user clicks the discard button in the "save the current project" dialog?
I hope you understand what I want to do
Any hints would be great.
Best regards
Michael
--
View this message in context: http://www.nabble.com/How-to-stopediting-rollback-in-a-plugin-before-changing-the-project-file-tp20848621p20848621.html
Sent from the qgis-developer mailing list archive at Nabble.com.
More information about the Qgis-developer
mailing list