Compare commits

...

5 Commits

Author SHA1 Message Date
Theophile Terraz a31e2127e7 debug old .INI file read 2025-10-23 16:32:04 +02:00
Pierre-Antoine a29df8f904 Network: Center on previous size. 2025-10-21 17:28:16 +02:00
Pierre-Antoine 97ebf9324a Merge branch 'master' of gitlab.com:pamhyr/pamhyr2 2025-10-21 15:42:01 +02:00
Pierre-Antoine 0112ad63d9 Network: Resize network zone. 2025-10-21 15:38:12 +02:00
Theophile Terraz bcbb440ad4 debug import friction 2025-10-21 15:11:28 +02:00
4 changed files with 32 additions and 10 deletions

View File

@ -274,15 +274,14 @@ class FrictionTableModel(PamhyrTableModel):
with open(file_name, encoding="utf-8") as rug_file:
for line in rug_file:
if line.upper().startswith("K"):
line = line.split()
if int(line[1]) == reach_id:
data.append(line[1:])
if int(line[1:4]) == reach_id:
data.append(line[4:].split())
new_data = []
for d in data:
new = None
minor = float(d[3])
medium = float(d[4])
minor = float(d[2])
medium = float(d[3])
for s in self._study.river.stricklers.stricklers:
if s.minor == minor and s.medium == medium:
new = s
@ -292,5 +291,5 @@ class FrictionTableModel(PamhyrTableModel):
self._study.river.stricklers))
new.minor = minor
new.medium = medium
new_data.append([self._data, float(d[1]), float(d[2]), new, new])
new_data.append([self._data, float(d[0]), float(d[1]), new, new])
self.replace_data(new_data)

View File

@ -292,9 +292,27 @@ class InitialConditionTableModel(PamhyrTableModel):
if not (line.startswith("#") or
line.startswith("*") or
line.startswith("$")):
line = line.split()
if int(line[0]) == reach_id:
data.append([line[4], line[2], line[3]])
line_split = line.split()
formated = False
if len(line_split[0]) > 3:
formated = True
elif len(line_split[2]) > 10:
formated = True
elif len(line_split[3]) > 11:
formated = True
elif len(line_split[4]) > 9:
formated = True
if formated: # old PamHyr format
if int(line[1:4]) == reach_id:
data.append([line[31:40],
line[10:20],
line[20:31]])
else:
if int(line_split[0]) == reach_id:
data.append([line_split[4],
line_split[2],
line_split[3]])
self._undo.push(
ReplaceDataCommand(

View File

@ -220,6 +220,8 @@ class InitialConditionsWindow(PamhyrWindow):
def _update_plot(self):
self.plot_1.draw()
self.plot_2.draw()
self.plot_1.idle()
self.plot_2.idle()
def _propagated_update(self, key=Modules(0)):
if Modules.GEOMETRY not in key:
@ -315,10 +317,12 @@ class InitialConditionsWindow(PamhyrWindow):
def _import_from_results(self, results):
logger.debug(f"import from results: {results}")
self._table.import_from_results(results)
self._update()
def _import_from_ini_file(self, file_name):
logger.debug(f"import from INI file: {file_name}")
self._table.read_from_ini(file_name)
self._update()
def move_up(self):
row = self.index_selected_row()

View File

@ -475,7 +475,7 @@ class GraphWidget(QGraphicsView):
def setup_scene(self, min_size, max_size, size):
scene = QGraphicsScene(self)
scene.setItemIndexMethod(QGraphicsScene.NoIndex)
scene.setSceneRect(0, 0, 2000, 2000)
scene.setSceneRect(0, 0, 6000, 6000)
self.setScene(scene)
self.setCacheMode(QGraphicsView.CacheBackground)
@ -486,6 +486,7 @@ class GraphWidget(QGraphicsView):
self.scale(1, 1)
self.previousScale = 1
self.centerOn(1000.0, 1000.0)
if min_size:
self.setMinimumSize(*min_size)