mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-24 06:48:13 -06:00
collection_name() returned the stored m_collectionName, which is empty
for a RimPolygonFile or RimPolygonCloudAddress without a name. Both
classes fall back to the file name or a default ("Polygon File", "Sumo
Polygon Address") in name().
PdmNestedCollectionBase::displayName() is a virtual that defaults to
collectionName(); RimPolygonFile and RimPolygonCloudAddress override it
with name(), and CollectionNameInternal returns displayName().
collectionName() itself is unchanged, since findSubCollectionByName()
and the name conflict policy compare stored names.
ResInsight-tests: RimcNestedCollectionBase-Test covers a polygon
collection, a polygon file (default, base name, file name fallback) and
a cloud polygon address.
18 lines
608 B
Python
18 lines
608 B
Python
from .pdmobject import add_method
|
|
from .resinsight_classes import PdmNestedCollectionBase
|
|
|
|
|
|
@add_method(PdmNestedCollectionBase)
|
|
def collection_name(self: PdmNestedCollectionBase) -> str:
|
|
"""Get the name of this folder
|
|
|
|
The same for every folder class. A folder without a stored name returns the
|
|
name ResInsight falls back to, such as the file name of an imported polygon
|
|
file. The class specific attributes
|
|
(surface_user_description, polygon_collection_name) remain for existing scripts.
|
|
|
|
Returns:
|
|
The folder name
|
|
"""
|
|
return self.collection_name_internal().values[0]
|