def on_motion_notify_event(self, widget, hippo_event, url): if self.__drag_start_pos != None and self.__drag_window == None: start_x, start_y = self.__drag_start_pos canvas_window = hippo.get_canvas_for_item(self._box) if canvas_window.drag_check_threshold(int(start_x), int(start_y), int(hippo_event.x), int(hippo_event.y)): self.__drag_window = gtk.Invisible() self.__drag_window.connect("drag-data-get", self.on_drag_data_get, url) self.__drag_window.connect("drag-end", self.on_drag_end) event = gtk.gdk.Event(gtk.gdk.MOTION_NOTIFY) x, y, s = gtk.gdk.get_default_root_window().get_pointer() event.x_root = float(x) event.y_root = float(y) event.state = s event.window = gtk.gdk.get_default_root_window() self.__drag_window.drag_begin(gtk.target_list_add_uri_targets(), gtk.gdk.ACTION_COPY, 1, event) return True return False
def get_toplevel(self): return hippo.get_canvas_for_item(self._item).get_toplevel()