From d35262f5654ffd0c9cf19b95864557f75f06f97e Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Tue, 14 May 2024 16:34:43 +0200 Subject: [PATCH] Improved float representation and resizable columns --- src/tailor/data_sheet.py | 5 +++++ src/tailor/qdata_model.py | 2 +- src/throw_away_tests/test_large_data.py | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tailor/data_sheet.py b/src/tailor/data_sheet.py index b7f53e7..07836b5 100644 --- a/src/tailor/data_sheet.py +++ b/src/tailor/data_sheet.py @@ -27,6 +27,11 @@ def __init__(self, name, id, main_window): self.connect_ui_events() self.setup_keyboard_shortcuts() + # Make columns resizable + self.ui.data_view.horizontalHeader().setSectionResizeMode( + self.ui.data_view.horizontalHeader().ResizeMode.Interactive + ) + # Start at (0, 0) self.ui.data_view.setCurrentIndex(self.model.createIndex(0, 0)) diff --git a/src/tailor/qdata_model.py b/src/tailor/qdata_model.py index c5b3bdb..7691fb4 100644 --- a/src/tailor/qdata_model.py +++ b/src/tailor/qdata_model.py @@ -100,7 +100,7 @@ def data( return "" else: # Show float value or "nan" in a calculated column - return f"{value:.10g}" + return float(value) elif role == QtCore.Qt.BackgroundRole: # request for the background fill of the cell if self.data_model.is_calculated_column(label): diff --git a/src/throw_away_tests/test_large_data.py b/src/throw_away_tests/test_large_data.py index 806ef4f..6f0f03b 100644 --- a/src/throw_away_tests/test_large_data.py +++ b/src/throw_away_tests/test_large_data.py @@ -28,7 +28,6 @@ def create_test_project(app: MainWindow): ) sheet.model.updateColumnExpression(1, "sin(x)") sheet.model.updateColumnExpression(3, "y") - sheet.model.updateColumnExpression(3, "y * a") sheet.ui.data_view.setCurrentIndex(sheet.model.createIndex(0, 1)) sheet.ui.formula_edit.setFocus()