Re: [Qgis-user] QGIS - value relation widget
I continue my work and I discover another problem.I have a 3 level nested form (granparent-parent and child). If I don't use global variables when I select a record in child to parent and then one in parent, QGIS raise an error: Traceback (most recent call last): File "E:/lavori/Progetti_PIE/Convenzione_SISMICA/NomeComune_RP_v2.1.3_alpha1\indaginipun.py", line 42, in LedQtop.textChanged.connect(lambda: validaQuota(LedQtop)) NameError: free variable 'LedQtop' referenced before assignment in enclosing scope to avoid this error I have to declare some variable in my parent form but then I have a minidump error when insert new records. I'm in a "cul de sac". To hard for my weak python knowledge thanks for all Luca 2015-10-02 10:57 GMT+02:00 Luca Lanteri : > Great Matthias, > > I remove all global variables and now it work fine ! > > It remain just one problem, I add some code [0] connected with a button to > insert a filename in a field. > If use the button from single form all works fine but when I use it in > from the parent-child form the code start lot of times (it seems one time > for every record in the table). > > > ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] QGIS - value relation widget
Hi Andreas On 10/02/2015 09:27 AM, Andreas Neumann wrote: > Hi Matthias, > > I was also thinking about that - but would it work also with normal > value relation widgets instead of relation reference widgets? They should probably be consolidated at one point in order not to develop things like this twice. > > The option to filter value relation lists, depending on the selection > of other value relation widgets is probably a quite common request. > Would be cool if this could be supported in QGIS core. > > Andreas > > On 02.10.2015 09:24, Matthias Kuhn wrote: >> Hi Luca >> >> Would this core functionality of QGIS be an option for you? >> >> https://www.qgis.org/en/site/forusers/visualchangelog210/index.html#feature-filter-chaining-for-relation-reference-widget >> >> If you are still required to use python in your forms: are you using >> global variables? They can be an issue for embedded forms. >> >> Cheers, >> Matthias >> >> On 10/02/2015 09:09 AM, Luca Lanteri wrote: >>> Sadly, after further test I discover that the crashes remain, so I >>> think it is a qgis bug and not a problem in my code. >>> The problem happens when I put my custom form into a subform widget >>> (QgsRelationEditorWidget). If I add a new record in the subform and >>> I move to another record using the left column QGIS crashes. It >>> seems to be a more general problem because the crash appears also >>> when I add some simple control that modify the object in the form. >>> >>> I can open a ticket and add some test data. >>> If it is a minor bug and it could be resolved easily I really offer >>> a pizza and a beer to resolve it. >>> >>> All the best >>> Luca >>> >>> >>> 2015-10-01 23:53 GMT+02:00 Luca Lanteri >> <mailto:mesca...@gmail.com>>: >>> >>> Hi, >>> >>> now I'm already using the python logic but my code is terrible >>> and I have a lot of crash problem. >>> Now that I using your example all is easier and seem to worsk fine. >>> >>> I owe you one beer. >>> Many many tanks ! >>> >>> Luca >>> >>> >>> 2015-10-01 22:23 GMT+02:00 Blumentrath, Stefan >>> : >>> >>> Hi Luca, >>> >>> >>> >>> Sounds like a case for Python logic! >>> >>> General principles are explained here: >>> >>> >>> http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ >>> >>> >>> >>> Also nice, and probably exactly what you are looking for: >>> >>> http://medspx.fr/blog/Qgis/cascade_forms/ >>> >>> >>> >>> Cheers >>> >>> Stefan >>> >>> >>> >>> *From:*qgis-user-boun...@lists.osgeo.org >>> <mailto:qgis-user-boun...@lists.osgeo.org> >>> [mailto:qgis-user-boun...@lists.osgeo.org >>> <mailto:qgis-user-boun...@lists.osgeo.org>] *On Behalf Of >>> *Luca Lanteri >>> *Sent:* 1. oktober 2015 22:07 >>> *To:* qgis-user >>> *Subject:* [Qgis-user] QGIS - value relation widget >>> >>> >>> >>> Hi to all, >>> >>> I need to build a form when the value of a combo are >>> filtered basing on the value of anoter combobox. >>> I have a first combo where I choose the region and a second >>> with the municipalities. >>> I need that the second combo shows only the municipalities >>> of the choosed region. >>> I tried to use use the widget "relationship value" with the >>> a filter like classe_munic = attribute($currentfeature, >>> 'classe_munic') without any success. >>> >>> Has anyone ever done something similar? >>> Thank in advance >>> >>> >>> Luca >>> >>> >>> >>> >>> >>> ___ >>> Qgis-user mailing list >>> Qgis-user@lists.osgeo.org >>> http://lists.osgeo.org/mailman/listinfo/qgis-user >> >> >> >> ___ >> Qgis-user mailing list >> Qgis-user@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/qgis-user > > > > ___ > Qgis-user mailing list > Qgis-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-user signature.asc Description: OpenPGP digital signature ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] QGIS - value relation widget
Great Matthias, I remove all global variables and now it work fine ! It remain just one problem, I add some code [0] connected with a button to insert a filename in a field. If use the button from single form all works fine but when I use it in from the parent-child form the code start lot of times (it seems one time for every record in the table). [0] def apriFile(QLine): fileName=QLine.text() try: if os.path.isfile(fileName): os.startfile(fileName) else: msgBox = QMessageBox() msgBox.setText("Il file non esiste.") msgBox.exec_() except: msgBox = QMessageBox() msgBox.setText("Non riesco ad aprire il file.") msgBox.exec_() Thanks a lot and let me know how to send your beer. ;-) 2015-10-02 9:24 GMT+02:00 Matthias Kuhn : > Hi Luca > > Would this core functionality of QGIS be an option for you? > > > https://www.qgis.org/en/site/forusers/visualchangelog210/index.html#feature-filter-chaining-for-relation-reference-widget > > If you are still required to use python in your forms: are you using > global variables? They can be an issue for embedded forms. > > Cheers, > Matthias > > > On 10/02/2015 09:09 AM, Luca Lanteri wrote: > > Sadly, after further test I discover that the crashes remain, so I think > it is a qgis bug and not a problem in my code. > The problem happens when I put my custom form into a subform widget > (QgsRelationEditorWidget). If I add a new record in the subform and I move > to another record using the left column QGIS crashes. It seems to be a more > general problem because the crash appears also when I add some simple > control that modify the object in the form. > > I can open a ticket and add some test data. > If it is a minor bug and it could be resolved easily I really offer a > pizza and a beer to resolve it. > > All the best > Luca > > > 2015-10-01 23:53 GMT+02:00 Luca Lanteri : > >> Hi, >> >> now I'm already using the python logic but my code is terrible and I have >> a lot of crash problem. >> Now that I using your example all is easier and seem to worsk fine. >> >> I owe you one beer. >> Many many tanks ! >> >> Luca >> >> >> 2015-10-01 22:23 GMT+02:00 Blumentrath, Stefan < >> stefan.blumentr...@nina.no>: >> >>> Hi Luca, >>> >>> >>> >>> Sounds like a case for Python logic! >>> >>> General principles are explained here: >>> >>> >>> http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ >>> >>> >>> >>> Also nice, and probably exactly what you are looking for: >>> >>> http://medspx.fr/blog/Qgis/cascade_forms/ >>> >>> >>> >>> Cheers >>> >>> Stefan >>> >>> >>> >>> *From:* qgis-user-boun...@lists.osgeo.org [mailto: >>> qgis-user-boun...@lists.osgeo.org] *On Behalf Of *Luca Lanteri >>> *Sent:* 1. oktober 2015 22:07 >>> *To:* qgis-user < Qgis-user@lists.osgeo.org> >>> *Subject:* [Qgis-user] QGIS - value relation widget >>> >>> >>> >>> Hi to all, >>> >>> I need to build a form when the value of a combo are filtered basing on >>> the value of anoter combobox. >>> I have a first combo where I choose the region and a second with the >>> municipalities. >>> I need that the second combo shows only the municipalities of the >>> choosed region. >>> I tried to use use the widget "relationship value" with the a filter >>> like classe_munic = attribute($currentfeature, 'classe_munic') without any >>> success. >>> >>> Has anyone ever done something similar? >>> Thank in advance >>> >>> >>> Luca >>> >> >> > > > ___ > Qgis-user mailing > listQgis-user@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/qgis-user > > > > ___ > Qgis-user mailing list > Qgis-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-user > ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] QGIS - value relation widget
Thanks Matthias! Cool stuff! There is happening so much with and around QGIS, it is hard keep up-to-date with the developers pace ... I am definitely gonna use this one! Cheers Stefan From: qgis-user-boun...@lists.osgeo.org [mailto:qgis-user-boun...@lists.osgeo.org] On Behalf Of Matthias Kuhn Sent: 2. oktober 2015 09:25 To: qgis-user@lists.osgeo.org Subject: Re: [Qgis-user] QGIS - value relation widget Hi Luca Would this core functionality of QGIS be an option for you? https://www.qgis.org/en/site/forusers/visualchangelog210/index.html#feature-filter-chaining-for-relation-reference-widget If you are still required to use python in your forms: are you using global variables? They can be an issue for embedded forms. Cheers, Matthias On 10/02/2015 09:09 AM, Luca Lanteri wrote: Sadly, after further test I discover that the crashes remain, so I think it is a qgis bug and not a problem in my code. The problem happens when I put my custom form into a subform widget (QgsRelationEditorWidget). If I add a new record in the subform and I move to another record using the left column QGIS crashes. It seems to be a more general problem because the crash appears also when I add some simple control that modify the object in the form. I can open a ticket and add some test data. If it is a minor bug and it could be resolved easily I really offer a pizza and a beer to resolve it. All the best Luca 2015-10-01 23:53 GMT+02:00 Luca Lanteri mailto:mesca...@gmail.com>>: Hi, now I'm already using the python logic but my code is terrible and I have a lot of crash problem. Now that I using your example all is easier and seem to worsk fine. I owe you one beer. Many many tanks ! Luca 2015-10-01 22:23 GMT+02:00 Blumentrath, Stefan mailto:stefan.blumentr...@nina.no>>: Hi Luca, Sounds like a case for Python logic! General principles are explained here: http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ Also nice, and probably exactly what you are looking for: http://medspx.fr/blog/Qgis/cascade_forms/ Cheers Stefan From: qgis-user-boun...@lists.osgeo.org<mailto:qgis-user-boun...@lists.osgeo.org> [mailto:qgis-user-boun...@lists.osgeo.org<mailto:qgis-user-boun...@lists.osgeo.org>] On Behalf Of Luca Lanteri Sent: 1. oktober 2015 22:07 To: qgis-user mailto:Qgis-user@lists.osgeo.org>> Subject: [Qgis-user] QGIS - value relation widget Hi to all, I need to build a form when the value of a combo are filtered basing on the value of anoter combobox. I have a first combo where I choose the region and a second with the municipalities. I need that the second combo shows only the municipalities of the choosed region. I tried to use use the widget "relationship value" with the a filter like classe_munic = attribute($currentfeature, 'classe_munic') without any success. Has anyone ever done something similar? Thank in advance Luca ___ Qgis-user mailing list Qgis-user@lists.osgeo.org<mailto:Qgis-user@lists.osgeo.org> http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] QGIS - value relation widget
Hi Matthias, I was also thinking about that - but would it work also with normal value relation widgets instead of relation reference widgets? The option to filter value relation lists, depending on the selection of other value relation widgets is probably a quite common request. Would be cool if this could be supported in QGIS core. Andreas On 02.10.2015 09:24, Matthias Kuhn wrote: Hi Luca Would this core functionality of QGIS be an option for you? https://www.qgis.org/en/site/forusers/visualchangelog210/index.html#feature-filter-chaining-for-relation-reference-widget If you are still required to use python in your forms: are you using global variables? They can be an issue for embedded forms. Cheers, Matthias On 10/02/2015 09:09 AM, Luca Lanteri wrote: Sadly, after further test I discover that the crashes remain, so I think it is a qgis bug and not a problem in my code. The problem happens when I put my custom form into a subform widget (QgsRelationEditorWidget). If I add a new record in the subform and I move to another record using the left column QGIS crashes. It seems to be a more general problem because the crash appears also when I add some simple control that modify the object in the form. I can open a ticket and add some test data. If it is a minor bug and it could be resolved easily I really offer a pizza and a beer to resolve it. All the best Luca 2015-10-01 23:53 GMT+02:00 Luca Lanteri <mailto:mesca...@gmail.com>>: Hi, now I'm already using the python logic but my code is terrible and I have a lot of crash problem. Now that I using your example all is easier and seem to worsk fine. I owe you one beer. Many many tanks ! Luca 2015-10-01 22:23 GMT+02:00 Blumentrath, Stefan : Hi Luca, Sounds like a case for Python logic! General principles are explained here: http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ Also nice, and probably exactly what you are looking for: http://medspx.fr/blog/Qgis/cascade_forms/ Cheers Stefan *From:*qgis-user-boun...@lists.osgeo.org <mailto:qgis-user-boun...@lists.osgeo.org> [mailto:qgis-user-boun...@lists.osgeo.org <mailto:qgis-user-boun...@lists.osgeo.org>] *On Behalf Of *Luca Lanteri *Sent:* 1. oktober 2015 22:07 *To:* qgis-user *Subject:* [Qgis-user] QGIS - value relation widget Hi to all, I need to build a form when the value of a combo are filtered basing on the value of anoter combobox. I have a first combo where I choose the region and a second with the municipalities. I need that the second combo shows only the municipalities of the choosed region. I tried to use use the widget "relationship value" with the a filter like classe_munic = attribute($currentfeature, 'classe_munic') without any success. Has anyone ever done something similar? Thank in advance Luca ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] QGIS - value relation widget
Hi Luca Would this core functionality of QGIS be an option for you? https://www.qgis.org/en/site/forusers/visualchangelog210/index.html#feature-filter-chaining-for-relation-reference-widget If you are still required to use python in your forms: are you using global variables? They can be an issue for embedded forms. Cheers, Matthias On 10/02/2015 09:09 AM, Luca Lanteri wrote: > Sadly, after further test I discover that the crashes remain, so I > think it is a qgis bug and not a problem in my code. > The problem happens when I put my custom form into a subform widget > (QgsRelationEditorWidget). If I add a new record in the subform and I > move to another record using the left column QGIS crashes. It seems to > be a more general problem because the crash appears also when I add > some simple control that modify the object in the form. > > I can open a ticket and add some test data. > If it is a minor bug and it could be resolved easily I really offer a > pizza and a beer to resolve it. > > All the best > Luca > > > 2015-10-01 23:53 GMT+02:00 Luca Lanteri <mailto:mesca...@gmail.com>>: > > Hi, > > now I'm already using the python logic but my code is terrible and > I have a lot of crash problem. > Now that I using your example all is easier and seem to worsk fine. > > I owe you one beer. > Many many tanks ! > > Luca > > > 2015-10-01 22:23 GMT+02:00 Blumentrath, Stefan > mailto:stefan.blumentr...@nina.no>>: > > Hi Luca, > > > > Sounds like a case for Python logic! > > General principles are explained here: > > > http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ > > > > Also nice, and probably exactly what you are looking for: > > http://medspx.fr/blog/Qgis/cascade_forms/ > > > > Cheers > > Stefan > > > > *From:*qgis-user-boun...@lists.osgeo.org > <mailto:qgis-user-boun...@lists.osgeo.org> > [mailto:qgis-user-boun...@lists.osgeo.org > <mailto:qgis-user-boun...@lists.osgeo.org>] *On Behalf Of > *Luca Lanteri > *Sent:* 1. oktober 2015 22:07 > *To:* qgis-user <mailto:Qgis-user@lists.osgeo.org>> > *Subject:* [Qgis-user] QGIS - value relation widget > > > > Hi to all, > > I need to build a form when the value of a combo are filtered > basing on the value of anoter combobox. > I have a first combo where I choose the region and a second > with the municipalities. > I need that the second combo shows only the municipalities of > the choosed region. > I tried to use use the widget "relationship value" with the a > filter like classe_munic = attribute($currentfeature, > 'classe_munic') without any success. > > Has anyone ever done something similar? > Thank in advance > > > Luca > > > > > > ___ > Qgis-user mailing list > Qgis-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-user signature.asc Description: OpenPGP digital signature ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] QGIS - value relation widget
Sadly, after further test I discover that the crashes remain, so I think it is a qgis bug and not a problem in my code. The problem happens when I put my custom form into a subform widget (QgsRelationEditorWidget). If I add a new record in the subform and I move to another record using the left column QGIS crashes. It seems to be a more general problem because the crash appears also when I add some simple control that modify the object in the form. I can open a ticket and add some test data. If it is a minor bug and it could be resolved easily I really offer a pizza and a beer to resolve it. All the best Luca 2015-10-01 23:53 GMT+02:00 Luca Lanteri : > Hi, > > now I'm already using the python logic but my code is terrible and I have > a lot of crash problem. > Now that I using your example all is easier and seem to worsk fine. > > I owe you one beer. > Many many tanks ! > > Luca > > > 2015-10-01 22:23 GMT+02:00 Blumentrath, Stefan >: > >> Hi Luca, >> >> >> >> Sounds like a case for Python logic! >> >> General principles are explained here: >> >> >> http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ >> >> >> >> Also nice, and probably exactly what you are looking for: >> >> http://medspx.fr/blog/Qgis/cascade_forms/ >> >> >> >> Cheers >> >> Stefan >> >> >> >> *From:* qgis-user-boun...@lists.osgeo.org [mailto: >> qgis-user-boun...@lists.osgeo.org] *On Behalf Of *Luca Lanteri >> *Sent:* 1. oktober 2015 22:07 >> *To:* qgis-user >> *Subject:* [Qgis-user] QGIS - value relation widget >> >> >> >> Hi to all, >> >> I need to build a form when the value of a combo are filtered basing on >> the value of anoter combobox. >> I have a first combo where I choose the region and a second with the >> municipalities. >> I need that the second combo shows only the municipalities of the choosed >> region. >> I tried to use use the widget "relationship value" with the a filter like >> classe_munic = attribute($currentfeature, 'classe_munic') without any >> success. >> >> Has anyone ever done something similar? >> Thank in advance >> >> >> Luca >> > > ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] QGIS - value relation widget
Hi, now I'm already using the python logic but my code is terrible and I have a lot of crash problem. Now that I using your example all is easier and seem to worsk fine. I owe you one beer. Many many tanks ! Luca 2015-10-01 22:23 GMT+02:00 Blumentrath, Stefan : > Hi Luca, > > > > Sounds like a case for Python logic! > > General principles are explained here: > > > http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ > > > > Also nice, and probably exactly what you are looking for: > > http://medspx.fr/blog/Qgis/cascade_forms/ > > > > Cheers > > Stefan > > > > *From:* qgis-user-boun...@lists.osgeo.org [mailto: > qgis-user-boun...@lists.osgeo.org] *On Behalf Of *Luca Lanteri > *Sent:* 1. oktober 2015 22:07 > *To:* qgis-user > *Subject:* [Qgis-user] QGIS - value relation widget > > > > Hi to all, > > I need to build a form when the value of a combo are filtered basing on > the value of anoter combobox. > I have a first combo where I choose the region and a second with the > municipalities. > I need that the second combo shows only the municipalities of the choosed > region. > I tried to use use the widget "relationship value" with the a filter like > classe_munic = attribute($currentfeature, 'classe_munic') without any > success. > > Has anyone ever done something similar? > Thank in advance > > > Luca > ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] QGIS - value relation widget
Hi Luca, Sounds like a case for Python logic! General principles are explained here: http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ Also nice, and probably exactly what you are looking for: http://medspx.fr/blog/Qgis/cascade_forms/ Cheers Stefan From: qgis-user-boun...@lists.osgeo.org [mailto:qgis-user-boun...@lists.osgeo.org] On Behalf Of Luca Lanteri Sent: 1. oktober 2015 22:07 To: qgis-user Subject: [Qgis-user] QGIS - value relation widget Hi to all, I need to build a form when the value of a combo are filtered basing on the value of anoter combobox. I have a first combo where I choose the region and a second with the municipalities. I need that the second combo shows only the municipalities of the choosed region. I tried to use use the widget "relationship value" with the a filter like classe_munic = attribute($currentfeature, 'classe_munic') without any success. Has anyone ever done something similar? Thank in advance Luca ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] QGIS - value relation widget
Hi to all, I need to build a form when the value of a combo are filtered basing on the value of anoter combobox. I have a first combo where I choose the region and a second with the municipalities. I need that the second combo shows only the municipalities of the choosed region. I tried to use use the widget "relationship value" with the a filter like classe_munic = attribute($currentfeature, 'classe_munic') without any success. Has anyone ever done something similar? Thank in advance Luca ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user