Notes: Add notes to SQL save file.

This commit is contained in:
parouby committed 2025-04-17 14:00:46 +02:00
1 parent 96144d88ee
commit 69eb051270
5 files changed
+104 -34

No files matched your search

+30
View File
@@ -195,6 +195,13 @@ class CreateTableForSaveAs:
)
"""
self.create_Notes = """
CREATE TABLE Notes(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
notes TEXT
)
"""
def save_as(self):
self.open_file_dialog()
self.save()
@@ -247,6 +254,7 @@ class CreateTableForSaveAs:
self.create_table_calibration_parameters(cnx, cur)
self.create_table_calibration(cnx, cur)
self.create_table_inversion(cnx, cur)
self.create_table_notes(cnx, cur)
cnx.commit()
@@ -625,3 +633,25 @@ class CreateTableForSaveAs:
cnx.commit()
logger.info(f"table Inversion : {time.time() - start_table_Inversion} sec")
def create_table_notes(self, cnx, cur):
start_table = time.time()
cur.execute("DROP TABLE if exists Notes")
cur.execute(self.create_Notes)
for i in range(len(stg.SSC_fine)):
cur.execute(
"""
INSERT into Notes(
notes
)
VALUES(?)
""",
(stg.notes,)
)
cnx.commit()
logger.info(f"table Notes : {time.time() - start_table} sec")
+14
View File
@@ -85,6 +85,7 @@ class ReadTableForOpen:
self.read_table_table_sediment_data()
self.read_table_table_calibration_parameters()
self.read_table_table_calibration()
self.read_table_table_notes()
logger.debug(f"Reading '{stg.filename_open}' done")
@@ -705,3 +706,16 @@ class ReadTableForOpen:
stg.FCB = np_f64_parse(next(it)).tolist()
stg.depth_real = np_f64_parse(next(it)).tolist()
stg.lin_reg = np_f64_parse(next(it)).tolist()
@trace
def read_table_table_notes(self):
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
query = f'''
SELECT notes
FROM Notes
'''
data = self.execute(query)
if len(data) != 0:
stg.notes = data[0][0]