|
1 | 1 | #!/usr/bin/python3 |
2 | | -version = __version__ = "4.55.1.7 Unreleased" |
| 2 | +version = __version__ = "4.55.1.8 Unreleased" |
3 | 3 |
|
4 | 4 | _change_log = """ |
5 | 5 | Changelog since 4.55.1 released to PyPI on 7-Nov-2021 |
|
25 | 25 | New Table Element parameter - right_click_selects. Default is False. If True, then will select a row using the right mouse button, but only if |
26 | 26 | zero or one rows are selected. If multiple rows are already selected, then the right click will not change the selection. This feature enables |
27 | 27 | a right-click-menu to be combined with table selection for features such as "delete row" using a right click menu. |
| 28 | + Fixed bug in Column element - was incorrectly checking background color for None or COLOR_SYSTEM_DEFAULT |
| 29 | + 4.55.1.8 |
| 30 | + Changed docstring for Table.get_last_clicked_postition to indicate what's returned now. Was not useful for tkinter port until recently when cell clicks added. |
| 31 | + Better auto-sizing of Columns for Tables. |
| 32 | + Better sizing of the row number column using the font for the header in the calculation |
| 33 | + Use the column heading font to help determine if the header will be what determines the width instead of the data in the column |
28 | 34 | """ |
29 | 35 |
|
30 | 36 | __version__ = version.split()[0] # For PEP 396 and PEP 345 |
@@ -8113,11 +8119,9 @@ def get(self): |
8113 | 8119 |
|
8114 | 8120 | def get_last_clicked_position(self): |
8115 | 8121 | """ |
8116 | | - Dummy function for tkinter port. In the Qt port you can read back the values in the table in case they were |
8117 | | - edited. Don't know yet how to enable editing of a Tree in tkinter so just returning the values provided by |
8118 | | - user when Table was created or Updated. |
8119 | | - |
8120 | | - :return: the current table values (for now what was originally provided up updated) |
| 8122 | + Returns a tuple with the row and column of the cell that was last clicked. |
| 8123 | + Headers will have a row == -1 and the Row Number Column (if present) will have a column == -1 |
| 8124 | + :return: The (row,col) position of the last cell clicked in the table |
8121 | 8125 | :rtype: (int | None, int | None) |
8122 | 8126 | """ |
8123 | 8127 | return self.last_clicked_position |
@@ -15168,14 +15172,16 @@ def _add_expansion(element, row_should_expand, row_fill_direction): |
15168 | 15172 | treeview = element.TKTreeview |
15169 | 15173 | if element.DisplayRowNumbers: |
15170 | 15174 | treeview.heading(element.RowHeaderText, text=element.RowHeaderText) # make a dummy heading |
15171 | | - treeview.column(element.RowHeaderText, width=_string_width_in_pixels(font, element.RowHeaderText) + 10, minwidth=10, anchor=anchor, |
15172 | | - stretch=0) |
| 15175 | + row_number_header_width =_string_width_in_pixels(element.HeaderFont, element.RowHeaderText) + 10 |
| 15176 | + row_number_width = _string_width_in_pixels(font, str(len(element.Values))) + 10 |
| 15177 | + row_number_width = max(row_number_header_width, row_number_width) |
| 15178 | + treeview.column(element.RowHeaderText, width=row_number_width, minwidth=10, anchor=anchor, stretch=0) |
15173 | 15179 |
|
15174 | 15180 | headings = element.ColumnHeadings if element.ColumnHeadings is not None else element.Values[0] |
15175 | 15181 | for i, heading in enumerate(headings): |
15176 | 15182 | treeview.heading(heading, text=heading) |
15177 | 15183 | if element.AutoSizeColumns: |
15178 | | - width = max(column_widths[i], len(heading)) * _char_width_in_pixels(font) |
| 15184 | + width = max(column_widths[i] * _char_width_in_pixels(font), len(heading)*_char_width_in_pixels(element.HeaderFont)) |
15179 | 15185 | else: |
15180 | 15186 | try: |
15181 | 15187 | width = element.ColumnWidths[i] * _char_width_in_pixels(font) |
|
0 commit comments