Пример #1
0
 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()
Пример #2
0
 def release_item(self, event):
     if is_left_button(event):
         cell = self.get_cell_with_event(event)
         if cell is not None:
             (release_row, release_column, offset_x, offset_y) = cell
             
             if release_row is not None:
                 if self.double_click_row == release_row:
                     self.visible_items[release_row].double_click(release_column, offset_x, offset_y)
                 elif self.single_click_row == release_row:
                     self.emit("clicked", self.visible_items[release_row], release_column)
                     self.visible_items[release_row].single_click(release_column, offset_x, offset_y)
             
             if self.start_drag and self.is_in_visible_area(event):
                 self.drag_select_items_at_cursor()
                 
             self.double_click_row = None    
             self.single_click_row = None    
             self.start_drag = False
             
             # Disable select rows when press_in_select_rows valid after button release.
             if self.press_in_select_rows:
                 self.set_select_rows([self.press_in_select_rows])
                 self.start_select_row = self.press_in_select_rows
                 self.press_in_select_rows = None
             
             self.set_drag_row(None)
Пример #3
0
 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()
Пример #4
0
    def press_volume_progressbar(self, widget, event):
        # Init.
        if is_left_button(event):
            rect = widget.allocation
            lower = self.get_adjustment().get_lower()
            upper = self.get_adjustment().get_upper()
            point_width = self.point_normal_dpixbuf.get_pixbuf().get_width()

            self.set_value(lower + ((event.x - point_width / 2)) / (rect.width - point_width) * (upper - lower))
            self.queue_draw()

        return False
Пример #5
0
 def press_volume_progressbar(self, widget, event):
     # Init.
     if is_left_button(event):
         rect = widget.allocation
         lower = self.get_adjustment().get_lower()
         upper = self.get_adjustment().get_upper()
         point_width = self.point_normal_dpixbuf.get_pixbuf().get_width()
         
         self.set_value(lower + ((event.x - point_width / 2)) / (rect.width - point_width) * (upper - lower))
         self.queue_draw()
         
     return False    
Пример #6
0
    def on_button_press(self, widget, event):
        if is_left_button(event):
            rect = widget.allocation
            if event.y < self.point_height / 2:
                motion_y = self.point_height / 2
            elif event.y > rect.height - self.point_height:
                motion_y = rect.height - self.point_height
            else:
                motion_y = event.y

            if self.current_y != motion_y:
                self.current_y = motion_y
                self.emit("value-changed", self.get_value())

                self.queue_draw()
            self.__button_press_flag = True
Пример #7
0
 def on_button_press(self, widget, event):
     if is_left_button(event):
         rect = widget.allocation
         if event.y < self.point_height / 2:
             motion_y = self.point_height / 2
         elif event.y > rect.height - self.point_height:
             motion_y = rect.height - self.point_height
         else:    
             motion_y = event.y
             
         if self.current_y != motion_y:    
             self.current_y = motion_y
             self.emit("value-changed", self.get_value())
             
             self.queue_draw()            
         self.__button_press_flag = True