mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sync to trunk.
This commit is contained in:
commit
5c7ac6f44f
@ -271,12 +271,15 @@ class BooksModel(QAbstractTableModel):
|
||||
try:
|
||||
self.db.search(text)
|
||||
except ParseException:
|
||||
self.emit(SIGNAL('parse_exception()'))
|
||||
self.emit(SIGNAL('searched(PyQt_PyObject)'), False)
|
||||
return
|
||||
self.last_search = text
|
||||
if reset:
|
||||
self.clear_caches()
|
||||
self.reset()
|
||||
if self.last_search:
|
||||
self.emit(SIGNAL('searched(PyQt_PyObject)'), True)
|
||||
|
||||
|
||||
def sort(self, col, order, reset=True):
|
||||
if not self.db:
|
||||
@ -785,14 +788,20 @@ class BooksView(TableView):
|
||||
def set_editable(self, editable):
|
||||
self._model.set_editable(editable)
|
||||
|
||||
def connect_to_search_box(self, sb):
|
||||
def connect_to_search_box(self, sb, search_done):
|
||||
QObject.connect(sb, SIGNAL('search(PyQt_PyObject, PyQt_PyObject)'),
|
||||
self._model.search)
|
||||
self._search_done = search_done
|
||||
self.connect(self._model, SIGNAL('searched(PyQt_PyObject)'),
|
||||
self.search_done)
|
||||
|
||||
def connect_to_book_display(self, bd):
|
||||
QObject.connect(self._model, SIGNAL('new_bookdisplay_data(PyQt_PyObject)'),
|
||||
bd)
|
||||
|
||||
def search_done(self, ok):
|
||||
self._search_done(self, ok)
|
||||
|
||||
|
||||
class DeviceBooksView(BooksView):
|
||||
|
||||
@ -909,7 +918,7 @@ class DeviceBooksModel(BooksModel):
|
||||
try:
|
||||
matches = self.search_engine.parse(text)
|
||||
except ParseException:
|
||||
self.emit(SIGNAL('parse_exception()'))
|
||||
self.emit(SIGNAL('searched(PyQt_PyObject)'), False)
|
||||
return
|
||||
|
||||
self.map = []
|
||||
@ -920,6 +929,9 @@ class DeviceBooksModel(BooksModel):
|
||||
if reset:
|
||||
self.reset()
|
||||
self.last_search = text
|
||||
if self.last_search:
|
||||
self.emit(SIGNAL('searched(PyQt_PyObject)'), True)
|
||||
|
||||
|
||||
def resort(self, reset):
|
||||
self.sort(self.sorted_on[0], self.sorted_on[1], reset=reset)
|
||||
@ -1114,11 +1126,15 @@ class SearchBox(QLineEdit):
|
||||
self.setText(self.help_text)
|
||||
self.home(False)
|
||||
self.initial_state = True
|
||||
self.setStyleSheet("background-color: white")
|
||||
|
||||
def clear(self):
|
||||
self.clear_to_help()
|
||||
self.emit(SIGNAL('search(PyQt_PyObject, PyQt_PyObject)'), '', False)
|
||||
|
||||
def search_done(self, ok):
|
||||
col = 'rgba(0,255,0,25%)' if ok else 'rgb(255,0,0,25%)'
|
||||
self.setStyleSheet('background-color: '+col)
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
if self.initial_state:
|
||||
|
@ -396,13 +396,14 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
||||
QObject.connect(self.library_view,
|
||||
SIGNAL('files_dropped(PyQt_PyObject)'),
|
||||
self.files_dropped, Qt.QueuedConnection)
|
||||
for func, target in [
|
||||
('connect_to_search_box', self.search),
|
||||
for func, args in [
|
||||
('connect_to_search_box', (self.search,
|
||||
self.search_done)),
|
||||
('connect_to_book_display',
|
||||
self.status_bar.book_info.show_data),
|
||||
(self.status_bar.book_info.show_data,)),
|
||||
]:
|
||||
for view in (self.library_view, self.memory_view, self.card_a_view, self.card_b_view):
|
||||
getattr(view, func)(target)
|
||||
getattr(view, func)(*args)
|
||||
|
||||
self.memory_view.connect_dirtied_signal(self.upload_booklists)
|
||||
self.card_a_view.connect_dirtied_signal(self.upload_booklists)
|
||||
@ -633,6 +634,10 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
||||
self.match_any.setVisible(False)
|
||||
self.popularity.setVisible(False)
|
||||
|
||||
def search_done(self, view, ok):
|
||||
if view is self.current_view():
|
||||
self.search.search_done(ok)
|
||||
|
||||
def sync_cf_to_listview(self, index, *args):
|
||||
if not hasattr(index, 'row') and \
|
||||
self.library_view.currentIndex().row() != index:
|
||||
|
@ -19,7 +19,7 @@ class WallStreetJournal(BasicNewsRecipe):
|
||||
no_stylesheets = True
|
||||
|
||||
extra_css = '''h1{color:#093D72 ; font-size:large ; font-family:Georgia,"Century Schoolbook","Times New Roman",Times,serif; }
|
||||
h2{color:gray; font-family:Georgia,"Century Schoolbook","Times New Roman",Times,serif; font-size:small; font-style:italic;}
|
||||
h2{color:#474537; font-family:Georgia,"Century Schoolbook","Times New Roman",Times,serif; font-size:small; font-style:italic;}
|
||||
.subhead{color:gray; font-family:Georgia,"Century Schoolbook","Times New Roman",Times,serif; font-size:small; font-style:italic;}
|
||||
.insettipUnit {color:#666666; font-family:Arial,Sans-serif;font-size:xx-small }
|
||||
.targetCaption{ font-size:x-small; color:#333333; font-family:Arial,Helvetica,sans-serif}
|
||||
@ -34,7 +34,7 @@ class WallStreetJournal(BasicNewsRecipe):
|
||||
remove_tags_before = dict(name='h1')
|
||||
remove_tags = [
|
||||
dict(id=["articleTabs_tab_article", "articleTabs_tab_comments", "articleTabs_tab_interactive","articleTabs_tab_video","articleTabs_tab_map","articleTabs_tab_slideshow"]),
|
||||
{'class':['footer_columns','network','insetCol3wide','interactive','video','slideshow','map','insettip','more_in', "insetContent", 'articleTools_bottom', 'aTools', "tooltip", "adSummary", "nav-inline"]},
|
||||
{'class':['footer_columns','network','insetCol3wide','interactive','video','slideshow','map','insettip','insetClose','more_in', "insetContent", 'articleTools_bottom', 'aTools', "tooltip", "adSummary", "nav-inline"]},
|
||||
dict(rel='shortcut icon'),
|
||||
]
|
||||
remove_tags_after = [dict(id="article_story_body"), {'class':"article story"},]
|
||||
@ -54,7 +54,7 @@ class WallStreetJournal(BasicNewsRecipe):
|
||||
for tag in soup.findAll(name=['table', 'tr', 'td']):
|
||||
tag.name = 'div'
|
||||
|
||||
for tag in soup.findAll('div', dict(id=["articleImage_1", "articleImage_2", "articleImage_3", "articleImage_4", "articleImage_5", "articleImage_6", "articleImage_7"])):
|
||||
for tag in soup.findAll('div', dict(id=["articleThumbnail_1", "articleThumbnail_2", "articleThumbnail_3", "articleThumbnail_4", "articleThumbnail_5", "articleThumbnail_6", "articleThumbnail_7"])):
|
||||
tag.extract()
|
||||
|
||||
return soup
|
||||
|
Loading…
x
Reference in New Issue
Block a user