def color_list_event_handling(self):
        """Event handling for the color list mode."""
        for event in SERVICES_NS.get_events():
            ### raise specific exception if user tries to
            ### quit the application

            if event.type == QUIT:
                raise QuitAppException

            ### trigger exiting the color viewer by setting
            ### 'running' flag to False if one of following
            ### keys is released

            elif event.type == KEYUP:

                if event.key in (K_ESCAPE, K_RETURN, K_KP_ENTER):
                    self.running = False

            ### if a mouse button is released...

            elif event.type == MOUSEBUTTONUP:

                ## if it is the left button, execute
                ## specific mouse action method

                if event.button == 1:
                    self.color_list_on_mouse_release(event)

                ## if it is the mouse wheel being
                ## scrolled, scroll the list up or down

                elif event.button == 4:
                    self.scroll_color_list(40)

                elif event.button == 5:
                    self.scroll_color_list(-40)
Event handling for the color list mode.
nodezator/colorsman/viewer/modes/colorlist.py