Initial prototype.

* Changed database to introduce Citations
* Introduced new Citation Primary object and CitationBase (equivalent to CitationRef) child object
* Implemented CitationTreeModel and CitationListModel
* Implemented CitationTreeView and CitationListView for new citation views in the navigator
* Implemented EditCitation which is used both for the citation views in the navigator and for the citations of an object
* Implemented the CitationEmbedList to display the citations of an object
* Modified the bottom bar gramplets to support citations
* Implemented the citation selector.
* Modified Media object to include references to Citations
* Initial work on deleting citations


svn: r17960
This commit is contained in:
Tim G L Lyons
2011-07-24 18:30:28 +00:00
parent 1012286be7
commit 9ff46d9eab
50 changed files with 3629 additions and 26 deletions

View File

@ -0,0 +1,155 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: placetreeview.py 14176 2010-02-01 07:01:45Z bmcage $
"""
Citation Tree View
"""
#-------------------------------------------------------------------------
#
# python modules
#
#-------------------------------------------------------------------------
import logging
LOG = logging.getLogger(".citation")
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from gui.views.listview import LISTTREE
from libcitationview import BaseCitationView
from gui.views.treemodels.citationmodel import CitationTreeModel
import gen.lib
import Errors
from gui.editors import EditCitation
from Utils import preset_name
#-------------------------------------------------------------------------
#
# Internationalization
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# PlaceTreeView
#
#-------------------------------------------------------------------------
class CitationTreeView(BaseCitationView):
"""
A hierarchical view of the top three levels of places.
"""
def __init__(self, pdata, dbstate, uistate, nav_group=0):
BaseCitationView.__init__(self, pdata, dbstate, uistate,
_('Citation Tree View'), CitationTreeModel,
nav_group=nav_group)
def type_list(self):
"""
set the listtype, this governs eg keybinding
"""
return LISTTREE
def get_viewtype_stock(self):
"""
Override the default icon. Set for hierarchical view.
"""
return 'gramps-tree-group'
def define_actions(self):
"""
Define actions for the popup menu specific to the tree view.
"""
BaseCitationView.define_actions(self)
self.all_action.add_actions([
('OpenAllNodes', None, _("Expand all Nodes"), None, None,
self.open_all_nodes),
('CloseAllNodes', None, _("Collapse all Nodes"), None, None,
self.close_all_nodes),
])
def additional_ui(self):
"""
Defines the UI string for UIManager
"""
return '''<ui>
<menubar name="MenuBar">
<menu action="FileMenu">
<placeholder name="LocalExport">
<menuitem action="ExportTab"/>
</placeholder>
</menu>
<menu action="BookMenu">
<placeholder name="AddEditBook">
<menuitem action="AddBook"/>
<menuitem action="EditBook"/>
</placeholder>
</menu>
<menu action="GoMenu">
<placeholder name="CommonGo">
<menuitem action="Back"/>
<menuitem action="Forward"/>
</placeholder>
</menu>
<menu action="EditMenu">
<placeholder name="CommonEdit">
<menuitem action="Add"/>
<menuitem action="Edit"/>
<menuitem action="Remove"/>
<menuitem action="Merge"/>
</placeholder>
<menuitem action="FilterEdit"/>
</menu>
</menubar>
<toolbar name="ToolBar">
<placeholder name="CommonNavigation">
<toolitem action="Back"/>
<toolitem action="Forward"/>
</placeholder>
<placeholder name="CommonEdit">
<toolitem action="Add"/>
<toolitem action="Edit"/>
<toolitem action="Remove"/>
<toolitem action="Merge"/>
</placeholder>
</toolbar>
<popup name="Popup">
<menuitem action="Back"/>
<menuitem action="Forward"/>
<separator/>
<menuitem action="OpenAllNodes"/>
<menuitem action="CloseAllNodes"/>
<separator/>
<menuitem action="Add"/>
<menuitem action="Edit"/>
<menuitem action="Remove"/>
<menuitem action="Merge"/>
<separator/>
<menu name="QuickReport" action="QuickReport">
<menuitem action="Dummy"/>
</menu>
</popup>
</ui>'''