Beispiel #1
0
    def _setUpDragAndDrop(self):
        self.dragAction = Clutter.DragAction()
        self.add_action(self.dragAction)

        self.dragAction.connect("drag-begin", self._dragBeginCb)
        self.dragAction.connect("drag-progress", self._dragProgressCb)
        self.dragAction.connect("drag-end", self._dragEndCb)
Beispiel #2
0
    def __init__(self, timelineElement, keyframe, lastKeyframe):
        Clutter.Actor.__init__(self)
        self.timelineElement = weakref.proxy(timelineElement)

        self.canvas = Clutter.Canvas()
        self.canvas.set_size(1000, KEYFRAME_SIZE)
        self.canvas.connect("draw", self._drawCb)
        self.set_content(self.canvas)
        self.set_reactive(True)

        self.gotDragged = False

        self.dragAction = Clutter.DragAction()
        self.add_action(self.dragAction)

        self.dragAction.connect("drag-begin", self._dragBeginCb)
        self.dragAction.connect("drag-end", self._dragEndCb)
        self.dragAction.connect("drag-progress", self._dragProgressCb)

        self.connect("button-release-event", self._clickedCb)
        self.connect("motion-event", self._motionEventCb)
        self.connect("enter-event", self._enterEventCb)
        self.connect("leave-event", self._leaveEventCb)

        self.previousKeyframe = lastKeyframe
        self.nextKeyframe = keyframe
Beispiel #3
0
    def show_tile(self, actor, pos):
        x, y = pos
        #        nx = (-self.current_tile[0] + x)*ACTOR_SIZE
        #        ny = (-self.current_tile[1] + y)*ACTOR_SIZE
        nx = -x * ACTOR_SIZE
        ny = -y * ACTOR_SIZE

        if self.tile_cache.has_key((x, y)):
            print "Tile already cached at", (x, y), self.tile_cache
            raise KeyError

        self.tile_cache[(x, y)] = actor

        print "moving", actor, "to:", (x, y), self.current_tile, "to", nx, ny
        if not actor:
            print "No tile at", x, y
            return

        actor.set_position(nx, ny)
        self.scroll.add_actor(actor)

        action = Clutter.DragAction()
        #        action.connect ("drag-begin",    self.drag_begin_cb)
        action.connect("drag-end", self.drag_end_cb)
        action.connect("drag-progress", self.drag_progress_cb, self.scroll)
        actor.add_action(action)
        actor.set_reactive(True)

        actor.props.clip_to_allocation = True
Beispiel #4
0
    def __init__(self, timelineElement, isLeft):
        Clutter.Texture.__init__(self)

        self.isLeft = isLeft
        self.isSelected = False
        self.timelineElement = timelineElement
        self.dragAction = Clutter.DragAction()

        self.set_from_file(
            os.path.join(configure.get_pixmap_dir(), "trimbar-normal.png"))
        self.set_size(-1, EXPANDED_SIZE)
        self.hide()
        self.set_reactive(True)

        self.add_action(self.dragAction)

        self.dragAction.connect("drag-begin", self._dragBeginCb)
        self.dragAction.connect("drag-end", self._dragEndCb)
        self.dragAction.connect("drag-progress", self._dragProgressCb)

        self.connect("enter-event", self._enterEventCb)
        self.connect("leave-event", self._leaveEventCb)

        self.timelineElement.connect("enter-event", self._elementEnterEventCb)
        self.timelineElement.connect("leave-event", self._elementLeaveEventCb)
        self.timelineElement.bElement.selected.connect("selected-changed",
                                                       self._selectedChangedCb)
    def __init__(self, stage, **kw):
        kw["opacity"] = 0
        kw["reactive"] = True
        super(DraggableBox, self).__init__(**kw)

        drag_action = Clutter.DragAction()
        self.add_action(drag_action)

        self._last_region = 0

        self.stage = stage
        self.surrounding_squares = self.init_surrounding_squares()
        self.draggable_handles = self.init_draggable_handles()
        self.draggable_borders = self.init_draggable_borders()
        self.reset_dimensions()

        self.stage.add_child(self)
        for square in self.surrounding_squares:
            square.connect("enter-event", self.mouse_leave_handler)
            self.stage.add_child(square)

        for border in self.draggable_borders:
            self.stage.add_child(border)

        for handle in self.draggable_handles:
            self.stage.add_child(handle)

        drag_action.connect("drag-progress", self.drag_progress_handler)
        self.connect("enter-event", self.mouse_enter_handler)
        self.get_parent().connect("leave-event", self.mouse_leave_handler)
Beispiel #6
0
 def _connectToEvents(self):
     self.dragAction = Clutter.DragAction()
     self.add_action(self.dragAction)
     self.dragAction.connect("drag-progress", self._dragProgressCb)
     self.dragAction.connect("drag-begin", self._dragBeginCb)
     self.dragAction.connect("drag-end", self._dragEndCb)
     self.bElement.selected.connect("selected-changed",
                                    self._selectedChangedCb)
     # We gotta go low-level cause Clutter.ClickAction["clicked"]
     # gets emitted after Clutter.DragAction["drag-begin"]
     self.connect("button-press-event", self._clickedCb)
    def __init__(self, box, coordinate, **kw):
        kw["reactive"] = True
        super(DraggableOrnament, self).__init__(**kw)

        self.draggable_box = box
        self.coordinate = coordinate

        self.hitbox = Clutter.Actor()
        self.hitbox.set_reactive(True)

        drag_action = Clutter.DragAction()
        drag_action.connect("drag-progress", self.drag_progress_handler)

        self.hitbox.add_action(drag_action)
        self.hitbox.connect("enter-event", self.mouse_enter_handler)
Beispiel #8
0
    def __init__(self, timelineElement, value, has_changeable_time):
        Clutter.Actor.__init__(self)

        self.value = value
        self.timelineElement = weakref.proxy(timelineElement)
        self.has_changeable_time = has_changeable_time
        self.lastClick = datetime.now()

        self.set_size(KEYFRAME_SIZE, KEYFRAME_SIZE)
        self.set_background_color(KEYFRAME_NORMAL_COLOR)

        self.dragAction = Clutter.DragAction()
        self.add_action(self.dragAction)

        self.dragAction.connect("drag-begin", self._dragBeginCb)
        self.dragAction.connect("drag-end", self._dragEndCb)
        self.dragAction.connect("drag-progress", self._dragProgressCb)
        self.connect("enter-event", self._enterEventCb)
        self.connect("leave-event", self._leaveEventCb)
        self.connect("button-press-event", self._clickedCb)

        self.createMenu()
        self.dragProgressed = False
        self.set_reactive(True)