small adjustments to the lens for 1.18
This commit is contained in:
parent
d731292858
commit
b77794d22e
2 changed files with 16 additions and 23 deletions
|
@ -62,23 +62,18 @@ def create_lens ():
|
||||||
|
|
||||||
|
|
||||||
# Populate filters
|
# Populate filters
|
||||||
filters = []
|
|
||||||
|
|
||||||
# We should get the categories from the config but the python
|
# We should get the categories from the config but the python
|
||||||
# module currently has no code for this. CheckOption or RadioOption?
|
# module currently has no code for this. CheckOption or RadioOption?
|
||||||
filter = Unity.RadioOptionFilter.new("rclcat", "Category",
|
filter = Unity.RadioOptionFilter.new("rclcat", "Category",
|
||||||
Gio.ThemedIcon.new("input-keyboard-symbolic"), False)
|
Gio.ThemedIcon.new("input-keyboard-symbolic"), False)
|
||||||
|
|
||||||
filter.add_option("text", "Text", None);
|
filter.add_option("text", "Text", None);
|
||||||
filter.add_option("spreadsheet", "Spreadsheet", None);
|
filter.add_option("spreadsheet", "Spreadsheet", None);
|
||||||
filter.add_option("presentation", "Presentation", None);
|
filter.add_option("presentation", "Presentation", None);
|
||||||
filter.add_option("media", "Media", None);
|
filter.add_option("media", "Media", None);
|
||||||
filter.add_option("message", "Message", None);
|
filter.add_option("message", "Message", None);
|
||||||
filter.add_option("other", "Other", None);
|
filter.add_option("other", "Other", None);
|
||||||
|
lens.props.filters = [filter]
|
||||||
|
|
||||||
filters.append(filter)
|
|
||||||
|
|
||||||
lens.props.filters = filters
|
|
||||||
return lens
|
return lens
|
||||||
|
|
||||||
lens = create_lens ()
|
lens = create_lens ()
|
||||||
|
|
|
@ -7,9 +7,7 @@ import hashlib
|
||||||
import os
|
import os
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
from gi.repository import GLib, GObject, Gio
|
from gi.repository import Unity, GObject, Gio
|
||||||
from gi.repository import Dee
|
|
||||||
from gi.repository import Unity
|
|
||||||
|
|
||||||
import recoll
|
import recoll
|
||||||
|
|
||||||
|
@ -27,6 +25,9 @@ SPEC_MIME_ICONS = {'application/x-fsdirectory' : 'gnome-fs-directory.svg',
|
||||||
'message/rfc822' : 'mail-read',
|
'message/rfc822' : 'mail-read',
|
||||||
'application/x-recoll' : 'recoll'}
|
'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
|
# These category ids must match the order in which we add them to the lens
|
||||||
CATEGORY_ALL = 0
|
CATEGORY_ALL = 0
|
||||||
|
|
||||||
|
@ -237,12 +238,10 @@ class Scope (Unity.Scope):
|
||||||
# original path could not be translated to unicode by
|
# original path could not be translated to unicode by
|
||||||
# pyrecoll, or if the unicode can't be translated back
|
# pyrecoll, or if the unicode can't be translated back
|
||||||
# in the current locale)
|
# in the current locale)
|
||||||
encoding = locale.nl_langinfo(locale.CODESET)
|
#encoding = locale.nl_langinfo(locale.CODESET)
|
||||||
thumbnail = \
|
#thumbnail = self._get_thumbnail_path(url.encode(encoding,
|
||||||
self._get_thumbnail_path(url.encode(encoding,
|
# errors='replace'))
|
||||||
errors='replace'))
|
thumbnail = self._get_thumbnail_path(doc.getbinurl())
|
||||||
|
|
||||||
#print "Recoll Lens: Using MIMETYPE", mimetype, " URL", url
|
|
||||||
|
|
||||||
titleorfilename = doc.title
|
titleorfilename = doc.title
|
||||||
if titleorfilename == "":
|
if titleorfilename == "":
|
||||||
|
@ -261,22 +260,21 @@ class Scope (Unity.Scope):
|
||||||
|
|
||||||
#print "iconname:", iconname
|
#print "iconname:", iconname
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
abstract = self.db.makeDocAbstract(doc, query).encode('utf-8')
|
abstract = self.db.makeDocAbstract(doc, query).encode('utf-8')
|
||||||
except:
|
except:
|
||||||
break
|
break
|
||||||
|
|
||||||
model.append (url,
|
model.append (url,
|
||||||
iconname,
|
iconname,
|
||||||
CATEGORY_ALL,
|
CATEGORY_ALL,
|
||||||
mimetype,
|
mimetype,
|
||||||
titleorfilename,
|
titleorfilename,
|
||||||
abstract,
|
abstract,
|
||||||
doc.url)
|
doc.url)
|
||||||
|
|
||||||
actual_results += 1
|
actual_results += 1
|
||||||
if actual_results >= 20:
|
if actual_results >= MAX_RESULTS:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue