From 093bffda4d692baff348f87b99cd321a8968735d Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Thu, 22 Mar 2012 19:13:04 +0100 Subject: [PATCH] changed icon. Added filter code, but wont display --- src/desktop/unity-lens-recoll/Makefile.am | 4 +-- src/desktop/unity-lens-recoll/Makefile.in | 4 +-- src/desktop/unity-lens-recoll/README | 4 +-- .../bin/unity-recoll-daemon.in | 27 ++++++++++++++-- .../unity-lens-recoll/data/recoll-lens.svg | 17 ---------- .../unity-lens-recoll/data/recoll.lens.in | 2 +- .../recollscope/rclsearch.py | 32 +++++++++++++++---- 7 files changed, 56 insertions(+), 34 deletions(-) delete mode 100644 src/desktop/unity-lens-recoll/data/recoll-lens.svg diff --git a/src/desktop/unity-lens-recoll/Makefile.am b/src/desktop/unity-lens-recoll/Makefile.am index efc03cf9..852c97ad 100644 --- a/src/desktop/unity-lens-recoll/Makefile.am +++ b/src/desktop/unity-lens-recoll/Makefile.am @@ -3,7 +3,7 @@ NULL = EXTRA_DIST = \ bin/unity-recoll-daemon.in \ data/recoll.lens.in \ - data/recoll-lens.svg \ + data/recollbg24.png \ data/unity-lens-recoll.service.in \ $(docs_DATA) \ $(NULL) @@ -50,7 +50,7 @@ dotlens_DATA = \ ###################################################### iconsdir = $(datadir)/unity-lens-recoll icons_DATA = \ - data/recoll-lens.svg \ + data/recollbg24.png \ $(NULL) ###################################################### diff --git a/src/desktop/unity-lens-recoll/Makefile.in b/src/desktop/unity-lens-recoll/Makefile.in index a4909b3c..a147b2e7 100644 --- a/src/desktop/unity-lens-recoll/Makefile.in +++ b/src/desktop/unity-lens-recoll/Makefile.in @@ -179,7 +179,7 @@ NULL = EXTRA_DIST = \ bin/unity-recoll-daemon.in \ data/recoll.lens.in \ - data/recoll-lens.svg \ + data/recollbg24.png \ data/unity-lens-recoll.service.in \ $(docs_DATA) \ $(NULL) @@ -228,7 +228,7 @@ dotlens_DATA = \ ###################################################### iconsdir = $(datadir)/unity-lens-recoll icons_DATA = \ - data/recoll-lens.svg \ + data/recollbg24.png \ $(NULL) diff --git a/src/desktop/unity-lens-recoll/README b/src/desktop/unity-lens-recoll/README index 75ee8d89..718bd605 100644 --- a/src/desktop/unity-lens-recoll/README +++ b/src/desktop/unity-lens-recoll/README @@ -29,7 +29,7 @@ or if you checked the code out from a bazaar branch: RESOURCES --------- The source code and releases packages can be found on -https://www.recoll.org. + http://www.recoll.org. Bugs should be reported on the bitbucket recoll issues tracker: - https://bitbucket.org/medoc/recoll/issues + https://bitbucket.org/medoc/recoll/issues diff --git a/src/desktop/unity-lens-recoll/bin/unity-recoll-daemon.in b/src/desktop/unity-lens-recoll/bin/unity-recoll-daemon.in index 21868711..a8a1f026 100755 --- a/src/desktop/unity-lens-recoll/bin/unity-recoll-daemon.in +++ b/src/desktop/unity-lens-recoll/bin/unity-recoll-daemon.in @@ -44,6 +44,9 @@ if result != 1 : print >> sys.stderr, "Failed to own name %s. Bailing out." % BUS_NAME raise SystemExit (1) +rcltrace = open("/tmp/recolenstrace", "a") + +print >> rcltrace, "UNITY RECOLL DAEMON" def create_lens (): # The path for the Lens *must* also match the one in our .lens file from gi.repository import Unity @@ -51,23 +54,41 @@ def create_lens (): lens.props.search_hint = "Recoll search string" lens.props.visible = True; - lens.props.search_in_global = True; + lens.props.search_in_global = False; - # Populate categories TODO FIX THIS + # Populate categories cats = [] cats.append (Unity.Category.new ("Documents", Gio.ThemedIcon.new("document"), Unity.CategoryRenderer.HORIZONTAL_TILE)) lens.props.categories = cats + # Populate filters lens.props.filters = [] - + + # We should get the categories from the config but the python + # module currently has no code for this. + filter = Unity.RadioOptionFilter.new("rclcat", "Category", + Gio.ThemedIcon.new(""), 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.append(filter) return lens +print >> rcltrace, "UNITY RECOLL DAEMON: create lens" lens = create_lens () +print >> rcltrace, "UNITY RECOLL DAEMON: add local scope" lens.add_local_scope (recollscope.rclsearch.Scope()) # add more local scopes here (remote dbus scopes added automagically) +print >> rcltrace, "UNITY RECOLL DAEMON: add local export" lens.export () +print >> rcltrace, "UNITY RECOLL DAEMON: add local main loop" GObject.MainLoop().run() diff --git a/src/desktop/unity-lens-recoll/data/recoll-lens.svg b/src/desktop/unity-lens-recoll/data/recoll-lens.svg deleted file mode 100644 index 2ea0066c..00000000 --- a/src/desktop/unity-lens-recoll/data/recoll-lens.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/desktop/unity-lens-recoll/data/recoll.lens.in b/src/desktop/unity-lens-recoll/data/recoll.lens.in index 6e7ac97a..5a4ed257 100644 --- a/src/desktop/unity-lens-recoll/data/recoll.lens.in +++ b/src/desktop/unity-lens-recoll/data/recoll.lens.in @@ -2,7 +2,7 @@ DBusName=org.recoll.UnityLensRecoll.Lens DBusPath=/org/recoll/unitylensrecoll/lens Name=Recoll Lens -Icon=@DATADIR@/unity-lens-recoll/recoll-lens.svg +Icon=@DATADIR@/unity-lens-recoll/recollbg24.png Description=Search documents indexed by Recoll SearchHint=Type to search Shortcut=a diff --git a/src/desktop/unity-lens-recoll/recollscope/rclsearch.py b/src/desktop/unity-lens-recoll/recollscope/rclsearch.py index 4ff1c749..33f578e3 100755 --- a/src/desktop/unity-lens-recoll/recollscope/rclsearch.py +++ b/src/desktop/unity-lens-recoll/recollscope/rclsearch.py @@ -1,6 +1,7 @@ import sys from gi.repository import GLib, GObject, Gio +from gi.repository import Dee from gi.repository import Unity import recoll @@ -9,13 +10,19 @@ import recoll CATEGORY_ALL = 0 # typing timeout: we don't want to start a search for every -# char. Unity does batch on its side, but we may want more control ? -# Or not ? Set to 0 to not use it. +# char? Unity does batch on its side, but we may want more control ? +# Or not ? I'm not sure this does any good on a moderate size index. +# Set to 0 to not use it (default). Kept around because this still might be +# useful with a very big index ? TYPING_TIMEOUT = 0 class Scope (Unity.Scope): def __init__ (self): + self.trcfile = open("/tmp/recolenstrace", "w") + print >> self.trcfile, "Scope init" + self.trcfile.flush() + Unity.Scope.__init__ (self, dbus_path="/org/recoll/unitylensrecoll/scope/main") # Listen for changes and requests @@ -24,12 +31,16 @@ class Scope (Unity.Scope): # Bliss loaded the apps_tree menu here, let's connect to # the index + print >> self.trcfile, "Connecting to db" self.db = recoll.connect() + print >> self.trcfile, "Done" + self.trcfile.flush() + self.db.setAbstractParams(maxchars=200, contextwords=4) self.timeout_id = None - + def get_search_string (self): search = self.props.active_search return search.props.search_string if search else None @@ -47,7 +58,6 @@ class Scope (Unity.Scope): search = self.props.active_global_search if search: search.emit("finished") - def reset (self): self._do_browse (self.props.results_model) self._do_browse (self.props.global_results_model) @@ -106,17 +116,25 @@ class Scope (Unity.Scope): search_string, model) def _really_do_search(self, search_string, model): -# print "really_do_search:", search_string + print >> self.trcfile, "really_do_search:[", search_string, "]" + self.trcfile.flush() model.clear () if search_string == "": return True # Do the recoll thing query = self.db.query() - nres = query.execute(search_string) + try: + nres = query.execute(search_string) + except: + return + actual_results = 0 while query.next >= 0 and query.next < nres: - doc = query.fetchone() + try: + doc = query.fetchone() + except: + break # No sense in returning unusable results (until # I get an idea of what to do with them)