def handle_button_press(self, widget, event): ''' Internal function to handle button press. ''' # Get input focus. self.grab_focus() # Hide right menu immediately. self.right_menu.hide() # Select all when double click left button. if is_double_click(event): self.double_click_flag = True self.select_all() # Show right menu when click right button. elif is_right_button(event): if self.right_menu_visible_flag: (wx, wy) = self.window.get_root_origin() (cx, cy, modifier) = self.window.get_pointer() self.right_menu.show((cx + wx, cy + wy)) # Change cursor when click left button. elif is_left_button(event): self.left_click_flag = True self.left_click_coordindate = (event.x, event.y) xy = map(int, self.left_click_coordindate) insert = self.xy_to_iter(*xy) self.buffer.move_mark_by_name("insert", insert) self.buffer.move_mark_by_name("selection_bound", insert) self.drag_start_index = self.get_index_at_event(widget, event) self.queue_draw()
def handle_button_press(self, widget, event): ''' Internal function to handle button press. ''' # Get input focus. self.grab_focus() # Hide right menu immediately. self.right_menu.hide() # Select all when double click left button. if is_double_click(event): self.double_click_flag = True self.select_all() # Show right menu when click right button. elif is_right_button(event): if self.right_menu_visible_flag: (wx, wy) = self.window.get_root_origin() (cx, cy, modifier) = self.window.get_pointer() self.right_menu.show((cx + wx, cy + wy)) # Change cursor when click left button. elif is_left_button(event): self.left_click_flag = True self.left_click_coordindate = (event.x, event.y) xy = map(int, self.left_click_coordindate) insert = self.xy_to_iter(*xy) self.buffer.move_mark_by_name("insert", insert) self.buffer.move_mark_by_name("selection_bound", insert) self.drag_start_index = self.get_index_at_event(widget, event) self.queue_draw()
def button_press(self, widget, event): if self.get_data("entry_widget") is None: return cell = self.get_cell_with_event(event) entry = self.get_data("entry_widget") item = entry.get_data("item") # if pressed outside entry column area, destroy entry if cell is None: entry.get_parent().destroy() return (row, column, offset_x, offset_y) = cell if self.visible_items[row] != item or column not in item.ENTRY_COLUMN: entry.get_parent().destroy() return # right button the show menu if is_right_button(event): entry.right_menu.show((int(event.x_root), int(event.y_root))) return entry.set_data("button_press", True) send_event = event.copy() send_event.send_event = True send_event.x = float(offset_x) send_event.y = 1.0 send_event.window = entry.window entry.event(send_event) send_event.free()