def __is_valid_port(port): location = "localhost:" + str(port) channel = grpc.insecure_channel(location, options=[('grpc.enable_http_proxy', False)]) app = App_pb2_grpc.AppStub(channel) try: app.GetVersion(Empty(), timeout=1) except grpc.RpcError: return False return True
def selected_cases(self): """Get a list of all cases selected in the project tree Returns: A list of rips Case objects """ case_infos = self._project_stub.GetSelectedCases(Empty()) cases = [] for case_info in case_infos.data: cases.append(Case(self._channel, case_info.id)) return cases
def selected_cases(self): """Get a list of all cases selected in the project tree Returns: A list of :class:`rips.generated.pdm_objects.Case` """ case_infos = self._project_stub.GetSelectedCases(Empty()) cases = [] for case_info in case_infos.data: cases.append(self.case(case_info.id)) return cases
def cases(self): """Get a list of all cases in the project Returns: A list of rips Case objects """ try: case_infos = self._project_stub.GetAllCases(Empty()) cases = [] for case_info in case_infos.data: cases.append(Case(self._channel, case_info.id)) return cases except grpc.RpcError as rpc_error: if rpc_error.code() == grpc.StatusCode.NOT_FOUND: return [] print("ERROR: ", rpc_error) return []
def close(self): """Close the current project (and open new blank project)""" self._execute_command(closeProject=Empty())
def __init__(self, channel): self._project_stub = Project_pb2_grpc.ProjectStub(channel) PdmObject.__init__(self, self._project_stub.GetPdmObject(Empty()), channel)
def is_gui(self): """Returns true if the connected ResInsight instance is a GUI app""" return self.app.GetRuntimeInfo( Empty()).app_type == App_pb2.ApplicationTypeEnum.Value( 'GUI_APPLICATION')
def exit(self): """Tell ResInsight instance to quit""" print("Telling ResInsight to Exit") return self.app.Exit(Empty())
def __version_message(self): return self.app.GetVersion(Empty())
def create(channel): project_stub = Project_pb2_grpc.ProjectStub(channel) pb2_object = project_stub.GetPdmObject(Empty()) return Project(pb2_object, channel)