diff --git a/src/Simple/_SimpleTable.py b/src/Simple/_SimpleTable.py index b21f07671..bab97f3d4 100644 --- a/src/Simple/_SimpleTable.py +++ b/src/Simple/_SimpleTable.py @@ -174,7 +174,7 @@ class SimpleTable: # FIXME: add better text representations of these objects if type(item) in [str, unicode]: retval.append(item) - elif type(item) in [int, float]: + elif type(item) in [int, float, long]: retval.append(item) self.row_sort_val(col, item) elif isinstance(item, gen.lib.Person): diff --git a/src/plugins/DefaultGramplets.py b/src/plugins/DefaultGramplets.py index f287eed41..d0b103ac8 100644 --- a/src/plugins/DefaultGramplets.py +++ b/src/plugins/DefaultGramplets.py @@ -19,6 +19,7 @@ import sys import re import urllib +import posixpath import gen.lib from DataViews import register, Gramplet @@ -550,6 +551,7 @@ class PedigreeGramplet(Gramplet): class StatsGramplet(Gramplet): def init(self): self.set_text(_("No Family Tree loaded.")) + self.tooltip = _("Double-click item to see matches") def db_changed(self): self.dbstate.db.connect('person-add', self.update) @@ -674,12 +676,14 @@ class StatsGramplet(Gramplet): 'Filter', 'unique media') self.append_text(" %s" % pobjects) self.append_text("\n") - self.append_text("%s: %d %s\n" % (_("Total size of media objects"), - bytes, - _("bytes"))) + + self.link("%s:" % _("Total size of media objects"), + 'Filter', 'media by size') + self.append_text(" %d %s" % (bytes, _("bytes"))) + self.append_text("\n") self.link("%s:" % _("Missing Media Objects"), 'Filter', 'missing media') - self.append_text(" %s\n" % total_photos) + self.append_text(" %s\n" % len(notfound)) self.append_text("", scroll_to="begin") class PythonGramplet(Gramplet): diff --git a/src/plugins/FilterByName.py b/src/plugins/FilterByName.py index 5540a217b..1f3d9490a 100644 --- a/src/plugins/FilterByName.py +++ b/src/plugins/FilterByName.py @@ -24,13 +24,15 @@ Display filtered data """ from Simple import SimpleAccess, SimpleDoc, SimpleTable -from gettext import gettext as _ from PluginUtils import register_quick_report from Utils import media_path_full from QuickReports import run_quick_report_by_name_direct from gen.lib import Person import DateHandler +import posixpath +from gettext import gettext as _ + def run(database, document, filter_name): """ Loops through the families that the person is a child in, and display @@ -182,10 +184,22 @@ def run(database, document, filter_name): photo = database.get_object_from_handle(photo_id) fullname = media_path_full(database, photo.get_path()) try: - bytes = bytes + posixpath.getsize(fullname) + posixpath.getsize(fullname) except: stab.row(fullname) matches += 1 + elif (filter_name == 'media by size'): + stab.columns(_("Media"), _("Size in bytes")) + pobjects = database.get_media_object_handles() + for photo_id in database.get_media_object_handles(): + photo = database.get_object_from_handle(photo_id) + fullname = media_path_full(database, photo.get_path()) + try: + bytes = posixpath.getsize(fullname) + stab.row(fullname, bytes) + matches += 1 + except: + pass else: raise AttributeError, ("invalid filter name: '%s'" % filter_name) sdoc.paragraph(_("Filter matched %d records.") % matches)