engine.py
def _dispatch_events(self):
        """ default engine's event dispatched that would also call
            a cutsom event handler cb here
        """
        for event in pygame.event.get():            
            if event.type == pygame.QUIT:
                if self._on_quit_cb is None or self._on_quit_cb():     
                    self.quit()
                
            if event.type==self.EVENT_ANIM_HEARTBEAT:
                self._anim_timer += 1
                continue

            if event.type in self._unsettling_events:
                self._idle_ticks = 0

            if event.type==pygame.MOUSEBUTTONDOWN:
                mouse_pos = event.pos

                is_doubleclick = (self._last_mouse_click_ticks > (self.get_ticks() - self.DOUBLECLICK_DELAY) and
                                  self._last_mouse_click_button==event.button and self._last_mouse_click_pos==mouse_pos)

                self._last_mouse_click_ticks = self.get_ticks()
                self._last_mouse_click_button = event.button
                self._last_mouse_click_pos = event.pos                                                  

                if is_doubleclick:
                    doubleclick_event = pygame.event.Event(self.EVENT_DOUBLECLICK, {"pos": mouse_pos, "button": event.button})                                        
                    pygame.event.post(doubleclick_event)                    

                #self._selected_control_old = self._selected_control
                selected_control = None

                for ctr in [ctrl for ctrl in self._controls if ctrl._visible and not self._hide_gui]:
                    drag_mode = ctr.drag_test(*mouse_pos)
                    if drag_mode is not None:
                        self._draged_controls += [(ctr, event.button, drag_mode)]

                    if ctr.click_test(*mouse_pos):
                        if isinstance(ctr, ButtonCtrl):
                            if self._pushed_btn is None:
                                self._pushed_btn = ctr
                                ctr.is_pushed = True
                        else:
                            if is_doubleclick:
                                ctr.doubleclicked(*mouse_pos, event.button, self)   
                            ctr.clicked(*mouse_pos, event.button, self)   
                        self._clicked_control = ctr

                        if ctr._selectable:
                            selected_control = ctr
                        else:
                            if ctr.layout.parent is not None:
                                selected_control = ctr.layout.parent
                            else:
                                selected_control = None

                self._set_selected_control( selected_control )

            elif event.type==pygame.MOUSEBUTTONUP:
                if self._pushed_btn is not None:
                    self._pushed_btn.is_pushed=False
                    self._pushed_btn.clicked(*pygame.mouse.get_pos(), event.button, self)
                    self._pushed_btn=None
                self._draged_controls = []
                self._clicked_control = None

            elif event.type==pygame.MOUSEMOTION:                 
                for ctrl, button, drag_mode in self._draged_controls:
                    ctrl.drag_move(drag_mode, *event.pos, *event.rel, self, button)

            elif event.type==pygame.KEYDOWN:
                if event.key==pygame.K_ESCAPE:
                    if self._selected_control is not None:
                        self._selected_control.selected = False
                        self._selected_control = None
                elif event.key==pygame.K_RETURN:
                    if pygame.key.get_mods() & pygame.KMOD_ALT:
                        self.toggle_scaled_fullscreen()
                if self._selected_control is not None:
                    self._selected_control.key_pressed(event.key, self)

            if event.type == pygame.VIDEORESIZE:
                self._screen_size = (event.w , event.h)
                self._shadow_surface = pygame.Surface((self.screen_width, self.screen_height)).convert()                                   

            # if event.type==self._EVENT_CAPTURE_FRAME:
            #     pass

            if callable(self._on_event_cb):
                self._on_event_cb(event)

        self._idle_ticks += 1
 default engine's event dispatched that would also call
            a cutsom event handler cb here
        
