コード例 #1
0
    def _cancel_group(self):
        msg = _("This will cancel the group and related quotes. "
                "Are you sure?")
        if not yesno(msg, gtk.RESPONSE_NO, _("Cancel group"),
                     _("Don't Cancel")):
            return

        store = api.new_store()
        group = store.fetch(self._group)
        group.cancel()
        QuoteGroup.delete(group.id, store=store)
        store.confirm(True)
        store.close()
        self.wizard.finish()
コード例 #2
0
    def _remove_quote(self):
        q = self.search.results.get_selected().quotation
        msg = _('Are you sure you want to remove "%s" ?') % q.get_description()
        if not yesno(msg, gtk.RESPONSE_NO, _("Remove quote"),
                     _("Don't remove")):
            return

        store = api.new_store()
        group = store.fetch(q.group)
        quote = store.fetch(q)
        group.remove_item(quote)
        # there is no reason to keep the group if there's no more quotes
        if group.get_items().count() == 0:
            QuoteGroup.delete(group.id, store=store)
        store.confirm(True)
        store.close()
        self.search.refresh()