Compare commits

..

22 Commits

Author SHA1 Message Date
Dylan Jeannin cea4dcd9cb refacto variable names for D90 2026-04-28 11:06:57 +02:00
Dylan Jeannin e1c1f411c3 fix bug when add button didnt refresh the tab list in Initial conditions AdisTS and d90 2026-04-28 11:06:57 +02:00
Dylan Jeannin 4550fc95d7 debug delete functionnality in InitialConditionsAdisTS 2026-04-28 11:06:57 +02:00
Dylan Jeannin 1f97af9c03 clean useless data 2026-04-28 11:06:57 +02:00
Dylan Jeannin df9e1ec42d fix delete for pollutants D90 2026-04-28 11:06:57 +02:00
Dylan Jeannin ac79fae1fb debug save db d90 2026-04-28 11:06:57 +02:00
Dylan Jeannin fe39f07981 consistency with called functions in the file 2026-04-28 11:06:57 +02:00
Dylan Jeannin b578e0c50c désactivation temporaire de undo dans la fenêtre résultat qui fait crash Pamhyr 2026-04-28 11:06:57 +02:00
Dylan Jeannin 4408a8f368 debug save BoundaryConditionsAdisTS 2026-04-28 11:06:57 +02:00
Dylan Jeannin d3e922af6e desactivation du clic sur le graph du réseau hors de l'onglet d'édition du réseau (ex. BoundaryConditions...) 2026-04-28 11:06:57 +02:00
Dylan Jeannin 8adf878584 garde le zoom sur un graph après rafraichissement des données 2026-04-28 11:06:57 +02:00
Dylan Jeannin aa6973813f debug fonction SAVE des figures, qui utilisait une méthode Matplotlib, plutôt qu'une méthode native Qt 2026-04-28 11:06:57 +02:00
Dylan Jeannin e21a64fcad zoom plus intuitif avec translation du widget pour garder une cohérence dans le zoom 2026-04-28 11:06:57 +02:00
Dylan Jeannin 8b6308d3c9 inversion du sens de zoom avec la molette sur les graphs (contrintuitif auparavant) 2026-04-28 11:06:57 +02:00
Dylan Jeannin bc3ea9c4b9 ajout automatique de l'extansion .st lorsque l'on ne le stipule pas manuellement dans l'export des tronçons 2026-04-28 11:06:57 +02:00
Dylan Jeannin 04ea55e21a can use '.' caracter and not only ',' in Shift Geometry window 2026-04-28 11:06:57 +02:00
Dylan Jeannin a68270ff67 update model + view to display only BCAdisTS related to pollutant, and not the global list, todo: reconnect add/del buttons 2026-04-28 11:06:57 +02:00
Dylan Jeannin c498ed2d96 add d50/sigma in database + load/save data in UI 2026-04-28 11:06:57 +02:00
Dylan Jeannin e6d059bc19 correction erreur identifiant bdd 2026-04-28 11:06:57 +02:00
Dylan Jeannin cc500ceccf debug model InitialConditionsAdisTSSpec 2026-04-28 11:06:57 +02:00
Theophile Terraz 6bd3605d10 update doc links 2026-04-28 10:13:43 +02:00
Theophile Terraz 6c6da90952 debug QSO export 2026-04-28 10:09:49 +02:00
49 changed files with 2945 additions and 2750 deletions

View File

@ -232,6 +232,8 @@ class BoundaryCondition(SQLSubModel):
type TEXT NOT NULL, type TEXT NOT NULL,
tab TEXT NOT NULL, tab TEXT NOT NULL,
node INTEGER, node INTEGER,
d50 REAL DEFAULT 0.002,
sigma REAL DEFAULT 1,
{Scenario.create_db_add_scenario()}, {Scenario.create_db_add_scenario()},
{Scenario.create_db_add_scenario_fk()}, {Scenario.create_db_add_scenario_fk()},
FOREIGN KEY(node) REFERENCES river_node(pamhyr_id), FOREIGN KEY(node) REFERENCES river_node(pamhyr_id),
@ -258,6 +260,17 @@ class BoundaryCondition(SQLSubModel):
"ADD COLUMN deleted BOOLEAN NOT NULL DEFAULT FALSE" "ADD COLUMN deleted BOOLEAN NOT NULL DEFAULT FALSE"
) )
if major == "0" and int(minor) <= 2:
if int(release) < 4:
execute(
"ALTER TABLE boundary_condition " +
"ADD COLUMN d50 REAL DEFAULT 0.002"
)
execute(
"ALTER TABLE boundary_condition " +
"ADD COLUMN sigma REAL DEFAULT 1"
)
return cls._update_submodel(execute, version, data) return cls._update_submodel(execute, version, data)
@classmethod @classmethod
@ -316,7 +329,7 @@ class BoundaryCondition(SQLSubModel):
return new return new
table = execute( table = execute(
"SELECT pamhyr_id, deleted, name, type, node, scenario " + "SELECT pamhyr_id, deleted, name, type, node, d50, sigma, scenario " +
"FROM boundary_condition " + "FROM boundary_condition " +
f"WHERE tab = '{tab}' " + f"WHERE tab = '{tab}' " +
f"AND scenario = {scenario.id} " + f"AND scenario = {scenario.id} " +
@ -331,6 +344,8 @@ class BoundaryCondition(SQLSubModel):
name = next(it) name = next(it)
t = next(it) t = next(it)
node = next(it) node = next(it)
d50 = next(it)
sigma = next(it)
owner_scenario = next(it) owner_scenario = next(it)
ctor = cls._get_ctor_from_type(t) ctor = cls._get_ctor_from_type(t)
@ -342,7 +357,9 @@ class BoundaryCondition(SQLSubModel):
) )
if deleted: if deleted:
bc.set_as_deleted() bc.set_as_deleted()
if t=="SL":
bc.d50 = d50
bc.sigma = sigma
bc.node = None bc.node = None
if node != -1: if node != -1:
bc.node = next(filter(lambda n: n.id == node, nodes), None) bc.node = next(filter(lambda n: n.id == node, nodes), None)
@ -375,15 +392,22 @@ class BoundaryCondition(SQLSubModel):
if self._node is not None: if self._node is not None:
node = self._node.id node = self._node.id
d50 = 0.002
sigma = 1
if self._type == "SL":
d50 = self._d50
sigma = self._sigma
execute( execute(
"INSERT INTO " + "INSERT INTO " +
"boundary_condition(" + "boundary_condition(" +
"pamhyr_id, deleted, name, type, tab, node, scenario" + "pamhyr_id, deleted, name, type, tab, node, d50, sigma, scenario" +
") " + ") " +
"VALUES (" + "VALUES (" +
f"{self._pamhyr_id}, {self._db_format(self.is_deleted())}, " + f"{self._pamhyr_id}, {self._db_format(self.is_deleted())}, " +
f"'{self._db_format(self._name)}', " + f"'{self._db_format(self._name)}', " +
f"'{self._db_format(self._type)}', '{tab}', {node}, " + f"'{self._db_format(self._type)}', '{tab}', {node}, " +
f"{d50}, {sigma}, " +
f"{self._status.scenario_id}" + f"{self._status.scenario_id}" +
")" ")"
) )
@ -468,6 +492,24 @@ class BoundaryCondition(SQLSubModel):
def has_node(self): def has_node(self):
return self._node is not None return self._node is not None
@property
def d50(self):
return self._d50
@d50.setter
def d50(self, value):
self._d50 = float(value)
self.modified()
@property
def sigma(self):
return self._sigma
@sigma.setter
def sigma(self, value):
self._sigma = float(value)
self.modified()
@property @property
def header(self): def header(self):
return self._header.copy() return self._header.copy()

