add copy AdisTS results table

terraz_dev
Theophile Terraz 2025-01-29 14:29:28 +01:00
parent 0a97070b90
commit 09029dc993
2 changed files with 33 additions and 19 deletions

View File

@ -99,16 +99,18 @@ class TableModel(PamhyrTableModel):
v = self._lst[row].get_ts_key( v = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][0] self._timestamp, "pols")[pol_index][0]
return f"{v:.4f}" return f"{v:.4f}"
if (self._headers[column] == pol + " Mass" if self._headers[column] == pol + " Mass":
and self._type_pol[pol_index] == 7): if self._type_pol[pol_index] == 7:
m1 = self._lst[row].get_ts_key( m1 = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][1] self._timestamp, "pols")[pol_index][1]
m2 = self._lst[row].get_ts_key( m2 = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][2] self._timestamp, "pols")[pol_index][2]
m3 = self._lst[row].get_ts_key( m3 = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][3] self._timestamp, "pols")[pol_index][3]
v = m1 + m2 + m3 v = m1 + m2 + m3
return f"{v:.4f}" return f"{v:.4f}"
else:
return ""
return QVariant() return QVariant()

View File

@ -554,14 +554,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
self.update(pol_id=rows) self.update(pol_id=rows)
def _set_current_profile_raw_data(self): def _set_current_profile_raw_data(self):
table = self.find(QTableView, f"tableView_raw_data") return
indexes = table.selectedIndexes()
if len(indexes) == 0:
return
ind = indexes[0].row()
self.update(profile_id=ind)
self._slider_profile.setValue(ind)
def _set_current_timestamp(self): def _set_current_timestamp(self):
timestamp = self._timestamps[self._slider_time.value()] timestamp = self._timestamps[self._slider_time.value()]
@ -597,7 +590,26 @@ class ResultsWindowAdisTS(PamhyrWindow):
self._reload_slider() self._reload_slider()
def _copy(self): def _copy(self):
logger.info("TODO: copy") # focus on raw data table
if self.find(QTabWidget, f"tabWidget").currentIndex() == 0:
table = self.find(QTableView, f"tableView_raw_data")
model = self._table["raw_data"]
coltext = []
for index in sorted(table.selectionModel().selectedRows()):
row = index.row()
rowtext = []
for column in range(model.columnCount()):
i = model.createIndex(row, column)
try:
rowtext.append(str(model.data(i)))
except AttributeError:
rowtext.append("")
coltext.append(rowtext)
self.copyTableIntoClipboard(coltext)
else:
logger.info("TODO: copy")
def _paste(self): def _paste(self):
logger.info("TODO: paste") logger.info("TODO: paste")