debug old .INI file read

master
Theophile Terraz 2025-10-23 16:32:04 +02:00
parent a29df8f904
commit a31e2127e7
2 changed files with 25 additions and 3 deletions

View File

@ -292,9 +292,27 @@ class InitialConditionTableModel(PamhyrTableModel):
if not (line.startswith("#") or if not (line.startswith("#") or
line.startswith("*") or line.startswith("*") or
line.startswith("$")): line.startswith("$")):
line = line.split() line_split = line.split()
if int(line[0]) == reach_id: formated = False
data.append([line[4], line[2], line[3]]) 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( self._undo.push(
ReplaceDataCommand( ReplaceDataCommand(

View File

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