def handle_events(self): scroll_left_button = self.scroll_left_button scroll_right_button = self.scroll_right_button bar = self.bar if scroll_right_button.contains(wotsuievents.mouse_pos): if (wotsuievents.mousebutton_pressed() and not scroll_left_button.selected and not bar.selected): if not scroll_right_button.selected: scroll_right_button.handle_selected() # print("scroll right") # print(self.scrolled_distance()) self.scroll(self.scroll_increment) self.scroll_increment = max(self.max_scroll_increment, self.scroll_increment + 1) if scroll_left_button.contains(wotsuievents.mouse_pos): if (wotsuievents.mousebutton_pressed() and not scroll_right_button.selected and not bar.selected): if not scroll_left_button.selected: scroll_left_button.handle_selected() # print("scroll left") # print(self.scrolled_distance()) self.scroll(-1 * self.scroll_increment) self.scroll_increment = max(self.max_scroll_increment, self.scroll_increment + 1) if bar.contains(wotsuievents.mouse_pos): if (wotsuievents.mousebutton_pressed() and not scroll_left_button.selected and not scroll_right_button.selected): if not bar.selected: bar.handle_selected() #self.scroll(int(2 * wotsuievents.mouse_delta[0])) if pygame.MOUSEMOTION in wotsuievents.event_types: if bar.selected: self.scroll(int(2 * wotsuievents.mouse_delta[0])) if pygame.MOUSEBUTTONUP in wotsuievents.event_types: if bar.selected: bar.handle_deselected() if scroll_right_button.selected: scroll_right_button.handle_deselected() if scroll_left_button.selected: scroll_left_button.handle_deselected() self.scroll_increment = self.min_scroll_increment
def handle_events(self): if wotsuievents.mousebutton_pressed(): for swatch in self.color_swatches: if swatch.contains(wotsuievents.mouse_pos): self.selected_swatch.handle_deselected() swatch.handle_selected() self.selected_swatch = swatch
def handle_events(self): scroll_down_button = self.scroll_down_button scroll_up_button = self.scroll_up_button bar = self.bar if scroll_down_button.contains(wotsuievents.mouse_pos): if (wotsuievents.mousebutton_pressed() and not bar.selected and not scroll_up_button.selected): if not scroll_down_button.selected: scroll_down_button.handle_selected() self.scroll(self.scroll_increment) self.scroll_increment = max(self.max_scroll_increment, self.scroll_increment + 1) if scroll_up_button.contains(wotsuievents.mouse_pos): if (wotsuievents.mousebutton_pressed() and not bar.selected and not scroll_down_button.selected): if not scroll_up_button.selected: scroll_up_button.handle_selected() self.scroll(-1 * self.scroll_increment) self.scroll_increment = max(self.max_scroll_increment, self.scroll_increment + 1) if bar.contains(wotsuievents.mouse_pos): if (wotsuievents.mousebutton_pressed() and not scroll_down_button.selected and not scroll_up_button.selected): if not bar.selected: bar.handle_selected() #self.scroll(2*wotsuievents.mouse_delta[1]) if pygame.MOUSEMOTION in wotsuievents.event_types: if bar.selected: self.scroll(2*wotsuievents.mouse_delta[1]) if pygame.MOUSEBUTTONUP in wotsuievents.event_types: if bar.selected: bar.handle_deselected() if scroll_up_button.selected: scroll_up_button.handle_deselected() if scroll_down_button.selected: scroll_down_button.handle_deselected() self.scroll_increment = self.min_scroll_increment
def handle_events(self): for button in self.buttons: if (button.contains(wotsuievents.mouse_pos) and wotsuievents.mousebutton_pressed()): button.handle_selected() if ((self.selected_button != None) and (self.selected_button != button)): self.selected_button.handle_deselected() self.selected_button = button break
def handle_events(self): self.update_reference_frames() self.update_reference_frame_positions() if self.reference_frame_index != self.animation.frame_index: self.update_active_reference_frame(self.animation.frame_index) for i in range(len(self.reference_frames)): reference_frame = self.reference_frames[i] reference_frame.handle_events() if wotsuievents.mousebutton_pressed() and reference_frame.contains_mouse: reference_frame.handle_selected() if not wotsuievents.mousebutton_pressed() and reference_frame.selected: if reference_frame.contains_mouse and reference_frame != self.active_reference_frame: self.active_reference_frame.handle_deselected() self.active_reference_frame = reference_frame self.reference_frame_index = i self.animation.frame_index = i elif reference_frame != self.active_reference_frame: reference_frame.handle_deselected()
def handle_events(self): if self.contains(wotsuievents.mouse_pos): if wotsuievents.mousebutton_pressed(): for thumbnail in self.thumbnails: if thumbnail.contains(wotsuievents.mouse_pos): if self.selected_thumbnail != None: self.selected_thumbnail.handle_deselected() thumbnail.handle_selected() self.selected_thumbnail = thumbnail if pygame.K_UP in wotsuievents.keys_pressed: if self.selected_thumbnail != None: new_selected_index = self.thumbnails.index(self.selected_thumbnail) - 1 if new_selected_index == -1: new_selected_index = len(self.thumbnails) - 1 self.selected_thumbnail.handle_deselected() self.thumbnails[new_selected_index].handle_selected() self.selected_thumbnail = self.thumbnails[new_selected_index] else: new_selected_index = 0 self.thumbnails[new_selected_index].handle_selected() self.selected_thumbnail = self.thumbnails[new_selected_index] if pygame.K_DOWN in wotsuievents.keys_pressed: if self.selected_thumbnail != None: new_selected_index = self.thumbnails.index(self.selected_thumbnail) + 1 if new_selected_index == len(self.thumbnails): new_selected_index = 0 self.selected_thumbnail.handle_deselected() self.thumbnails[new_selected_index].handle_selected() self.selected_thumbnail = self.thumbnails[new_selected_index] else: new_selected_index = 0 self.thumbnails[new_selected_index].handle_selected() self.selected_thumbnail = self.thumbnails[new_selected_index] if self.selected_thumbnail_is_not_in_place(): self.shift_thumbnails()