diff --git a/src/textual/widgets/_data_table.py b/src/textual/widgets/_data_table.py index c9adfe4db..832ba54c7 100644 --- a/src/textual/widgets/_data_table.py +++ b/src/textual/widgets/_data_table.py @@ -117,7 +117,6 @@ class Row: key: RowKey height: int - y: int cell_renderables: list[RenderableType] = field(default_factory=list) @@ -606,13 +605,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True): column.key: cell for column, cell in zip_longest(self._ordered_columns, cells) } - self.rows[row_key] = Row(row_key, height, self._line_no) - - # for line_no in range(height): - # self._y_offsets.append((row_key, line_no)) - - self._line_no += height - + self.rows[row_key] = Row(row_key, height) self._new_rows.add(row_index) self._require_update_dimensions = True self.cursor_cell = self.cursor_cell @@ -754,7 +747,6 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True): # Ensure we order the cells in the row based on current column ordering row_key = self._row_locations.get_key(row_index) cell_mapping: dict[ColumnKey, CellType] = self.data.get(row_key) - print(row_index, cell_mapping.values()) ordered_row: list[CellType] = [] for column in ordered_columns: @@ -823,7 +815,6 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True): style += Style.from_meta({"row": row_index, "column": column_index}) height = self.header_height if is_header_row else self.rows[row_key].height cell = self._get_row_renderables(row_index)[column_index] - print(f"CELL = {cell}") lines = self.app.console.render_lines( Padding(cell, (0, 1)), self.app.console.options.update_dimensions(width, height), diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr index 202d933ee..3a48ca0dd 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr +++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr @@ -10015,134 +10015,134 @@ font-weight: 700; } - .terminal-672973116-matrix { + .terminal-3633944034-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-672973116-title { + .terminal-3633944034-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-672973116-r1 { fill: #dde6ed;font-weight: bold } - .terminal-672973116-r2 { fill: #1e1201;font-weight: bold } - .terminal-672973116-r3 { fill: #e1e1e1 } - .terminal-672973116-r4 { fill: #c5c8c6 } - .terminal-672973116-r5 { fill: #211505 } + .terminal-3633944034-r1 { fill: #dde6ed;font-weight: bold } + .terminal-3633944034-r2 { fill: #1e1201;font-weight: bold } + .terminal-3633944034-r3 { fill: #e1e1e1 } + .terminal-3633944034-r4 { fill: #c5c8c6 } + .terminal-3633944034-r5 { fill: #211505 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TableApp + TableApp - - - -  lane  swimmer               country        time   -  4     Joseph Schooling      Singapore      50.39  -  2     Michael Phelps        United States  51.14  -  5     Chad le Clos          South Africa   51.14  -  6     László Cseh           Hungary        51.14  -  3     Li Zhuhao             China          51.26  -  8     Mehdy Metella         France         51.58  -  7     Tom Shields           United States  51.73  -  1     Aleksandr Sadovnikov  Russia         51.84  - - - - - - - - - - - - - - + + + +  lane  swimmer               country        time   +  4     Joseph Schooling      Singapore      50.39  +  2     Michael Phelps        United States  51.14  +  5     Chad le Clos          South Africa   51.14  +  6     László Cseh           Hungary        51.14  +  3     Li Zhuhao             China          51.26  +  8     Mehdy Metella         France         51.58  +  7     Tom Shields           United States  51.73  +  1     Aleksandr Sadovnikov  Russia         51.84  + + + + + + + + + + + + + + @@ -10173,133 +10173,133 @@ font-weight: 700; } - .terminal-1254167810-matrix { + .terminal-2438906615-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-1254167810-title { + .terminal-2438906615-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-1254167810-r1 { fill: #dde6ed;font-weight: bold } - .terminal-1254167810-r2 { fill: #e1e1e1 } - .terminal-1254167810-r3 { fill: #c5c8c6 } - .terminal-1254167810-r4 { fill: #211505 } + .terminal-2438906615-r1 { fill: #dde6ed;font-weight: bold } + .terminal-2438906615-r2 { fill: #e1e1e1 } + .terminal-2438906615-r3 { fill: #c5c8c6 } + .terminal-2438906615-r4 { fill: #211505 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TableApp + TableApp - - - -  lane  swimmer               country        time   -  4     Joseph Schooling      Singapore      50.39  -  2     Michael Phelps        United States  51.14  -  5     Chad le Clos          South Africa   51.14  -  6     László Cseh           Hungary        51.14  -  3     Li Zhuhao             China          51.26  -  8     Mehdy Metella         France         51.58  -  7     Tom Shields           United States  51.73  -  1     Aleksandr Sadovnikov  Russia         51.84  - - - - - - - - - - - - - - + + + +  lane  swimmer               country        time   +  4     Joseph Schooling      Singapore      50.39  +  2     Michael Phelps        United States  51.14  +  5     Chad le Clos          South Africa   51.14  +  6     László Cseh           Hungary        51.14  +  3     Li Zhuhao             China          51.26  +  8     Mehdy Metella         France         51.58  +  7     Tom Shields           United States  51.73  +  1     Aleksandr Sadovnikov  Russia         51.84  + + + + + + + + + + + + + + @@ -10330,133 +10330,133 @@ font-weight: 700; } - .terminal-2085601846-matrix { + .terminal-512278738-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2085601846-title { + .terminal-512278738-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2085601846-r1 { fill: #dde6ed;font-weight: bold } - .terminal-2085601846-r2 { fill: #e1e1e1 } - .terminal-2085601846-r3 { fill: #c5c8c6 } - .terminal-2085601846-r4 { fill: #211505 } + .terminal-512278738-r1 { fill: #dde6ed;font-weight: bold } + .terminal-512278738-r2 { fill: #e1e1e1 } + .terminal-512278738-r3 { fill: #c5c8c6 } + .terminal-512278738-r4 { fill: #211505 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TableApp + TableApp - - - -  lane  swimmer               country        time   -  4     Joseph Schooling      Singapore      50.39  -  2     Michael Phelps        United States  51.14  -  5     Chad le Clos          South Africa   51.14  -  6     László Cseh           Hungary        51.14  -  3     Li Zhuhao             China          51.26  -  8     Mehdy Metella         France         51.58  -  7     Tom Shields           United States  51.73  -  1     Aleksandr Sadovnikov  Russia         51.84  - - - - - - - - - - - - - - + + + +  lane  swimmer               country        time   +  4     Joseph Schooling      Singapore      50.39  +  2     Michael Phelps        United States  51.14  +  5     Chad le Clos          South Africa   51.14  +  6     László Cseh           Hungary        51.14  +  3     Li Zhuhao             China          51.26  +  8     Mehdy Metella         France         51.58  +  7     Tom Shields           United States  51.73  +  1     Aleksandr Sadovnikov  Russia         51.84  + + + + + + + + + + + + + + diff --git a/tests/test_data_table.py b/tests/test_data_table.py index 7af3b1c70..10eed9938 100644 --- a/tests/test_data_table.py +++ b/tests/test_data_table.py @@ -165,7 +165,7 @@ async def test_add_rows_user_defined_keys(): third_row = {key_a: ROWS[2][0], key_b: ROWS[2][1]} assert table.data[auto_key] == third_row - first_row = Row(algernon_key, height=1, y=0) + first_row = Row(algernon_key, height=1) assert table.rows[algernon_key] == first_row assert table.rows["algernon"] == first_row