Fix crash in search with epub files - part of SL #3924
This patch also highligth the results as in Browse.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Gonzalo Odiard
11 years ago
127 | 127 |
return
|
128 | 128 |
|
129 | 129 |
def find_set_highlight_search(self, set_highlight_search):
|
130 | |
#TODO : what is this?
|
131 | |
return
|
|
130 |
self._view.set_highlight_text_matches(set_highlight_search)
|
132 | 131 |
|
133 | 132 |
def set_current_page(self, n):
|
134 | 133 |
# When the book is being loaded, calling this does not help
|
337 | 337 |
Highlights the next matching item for current search
|
338 | 338 |
'''
|
339 | 339 |
self._view.grab_focus()
|
340 | |
self._view.grab_default()
|
341 | 340 |
|
342 | 341 |
if self._view.search_text(self._findjob.get_search_text(),
|
343 | 342 |
self._findjob.get_case_sensitive(),
|
|
355 | 354 |
Highlights the previous matching item for current search
|
356 | 355 |
'''
|
357 | 356 |
self._view.grab_focus()
|
358 | |
self._view.grab_default()
|
359 | 357 |
|
360 | 358 |
if self._view.search_text(self._findjob.get_search_text(),
|
361 | 359 |
self._findjob.get_case_sensitive(),
|
|
370 | 368 |
|
371 | 369 |
def _find_changed(self, job):
|
372 | 370 |
self._view.grab_focus()
|
373 | |
self._view.grab_default()
|
374 | 371 |
self._findjob = job
|
|
372 |
self._mark_found_text()
|
375 | 373 |
self.find_next()
|
|
374 |
|
|
375 |
def _mark_found_text(self):
|
|
376 |
self._view.unmark_text_matches()
|
|
377 |
self._view.mark_text_matches(self._findjob.get_search_text(),
|
|
378 |
case_sensitive=self._findjob.get_case_sensitive(), limit=0)
|
|
379 |
self._view.set_highlight_text_matches(True)
|
376 | 380 |
|
377 | 381 |
def __set_zoom(self, value):
|
378 | 382 |
self._view.set_zoom_level(value)
|
|
444 | 448 |
self._view.add_bottom_padding(extra)
|
445 | 449 |
|
446 | 450 |
if self.__in_search:
|
|
451 |
self._mark_found_text()
|
447 | 452 |
self._view.search_text(self._findjob.get_search_text(), \
|
448 | 453 |
self._findjob.get_case_sensitive(), \
|
449 | 454 |
self.__search_fwd, False)
|
17 | 17 |
|
18 | 18 |
from gi.repository import GObject
|
19 | 19 |
from gi.repository import Gtk
|
20 | |
from gi.repository import Gdk
|
21 | 20 |
import widgets
|
22 | 21 |
import cairo
|
23 | |
|
24 | 22 |
import math
|
25 | 23 |
import os.path
|
26 | 24 |
import BeautifulSoup
|
|
60 | 58 |
self.obj._matchfilelist.append(entry)
|
61 | 59 |
f.close()
|
62 | 60 |
|
63 | |
Gdk.threads_enter()
|
64 | 61 |
self.obj._finished = True
|
65 | |
self.obj.emit('updated')
|
66 | |
Gdk.threads_leave()
|
|
62 |
GObject.idle_add(self.obj.emit, 'updated')
|
67 | 63 |
|
68 | 64 |
return False
|
69 | 65 |
|
|
254 | 250 |
def __init__(self, document, start_page, n_pages, text,
|
255 | 251 |
case_sensitive=False):
|
256 | 252 |
GObject.GObject.__init__(self)
|
257 | |
Gdk.threads_init()
|
258 | 253 |
|
259 | 254 |
self._finished = False
|
260 | 255 |
self._document = document
|