예제 #1
0
    try:
        obj = session.query(Family).get(family.id)
        session.delete(obj)
        session.commit()
    except Exception, e:
        msg = _('Could not delete.\n\n%s') % utils.xml_safe(e)
        utils.message_details_dialog(msg,
                                     traceback.format_exc(),
                                     type=gtk.MESSAGE_ERROR)
    finally:
        session.close()
    return True


edit_action = view.Action('family_edit',
                          _('_Edit'),
                          callback=edit_callback,
                          accelerator='<ctrl>e')
add_species_action = view.Action('family_genus_add',
                                 _('_Add genus'),
                                 callback=add_genera_callback,
                                 accelerator='<ctrl>k')
remove_action = view.Action('family_remove',
                            _('_Delete'),
                            callback=remove_callback,
                            accelerator='<ctrl>Delete',
                            multiselect=True)

family_context_menu = [edit_action, add_species_action, remove_action]


#
예제 #2
0
    # TODO: set the tab to the source tab on the accessio neditor
    return edit_callback([coll[0].source.accession])


def collection_add_plants_callback(coll):
    from bauble.plugins.garden.accession import add_plants_callback
    return add_plants_callback([coll[0].source.accession])


def collection_remove_callback(coll):
    from bauble.plugins.garden.accession import remove_callback
    return remove_callback([coll[0].source.accession])


collection_edit_action = view.Action('collection_edit',
                                     _('_Edit'),
                                     callback=collection_edit_callback,
                                     accelerator='<ctrl>e')
collection_add_plant_action = \
    view.Action('collection_add', _('_Add plants'),
                callback=collection_add_plants_callback,
                accelerator='<ctrl>k')
collection_remove_action = view.Action('collection_remove',
                                       _('_Delete'),
                                       callback=collection_remove_callback,
                                       accelerator='<ctrl>Delete')

collection_context_menu = [
    collection_edit_action, collection_add_plant_action,
    collection_remove_action
]