Пример #1
0
    def _notify_err(self, err, **kargs):
        if self._notification:
            self._notification.hide()
            self._notification.delete()
            self._notification = None

        self._notification = ErrorNotify(self)

        if isinstance(err, IOError) and err.errno == errno.EEXIST:
            self._notification.title = "Swap file already exists"
            lb = elementary.Label(self._notification)
            lb.text_set("Another program may be editing the same file<br>" +
                        "or a previous edition session for this file crashed.")
            self._notification.pack_end(lb)
            lb.show()
            self._notification.action_add("Ignore Swap", self._open_forced)
            self._notification.action_add("Recover", self._open_recovery)
            self._notification.action_add("Abort", self._notify_abort)
        elif isinstance(err, swapfile.CompileError):
            self._notification.title = "Compiler Error"
            lb = elementary.Label(self._notification)
            lb.text_set(str(err.message).replace('\n', '<br>'))
            self._notification.pack_end(lb)
            lb.show()
            self._notification.action_add("Ok", self._notify_abort)
        else:
            self._notification.title = str(err).replace(':', '<br>')
            self._notification.action_add("Ok", self._notify_abort)

        self._notification.show()
Пример #2
0
    def _check_changed_cb(self, obj, part):
        if obj.state:
            self._part_add(part, self._edit_grp.animation.name)

            op = Operation("part (%s) addition into animation (%s)" % \
                                (part, self._edit_grp.animation.name))
            op.redo_callback_add(self._part_add, part,
                                 self._edit_grp.animation.name)
            op.undo_callback_add(self._part_remove, part,
                                 self._edit_grp.animation.name)
            self._operation_stack_cb(op)
        else:
            # FIXME: Take the confirmation out of this function
            self._notification = ErrorNotify(
                self, elementary.ELM_NOTIFY_ORIENT_CENTER)
            self._notification.title = "Part Removal"
            lb = elementary.Label(self._notification)
            lb.text_set("Are you sure you want to remove<br>"
                        "this part from the animation?")
            lb.show()
            self._notification.pack_end(lb)
            self._notification.action_add("Remove",
                                          self._confirm_remove_cb,
                                          data=part)
            self._notification.action_add("Cancel",
                                          self._cancel_remove_cb,
                                          data=obj)
            self._notification.show()
Пример #3
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()