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,
|
||||
):
|
||||
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...
|
||||
columns: tuple[str, ...] = table.cget("columns") or ()
|
||||
column_settings: dict[str, tuple[str, tk._Anchor, int, int]] = {}
|
||||
@@ -633,8 +635,7 @@ class ChannelList:
|
||||
column_settings[s_cid] = (
|
||||
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...
|
||||
if cid != "#0":
|
||||
# ..., then add the column
|
||||
table.config(columns=columns + (cid,))
|
||||
# ..., and then restore column settings and headings afterwards
|
||||
for s_cid, (s_name, s_anchor, s_width, s_minwidth) in column_settings.items():
|
||||
|
||||
Reference in new issue
Block a user