Пример #1
0
    def _timeremove_cb(self, obj, emission, source):
        t = float(source)
        anim_name = self.e.animation.name
        anim_frame = self.e.animation.state
        prog = "@%s@%.2f" % (anim_name, t)

        saved_states = []
        for part_name in self.e.animation.parts:
            part = self.e.part_get(part_name)
            st_obj = part.state_get(prog)
            st_class = objects_data.state_class_from_part_type_get(part)
            state_save = st_class(st_obj)
            saved_states.append([part.name, state_save])

        trans = self.e.animation.program.transition

        def agree(bt, notification):
            self._remove_time_point(t, anim_name, anim_frame)
            notification.hide()
            notification.delete()
            op = Operation("animation (%s) frame (%s) deletion" % \
                               (anim_name, t))
            op.redo_callback_add(self._remove_time_point, t, anim_name,
                                 anim_frame)
            op.undo_callback_add(
                self._frame_readd, t, anim_name, saved_states, trans)
            self._operation_stack_cb(op)

        def disagree(bt, notification):
            notification.hide()
            notification.delete()

        if t in self.e.animation.timestops:
            notification = ErrorNotify(
                self._parent, orient=elementary.ELM_NOTIFY_ORIENT_CENTER)
            notification.title = "Do you really want to delete this " \
                "animation frame?"
            notification.action_add("Yes", agree, None, notification)
            notification.action_add("No", disagree, None,  notification)
            notification.show()
Пример #2
0
    def _timeremove_cb(self, obj, emission, source):
        t = float(source)
        anim_name = self.e.animation.name
        anim_frame = self.e.animation.state
        prog = "@%s@%.2f" % (anim_name, t)

        saved_states = []
        for part_name in self.e.animation.parts:
            part = self.e.part_get(part_name)
            st_obj = part.state_get(prog)
            st_class = objects_data.state_class_from_part_type_get(part)
            state_save = st_class(st_obj)
            saved_states.append([part.name, state_save])

        trans = self.e.animation.program.transition

        def agree(bt, notification):
            self._remove_time_point(t, anim_name, anim_frame)
            notification.hide()
            notification.delete()
            op = Operation("animation (%s) frame (%s) deletion" % \
                               (anim_name, t))
            op.redo_callback_add(self._remove_time_point, t, anim_name,
                                 anim_frame)
            op.undo_callback_add(self._frame_readd, t, anim_name, saved_states,
                                 trans)
            self._operation_stack_cb(op)

        def disagree(bt, notification):
            notification.hide()
            notification.delete()

        if t in self.e.animation.timestops:
            notification = ErrorNotify(
                self._parent, orient=elementary.ELM_NOTIFY_ORIENT_CENTER)
            notification.title = "Do you really want to delete this " \
                "animation frame?"
            notification.action_add("Yes", agree, None, notification)
            notification.action_add("No", disagree, None, notification)
            notification.show()