qwat / QWAT

TEKSI Water module (project QWAT) - QGIS project
https://www.teksi.ch
GNU General Public License v2.0
57 stars 31 forks source link

upgrading to 3.16.4 installation form issue #311

Open tudorbarascu opened 3 years ago

tudorbarascu commented 3 years ago

upgrading to 3.16.4 crashes the installation form as the dialog.findChild outputs different results between 3.10 and 3.16

The code:

def formOpen(dialog, layer, feature):
    subForms = []
    typeSelector = dialog.findChild(QComboBox, 'installation_type')

has different results between 3.10 and 3.16. For example:

For 3.10:

Count of objects in subForms found in 3.10:  6
WidgetName:  chamber
WidgetName:  pump
WidgetName:  pressurecontrol
WidgetName:  tank
WidgetName:  source
WidgetName:  treatment
Subforms:  [<PyQt5.QtWidgets.QGroupBox object at 0x7f9919f8d9d0>,
 <PyQt5.QtWidgets.QGroupBox object at 0x7f9919f8de50>,
 <PyQt5.QtWidgets.QGroupBox object at 0x7f9919f8ddc0>,
 <PyQt5.QtWidgets.QTabWidget object at 0x7f9919f8dd30>,
 <PyQt5.QtWidgets.QGroupBox object at 0x7f9919f8dca0>,
 <PyQt5.QtWidgets.QGroupBox object at 0x7f9919f8dee0>]

For 3.16:

Count of objects in subForms found in 3.16: 7
WidgetName:  chamber
WidgetName:  pump
WidgetName:  pressurecontrol
WidgetName:  tank
WidgetName:  source
WidgetName:  treatment
WidgetName:  {2839923C-8B7D-419E-B84B-CA2FE9B80EC7} -- THE EXTRA STUFF.. something tied to the NULL value

Subforms:  [<PyQt5.QtWidgets.QGroupBox object at 0x7f46e4a7bd30>,
 <PyQt5.QtWidgets.QGroupBox object at 0x7f46e46a7040>,
 <PyQt5.QtWidgets.QGroupBox object at 0x7f46e46a70d0>,
 <PyQt5.QtWidgets.QTabWidget object at 0x7f46e46a7160>,
 <PyQt5.QtWidgets.QGroupBox object at 0x7f46e46a71f0>, 
<PyQt5.QtWidgets.QGroupBox object at 0x7f46e46a7280>, 
None]  -- HERE THERE's an extra None.. 

Currently investigating. Anyone else has this problem?

tudorbarascu commented 3 years ago

There's the 2839923C-8B7D-419E-B84B-CA2FE9B80EC7 magic value that appears but shouldn't be there as it is tied with the value map widget and I'm pretty sure it has no place in the result of dialog.findChild output.

See https://github.com/qgis/QGIS/search?q=2839923C-8B7D-419E-B84B-CA2FE9B80EC7&type=code

tudorbarascu commented 3 years ago

Wel.. actually.. that's if you use the installation.ui file :). So.. if nobody else uses it.. I'll close this down and not do any followup.

lbartoletti commented 3 years ago

mmm. I think insteallation.ui file is used by some groups ( @kandre @ponceta ?). We have to filter this magic value @tudorbarascu ?

ponceta commented 3 years ago

@tudorbarascu good catch!

We still have to update the qwat.qgs project to 3.16 (New LTR).

In Pully and SIGE we don't use .ui files anymore but the project has to be updated, either by removing or fixing this ui file definition.

Linked to https://github.com/qwat/QWAT/issues/312

tudorbarascu commented 3 years ago

mmm. I think insteallation.ui file is used by some groups ( @kandre @ponceta ?). We have to filter this magic value @tudorbarascu ?

Well.. I thought about filtering in the python logic that but IMHO it's not the correct thing to do as that magic value shouldn't be there, the correct fix would be in the core so that the None widget doesn't appear when finding children so that we don't stumble on it later on. If there's a bug in the core it could bite us elsewhere where we maybe wouldn't catch it or it will be too late and maybe data errors will already be introduced.