Exemplo n.º 1
0
 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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
    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 []
Exemplo n.º 5
0
 def close(self):
     """Close the current project (and open new blank project)"""
     self._execute_command(closeProject=Empty())
Exemplo n.º 6
0
 def __init__(self, channel):
     self._project_stub = Project_pb2_grpc.ProjectStub(channel)
     PdmObject.__init__(self, self._project_stub.GetPdmObject(Empty()),
                        channel)
Exemplo n.º 7
0
 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')
Exemplo n.º 8
0
 def exit(self):
     """Tell ResInsight instance to quit"""
     print("Telling ResInsight to Exit")
     return self.app.Exit(Empty())
Exemplo n.º 9
0
 def __version_message(self):
     return self.app.GetVersion(Empty())
Exemplo n.º 10
0
def create(channel):
    project_stub = Project_pb2_grpc.ProjectStub(channel)
    pb2_object = project_stub.GetPdmObject(Empty())
    return Project(pb2_object, channel)