default engine's event dispatched that would also call
a cutsom event handler cb here
default engine ' s event dispatched that would also call a cutsom event handler cb here
def _dispatch_events(self):
        for event in pygame.event.get():            
            if event.type == pygame.QUIT:
                if self._on_quit_cb is None or self._on_quit_cb():     
                    self.quit()
            if event.type==self.EVENT_ANIM_HEARTBEAT:
                self._anim_timer += 1
                continue
            if event.type in self._unsettling_events:
                self._idle_ticks = 0
            if event.type==pygame.MOUSEBUTTONDOWN:
                mouse_pos = event.pos
                is_doubleclick = (self._last_mouse_click_ticks > (self.get_ticks() - self.DOUBLECLICK_DELAY) and
                                  self._last_mouse_click_button==event.button and self._last_mouse_click_pos==mouse_pos)
                self._last_mouse_click_ticks = self.get_ticks()
                self._last_mouse_click_button = event.button
                self._last_mouse_click_pos = event.pos                                                  
                if is_doubleclick:
                    doubleclick_event = pygame.event.Event(self.EVENT_DOUBLECLICK, {"pos": mouse_pos, "button": event.button})                                        
                    pygame.event.post(doubleclick_event)                    
                selected_control = None
                for ctr in [ctrl for ctrl in self._controls if ctrl._visible and not self._hide_gui]:
                    drag_mode = ctr.drag_test(*mouse_pos)
                    if drag_mode is not None:
                        self._draged_controls += [(ctr, event.button, drag_mode)]
                    if ctr.click_test(*mouse_pos):
                        if isinstance(ctr, ButtonCtrl):
                            if self._pushed_btn is None:
                                self._pushed_btn = ctr
                                ctr.is_pushed = True
                        else:
                            if is_doubleclick:
                                ctr.doubleclicked(*mouse_pos, event.button, self)   
                            ctr.clicked(*mouse_pos, event.button, self)   
                        self._clicked_control = ctr
                        if ctr._selectable:
                            selected_control = ctr
                        else:
                            if ctr.layout.parent is not None:
                                selected_control = ctr.layout.parent
                            else:
                                selected_control = None
                self._set_selected_control( selected_control )
            elif event.type==pygame.MOUSEBUTTONUP:
                if self._pushed_btn is not None:
                    self._pushed_btn.is_pushed=False
                    self._pushed_btn.clicked(*pygame.mouse.get_pos(), event.button, self)
                    self._pushed_btn=None
                self._draged_controls = []
                self._clicked_control = None
            elif event.type==pygame.MOUSEMOTION:                 
                for ctrl, button, drag_mode in self._draged_controls:
                    ctrl.drag_move(drag_mode, *event.pos, *event.rel, self, button)
            elif event.type==pygame.KEYDOWN:
                if event.key==pygame.K_ESCAPE:
                    if self._selected_control is not None:
                        self._selected_control.selected = False
                        self._selected_control = None
                elif event.key==pygame.K_RETURN:
                    if pygame.key.get_mods() & pygame.KMOD_ALT:
                        self.toggle_scaled_fullscreen()
                if self._selected_control is not None:
                    self._selected_control.key_pressed(event.key, self)
            if event.type == pygame.VIDEORESIZE:
                self._screen_size = (event.w , event.h)
                self._shadow_surface = pygame.Surface((self.screen_width, self.screen_height)).convert()                                   
            if callable(self._on_event_cb):
                self._on_event_cb(event)
        self._idle_ticks += 1
def _dispatch_events ( self ) : for event in pygame . event . get ( ) : if event . type == pygame . QUIT : if self . _on_quit_cb is None or self . _on_quit_cb ( ) : self . quit ( ) if event . type == self . EVENT_ANIM_HEARTBEAT : self . _anim_timer += 1 continue if event . type in self . _unsettling_events : self . _idle_ticks = 0 if event . type == pygame . MOUSEBUTTONDOWN : mouse_pos = event . pos is_doubleclick = ( self . _last_mouse_click_ticks > ( self . get_ticks ( ) - self . DOUBLECLICK_DELAY ) and self . _last_mouse_click_button == event . button and self . _last_mouse_click_pos == mouse_pos ) self . _last_mouse_click_ticks = self . get_ticks ( ) self . _last_mouse_click_button = event . button self . _last_mouse_click_pos = event . pos if is_doubleclick : doubleclick_event = pygame . event . Event ( self . EVENT_DOUBLECLICK , { "pos" : mouse_pos , "button" : event . button } ) pygame . event . post ( doubleclick_event ) selected_control = None for ctr in [ ctrl for ctrl in self . _controls if ctrl . _visible and not self . _hide_gui ] : drag_mode = ctr . drag_test ( * mouse_pos ) if drag_mode is not None : self . _draged_controls += [ ( ctr , event . button , drag_mode ) ] if ctr . click_test ( * mouse_pos ) : if isinstance ( ctr , ButtonCtrl ) : if self . _pushed_btn is None : self . _pushed_btn = ctr ctr . is_pushed = True else : if is_doubleclick : ctr . doubleclicked ( * mouse_pos , event . button , self ) ctr . clicked ( * mouse_pos , event . button , self ) self . _clicked_control = ctr if ctr . _selectable : selected_control = ctr else : if ctr . layout . parent is not None : selected_control = ctr . layout . parent else : selected_control = None self . _set_selected_control ( selected_control ) elif event . type == pygame . MOUSEBUTTONUP : if self . _pushed_btn is not None : self . _pushed_btn . is_pushed = False self . _pushed_btn . clicked ( * pygame . mouse . get_pos ( ) , event . button , self ) self . _pushed_btn = None self . _draged_controls = [ ] self . _clicked_control = None elif event . type == pygame . MOUSEMOTION : for ctrl , button , drag_mode in self . _draged_controls : ctrl . drag_move ( drag_mode , * event . pos , * event . rel , self , button ) elif event . type == pygame . KEYDOWN : if event . key == pygame . K_ESCAPE : if self . _selected_control is not None : self . _selected_control . selected = False self . _selected_control = None elif event . key == pygame . K_RETURN : if pygame . key . get_mods ( ) & pygame . KMOD_ALT : self . toggle_scaled_fullscreen ( ) if self . _selected_control is not None : self . _selected_control . key_pressed ( event . key , self ) if event . type == pygame . VIDEORESIZE : self . _screen_size = ( event . w , event . h ) self . _shadow_surface = pygame . Surface ( ( self . screen_width , self . screen_height ) ) . convert ( ) if callable ( self . _on_event_cb ) : self . _on_event_cb ( event ) self . _idle_ticks += 1
default engine's event dispatched that would also call
a cutsom event handler cb here
default engine ' s event dispatched that would also call a cutsom event handler cb here
""" default engine's event dispatched that would also call
            a cutsom event handler cb here
        """ #self._selected_control_old = self._selected_control
 # if event.type==self._EVENT_CAPTURE_FRAME:
 #     pass

self