Пример #1
0
    def _delete(self, *args):

        self.current = Fields.Reference([])
        self.string = _("[ Drop an Entry here ]")

        self.edit.set_text(self.string)
        return
Пример #2
0
    def update(self, entry):

        if self.current == self.initial: return 0

        if self.current == Fields.Reference([]):
            del entry[self.field]
            return 1

        entry[self.field] = self.current
        return 1
Пример #3
0
    def setup(self, entry):
        if entry.has_key(self.field):
            (self.current, self.loss) = entry.field_and_loss(self.field)

            if self.current.list:
                self.string = string.join(
                    map(lambda x: x.key, self.current.list), ', ')
            else:
                self.string = _("[ Drop an Entry here ]")
        else:
            (self.current, self.loss) = (Fields.Reference([]), 0)
            self.string = _("[ Drop an Entry here ]")

        self.initial = self.current
        return
Пример #4
0
    def drag_received(self, *arg):

        selection = arg[4]
        info = arg[5]

        if not info == Mime.KEY: return

        keys = string.split(selection.data, '\n')
        reflist = []
        for k in keys:
            (base, key) = string.split(k, '\0')
            if not base: base = None

            reflist.append(Key.Key(base, key))

        self.current = Fields.Reference(reflist)

        text = string.join(map(lambda x: x.key, self.current.list), ', ')
        self.edit.set_text(text)
        return