View File

@ -312,17 +312,21 @@ class BoundaryConditionAdisTS(SQLSubModel):
status = data['status'] status = data['status']
nodes = data['nodes'] nodes = data['nodes']
scenario = data["scenario"] scenario = data["scenario"]
pollutant = data.get("pollutant")
loaded = data['loaded_pid'] loaded = data['loaded_pid']
if scenario is None: if scenario is None:
return new return new
table = execute( sql = (
"SELECT pamhyr_id, deleted, pollutant, type, node, scenario " + "SELECT pamhyr_id, deleted, pollutant, type, node, scenario "
"FROM boundary_condition_adists " + "FROM boundary_condition_adists " +
f"WHERE scenario = {scenario.id} " + f"WHERE scenario = {scenario.id} "
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))}) "
) )
if pollutant is not None:
sql += f"AND pollutant = {pollutant.id} "
table = execute(sql)
if table is not None: if table is not None:
for row in table: for row in table:
@ -347,7 +351,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
bc.type = bc_type bc.type = bc_type
bc.node = None bc.node = None
if row[3] != -1: if node != -1:
tmp = next( tmp = next(
filter( filter(
lambda n: n.id == node, nodes lambda n: n.id == node, nodes
@ -451,7 +455,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
@node.setter @node.setter
def node(self, node): def node(self, node):
self._node = node self._node = node
self._status.modified() self.modified()
@property @property
def header(self): def header(self):
@ -460,7 +464,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
@header.setter @header.setter
def header(self, header): def header(self, header):
self._header = header self._header = header
self._status.modified() self.modified()
@property @property
def pollutant(self): def pollutant(self):
@ -469,7 +473,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
@pollutant.setter @pollutant.setter
def pollutant(self, pollutant): def pollutant(self, pollutant):
self._pollutant = pollutant self._pollutant = pollutant
self._status.modified() self.modified()
@property @property
def type(self): def type(self):
@ -478,7 +482,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
@type.setter @type.setter
def type(self, type): def type(self, type):
self._type = type self._type = type
self._status.modified() self.modified()
@property @property
def data(self): def data(self):
@ -511,14 +515,17 @@ class BoundaryConditionAdisTS(SQLSubModel):
return (new_0, new_1) return (new_0, new_1)
def add(self, index: int): def add(self, index: int):
value = (self._default_0, self._default_1) value = Data(
self._default_0, self._default_1,
status=self._status
)
self._data.insert(index, value) self._data.insert(index, value)
self._status.modified() self.modified()
return value return value
def insert(self, index: int, value): def insert(self, index: int, value):
self._data.insert(index, value) self._data.insert(index, value)
self._status.modified() self.modified()
def delete_i(self, indexes): def delete_i(self, indexes):
self._data = list( self._data = list(
@ -530,14 +537,14 @@ class BoundaryConditionAdisTS(SQLSubModel):
) )
) )
) )
self._status.modified() self.modified()
def sort(self, _reverse=False, key=None): def sort(self, _reverse=False, key=None):
if key is None: if key is None:
self._data.sort(reverse=_reverse) self._data.sort(reverse=_reverse)
else: else:
self._data.sort(reverse=_reverse, key=key) self._data.sort(reverse=_reverse, key=key)
self._status.modified() self.modified()
def index(self, bc): def index(self, bc):
self._data.index(bc) self._data.index(bc)
@ -552,10 +559,10 @@ class BoundaryConditionAdisTS(SQLSubModel):
return lst return lst
def _set_i_c_v(self, index, column, value): def _set_i_c_v(self, index, column, value):
v = list(self._data[index]) v = self._data[index]
v[column] = self._types[column](value) v[column] = self._types[column](value)
self._data[index] = tuple(v) self._data[index] = v
self._status.modified() self.modified()
def set_i_0(self, index: int, value): def set_i_0(self, index: int, value):
self._set_i_c_v(index, 0, value) self._set_i_c_v(index, 0, value)

View File

@ -38,9 +38,13 @@ class BoundaryConditionsAdisTSList(PamhyrModelList):
if data is None: if data is None:
data = {} data = {}
new._lst = BoundaryConditionAdisTS._db_load( previous_pollutant = data.get("pollutant")
execute, data data.pop("pollutant", None)
)
new._lst = BoundaryConditionAdisTS._db_load(execute, data)
if previous_pollutant is not None:
data["pollutant"] = previous_pollutant
return new return new

View File

