mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
RubarBE: refuse and disable upstream water level settings (REGIME=1, CONDAM=2)
This commit is contained in:
1 parent
ace85ccb40
commit
7103fdcb46
2 files changed
+31
-4
No files matched your search
@@ -42,6 +42,16 @@ OPTION_CHOICES = (
|
||||
)
|
||||
|
||||
|
||||
# Choices read by RubarBE 2021 but never used by its computation: the
|
||||
# upstream level of HAMONT (rubar_init.f90). The export refuses them.
|
||||
UNSUPPORTED_CHOICES = {
|
||||
('rubarbe_condam', '2'): 'La version actuelle de RubarBE ne prend pas '
|
||||
'en compte la cote amont imposée.',
|
||||
('rubarbe_regime', '1'): 'La version actuelle de RubarBE ne prend pas '
|
||||
'en compte le tirant d’eau amont imposé.',
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Field:
|
||||
key: str
|
||||
@@ -89,7 +99,9 @@ def fields():
|
||||
'Nécessite les fichiers de reprise du calcul précédent.', YES_NO)
|
||||
|
||||
choice('condam', 1, 'Condition à la limite amont',
|
||||
'Le choix doit correspondre aux données de la limite amont.',
|
||||
'Le choix doit correspondre aux données de la limite amont. '
|
||||
'La cote imposée n’est pas prise en compte par la version '
|
||||
'actuelle de RubarBE.',
|
||||
{'0': 'Réflexion', '1': 'Débit imposé Q(t)',
|
||||
'2': 'Cote imposée Z(t)', '4': 'Confluence'})
|
||||
choice('condav', 1, 'Condition à la limite aval',
|
||||
@@ -99,8 +111,8 @@ def fields():
|
||||
'3': 'Cote imposée Z(t)', '4': 'Confluence / défluence',
|
||||
'5': 'Régime uniforme', '7': 'Régime critique'})
|
||||
choice('regime', 1, 'Imposer aussi le tirant d’eau amont',
|
||||
'Complète le débit imposé ; incompatible avec une limite '
|
||||
'amont de type "Réflexion".',
|
||||
'Complète le débit imposé ; non pris en compte par la version '
|
||||
'actuelle de RubarBE.',
|
||||
ON_OFF)
|
||||
choice('iodev', 1, 'Déversement latéral',
|
||||
'Nécessite les données de déversements latéraux.',
|
||||
|
||||
@@ -10,7 +10,8 @@ from PyQt5.QtWidgets import (
|
||||
)
|
||||
|
||||
from View.SolverParameters.RubarFields import (
|
||||
FIELDS, GROUPS, OPTION_CHOICES, Field, active, canonical, validate,
|
||||
FIELDS, GROUPS, OPTION_CHOICES, UNSUPPORTED_CHOICES, Field, active,
|
||||
canonical, validate,
|
||||
)
|
||||
from View.SolverParameters.UndoCommand import SetCommand
|
||||
|
||||
@@ -293,6 +294,15 @@ class RubarForm(QWidget):
|
||||
index = editor.findData(forbidden)
|
||||
if index >= 0:
|
||||
editor.model().item(index).setEnabled(not blocked)
|
||||
# Unsupported choices stay visible, so a stored value is still
|
||||
# displayed, but cannot be selected anymore
|
||||
for (key, value), reason in UNSUPPORTED_CHOICES.items():
|
||||
editor = self.editors.get(key)
|
||||
index = editor.findData(value) if editor is not None else -1
|
||||
if index >= 0:
|
||||
item = editor.model().item(index)
|
||||
item.setEnabled(False)
|
||||
item.setToolTip(tr(reason))
|
||||
self._refreshing = False
|
||||
|
||||
def _update_context(self, values):
|
||||
@@ -312,6 +322,11 @@ class RubarForm(QWidget):
|
||||
values.get('rubarbe_regime') == '1'):
|
||||
warnings.append(tr('Une limite amont réfléchissante ne permet pas '
|
||||
'd’imposer aussi le tirant d’eau.'))
|
||||
for (key, value), reason in UNSUPPORTED_CHOICES.items():
|
||||
if values.get(key) == value:
|
||||
warnings.append(tr(reason) + tr(
|
||||
' Le calcul sera refusé : choisissez un autre réglage '
|
||||
'de la limite amont.'))
|
||||
try:
|
||||
from tools import old_pamhyr_date_to_timestamp
|
||||
|
||||
|
||||
Reference in new issue
Block a user