Hi all.Any ideas?--On Fri, Apr 26, 2013 at 5:08 PM, Ajay Garg <ajaygargnsit gmail com> wrote:
If yes, perhaps it could be an issue with the python-bindings?It it true?It does seem that "self._view.find_set_highlight_search(True)" SHOULD enable the highlighting of searched-words.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));
}
#####################################################
On Thu, Apr 25, 2013 at 10:04 PM, Ajay Garg <ajaygargnsit gmail com> wrote:
Thanks a ton, again :)Anyhow, I will keep trying !!statement.Just a small caveat :: Highlighting still does not work, even though I have addedLuckily, that is good enough for me :)After I add the line https://git.sugarlabs.org/read/mainline/blobs/master/evinceadapter.py#line255, the above code works fine in Fedora-18;Hi Gonzalo.Thanks a ton !!!
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.
"self._view.find_set_highlight_search(True)"
--On Thu, Apr 25, 2013 at 9:17 PM, Gonzalo Odiard <gonzalo laptop org> wrote:
Hi Ajay,Look at the Read activity sources https://git.sugarlabs.org/read/mainline/blobs/master/evinceadapter.py#line248search is working ok.GonzaloOn Thu, Apr 25, 2013 at 12:29 PM, Ajay Garg <ajaygargnsit gmail com> wrote:
_______________________________________________When I run the above program, I get the output ::Following is the ported program ::However, neither do the words highlight, nor the scrolling takes place to the appropriate page/location.I have then ported the program to GTK3, and seem to be getting the results in the callback function associated to "updated" signal.It worked perfectly fine there - highlighting the words, and scrolling to the desired page/location (if and when necessary).Hi all.I had earlier written a program using GTK2-bindings, to load a PDF, and highlight all the searched-words.
################################################################################
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()
################################################################################
################################################################################
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