Hi all. Any ideas?
On Fri, Apr 26, 2013 at 5:08 PM, Ajay Garg <ajaygargn...@gmail.com> wrote: > Hi all. > > > I investigated the source, and as per > > > ##################################################### > void > ev_view_find_set_highlight_search (EvView *view, gboolean > value) > > { > view->highlight_find_results = value; > gtk_widget_queue_draw (GTK_WIDGET (view)); > } > ##################################################### > > > It does seem that "self._view.find_set_highlight_search(True)" SHOULD > enable the highlighting of searched-words. > It it true? > > If yes, perhaps it could be an issue with the python-bindings? > > > > > > On Thu, Apr 25, 2013 at 10:04 PM, Ajay Garg <ajaygargn...@gmail.com>wrote: > >> Hi Gonzalo. >> >> Thanks a ton !!! >> >> >> After I add the line >> https://git.sugarlabs.org/read/mainline/blobs/master/evinceadapter.py#line255, >> the above code works fine in Fedora-18; >> the view scrolled to the "found text" locations :) >> >> However, the same does not work on Fedora-17, as the method >> "Evince.EvinceView.find_started" is not present in the Fedora-17 rpms, >> but it is on Fedora-18. >> >> Luckily, that is good enough for me :) >> >> >> Just a small caveat :: Highlighting still does not work, even though I >> have added >> "self._view.find_set_highlight_search(True)" >> statement. >> >> >> Anyhow, I will keep trying !! >> >> >> Thanks a ton, again :) >> >> >> >> >> On Thu, Apr 25, 2013 at 9:17 PM, Gonzalo Odiard <gonz...@laptop.org>wrote: >> >>> Hi Ajay, >>> >>> Look at the Read activity sources >>> https://git.sugarlabs.org/read/mainline/blobs/master/evinceadapter.py#line248 >>> search is working ok. >>> >>> Gonzalo >>> >>> >>> On Thu, Apr 25, 2013 at 12:29 PM, Ajay Garg <ajaygargn...@gmail.com>wrote: >>> >>>> Hi all. >>>> >>>> I had earlier written a program using GTK2-bindings, to load a PDF, and >>>> highlight all the searched-words. >>>> It worked perfectly fine there - highlighting the words, and scrolling >>>> to the desired page/location (if and when necessary). >>>> >>>> I have then ported the program to GTK3, and seem to be getting the >>>> results in the callback function associated to "updated" signal. >>>> However, neither do the words highlight, nor the scrolling takes place >>>> to the appropriate page/location. >>>> >>>> >>>> Following is the ported program :: >>>> >>>> >>>> ################################################################################ >>>> from gi.repository import GObject >>>> from gi.repository import Gtk >>>> >>>> from gi.repository import EvinceView >>>> from gi.repository import EvinceDocument >>>> >>>> >>>> class EvinceViewer(Gtk.ScrolledWindow): >>>> >>>> def __init__(self): >>>> Gtk.ScrolledWindow.__init__(self) >>>> >>>> EvinceDocument.init() >>>> >>>> self._view = EvinceView.View() >>>> self._view.find_set_highlight_search(True) >>>> >>>> self.add(self._view) >>>> >>>> self._find_job = None >>>> >>>> >>>> self.load_document('file:///home/ajay/Downloads/Ajay_Garg_Resume.pdf') >>>> self.find_text_first('demoable') >>>> >>>> def load_document(self, file_path): >>>> try: >>>> self._document = >>>> EvinceDocument.Document.factory_get_document(file_path) >>>> except GObject.GError, e: >>>> print 'ERROR in loading' >>>> return >>>> else: >>>> self._model = EvinceView.DocumentModel() >>>> self._model.set_document(self._document) >>>> self._view.set_model(self._model) >>>> >>>> def find_text_first(self, text): >>>> if text == "": >>>> self._view.find_set_highlight_search(False) >>>> return >>>> >>>> self._view.find_set_highlight_search(True) >>>> >>>> if self._find_job is not None: >>>> self._find_job.cancel() >>>> self._find_job.disconnect(self._find_updated_handler) >>>> self._find_job = None >>>> >>>> if text != "": >>>> self._find_job = EvinceView.JobFind.new(self._document, 0, >>>> >>>> self._document.get_n_pages(), >>>> text, False) >>>> self._find_updated_handler = \ >>>> self._find_job.connect('updated', >>>> self.__find_updated_cb) >>>> >>>> EvinceView.Job.scheduler_push_job(self._find_job, >>>> >>>> EvinceView.JobPriority.PRIORITY_NONE) >>>> >>>> def __find_updated_cb(self, job, page=None): >>>> print page >>>> print job >>>> >>>> ##### >>>> # This method no longer seems to be present in GTK3. >>>> #self._view.find_changed(job, page) >>>> ##### >>>> >>>> self._view.find_next() >>>> >>>> win = Gtk.Window() >>>> win.add(EvinceViewer()) >>>> win.maximize() >>>> win.show_all() >>>> >>>> Gtk.main() >>>> >>>> ################################################################################ >>>> >>>> >>>> >>>> >>>> >>>> >>>> When I run the above program, I get the output :: >>>> >>>> >>>> ################################################################################ >>>> 0 >>>> <JobFind object at 0x8489c0c (EvJobFind at 0x84b2218)> >>>> 1 >>>> <JobFind object at 0x8489c0c (EvJobFind at 0x84b2218)> >>>> 2 >>>> <JobFind object at 0x8489c0c (EvJobFind at 0x84b2218)> >>>> 3 >>>> <JobFind object at 0x8489c0c (EvJobFind at 0x84b2218)> >>>> 4 >>>> <JobFind object at 0x8489c0c (EvJobFind at 0x84b2218)> >>>> >>>> ################################################################################ >>>> >>>> >>>> >>>> This shows that "__find_updated_cb" is being hit; however, as I said, >>>> neither of "text-highlighting" or "scrolling-to-desired-location" takes >>>> place :( >>>> >>>> I am sure that I am missing something, as :: >>>> >>>> * I have simply done the porting in the "textual sense". >>>> * "Search" is too major a feature to not work in GTK3. >>>> >>>> >>>> I will be grateful for any pointers, that may help rectify my situation >>>> :) >>>> >>>> >>>> >>>> Thanks and Regards, >>>> Ajay >>>> >>>> _______________________________________________ >>>> evince-list mailing list >>>> evince-list@gnome.org >>>> https://mail.gnome.org/mailman/listinfo/evince-list >>>> >>>> >>> >> >> >> -- >> Regards, >> Ajay >> > > > > -- > Regards, > Ajay > -- Regards, Ajay
_______________________________________________ evince-list mailing list evince-list@gnome.org https://mail.gnome.org/mailman/listinfo/evince-list