def button_press_event_cb(self, page, event, value, entity): print("Disconnecting all signals") self.value_disable_signals(page, value, entity) print("Editor: Entity entry emitting 'focus-out-event'") event = Event(EventType(12)) event.window = page.get_window() # the gtk.gdk.Window of the widget event.send_event = True # this means you sent the event explicitly event.in_ = False entity.entry.emit("focus-out-event", event)
def on_line_mark(self, view, iter, event: Gdk.Event): # print(event.get_button().button == Gdk.BUTTON_PRIMARY, # event.get_button(), Gdk.BUTTON_PRIMARY) if event.get_button().button == Gdk.BUTTON_PRIMARY: line = iter.get_line() if line in self._breakpoints: self._disable_breakpoint(iter) else: self._enable_breakpoint(iter) elif event.get_button() == Gdk.BUTTON_SECONDARY: pass # TODO Support for SYNC points
def event_after(self, text_view: 'LinkedTextView', event: Gdk.Event) -> bool: """Handle mouse clicks on time links.""" _, button = event.get_button() # Check for a left mouse click (as set by the system, not hardware). if event.type == Gdk.EventType.BUTTON_RELEASE and button == 1: buffer = text_view.get_buffer() # we shouldn't follow a link if the user has selected something try: start, end = buffer.get_selection_bounds() except ValueError: # If there is nothing selected, None is return pass else: if start.get_offset() != end.get_offset(): return False x, y = text_view.window_to_buffer_coords(Gtk.TextWindowType.WIDGET, int(event.x), int(event.y)) _, itr = text_view.get_iter_at_location(x, y) self.follow_if_link(text_view, itr) return False
def release_event(self, button: 'ActionButton', event: Gdk.Event): """ On button release, call press or long_press if appropriate. """ if self.button_timer_handle is not None: self.button_timer_handle.cancel() if event.get_button()[1] == 1 and self.button_down: if time() - self.button_down_timestamp >= LONG_PRESS_TIME: self.call_long_press() else: self.call_press() self.button_down = False
def press_event(self, button: 'ActionButton', event: Gdk.Event): """ On button press, if button is 1, mark time stamp. """ if event.get_button()[1] == 1: self.button_down = True self.button_down_timestamp = time() event_loop = asyncio.get_event_loop() self.button_timer_handle = event_loop.call_later( LONG_PRESS_TIME, self.timer_event) else: self.button_down = False
def event_after(self, text_view: 'LinkedTextView', event: Gdk.Event) -> bool: """Handle mouse clicks on time links.""" _, button = event.get_button() # Check for selection buffer = text_view.get_buffer() selection = buffer.get_selection_bounds() selecting = not (len(selection) != 0 and (selection[0].get_offset() != selection[1].get_offset())) # Check for a left mouse click (as set by the system, not hardware). if (event.type == Gdk.EventType.BUTTON_RELEASE and button == 1 and not selecting): x, y = text_view.window_to_buffer_coords(Gtk.TextWindowType.WIDGET, int(event.x), int(event.y)) _, itr = text_view.get_iter_at_location(x, y) self.follow_if_link(text_view, itr) return False # Do not process the event further