Bug report #10862

QGIS 2.4 adds 2 objects in one click while using Python Init functions and own UI form..

Added by Seb Radzimski about 10 years ago. Updated almost 10 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Python plugins
Affected QGIS version:2.4.0 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:19231

Description

Hi.
I have a problem in QGIS 2.4 and Python Init functions working with UI form. In previus versions of QGIS everything is working fine but in 2.4 every time I add one object, QGIS adds second one in the same place. It happens if I work on SHP files or on PostgreSQL database. Second object has the same attributes as the first one (instead of GID in PostgreSQL).
I don't know if something has change in QGIS 2.4 and Python Init function. I've attached some project (works in Windows) with 2 layers (point and line), form.ui and Python script (does nothing, apart of making problem) which is part of my biger project.
Please let me know if I should change something in Python code or there is a problem in QGIS 2.4?
Thanks!

error.zip (7.8 KB) Seb Radzimski, 2014-07-10 02:15 AM

Associated revisions

Revision 9f073834
Added by Matthias Kuhn almost 10 years ago

Only add feature once when python init function is set on attribute form
Fix #10862

Revision bd5846b5
Added by Matthias Kuhn almost 10 years ago

Only add feature once when python init function is set on attribute form
Fix #10862

History

#1 Updated by Jürgen Fischer about 10 years ago

  • Subject changed from QGIS 2.4 adds 2 objects in one click while using Phyton Init functions and own UI form.. to QGIS 2.4 adds 2 objects in one click while using Python Init functions and own UI form..

#2 Updated by Thomas Kreuzer almost 10 years ago

I have the exact same problem for PostGIS layers, on Windows and on Linux.
And the problem is only because of the "Python Init Function", whether you use a custom ui or not doesn't matter.
And it doesn't matter how the "Python Init Function" looks like, even if it is just

def openForm(dialog, layer, feature):
   pass

QGIS will create two exact features.
This renders most database interfaces useless.

#3 Updated by Seb Radzimski almost 10 years ago

OK now I know it is not only my problem. Is there any chance to fix it in 2.4 or maybe 2.6 QGIS? For now I can try to delete this duplicate object on database level...
Regards!

#4 Updated by Giovanni Manghi almost 10 years ago

  • Status changed from Open to Feedback

Seb Radzimski wrote:

OK now I know it is not only my problem. Is there any chance to fix it in 2.4 or maybe 2.6 QGIS? For now I can try to delete this duplicate object on database level...
Regards!

did it worked as expected in previous qgis releases?

#5 Updated by Thomas Kreuzer almost 10 years ago

It worked in the 2.3.0-24 weekly build, at least.
I maybe should say that I am on x64.

#6 Updated by Giovanni Manghi almost 10 years ago

  • Status changed from Feedback to Open
  • Priority changed from Normal to Severe/Regression

#7 Updated by Seb Radzimski almost 10 years ago

It happens in QGIS 2.4 installed on Windows 32 and 64 bit (OSGeo4W on 7x64 and standalone installer on server 2008x86 nad XP) while working with postgis database or shp files. In previus version of QGIS (2.0 and 2.2) the same project works fine (no duplicates are added). You can check it with files attached in first post.

#8 Updated by Andreas Neumann almost 10 years ago

hm - this should definitely go into a 2.4 bugfix release.

I very much hope that there will be a 2.4 bugfix release.

#9 Updated by Matthias Kuhn almost 10 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF