Optimize _add_column
This commit is contained in:
1 parent
ec0781acae
commit
3fb8a3e089
1 file changed
+3
-2
@@ -622,6 +622,8 @@ class ChannelList:
|
|||||||
width_template: str | None = None,
|
width_template: str | None = None,
|
||||||
):
|
):
|
||||||
table = self._table
|
table = self._table
|
||||||
|
# NOTE: we don't do this for the icon column
|
||||||
|
if cid != "#0":
|
||||||
# we need to save the column settings and headings before modifying the columns...
|
# we need to save the column settings and headings before modifying the columns...
|
||||||
columns: tuple[str, ...] = table.cget("columns") or ()
|
columns: tuple[str, ...] = table.cget("columns") or ()
|
||||||
column_settings: dict[str, tuple[str, tk._Anchor, int, int]] = {}
|
column_settings: dict[str, tuple[str, tk._Anchor, int, int]] = {}
|
||||||
@@ -633,8 +635,7 @@ class ChannelList:
|
|||||||
column_settings[s_cid] = (
|
column_settings[s_cid] = (
|
||||||
s_heading["text"], s_heading["anchor"], s_column["width"], s_column["minwidth"]
|
s_heading["text"], s_heading["anchor"], s_column["width"], s_column["minwidth"]
|
||||||
)
|
)
|
||||||
# ..., then add the column, but ensure we're not adding the icons column...
|
# ..., then add the column
|
||||||
if cid != "#0":
|
|
||||||
table.config(columns=columns + (cid,))
|
table.config(columns=columns + (cid,))
|
||||||
# ..., and then restore column settings and headings afterwards
|
# ..., and then restore column settings and headings afterwards
|
||||||
for s_cid, (s_name, s_anchor, s_width, s_minwidth) in column_settings.items():
|
for s_cid, (s_name, s_anchor, s_width, s_minwidth) in column_settings.items():
|
||||||
|
|||||||
Reference in new issue
Block a user