nens / threedi-api-qgis-client

3Di Models & Simulations plugin
https://plugins.lizard.net/
Other
2 stars 0 forks source link

Allow max_time_step to be NULL #418

Closed leendertvanwolfswinkel closed 1 year ago

leendertvanwolfswinkel commented 1 year ago

When initializing the simulation wizard from a simulation template that has NULL for maximum_time_step, an error is produced.

Apparently, the problem is that if max_time_step is NULL / null / None is, it is attempted to initialise the value in the UI to None, which is not allowed. (https://github.com/nens/threedi-api-qgis-client/blob/cb2a463f044ac2638f31c5df60a69569c0a36e59/threedi_models_and_simulations/utils_ui.py#L106)

caspervdw commented 1 year ago
Traceback (most recent call last):
  File "C:\Users\jonas.vanschrojenste\AppData\Roaming\3Di\QGIS3\profiles\demo user/python/plugins\threedi_models_and_simulations\widgets\simulation_overview.py", line 107, in new_wizard_init
    self.new_simulation(simulation, settings_overview, events)
  File "C:\Users\jonas.vanschrojenste\AppData\Roaming\3Di\QGIS3\profiles\demo user/python/plugins\threedi_models_and_simulations\widgets\simulation_overview.py", line 131, in new_simulation
    self.simulation_wizard.load_template_parameters(simulation, settings_overview, events)
  File "C:\Users\jonas.vanschrojenste\AppData\Roaming\3Di\QGIS3\profiles\demo user/python/plugins\threedi_models_and_simulations\widgets\simulation_wizard.py", line 1926, in load_template_parameters
    set_widgets_parameters(
  File "C:\Users\jonas.vanschrojenste\AppData\Roaming\3Di\QGIS3\profiles\demo user/python/plugins\threedi_models_and_simulations\utils_ui.py", line 106, in set_widgets_parameters
    widget.setValue(value)
TypeError: setValue(self, float): argument 1 has unexpected type 'NoneType'
leendertvanwolfswinkel commented 1 year ago

@ldebek do not bother about making this field NULLable in the UI; if "Use timestep stretch" if turned on, it is required; if it is turned off, it is ignored.

leendertvanwolfswinkel commented 1 year ago

@ldebek As an example, you can use revision 7 of Demo model 1D2D (Lutra) on production

ldebek commented 1 year ago

@leendertvanwolfswinkel Fix ready for testing on branch: issue_418_fix

leendertvanwolfswinkel commented 1 year ago

@ldebek tested, please merge