Commit 09029dc9 authored by Theophile Terraz's avatar Theophile Terraz
Browse files

add copy AdisTS results table

No related merge requests found
Showing with 33 additions and 19 deletions
+33 -19
......@@ -99,16 +99,18 @@ class TableModel(PamhyrTableModel):
v = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][0]
return f"{v:.4f}"
if (self._headers[column] == pol + " Mass"
and self._type_pol[pol_index] == 7):
m1 = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][1]
m2 = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][2]
m3 = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][3]
v = m1 + m2 + m3
return f"{v:.4f}"
if self._headers[column] == pol + " Mass":
if self._type_pol[pol_index] == 7:
m1 = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][1]
m2 = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][2]
m3 = self._lst[row].get_ts_key(
self._timestamp, "pols")[pol_index][3]
v = m1 + m2 + m3
return f"{v:.4f}"
else:
return ""
return QVariant()
......
......@@ -554,14 +554,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
self.update(pol_id=rows)
def _set_current_profile_raw_data(self):
table = self.find(QTableView, f"tableView_raw_data")
indexes = table.selectedIndexes()
if len(indexes) == 0:
return
ind = indexes[0].row()
self.update(profile_id=ind)
self._slider_profile.setValue(ind)
return
def _set_current_timestamp(self):
timestamp = self._timestamps[self._slider_time.value()]
......@@ -597,7 +590,26 @@ class ResultsWindowAdisTS(PamhyrWindow):
self._reload_slider()
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):
logger.info("TODO: paste")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment