Exemplo n.º 1
0
    def handle_request(self, request):
        label = request['label']
        obj = request['obj']
        w = request['which_window']
        mv = self.mesh_viewers[w[0]][w[1]]

        # Handle each type of request.
        # Some requests require a redraw, and
        # some don't.
        if label == 'dynamic_meshes':
            mv.dynamic_meshes = obj
            self.need_redraw = True
        elif label == 'dynamic_models':
            mv.dynamic_models = obj
            self.need_redraw = True
        elif label == 'static_meshes':
            mv.static_meshes = obj
            self.need_redraw = True
        elif label == 'dynamic_lines':
            mv.dynamic_lines = obj
            self.need_redraw = True
        elif label == 'static_lines':
            mv.static_lines = obj
            self.need_redraw = True
        elif label == 'autorecenter':
            mv.autorecenter = obj
            self.need_redraw = True
        elif label == 'titlebar':
            assert (isinstance(obj, str) or isinstance(obj, unicode))
            self.titlebar = obj
            glutSetWindowTitle(obj)
        elif label == 'lighting_on':
            mv.lighting_on = obj
            self.need_redraw = True
        elif label == 'background_color':
            glClearColor(obj[0], obj[1], obj[2], 1.0)
            self.need_redraw = True
        elif label == 'save_snapshot':  # redraws for itself
            assert (isinstance(obj, str) or isinstance(obj, unicode))
            self.snapshot(obj)
        elif label == 'get_keypress':
            self.keypress_port = obj
        elif label == 'get_mouseclick':
            self.mouseclick_port = obj
        elif label == 'get_event':
            self.event_port = obj
        else:
            return False  # can't handle this request string

        return True  # handled the request string
Exemplo n.º 2
0
 def set_title(self, title):
     glutSetWindowTitle(title)
Exemplo n.º 3
0
 def set_title(self, title):
     glutSetWindowTitle(title)