@ -167,7 +167,7 @@ class D90AdisTSSpec(SQLSubModel):
owner_scenario=owner_scenario owner_scenario=owner_scenario
) )
if deleted: if deleted:
new_spec.is_deleted() new_spec.set_as_deleted()
new_spec.reach = reach new_spec.reach = reach
new_spec.start_rk = start_rk new_spec.start_rk = start_rk
@ -196,12 +196,12 @@ class D90AdisTSSpec(SQLSubModel):
"d90_default, name, reach, " + "d90_default, name, reach, " +
"start_rk, end_rk, d90, enabled, scenario) " + "start_rk, end_rk, d90, enabled, scenario) " +
"VALUES (" + "VALUES (" +
f"{self.id}, {self._db_format(self.is_deleted())}" + f"{self.id}, {self._db_format(self.is_deleted())}, " +
f"{d90_default}, " + f"{d90_default}, " +
f"'{self._db_format(self._name_section)}', " + f"'{self._db_format(self._name_section)}', " +
f"{self._reach}, " + f"{self._reach}, " +
f"{self._start_rk}, {self._end_rk}, " + f"{self._start_rk}, {self._end_rk}, " +
f"{self._d90}, {self._enabled}" + f"{self._d90}, {self._enabled}, " +
f"{self._status.scenario_id}" + f"{self._status.scenario_id}" +
")" ")"
) )

View File

@ -267,7 +267,7 @@ class InitialConditionsAdisTS(SQLSubModel):
@name.setter @name.setter
def name(self, name): def name(self, name):
self._name = name self._name = name
self._status.modified() self.modified()
@property @property
def pollutant(self): def pollutant(self):
@ -276,7 +276,7 @@ class InitialConditionsAdisTS(SQLSubModel):
@pollutant.setter @pollutant.setter
def pollutant(self, pollutant): def pollutant(self, pollutant):
self._pollutant = pollutant self._pollutant = pollutant
self._status.modified() self.modified()
@property @property
def concentration(self): def concentration(self):
@ -285,7 +285,7 @@ class InitialConditionsAdisTS(SQLSubModel):
@concentration.setter @concentration.setter
def concentration(self, concentration): def concentration(self, concentration):
self._concentration = concentration self._concentration = concentration
self._status.modified() self.modified()
@property @property
def eg(self): def eg(self):
@ -294,7 +294,7 @@ class InitialConditionsAdisTS(SQLSubModel):
@eg.setter @eg.setter
def eg(self, eg): def eg(self, eg):
self._eg = eg self._eg = eg
self._status.modified() self.modified()
@property @property
def em(self): def em(self):
@ -303,7 +303,7 @@ class InitialConditionsAdisTS(SQLSubModel):
@em.setter @em.setter
def em(self, em): def em(self, em):
self._em = em self._em = em
self._status.modified() self.modified()
@property @property
def ed(self): def ed(self):
@ -312,7 +312,7 @@ class InitialConditionsAdisTS(SQLSubModel):
@ed.setter @ed.setter
def ed(self, ed): def ed(self, ed):
self._ed = ed self._ed = ed
self._status.modified() self.modified()
@property @property
def enabled(self): def enabled(self):
@ -321,28 +321,45 @@ class InitialConditionsAdisTS(SQLSubModel):
@enabled.setter @enabled.setter
def enabled(self, enabled): def enabled(self, enabled):
self._enabled = enabled self._enabled = enabled
self._status.modified() self.modified()
def new(self, index): def new(self, index):
n = ICAdisTSSpec(status=self._status) n = ICAdisTSSpec(status=self._status)
self._data.insert(index, n) self._data.insert(index, n)
self._status.modified() self.modified()
return n return n
def delete(self, data): def delete(self, data):
self._data = list( list(
filter( map(
lambda x: x not in data, lambda x: x.set_as_deleted(),
self._data data
) )
) )
self._status.modified() self.modified()
def delete_i(self, indexes): def delete_i(self, indexes):
for ind in indexes: list(
del self._data[ind] map(
self._status.modified() lambda e: e[1].set_as_deleted(),
filter(
lambda e: e[0] in indexes,
enumerate(self._data)
)
)
)
self.modified()
def insert(self, index, data): def insert(self, index, data):
self._data.insert(index, data) if data in self._data:
self._status.modified() self.undelete([data])
else:
self._data.insert(index, data)
self.modified()
def undelete(self, lst):
for x in lst:
x.set_as_not_deleted()
self.modified()

View File

