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