small adjustments to the lens for 1.18

This commit is contained in:
Jean-Francois Dockes 2012-10-21 18:56:42 +02:00
parent d731292858
commit b77794d22e
2 changed files with 16 additions and 23 deletions

View file

@ -62,23 +62,18 @@ def create_lens ():
# Populate filters
filters = []
# We should get the categories from the config but the python
# module currently has no code for this. CheckOption or RadioOption?
filter = Unity.RadioOptionFilter.new("rclcat", "Category",
Gio.ThemedIcon.new("input-keyboard-symbolic"), False)
filter.add_option("text", "Text", None);
filter.add_option("spreadsheet", "Spreadsheet", None);
filter.add_option("presentation", "Presentation", None);
filter.add_option("media", "Media", None);
filter.add_option("message", "Message", None);
filter.add_option("other", "Other", None);
lens.props.filters = [filter]
filters.append(filter)
lens.props.filters = filters
return lens
lens = create_lens ()

View file

@ -7,9 +7,7 @@ import hashlib
import os
import locale
from gi.repository import GLib, GObject, Gio
from gi.repository import Dee
from gi.repository import Unity
from gi.repository import Unity, GObject, Gio
import recoll
@ -27,6 +25,9 @@ SPEC_MIME_ICONS = {'application/x-fsdirectory' : 'gnome-fs-directory.svg',
'message/rfc822' : 'mail-read',
'application/x-recoll' : 'recoll'}
# Truncate results here:
MAX_RESULTS = 30
# These category ids must match the order in which we add them to the lens
CATEGORY_ALL = 0
@ -237,12 +238,10 @@ class Scope (Unity.Scope):
# original path could not be translated to unicode by
# pyrecoll, or if the unicode can't be translated back
# in the current locale)
encoding = locale.nl_langinfo(locale.CODESET)
thumbnail = \
self._get_thumbnail_path(url.encode(encoding,
errors='replace'))
#print "Recoll Lens: Using MIMETYPE", mimetype, " URL", url
#encoding = locale.nl_langinfo(locale.CODESET)
#thumbnail = self._get_thumbnail_path(url.encode(encoding,
# errors='replace'))
thumbnail = self._get_thumbnail_path(doc.getbinurl())
titleorfilename = doc.title
if titleorfilename == "":
@ -261,7 +260,6 @@ class Scope (Unity.Scope):
#print "iconname:", iconname
try:
abstract = self.db.makeDocAbstract(doc, query).encode('utf-8')
except:
@ -276,7 +274,7 @@ class Scope (Unity.Scope):
doc.url)
actual_results += 1
if actual_results >= 20:
if actual_results >= MAX_RESULTS:
break