@ -31,7 +31,7 @@ class ICAdisTSSpec(SQLSubModel):
_sub_classes = [] _sub_classes = []
def __init__(self, id: int = -1, name: str = "", def __init__(self, id: int = -1, name: str = "",
status=None): status=None, owner_scenario=None):
super(ICAdisTSSpec, self).__init__() super(ICAdisTSSpec, self).__init__()
self._status = status self._status = status
@ -194,7 +194,7 @@ class ICAdisTSSpec(SQLSubModel):
new_spec.rate = rate new_spec.rate = rate
new_spec.enabled = enabled new_spec.enabled = enabled
loaded.add(pid) # loaded.add(pid)
new.append(new_spec) new.append(new_spec)
data["scenario"] = scenario.parent data["scenario"] = scenario.parent
@ -211,7 +211,7 @@ class ICAdisTSSpec(SQLSubModel):
sql = ( sql = (
"INSERT INTO " + "INSERT INTO " +
"initial_conditions_adists_spec(id, deleted, " + "initial_conditions_adists_spec(pamhyr_id, deleted, " +
"ic_default, name, reach, " + "ic_default, name, reach, " +
"start_rk, end_rk, concentration, eg, em, ed, rate, " + "start_rk, end_rk, concentration, eg, em, ed, rate, " +
"enabled, scenario) " + "enabled, scenario) " +

View File

@ -372,7 +372,7 @@ class LateralContributionAdisTS(SQLSubModel):
execute( execute(
"INSERT INTO " + "INSERT INTO " +
"lateral_contribution_adists(id, deleted," + "lateral_contribution_adists(pamhyr_id, deleted," +
"pollutant, reach, begin_rk, end_rk, scenario) " + "pollutant, reach, begin_rk, end_rk, scenario) " +
"VALUES (" + "VALUES (" +
f"{self.id}, {self._db_format(self.is_deleted())}, " + f"{self.id}, {self._db_format(self.is_deleted())}, " +

View File

@ -28,6 +28,7 @@ from tools import (
from Model.Tools.PamhyrDB import SQLSubModel from Model.Tools.PamhyrDB import SQLSubModel
from Model.Except import NotImplementedMethodeError from Model.Except import NotImplementedMethodeError
from Model.Scenario import Scenario from Model.Scenario import Scenario
from Model.BoundaryConditionsAdisTS.BoundaryConditionAdisTS import BoundaryConditionAdisTS
logger = logging.getLogger() logger = logging.getLogger()
@ -275,7 +276,8 @@ class PollutantCharacteristics(SQLSubModel):
class Pollutants(SQLSubModel): class Pollutants(SQLSubModel):
_sub_classes = [PollutantCharacteristics] _sub_classes = [PollutantCharacteristics,
BoundaryConditionAdisTS]
def __init__(self, id: int = -1, name: str = "", def __init__(self, id: int = -1, name: str = "",
status=None, owner_scenario=-1): status=None, owner_scenario=-1):
@ -293,6 +295,11 @@ class Pollutants(SQLSubModel):
self._enabled = True self._enabled = True
self._data = [] self._data = []
self._boundary_conditions_adists = []
@property
def boundary_conditions_adists(self):
return self._boundary_conditions_adists
@property @property
def name(self): def name(self):
@ -416,6 +423,10 @@ class Pollutants(SQLSubModel):
execute, data=data execute, data=data
) )
new_pollutant._boundary_conditions_adists = BoundaryConditionAdisTS._db_load(
execute, data=data
)
loaded.add(pid) loaded.add(pid)
new.append(new_pollutant) new.append(new_pollutant)
@ -455,6 +466,9 @@ class Pollutants(SQLSubModel):
for d in self._data: for d in self._data:
ok &= d._db_save(execute, data) ok &= d._db_save(execute, data)
for bc in self._boundary_conditions_adists:
ok &= bc._db_save(execute, data)
return ok return ok
def _data_traversal(self, def _data_traversal(self,

View File

@ -37,7 +37,7 @@ logger = logging.getLogger()
class Study(SQLModel): class Study(SQLModel):
_version = "0.2.3" _version = "0.2.4"
_sub_classes = [ _sub_classes = [
Scenario, Scenario,

View File

@ -326,7 +326,7 @@ class Mage(CommandLineSolver):
v0 = d[0] v0 = d[0]
v1 = d[1] v1 = d[1]
if t in ["HYD", "QSO", "LIM"]: if t in ["HYD", "LIM"]:
v0 /= 60 # Convert first column to minute v0 /= 60 # Convert first column to minute
f.write(f"{v0:9} {v1:9} \n") f.write(f"{v0:9} {v1:9} \n")
@ -989,7 +989,7 @@ class Mage8(Mage):
# Data # Data
for d in bound.data: for d in bound.data:
f.write(f"{d[0]:10.3f}{d[1]:10.3f}\n") f.write(f"{d[0]/60:10.3f}{d[1]:10.3f}\n")
return files return files

View File

@ -55,7 +55,7 @@ class AboutWindow(PamhyrDialog):
label = self.get_label_text("label_version") label = self.get_label_text("label_version")
label = label.replace("@version", version) label = label.replace("@version", version)
label = label.replace("@codename", "(Adis-TS)") label = label.replace("@codename", "")
self.set_label_text("label_version", label) self.set_label_text("label_version", label)
# Authors # Authors

View File

@ -54,7 +54,7 @@ class Plot(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
def custom_ticks(self): def custom_ticks(self):
if self.data.header[0] != "time": if self.data.header[0] != "time":

View File

@ -55,7 +55,7 @@ class Plot(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
def custom_ticks(self): def custom_ticks(self):
if self.data.header[0] != "time": if self.data.header[0] != "time":

View File

@ -61,9 +61,7 @@ class AddCommand(QUndoCommand):
def redo(self): def redo(self):
if self._new is None: if self._new is None:
self._new = self._data.insert(self._index, ( self._new = self._data.add(self._index)
self._data._types[0](0), self._data._types[1](0.0)
))
else: else:
self._data.insert(self._index, self._new) self._data.insert(self._index, self._new)

View File

@ -112,18 +112,36 @@ class ComboBoxDelegate(QItemDelegate):
class TableModel(PamhyrTableModel): class TableModel(PamhyrTableModel):
def __init__(self, pollutant=None, bc_list=None, trad=None, **kwargs): def __init__(self, bc_list=None, pollutant_bc_list=None, trad=None, **kwargs):
self._trad = trad self._trad = trad
self._bc_list = bc_list self._bc_list = bc_list
self._pollutant = pollutant self._pollutant = pollutant_bc_list.id
super(TableModel, self).__init__(trad=trad, **kwargs) super(TableModel, self).__init__(trad=trad, **kwargs)
def rowCount(self, parent): def _setup_lst(self):
return len(self._bc_list) self._lst = list(
filter(
lambda bc: bc.pollutant == self._pollutant,
self._bc_list.lst
)
)
def get(self, row):
if row < 0 or row >= len(self._lst):
return None
return self._lst[row]
def _global_row(self, row):
bc = self.get(row)
if bc is None:
return None
return self._bc_list.index(bc)
def rowCount(self, parent=QModelIndex()):
return len(self._lst)
def data(self, index, role): def data(self, index, role):
if role != Qt.ItemDataRole.DisplayRole: if role != Qt.ItemDataRole.DisplayRole:
return QVariant() return QVariant()
@ -131,12 +149,12 @@ class TableModel(PamhyrTableModel):
column = index.column() column = index.column()
if self._headers[column] == "type": if self._headers[column] == "type":
n = self._bc_list.get(row).type n = self._lst[row].type
if n is None or n == "": if n is None or n == "":
return self._trad["not_associated"] return self._trad["not_associated"]
return n return n
elif self._headers[column] == "node": elif self._headers[column] == "node":
n = self._bc_list.get(row).node n = self._lst[row].node
if n is None: if n is None:
return self._trad["not_associated"] return self._trad["not_associated"]
tmp = next(filter(lambda x: x.id == n, self._data._nodes), None) tmp = next(filter(lambda x: x.id == n, self._data._nodes), None)
@ -144,18 +162,6 @@ class TableModel(PamhyrTableModel):
return tmp.name return tmp.name
else: else:
return self._trad["not_associated"] return self._trad["not_associated"]
elif self._headers[column] == "pol":
n = self._bc_list.get(row).pollutant
if n is None or n == "not_associated" or n == "":
return self._trad["not_associated"]
tmp = next(filter(lambda x: x.id == n,
self._data._Pollutants.Pollutants_List
),
None)
if tmp is not None:
return tmp.name
else:
return self._trad["not_associated"]
return QVariant() return QVariant()
@ -168,33 +174,24 @@ class TableModel(PamhyrTableModel):
try: try:
if self._headers[column] == "type": if self._headers[column] == "type":
global_row = self._global_row(row)
self._undo.push( self._undo.push(
SetTypeCommand( SetTypeCommand(
self._bc_list, row, value self._bc_list, global_row, value
) )
) )
elif self._headers[column] == "node": elif self._headers[column] == "node":
global_row = self._global_row(row)
node = next(
filter(lambda n: n.name == value, self._data.nodes()),
None
)
self._undo.push( self._undo.push(
SetNodeCommand( SetNodeCommand(
self._bc_list, row, self._data.node(value) self._bc_list, global_row, node
) )
) )
elif self._headers[column] == "pol":
if value == self._trad["not_associated"]:
self._undo.push(
SetPolCommand(
self._bc_list, row, None
)
)
else:
pol = next(filter(lambda x: x.name == value,
self._data._Pollutants.Pollutants_List)
)
self._undo.push(
SetPolCommand(
self._bc_list, row, pol.id
)
)
except Exception as e: except Exception as e:
logger.info(e) logger.info(e)
logger.debug(traceback.format_exc()) logger.debug(traceback.format_exc())
@ -203,33 +200,39 @@ class TableModel(PamhyrTableModel):
return True return True
def add(self, row, parent=QModelIndex()): def add(self, row, parent=QModelIndex()):
self.beginInsertRows(parent, row, row - 1) row = len(self._lst)
self.beginInsertRows(parent, row, row)
self._undo.push( self._undo.push(
AddCommand( AddCommand(
self._pollutant, self._bc_list, row self._pollutant, self._bc_list, len(self._bc_list)
) )
) )
self._setup_lst()
self.endInsertRows() self.endInsertRows()
self.layoutChanged.emit() self.layoutChanged.emit()
def delete(self, rows, parent=QModelIndex()): def delete(self, rows, parent=QModelIndex()):
self.beginRemoveRows(parent, rows[0], rows[-1]) self.beginRemoveRows(parent, rows[0], rows[-1])
global_rows = list(
map(self._global_row, rows)
)
self._undo.push( self._undo.push(
DelCommand( DelCommand(
self._bc_list, rows self._bc_list, global_rows
) )
) )
self._setup_lst()
self.endRemoveRows() self.endRemoveRows()
self.layoutChanged.emit() self.layoutChanged.emit()
def undo(self): def undo(self):
self._undo.undo() self._undo.undo()
self._setup_lst()
self.layoutChanged.emit() self.layoutChanged.emit()
def redo(self): def redo(self):
self._undo.redo() self._undo.redo()
self._setup_lst()
self.layoutChanged.emit() self.layoutChanged.emit()

View File

@ -36,7 +36,7 @@ class SetNodeCommand(QUndoCommand):
self._bcs = bcs self._bcs = bcs
self._index = index self._index = index
self._old = self._bcs.get(self._index).node self._old = self._bcs.get(self._index).node
self._new = node.id self._new = node.id if node is not None else None
def undo(self): def undo(self):
self._bcs.get(self._index).node = self._old self._bcs.get(self._index).node = self._old

View File

@ -58,11 +58,21 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
_pamhyr_ui = "BoundaryConditionsAdisTS" _pamhyr_ui = "BoundaryConditionsAdisTS"
_pamhyr_name = "Boundary conditions AdisTS" _pamhyr_name = "Boundary conditions AdisTS"
def __init__(self, study=None, config=None, parent=None): def __init__(self, data=None, pollutant_id=None, study=None, config=None, parent=None):
self._data = data
self._pollutant_id = pollutant_id
_pollutants_lst = study._river._Pollutants.Pollutants_List
self._pollutant_name = next(
(x.name for x in _pollutants_lst if x.id == self._pollutant_id),
None
)
trad = BCAdisTSTranslate() trad = BCAdisTSTranslate()
name = ( name = (
trad[self._pamhyr_name] + trad[self._pamhyr_name] +
" - " + study.name " - " + study.name +
" - " + self._pollutant_name
) )
super(BoundaryConditionAdisTSWindow, self).__init__( super(BoundaryConditionAdisTSWindow, self).__init__(
@ -73,7 +83,6 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
parent=parent parent=parent
) )
self._pollutants_lst = self._study._river._Pollutants
self._bcs = self._study.river.boundary_conditions_adists self._bcs = self._study.river.boundary_conditions_adists
self.setup_graph() self.setup_graph()
@ -95,12 +104,6 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
mode="node", mode="node",
parent=self parent=self
) )
self._delegate_pol = ComboBoxDelegate(
trad=self._trad,
data=self._study.river,
mode="pol",
parent=self
)
table = self.find(QTableView, f"tableView") table = self.find(QTableView, f"tableView")
self._table = TableModel( self._table = TableModel(
@ -110,10 +113,10 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
delegates={ delegates={
"type": self._delegate_type, "type": self._delegate_type,
"node": self._delegate_node, "node": self._delegate_node,
"pol": self._delegate_pol,
}, },
trad=self._trad, trad=self._trad,
bc_list=self._study.river.boundary_conditions_adists, bc_list=self._study.river.boundary_conditions_adists,
pollutant_bc_list=self._data,
undo=self._undo_stack, undo=self._undo_stack,
data=self._study.river data=self._study.river
) )
@ -156,7 +159,7 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
) )
def add(self): def add(self):
self._table.add(len(self._bcs)) self._table.add(self._table.rowCount())
def delete(self): def delete(self):
rows = self.index_selected_rows() rows = self.index_selected_rows()
@ -180,7 +183,7 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
def edit(self): def edit(self):
rows = self.index_selected_rows() rows = self.index_selected_rows()
for row in rows: for row in rows:
data = self._bcs.get(row) data = self._table.get(row)
if data.node is None: if data.node is None:
continue continue

View File

@ -34,5 +34,4 @@ class BCAdisTSTranslate(MainTranslate):
self._sub_dict["table_headers"] = { self._sub_dict["table_headers"] = {
"type": self._dict["type"], "type": self._dict["type"],
"node": _translate("BoundaryCondition", "Node"), "node": _translate("BoundaryCondition", "Node"),
"pol": _translate("BoundaryCondition", "Pollutant")
} }

View File

@ -46,21 +46,21 @@ _translate = QCoreApplication.translate
class ComboBoxDelegate(QItemDelegate): class ComboBoxDelegate(QItemDelegate):
def __init__(self, data=None, ic_spec_lst=None, def __init__(self, data=None, d90_spec_lst=None,
trad=None, parent=None, mode="reaches"): trad=None, parent=None, mode="reaches"):
super(ComboBoxDelegate, self).__init__(parent) super(ComboBoxDelegate, self).__init__(parent)
self._data = data self._data = data
self._mode = mode self._mode = mode
self._trad = trad self._trad = trad
self._ic_spec_lst = ic_spec_lst self._d90_spec_lst = d90_spec_lst
def createEditor(self, parent, option, index): def createEditor(self, parent, option, index):
self.editor = QComboBox(parent) self.editor = QComboBox(parent)
val = [] val = []
if self._mode == "rk": if self._mode == "rk":
reach_id = self._ic_spec_lst[index.row()].reach reach_id = self._d90_spec_lst[index.row()].reach
reach = next(filter( reach = next(filter(
lambda edge: edge.id == reach_id, self._data.edges() lambda edge: edge.id == reach_id, self._data.edges()
@ -118,7 +118,12 @@ class D90TableModel(PamhyrTableModel):
self._data = data self._data = data
def _setup_lst(self): def _setup_lst(self):
self._lst = self._data._data self._lst = list(
filter(
lambda d90: d90._deleted == False,
self._data._data
)
)
def rowCount(self, parent): def rowCount(self, parent):
return len(self._lst) return len(self._lst)
@ -197,18 +202,25 @@ class D90TableModel(PamhyrTableModel):
) )
) )
self._setup_lst()
self.endInsertRows() self.endInsertRows()
self.layoutChanged.emit() self.layoutChanged.emit()
def delete(self, rows, parent=QModelIndex()): def delete(self, rows, parent=QModelIndex()):
self.beginRemoveRows(parent, rows[0], rows[-1]) self.beginRemoveRows(parent, rows[0], rows[-1])
data_rows = {
id(d90): i for i, d90 in enumerate(self._data._data)
}
self._undo.push( self._undo.push(
DelCommand( DelCommand(
self._data, self._lst, rows self._data,
self._data._data,
[data_rows[id(self._lst[row])] for row in rows]
) )
) )
self._setup_lst()
self.endRemoveRows() self.endRemoveRows()
self.layoutChanged.emit() self.layoutChanged.emit()

View File

@ -112,11 +112,11 @@ class SetCommandSpec(QUndoCommand):
class AddCommand(QUndoCommand): class AddCommand(QUndoCommand):
def __init__(self, data, ics_spec, index): def __init__(self, data, d90_spec, index):
QUndoCommand.__init__(self) QUndoCommand.__init__(self)
self._data = data self._data = data
self._ics_spec = ics_spec self._d90_spec = d90_spec
self._index = index self._index = index
self._new = None self._new = None
@ -131,21 +131,20 @@ class AddCommand(QUndoCommand):
class DelCommand(QUndoCommand): class DelCommand(QUndoCommand):
def __init__(self, data, ics_spec, rows): def __init__(self, data, d90_spec, rows):
QUndoCommand.__init__(self) QUndoCommand.__init__(self)
self._data = data self._data = data
self._ics_spec = ics_spec self._d90_spec = d90_spec
self._rows = rows self._rows = rows
# self._data = data
self._ic = [] self._d90 = []
for row in rows: for row in rows:
self._ic.append((row, self._ics_spec[row])) self._d90.append((row, self._d90_spec[row]))
self._ic.sort() self._d90.sort()
def undo(self): def undo(self):
for row, el in self._ic: for row, el in self._d90:
self._data.insert(row, el) self._data.insert(row, el)
def redo(self): def redo(self):

View File

@ -138,14 +138,14 @@ class D90AdisTSWindow(PamhyrWindow):
self._delegate_reach = ComboBoxDelegate( self._delegate_reach = ComboBoxDelegate(
trad=self._trad, trad=self._trad,
data=self._study.river, data=self._study.river,
ic_spec_lst=self._data[0]._data, d90_spec_lst=self._data[0]._data,
parent=self, parent=self,
mode="reaches" mode="reaches"
) )
self._delegate_rk = ComboBoxDelegate( self._delegate_rk = ComboBoxDelegate(
trad=self._trad, trad=self._trad,
data=self._study.river, data=self._study.river,
ic_spec_lst=self._data[0]._data, d90_spec_lst=self._data[0]._data,
parent=self, parent=self,
mode="rk" mode="rk"
) )
@ -227,15 +227,15 @@ class D90AdisTSWindow(PamhyrWindow):
table = list( table = list(
map( map(
lambda eic: list( lambda ed90: list(
map( map(
lambda k: eic[1][k], lambda k: ed90[1][k],
["rk", "discharge", "elevation"] ["rk", "discharge", "elevation"]
) )
), ),
filter( filter(
lambda eic: eic[0] in rows, lambda ed90: ed90[0] in rows,
enumerate(self._ics.lst()) enumerate(self._d90.lst())
) )
) )
) )

View File

@ -43,7 +43,7 @@ class PlotRKZ(PlotRKC):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
self.parent = parent self.parent = parent
def onpick(self, event): def onpick(self, event):

View File

@ -50,7 +50,7 @@ class PlotStricklers(PamhyrPlot):
self._auto_relim = False self._auto_relim = False
self._auto_relim_update = False self._auto_relim_update = False
self._autoscale_update = True self._autoscale_update = False
@timer @timer
def draw(self, highlight=None): def draw(self, highlight=None):

View File

@ -38,7 +38,7 @@ class PlotAC(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
self.label_x = self._trad["transverse_abscissa"] self.label_x = self._trad["transverse_abscissa"]
self.label_y = self._trad["unit_elevation"] self.label_y = self._trad["unit_elevation"]

View File

@ -17,7 +17,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from View.Tools.PamhyrWindow import PamhyrDialog from View.Tools.PamhyrWindow import PamhyrDialog
from PyQt5.QtWidgets import QDoubleSpinBox
from View.Tools.FlexibleDoubleSpinBox import FlexibleDoubleSpinBox
class ShiftDialog(PamhyrDialog): class ShiftDialog(PamhyrDialog):
_pamhyr_ui = "GeometryReachShift" _pamhyr_ui = "GeometryReachShift"
@ -31,8 +32,36 @@ class ShiftDialog(PamhyrDialog):
parent=parent parent=parent
) )
self._replace_spinboxes()
self._init_default_values() self._init_default_values()
def _replace_spinboxes(self):
for name in ["doubleSpinBox_X", "doubleSpinBox_Y", "doubleSpinBox_Z"]:
old = self.find(QDoubleSpinBox, name)
if old is None:
continue
new = FlexibleDoubleSpinBox(old.parent())
new.setObjectName(old.objectName())
# Copier propriétés utiles
new.setDecimals(old.decimals())
new.setMinimum(old.minimum())
new.setMaximum(old.maximum())
new.setSingleStep(old.singleStep())
new.setValue(old.value())
new.setGeometry(old.geometry())
# Remplacement dans layout si présent
layout = old.parent().layout()
if layout is not None:
layout.replaceWidget(old, new)
old.hide()
old.setParent(None)
old.deleteLater()
def _init_default_values(self): def _init_default_values(self):
self._dx = 0.0 self._dx = 0.0
self._dy = 0.0 self._dy = 0.0

View File

@ -20,6 +20,7 @@ import os
import sys import sys
import time import time
import pathlib import pathlib
from pathlib import Path
import logging import logging
from copy import deepcopy from copy import deepcopy
@ -685,10 +686,18 @@ class GeometryWindow(PamhyrWindow):
) )
if filename != '' and filename is not None: if filename != '' and filename is not None:
self._export_to_file_st(filename) suffix = Path(filename).suffix
if suffix != "":
if suffix == ".st" or suffix == ".ST":
self._export_to_file_st(filename[:-3])
else:
# TODO : prévenir l'utilisateur que le format n'est pas exportable
pass
else:
self._export_to_file_st(filename)
def _export_to_file_st(self, filename): def _export_to_file_st(self, filename):
with open(filename, "w+") as f: with open(filename+".st", "w+") as f:
f.write("# Exported from Pamhyr2\n") f.write("# Exported from Pamhyr2\n")
self._export_to_file_st_reach(f, self._reach) self._export_to_file_st_reach(f, self._reach)

View File

@ -42,7 +42,7 @@ class PlotAC(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
@property @property
def river(self): def river(self):

View File

@ -50,7 +50,7 @@ class PlotRKC(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
self.parent = parent self.parent = parent
self.anotate_lst = [] self.anotate_lst = []

View File

@ -47,7 +47,7 @@ class PlotDRK(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
@timer @timer
def draw(self, highlight=None): def draw(self, highlight=None):

View File

@ -37,7 +37,7 @@ class PlotDischarge(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
@timer @timer
def draw(self): def draw(self):

View File

@ -117,7 +117,12 @@ class InitialConditionTableModel(PamhyrTableModel):
self._data = data self._data = data
def _setup_lst(self): def _setup_lst(self):
self._lst = self._data._data self._lst = list(
filter(
lambda ica: ica._deleted == False,
self._data._data
)
)
def rowCount(self, parent): def rowCount(self, parent):
return len(self._lst) return len(self._lst)
@ -216,18 +221,25 @@ class InitialConditionTableModel(PamhyrTableModel):
) )
) )
self._setup_lst()
self.endInsertRows() self.endInsertRows()
self.layoutChanged.emit() self.layoutChanged.emit()
def delete(self, rows, parent=QModelIndex()): def delete(self, rows, parent=QModelIndex()):
self.beginRemoveRows(parent, rows[0], rows[-1]) self.beginRemoveRows(parent, rows[0], rows[-1])
data_rows = {
id(ica): i for i, ica in enumerate(self._data._data)
}
self._undo.push( self._undo.push(
DelCommand( DelCommand(
self._data, self._lst, rows self._data,
self._data._data,
[data_rows[id(self._lst[row])] for row in rows]
) )
) )
self._setup_lst()
self.endRemoveRows() self.endRemoveRows()
self.layoutChanged.emit() self.layoutChanged.emit()

View File

@ -181,7 +181,6 @@ class DelCommand(QUndoCommand):
self._data = data self._data = data
self._ics_spec = ics_spec self._ics_spec = ics_spec
self._rows = rows self._rows = rows
# self._data = data
self._ic = [] self._ic = []
for row in rows: for row in rows:

View File

@ -54,7 +54,7 @@ class Plot(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
def custom_ticks(self): def custom_ticks(self):
if self.data.header[0] != "time": if self.data.header[0] != "time":

View File

@ -54,7 +54,7 @@ class Plot(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
def custom_ticks(self): def custom_ticks(self):
if self.data.header[0] != "time": if self.data.header[0] != "time":

View File

@ -901,7 +901,18 @@ class GraphWidget(QGraphicsView):
painter.drawRect(sceneRect) painter.drawRect(sceneRect)
def wheelEvent(self, event): def wheelEvent(self, event):
self.scaleView(math.pow(2.0, -event.angleDelta().y() / 240.0)) factor = math.pow(2.0, event.angleDelta().y() / 240.0)
old_pos = self.mapToScene(event.pos())
self.scaleView(factor)
new_pos = self.mapToScene(event.pos())
delta = old_pos - new_pos
# Compensation pour garder le point sous la souris fixe
self.translate(delta.x(), delta.y())
def scaleView(self, scaleFactor): def scaleView(self, scaleFactor):
factor = self.transform().scale( factor = self.transform().scale(
@ -914,6 +925,9 @@ class GraphWidget(QGraphicsView):
self.scale(scaleFactor, scaleFactor) self.scale(scaleFactor, scaleFactor)
def mousePressEvent(self, event): def mousePressEvent(self, event):
if self._only_display or self.graph._status.is_read_only():
return
pos = self.mapToScene(event.pos()) pos = self.mapToScene(event.pos())
self.clicked = True self.clicked = True

View File

@ -68,7 +68,7 @@ class PlotXY(PamhyrPlot):
self._isometric_axis = True self._isometric_axis = True
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
@timer @timer
def draw(self): def draw(self):

View File

@ -222,21 +222,32 @@ class PollutantsWindow(PamhyrWindow):
initial.show() initial.show()
def boundary_conditions(self): def boundary_conditions(self):
rows = self.index_selected_rows()
if self.sub_window_exists( if len(rows) == 0:
BoundaryConditionAdisTSWindow,
data=[self._study, None]
):
bound = self.get_sub_window(
BoundaryConditionAdisTSWindow,
data=[self._study, None]
)
return return
bound = BoundaryConditionAdisTSWindow( for row in rows:
study=self._study, parent=self pollutant_id = self._pollutants_lst.get(row).id
)
bound.show() bclist = self._study.river.boundary_conditions_adists.BCs_AdisTS_List
bcs_adists = [
x for x in bclist
if x.pollutant == pollutant_id
]
self._data = self._study.river.Pollutants.get(row)
if self.sub_window_exists(
BoundaryConditionAdisTSWindow,
data=[self._study, None, bcs_adists]
):
return
bound = BoundaryConditionAdisTSWindow(
study=self._study,
parent=self,
data=self._data,
pollutant_id=pollutant_id
)
bound.show()
def lateral_contrib(self): def lateral_contrib(self):
rows = self.index_selected_rows() rows = self.index_selected_rows()

View File

@ -55,7 +55,7 @@ class Plot(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
@timer @timer
def draw(self): def draw(self):

View File

@ -56,7 +56,7 @@ class PlotAC(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
@property @property
def results(self): def results(self):

View File

@ -59,7 +59,7 @@ class PlotRKC(PamhyrPlot):
self._isometric_axis = False self._isometric_axis = False
self._auto_relim_update = True self._auto_relim_update = True
self._autoscale_update = True self._autoscale_update = False
@property @property
def results(self): def results(self):

View File

@ -701,7 +701,8 @@ class ResultsWindow(PamhyrWindow):
logger.info("TODO: paste") logger.info("TODO: paste")
def _undo(self): def _undo(self):
self._table.undo() logger.info("TODO: undo")
# self._table.undo()
def _redo(self): def _redo(self):
self._table.redo() self._table.redo()

View File

@ -312,7 +312,18 @@ class GraphWidget(QGraphicsView):
painter.drawRect(sceneRect) painter.drawRect(sceneRect)
def wheelEvent(self, event): def wheelEvent(self, event):
self.scaleView(math.pow(2.0, -event.angleDelta().y() / 240.0)) factor = math.pow(2.0, event.angleDelta().y() / 240.0)
old_pos = self.mapToScene(event.pos())
self.scaleView(factor)
new_pos = self.mapToScene(event.pos())
delta = old_pos - new_pos
# Compensation pour garder le point sous la souris fixe
self.translate(delta.x(), delta.y())
def keyPressEvent(self, event): def keyPressEvent(self, event):
key = event.key() key = event.key()

View File

@ -49,7 +49,7 @@ class Plot(PamhyrPlot):
self._auto_relim = False self._auto_relim = False
self._auto_relim_update = False self._auto_relim_update = False
self._autoscale_update = True self._autoscale_update = False
@timer @timer
def draw(self): def draw(self):

View File

@ -53,7 +53,7 @@ class Plot(PamhyrPlot):
self._auto_relim = False self._auto_relim = False
self._auto_relim_update = False self._auto_relim_update = False
self._autoscale_update = True self._autoscale_update = False
@timer @timer
def draw(self): def draw(self):

View File

@ -53,7 +53,7 @@ class Plot(PamhyrPlot):
self._auto_relim = False self._auto_relim = False
self._auto_relim_update = False self._auto_relim_update = False
self._autoscale_update = True self._autoscale_update = False
@timer @timer
def draw(self): def draw(self):

View File

@ -0,0 +1,37 @@
# PamhyrWindow.py -- Pamhyr
# Copyright (C) 2023-2025 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import os
import logging
from PyQt5.QtWidgets import QDoubleSpinBox
class FlexibleDoubleSpinBox(QDoubleSpinBox):
def keyPressEvent(self, event):
if event.text() == ".":
# Simule une virgule à la place du point
event = type(event)(
event.type(),
event.key(),
event.modifiers(),
","
)
super().keyPressEvent(event)

View File

@ -222,10 +222,11 @@ class PamhyrPlotToolbar(NavigationToolbar2QT):
filters.append(new) filters.append(new)
filters = ';;'.join(filters) filters = ';;'.join(filters)
file_name, _ = qt_compat._getSaveFileName( file_name, _ = QtWidgets.QFileDialog.getSaveFileName(
self.canvas.parent(), self.canvas.parent(),
_translate("MainWindow_reach", "Select destination file"), _translate("MainWindow_reach", "Select destination file"),
start, filters, start,
filters,
selected_filter selected_filter
) )

View File

@ -225,7 +225,7 @@
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>&lt;a href=&quot;https://gitlab.irstea.fr/theophile.terraz/pamhyr&quot;&gt;Source code&lt;/a&gt;</string> <string>&lt;a href=&quot;https://gitlab.com/pamhyr/pamhyr2&quot;&gt;Source code&lt;/a&gt;</string>
</property> </property>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>

File diff suppressed because it is too large Load Diff