diff --git a/dzgui/init/migrate.py b/dzgui/init/migrate.py index 55af183..0ab7518 100644 --- a/dzgui/init/migrate.py +++ b/dzgui/init/migrate.py @@ -18,15 +18,20 @@ def has_new_config(config: Path) -> bool: def migrate_cols_file(res: Path) -> None: - # NOTE: dzg.columns.json is API 7 spec + # NOTE: filename "dzg.columns.json" is API 7 spec old_res = Path.home() / LEGACY_COLS_PATH if old_res.is_file(): j = read_json(old_res) cols = j["cols"] + # NOTE: implies prior conversion if "View" in cols: return - cols["View"] = cols.pop("Perspective") - cols["Max"] = cols.pop("Maximum") + # NOTE: user may not have changed these widths in API 6 + try: + cols["View"] = cols.pop("Perspective") + cols["Max"] = cols.pop("Maximum") + except Exception: + pass write_json(j, res) diff --git a/dzgui/views/trees/tree_servers.py b/dzgui/views/trees/tree_servers.py index c1174fe..ac2b2e3 100644 --- a/dzgui/views/trees/tree_servers.py +++ b/dzgui/views/trees/tree_servers.py @@ -72,6 +72,7 @@ class ServerTreeView(ContextMixin, TreeView): # type: ignore logger.critical(e) valid_json = False + # NOTE: reasonable defaults for long columns width_map = { "Name": 800, "Map": 300, @@ -96,8 +97,9 @@ class ServerTreeView(ContextMixin, TreeView): # type: ignore column.set_fixed_width(saved_size) column.set_expand(True) else: - w = width_map[column_title] - column.set_fixed_width(w) + if column_title in width_map: + w = width_map[column_title] + column.set_fixed_width(w) if column_title == "Ping": column.set_cell_data_func(renderer, self._get_ping)