From 25830e23258c75a3003bbe191c03b0a8c43646fd Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 15 Apr 2011 15:50:38 +0000 Subject: [PATCH] Added missing has_data interface for QuickViews svn: r17124 --- src/docgen/TextBufDoc.py | 1 + src/plugins/gramplet/QuickViewGramplet.py | 19 ++++++++++++++----- src/plugins/quickview/LinkReferences.py | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/docgen/TextBufDoc.py b/src/docgen/TextBufDoc.py index 0494911c0..dbab5dba2 100644 --- a/src/docgen/TextBufDoc.py +++ b/src/docgen/TextBufDoc.py @@ -104,6 +104,7 @@ class TextBufDoc(BaseDoc, TextDoc): #-------------------------------------------------------------------- def open(self, filename, container=None): self.type = "gtk" + self.has_data = True self.tag_table = gtk.TextTagTable() sheet = self.get_style_sheet() diff --git a/src/plugins/gramplet/QuickViewGramplet.py b/src/plugins/gramplet/QuickViewGramplet.py index fdbf39d6d..272f7f7ab 100644 --- a/src/plugins/gramplet/QuickViewGramplet.py +++ b/src/plugins/gramplet/QuickViewGramplet.py @@ -77,11 +77,20 @@ class QuickViewGramplet(Gramplet): except: active_handle = None if active_handle: - run_quick_report_by_name(self.gui.dbstate, - self.gui.uistate, - quick_view, - active_handle, - container=self.gui.textview) + docman = run_quick_report_by_name(self.gui.dbstate, + self.gui.uistate, + quick_view, + active_handle, + container=self.gui.textview) + self.set_has_data(docman.document.has_data) + else: + self.set_has_data(False) + + def update_has_data(self): + """ + Update the has_data indicator when gramplet is not visible. + """ + self.main() def build_options(self): from gen.plug.menu import EnumeratedListOption diff --git a/src/plugins/quickview/LinkReferences.py b/src/plugins/quickview/LinkReferences.py index 9fce2f52b..1e4891f6f 100644 --- a/src/plugins/quickview/LinkReferences.py +++ b/src/plugins/quickview/LinkReferences.py @@ -66,8 +66,10 @@ def run(database, document, obj): if stab.get_row_count() > 0: stab.write(sdoc) + document.has_data = True else: sdoc.paragraph(_("No link references for this note")) sdoc.paragraph("") + document.has_data = False sdoc.paragraph("")