Skip to content

Commit

Permalink
Improved float representation and resizable columns
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfokkema committed May 14, 2024
1 parent 7b09ceb commit d35262f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/tailor/data_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion src/tailor/qdata_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion src/throw_away_tests/test_large_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit d35262f

Please sign in to comment.