diff --git a/src/QuickReports.py b/src/QuickReports.py
index e983d040e..33025b9c1 100644
--- a/src/QuickReports.py
+++ b/src/QuickReports.py
@@ -54,9 +54,9 @@ import gtk
#
#-------------------------------------------------------------------------
-from gen.plug import (CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
+from gen.plug import (CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY, CATEGORY_QR_MEDIA,
CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE, CATEGORY_QR_MISC,
- CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY)
+ CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY, CATEGORY_QR_NOTE)
from gui.pluginmanager import GuiPluginManager
def create_quickreport_menu(category,dbstate,uistate, handle) :
@@ -64,7 +64,7 @@ def create_quickreport_menu(category,dbstate,uistate, handle) :
quick_report_list of _PluginMgr.py
It collects the reports of the requested category, which must be one of
CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
- CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE,
+ CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE, CATEGORY_QR_MEDIA,
CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY
It constructs the ui string of the quick report menu, and it's actions
The action callback function is constructed, using the dbstate and the
@@ -112,7 +112,7 @@ def get_quick_report_list(qv_category=None):
Returns a list of PluginData of quick views of category qv_category
CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT,
CATEGORY_QR_SOURCE, CATEGORY_QR_MISC, CATEGORY_QR_PLACE,
- CATEGORY_QR_REPOSITORY or None for all
+ CATEGORY_QR_REPOSITORY, CATEGORY_QR_MEDIA or None for all
"""
names = []
pmgr = GuiPluginManager.get_instance()
@@ -202,8 +202,12 @@ def run_report(dbstate, uistate, category, handle, pdata, container=None,
obj = dbstate.db.get_source_from_handle(handle)
elif category == CATEGORY_QR_PLACE :
obj = dbstate.db.get_place_from_handle(handle)
+ elif category == CATEGORY_QR_MEDIA :
+ obj = dbstate.db.get_object_from_handle(handle)
elif category == CATEGORY_QR_REPOSITORY :
obj = dbstate.db.get_repository_from_handle(handle)
+ elif category == CATEGORY_QR_NOTE :
+ obj = dbstate.db.get_note_from_handle(handle)
elif category == CATEGORY_QR_MISC:
obj = handle
else:
diff --git a/src/gen/plug/__init__.py b/src/gen/plug/__init__.py
index e91b27444..2f913c6d1 100644
--- a/src/gen/plug/__init__.py
+++ b/src/gen/plug/__init__.py
@@ -29,7 +29,7 @@ from _pluginreg import (PluginData, PluginRegister, REPORT, TOOL,
TOOL_UTILS, CATEGORY_QR_MISC, CATEGORY_QR_PERSON,
CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE,
CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY, CATEGORY_QR_NOTE,
- CATEGORY_QR_DATE, PTYPE_STR,
+ CATEGORY_QR_DATE, PTYPE_STR, CATEGORY_QR_MEDIA,
START, END
)
from _manager import BasePluginManager
@@ -48,5 +48,5 @@ __all__ = [ "docbackend", "docgen", "menu", Plugin, PluginData,
TOOL_UTILS, CATEGORY_QR_MISC, CATEGORY_QR_PERSON,
CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE,
CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY, CATEGORY_QR_NOTE,
- CATEGORY_QR_DATE, PTYPE_STR,
+ CATEGORY_QR_DATE, PTYPE_STR, CATEGORY_QR_MEDIA,
START, END]
diff --git a/src/gen/plug/_pluginreg.py b/src/gen/plug/_pluginreg.py
index 576caf6ca..8e9790b8c 100644
--- a/src/gen/plug/_pluginreg.py
+++ b/src/gen/plug/_pluginreg.py
@@ -112,6 +112,7 @@ CATEGORY_QR_PLACE = 4
CATEGORY_QR_REPOSITORY = 5
CATEGORY_QR_NOTE = 6
CATEGORY_QR_DATE = 7
+CATEGORY_QR_MEDIA = 8
# Modes for generating reports
REPORT_MODE_GUI = 1 # Standalone report using GUI
@@ -855,6 +856,7 @@ class PluginRegister(object):
'CATEGORY_QR_EVENT': CATEGORY_QR_EVENT,
'CATEGORY_QR_SOURCE': CATEGORY_QR_SOURCE,
'CATEGORY_QR_PLACE': CATEGORY_QR_PLACE,
+ 'CATEGORY_QR_MEDIA': CATEGORY_QR_MEDIA,
'CATEGORY_QR_REPOSITORY': CATEGORY_QR_REPOSITORY,
'CATEGORY_QR_NOTE': CATEGORY_QR_NOTE,
'CATEGORY_QR_DATE': CATEGORY_QR_DATE,
diff --git a/src/gui/views/placebaseview.py b/src/gui/views/placebaseview.py
index eb87173c6..ebf23cbd5 100644
--- a/src/gui/views/placebaseview.py
+++ b/src/gui/views/placebaseview.py
@@ -54,6 +54,7 @@ from gui.pluginmanager import GuiPluginManager
from DdTargets import DdTargets
from gui.editors import EditPlace, DeletePlaceQuery
from Filters.SideBar import PlaceSidebarFilter
+from gen.plug import CATEGORY_QR_PLACE
#-------------------------------------------------------------------------
#
@@ -89,6 +90,7 @@ class PlaceBaseView(ListView):
EDIT_MSG = _("Edit the selected place")
DEL_MSG = _("Delete the selected place")
FILTER_TYPE = "Place"
+ QR_CATEGORY = CATEGORY_QR_PLACE
def __init__(self, dbstate, uistate, title, model):
@@ -143,6 +145,8 @@ class PlaceBaseView(ListView):
"Service (OpenstreetMap, Google Maps, ...)"))
self._add_action('FilterEdit', None, _('Place Filter Editor'),
callback=self.filter_editor)
+ self._add_action('QuickReport', None, _("Quick View"), None, None, None)
+ self._add_action('Dummy', None, ' ', None, None, self.dummy_report)
def change_page(self):
"""
@@ -317,9 +321,20 @@ class PlaceBaseView(ListView):
+
+
'''
+ def dummy_report(self, obj):
+ """ For the xml UI definition of popup to work, the submenu
+ Quick Report must have an entry in the xml
+ As this submenu will be dynamically built, we offer a dummy action
+ """
+ pass
+
def add(self, obj):
try:
EditPlace(self.dbstate, self.uistate, [], gen.lib.Place())
diff --git a/src/plugins/gramplet/QuickViewGramplet.py b/src/plugins/gramplet/QuickViewGramplet.py
index 27d291b30..308103438 100644
--- a/src/plugins/gramplet/QuickViewGramplet.py
+++ b/src/plugins/gramplet/QuickViewGramplet.py
@@ -35,7 +35,7 @@ from TransUtils import sgettext as _
from QuickReports import run_quick_report_by_name, get_quick_report_list
from gen.plug import (CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE,
- CATEGORY_QR_MISC, CATEGORY_QR_PLACE,
+ CATEGORY_QR_MISC, CATEGORY_QR_PLACE, CATEGORY_QR_MEDIA,
CATEGORY_QR_REPOSITORY)
#------------------------------------------------------------------------
@@ -62,28 +62,38 @@ class QuickViewGramplet(Gramplet):
container=self.gui.textview)
else:
active_list = []
- for item in self.gui.uistate.viewmanager.pages:
- if (item.get_title() == _("Families") and
- quick_type == CATEGORY_QR_FAMILY):
- active_list = item.selected_handles()
- elif (item.get_title() == _("Events") and
- quick_type == CATEGORY_QR_EVENT):
- active_list = item.selected_handles()
- elif (item.get_title() == _("Sources") and
- quick_type == CATEGORY_QR_SOURCE):
- active_list = item.selected_handles()
- elif (item.get_title() == _("Places") and
- quick_type == CATEGORY_QR_PLACE):
- active_list = item.selected_handles()
- elif (item.get_title() == _("Repositories") and
- quick_type == CATEGORY_QR_REPOSITORY):
- active_list = item.selected_handles()
- if len(active_list) > 0:
- run_quick_report_by_name(self.gui.dbstate,
- self.gui.uistate,
- quick_view,
- active_list[0],
- container=self.gui.textview)
+ for pages in self.gui.uistate.viewmanager.pages:
+ for item in pages:
+ if (item.get_title() == _("Families") and
+ quick_type == CATEGORY_QR_FAMILY):
+ active_list += item.selected_handles()
+ elif (item.get_title() == _("Events") and
+ quick_type == CATEGORY_QR_EVENT):
+ active_list += item.selected_handles()
+ elif (item.get_title() == _("Sources") and
+ quick_type == CATEGORY_QR_SOURCE):
+ active_list += item.selected_handles()
+ elif (item.get_title() == _("Places") and
+ quick_type == CATEGORY_QR_PLACE):
+ active_list += item.selected_handles()
+ elif (item.get_title() == _("Media") and
+ quick_type == CATEGORY_QR_MEDIA):
+ active_list += item.selected_handles()
+ elif (item.get_title() == _("Repositories") and
+ quick_type == CATEGORY_QR_REPOSITORY):
+ active_list += item.selected_handles()
+ if len(active_list) > 1:
+ for active in active_list:
+ run_quick_report_by_name(self.gui.dbstate,
+ self.gui.uistate,
+ quick_view,
+ active)
+ elif len(active_list) == 1:
+ run_quick_report_by_name(self.gui.dbstate,
+ self.gui.uistate,
+ quick_view,
+ active_list[0],
+ container=self.gui.textview)
def build_options(self):
from gen.plug.menu import EnumeratedListOption
@@ -91,11 +101,12 @@ class QuickViewGramplet(Gramplet):
type_list = EnumeratedListOption(_("View Type"), CATEGORY_QR_PERSON)
for item in [(CATEGORY_QR_PERSON, _("Person")),
#TODO: add these once they have active change signals
- #(CATEGORY_QR_FAMILY, _("Family")),
- #(CATEGORY_QR_EVENT, _("Event")),
- #(CATEGORY_QR_SOURCE, _("Source")),
- #(CATEGORY_QR_PLACE, _("Place")),
- #(CATEGORY_QR_REPOSITORY, _("Repository")),
+ (CATEGORY_QR_EVENT, _("Event")),
+ (CATEGORY_QR_FAMILY, _("Family")),
+ (CATEGORY_QR_MEDIA, _("Media")),
+ (CATEGORY_QR_PLACE, _("Place")),
+ (CATEGORY_QR_REPOSITORY, _("Repository")),
+ (CATEGORY_QR_SOURCE, _("Source")),
]:
type_list.add_item(item[0], item[1])
# Add particular lists:
diff --git a/src/plugins/quickview/References.py b/src/plugins/quickview/References.py
index c29f979af..dea51cb80 100644
--- a/src/plugins/quickview/References.py
+++ b/src/plugins/quickview/References.py
@@ -43,6 +43,10 @@ def get_ref(db, objclass, handle):
ref = db.get_source_from_handle(handle)
elif objclass == 'Place':
ref = db.get_place_from_handle(handle)
+ elif objclass == 'Note':
+ ref = db.get_note_from_handle(handle)
+ elif objclass in ['MediaObject', 'Media']:
+ ref = db.get_object_from_handle(handle)
else:
ref = objclass
return ref
@@ -61,7 +65,6 @@ def run(database, document, object, item, trans):
sdoc.title(_("References for this %s") % trans)
sdoc.paragraph("\n")
stab.columns(_("Type"), _("Reference"))
-
for (objclass, handle) in database.find_backlink_handles(object.handle):
ref = get_ref(database, objclass, handle)
stab.row(_(objclass), ref) # translation are explicit (above)
@@ -78,4 +81,6 @@ run_person = lambda db, doc, obj: run(db, doc, obj, 'person', _("Person"))
run_family = lambda db, doc, obj: run(db, doc, obj, 'family', _("Family"))
run_event = lambda db, doc, obj: run(db, doc, obj, 'event', _("Event"))
run_source = lambda db, doc, obj: run(db, doc, obj, 'source', _("Source"))
-run_place = lambda db, doc, obj: run(db, doc, obj, 'place', _("Place"))
\ No newline at end of file
+run_place = lambda db, doc, obj: run(db, doc, obj, 'place', _("Place"))
+run_media = lambda db, doc, obj: run(db, doc, obj, 'media', _("Media"))
+run_note = lambda db, doc, obj: run(db, doc, obj, 'note', _("Note"))
diff --git a/src/plugins/quickview/quickview.gpr.py b/src/plugins/quickview/quickview.gpr.py
index 90e984e65..f8958b934 100644
--- a/src/plugins/quickview/quickview.gpr.py
+++ b/src/plugins/quickview/quickview.gpr.py
@@ -191,6 +191,8 @@ refitems = [(CATEGORY_QR_PERSON, 'person', _("Person")),
(CATEGORY_QR_EVENT, 'event', _("Event")),
(CATEGORY_QR_SOURCE, 'source', _("Source")),
(CATEGORY_QR_PLACE, 'place', _("Place")),
+ (CATEGORY_QR_MEDIA, 'media', _("Media")),
+ (CATEGORY_QR_NOTE, 'note', _("Note")),
]
for (category, item, trans) in refitems:
diff --git a/src/plugins/view/mediaview.py b/src/plugins/view/mediaview.py
index 2433132c9..4e0161573 100644
--- a/src/plugins/view/mediaview.py
+++ b/src/plugins/view/mediaview.py
@@ -60,7 +60,7 @@ from gui.editors import EditMedia, DeleteMediaQuery
import Errors
from Filters.SideBar import MediaSidebarFilter
from DdTargets import DdTargets
-
+from gen.plug import CATEGORY_QR_MEDIA
#-------------------------------------------------------------------------
#
@@ -89,6 +89,7 @@ class MediaView(ListView):
EDIT_MSG = _("Edit the selected media object")
DEL_MSG = _("Delete the selected media object")
FILTER_TYPE = 'MediaObject'
+ QR_CATEGORY = CATEGORY_QR_MEDIA
_DND_TYPE = DdTargets.URI_LIST
@@ -225,6 +226,9 @@ class MediaView(ListView):
_('Open Containing _Folder'),
tip=_("Open the folder containing the media file"),
callback=self.open_containing_folder)
+
+ self._add_action('QuickReport', None, _("Quick View"), None, None, None)
+ self._add_action('Dummy', None, ' ', None, None, self.dummy_report)
def view_media(self, obj):
"""
@@ -372,9 +376,20 @@ class MediaView(ListView):
+
+
'''
+ def dummy_report(self, obj):
+ """ For the xml UI definition of popup to work, the submenu
+ Quick Report must have an entry in the xml
+ As this submenu will be dynamically built, we offer a dummy action
+ """
+ pass
+
def add(self, obj):
"""Add a new media object to the media list"""
try:
diff --git a/src/plugins/view/noteview.py b/src/plugins/view/noteview.py
index 0f00ad81a..28cd65878 100644
--- a/src/plugins/view/noteview.py
+++ b/src/plugins/view/noteview.py
@@ -55,6 +55,7 @@ from gen.lib import Note
from DdTargets import DdTargets
from Filters.SideBar import NoteSidebarFilter
from gui.editors import EditNote, DeleteNoteQuery
+from gen.plug import CATEGORY_QR_NOTE
#-------------------------------------------------------------------------
#
@@ -74,6 +75,7 @@ class NoteView(ListView):
EDIT_MSG = _("Edit the selected note")
DEL_MSG = _("Delete the selected note")
FILTER_TYPE = "Note"
+ QR_CATEGORY = CATEGORY_QR_NOTE
def __init__(self, dbstate, uistate):
@@ -165,15 +167,28 @@ class NoteView(ListView):
+
+
'''
+ def dummy_report(self, obj):
+ """ For the xml UI definition of popup to work, the submenu
+ Quick Report must have an entry in the xml
+ As this submenu will be dynamically built, we offer a dummy action
+ """
+ pass
+
def define_actions(self):
ListView.define_actions(self)
self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
_('_Column Editor'), callback=self._column_editor)
self._add_action('FilterEdit', None, _('Note Filter Editor'),
callback=self.filter_editor,)
+ self._add_action('QuickReport', None, _("Quick View"), None, None, None)
+ self._add_action('Dummy', None, ' ', None, None, self.dummy_report)
def get_handle_from_gramps_id(self, gid):
obj = self.dbstate.db.get_note_from_gramps_id(gid)
diff --git a/src/plugins/view/sourceview.py b/src/plugins/view/sourceview.py
index 402d79978..2d6df7eb2 100644
--- a/src/plugins/view/sourceview.py
+++ b/src/plugins/view/sourceview.py
@@ -47,6 +47,7 @@ from DdTargets import DdTargets
from QuestionDialog import ErrorDialog
from gui.editors import EditSource, DeleteSrcQuery
from Filters.SideBar import SourceSidebarFilter
+from gen.plug import CATEGORY_QR_SOURCE
#-------------------------------------------------------------------------
#
@@ -76,6 +77,7 @@ class SourceView(ListView):
EDIT_MSG = _("Edit the selected source")
DEL_MSG = _("Delete the selected source")
FILTER_TYPE = "Source"
+ QR_CATEGORY = CATEGORY_QR_SOURCE
def __init__(self, dbstate, uistate):
@@ -119,6 +121,8 @@ class SourceView(ListView):
callback=self.fast_merge)
self._add_action('FilterEdit', None, _('Source Filter Editor'),
callback=self.filter_editor,)
+ self._add_action('QuickReport', None, _("Quick View"), None, None, None)
+ self._add_action('Dummy', None, ' ', None, None, self.dummy_report)
def _column_editor(self, obj):
import ColumnOrder
@@ -174,9 +178,20 @@ class SourceView(ListView):
+
+
'''
+ def dummy_report(self, obj):
+ """ For the xml UI definition of popup to work, the submenu
+ Quick Report must have an entry in the xml
+ As this submenu will be dynamically built, we offer a dummy action
+ """
+ pass
+
def add(self, obj):
EditSource(self.dbstate, self.uistate, [], gen.lib.Source())