mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4736 Project renames
This commit is contained in:
@@ -38,16 +38,16 @@ class Project (PdmObject):
|
|||||||
"""Close the current project (and open new blank project)"""
|
"""Close the current project (and open new blank project)"""
|
||||||
Commands(self.channel).close_project()
|
Commands(self.channel).close_project()
|
||||||
|
|
||||||
def selectedCases(self):
|
def selected_cases(self):
|
||||||
"""Get a list of all cases selected in the project tree
|
"""Get a list of all cases selected in the project tree
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A list of rips Case objects
|
A list of rips Case objects
|
||||||
"""
|
"""
|
||||||
caseInfos = self.project.GetSelectedCases(Empty())
|
case_infos = self.project.GetSelectedCases(Empty())
|
||||||
cases = []
|
cases = []
|
||||||
for caseInfo in caseInfos.data:
|
for case_info in case_infos.data:
|
||||||
cases.append(Case(self.channel, caseInfo.id))
|
cases.append(Case(self.channel, case_info.id))
|
||||||
return cases
|
return cases
|
||||||
|
|
||||||
def cases(self):
|
def cases(self):
|
||||||
@@ -57,11 +57,11 @@ class Project (PdmObject):
|
|||||||
A list of rips Case objects
|
A list of rips Case objects
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
caseInfos = self.project.GetAllCases(Empty())
|
case_infos = self.project.GetAllCases(Empty())
|
||||||
|
|
||||||
cases = []
|
cases = []
|
||||||
for caseInfo in caseInfos.data:
|
for case_info in case_infos.data:
|
||||||
cases.append(Case(self.channel, caseInfo.id))
|
cases.append(Case(self.channel, case_info.id))
|
||||||
return cases
|
return cases
|
||||||
except grpc.RpcError as e:
|
except grpc.RpcError as e:
|
||||||
if e.code() == grpc.StatusCode.NOT_FOUND:
|
if e.code() == grpc.StatusCode.NOT_FOUND:
|
||||||
@@ -96,11 +96,11 @@ class Project (PdmObject):
|
|||||||
|
|
||||||
def views(self):
|
def views(self):
|
||||||
"""Get a list of views belonging to a project"""
|
"""Get a list of views belonging to a project"""
|
||||||
pdmObjects = self.descendants("ReservoirView")
|
pdm_objects = self.descendants("ReservoirView")
|
||||||
viewList = []
|
view_list = []
|
||||||
for pdmObject in pdmObjects:
|
for pdm_object in pdm_objects:
|
||||||
viewList.append(View(pdmObject))
|
view_list.append(View(pdm_object))
|
||||||
return viewList
|
return view_list
|
||||||
|
|
||||||
def view(self, id):
|
def view(self, id):
|
||||||
"""Get a particular view belonging to a case by providing view id
|
"""Get a particular view belonging to a case by providing view id
|
||||||
@@ -111,39 +111,39 @@ class Project (PdmObject):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
views = self.views()
|
views = self.views()
|
||||||
for viewObject in views:
|
for view_object in views:
|
||||||
if viewObject.id == id:
|
if view_object.id == id:
|
||||||
return viewObject
|
return view_object
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def gridCaseGroups(self):
|
def grid_case_groups(self):
|
||||||
"""Get a list of all grid case groups in the project"""
|
"""Get a list of all grid case groups in the project"""
|
||||||
caseGroups = self.descendants("RimIdenticalGridCaseGroup");
|
case_groups = self.descendants("RimIdenticalGridCaseGroup")
|
||||||
|
|
||||||
caseGroupList = []
|
case_group_list = []
|
||||||
for pb2Group in caseGroups:
|
for pdm_group in case_groups:
|
||||||
caseGroupList.append(GridCaseGroup(pb2Group))
|
case_group_list.append(GridCaseGroup(pdm_group))
|
||||||
return caseGroupList
|
return case_group_list
|
||||||
|
|
||||||
def gridCaseGroup(self, groupId):
|
def grid_case_group(self, group_id):
|
||||||
"""Get a particular grid case group belonging to a project
|
"""Get a particular grid case group belonging to a project
|
||||||
Arguments:
|
Arguments:
|
||||||
groupId(int): group id
|
groupId(int): group id
|
||||||
|
|
||||||
Returns: a grid case group object
|
Returns: a grid case group object
|
||||||
"""
|
"""
|
||||||
caseGroups = self.gridCaseGroups()
|
case_groups = self.grid_case_groups()
|
||||||
for caseGroup in caseGroups:
|
for case_group in case_groups:
|
||||||
if caseGroup.groupId == groupId:
|
if case_group.groupId == group_id:
|
||||||
return caseGroup
|
return case_group
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def create_grid_case_group(self, casePaths):
|
def create_grid_case_group(self, case_paths):
|
||||||
"""Create a new grid case group from the provided case paths
|
"""Create a new grid case group from the provided case paths
|
||||||
Arguments:
|
Arguments:
|
||||||
casePaths(list): a list of paths to the cases to be loaded and included in the group
|
casePaths(list): a list of paths to the cases to be loaded and included in the group
|
||||||
Returns:
|
Returns:
|
||||||
A new grid case group object
|
A new grid case group object
|
||||||
"""
|
"""
|
||||||
groupId, groupName = Commands(self.channel).create_grid_case_group(casePaths)
|
group_id, group_name = Commands(self.channel).create_grid_case_group(case_paths)
|
||||||
return self.gridCaseGroup(groupId)
|
return self.grid_case_group(group_id)
|
||||||
@@ -9,7 +9,7 @@ import rips
|
|||||||
|
|
||||||
resinsight = rips.Instance.find()
|
resinsight = rips.Instance.find()
|
||||||
if resinsight is not None:
|
if resinsight is not None:
|
||||||
cases = resinsight.project.selectedCases()
|
cases = resinsight.project.selected_cases()
|
||||||
|
|
||||||
print ("Got " + str(len(cases)) + " cases: ")
|
print ("Got " + str(len(cases)) + " cases: ")
|
||||||
for case in cases:
|
for case in cases:
|
||||||
|
|||||||
Reference in New Issue
Block a user