Skip to content

Commit

Permalink
remove method call Layout.rename()
Browse files Browse the repository at this point in the history
  • Loading branch information
mozman committed Oct 25, 2024
1 parent c25abfa commit 5a848c9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/ezdxf/layouts/layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@


def key(name: str) -> str:
"""AutoCAD uses case insensitive layout names, but stores the name case
sensitive."""
"""AutoCAD uses case-insensitive layout names, but stores the name case-sensitive."""
return name.upper()


Expand Down Expand Up @@ -205,12 +204,11 @@ def modelspace(self) -> Modelspace:
return cast(Modelspace, self.get("Model"))

def names(self) -> list[str]:
"""Returns a list of all layout names, all names in original case
sensitive form."""
"""Returns a list of all layout names, all names in original case-sensitive form."""
return [layout.name for layout in self._layouts.values()]

def get(self, name: Optional[str]) -> Layout:
"""Returns :class:`~ezdxf.layouts.Layout` by `name`, case insensitive
"""Returns :class:`~ezdxf.layouts.Layout` by `name`, case-insensitive
"Model" == "MODEL".
Args:
Expand All @@ -226,8 +224,8 @@ def rename(self, old_name: str, new_name: str) -> None:
not exist.
Args:
old_name: actual layout name, case insensitive
new_name: new layout name, case insensitive
old_name: actual layout name, case-insensitive
new_name: new layout name, case-insensitive
Raises:
DXFValueError: try to rename ``'Model'``
Expand All @@ -245,7 +243,6 @@ def rename(self, old_name: str, new_name: str) -> None:

layout = self.get(old_name)
self._discard(layout)
layout.rename(new_name)
self._add_layout(new_name, layout)

def names_in_taborder(self) -> list[str]:
Expand Down Expand Up @@ -311,7 +308,7 @@ def delete(self, name: str) -> None:
name (str): layout name as shown in tabs
Raises:
DXFKeyError: if layout `name` do not exists
DXFKeyError: if layout `name` do not exist
DXFValueError: deleting modelspace layout is not possible
DXFValueError: deleting last paperspace layout is not possible
Expand Down

0 comments on commit 5a848c9

Please sign in to comment.