Sync to trunk.

This commit is contained in:
John Schember 2009-07-08 18:37:59 -04:00
commit 5c7ac6f44f
3 changed files with 31 additions and 10 deletions

View File

@ -271,12 +271,15 @@ class BooksModel(QAbstractTableModel):
try: try:
self.db.search(text) self.db.search(text)
except ParseException: except ParseException:
self.emit(SIGNAL('parse_exception()')) self.emit(SIGNAL('searched(PyQt_PyObject)'), False)
return return
self.last_search = text self.last_search = text
if reset: if reset:
self.clear_caches() self.clear_caches()
self.reset() self.reset()
if self.last_search:
self.emit(SIGNAL('searched(PyQt_PyObject)'), True)
def sort(self, col, order, reset=True): def sort(self, col, order, reset=True):
if not self.db: if not self.db:
@ -785,14 +788,20 @@ class BooksView(TableView):
def set_editable(self, editable): def set_editable(self, editable):
self._model.set_editable(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)'), QObject.connect(sb, SIGNAL('search(PyQt_PyObject, PyQt_PyObject)'),
self._model.search) 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): def connect_to_book_display(self, bd):
QObject.connect(self._model, SIGNAL('new_bookdisplay_data(PyQt_PyObject)'), QObject.connect(self._model, SIGNAL('new_bookdisplay_data(PyQt_PyObject)'),
bd) bd)
def search_done(self, ok):
self._search_done(self, ok)
class DeviceBooksView(BooksView): class DeviceBooksView(BooksView):
@ -909,7 +918,7 @@ class DeviceBooksModel(BooksModel):
try: try:
matches = self.search_engine.parse(text) matches = self.search_engine.parse(text)
except ParseException: except ParseException:
self.emit(SIGNAL('parse_exception()')) self.emit(SIGNAL('searched(PyQt_PyObject)'), False)
return return
self.map = [] self.map = []
@ -920,6 +929,9 @@ class DeviceBooksModel(BooksModel):
if reset: if reset:
self.reset() self.reset()
self.last_search = text self.last_search = text
if self.last_search:
self.emit(SIGNAL('searched(PyQt_PyObject)'), True)
def resort(self, reset): def resort(self, reset):
self.sort(self.sorted_on[0], self.sorted_on[1], reset=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.setText(self.help_text)
self.home(False) self.home(False)
self.initial_state = True self.initial_state = True
self.setStyleSheet("background-color: white")
def clear(self): def clear(self):
self.clear_to_help() self.clear_to_help()
self.emit(SIGNAL('search(PyQt_PyObject, PyQt_PyObject)'), '', False) 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): def keyPressEvent(self, event):
if self.initial_state: if self.initial_state:

View File

@ -396,13 +396,14 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
QObject.connect(self.library_view, QObject.connect(self.library_view,
SIGNAL('files_dropped(PyQt_PyObject)'), SIGNAL('files_dropped(PyQt_PyObject)'),
self.files_dropped, Qt.QueuedConnection) self.files_dropped, Qt.QueuedConnection)
for func, target in [ for func, args in [
('connect_to_search_box', self.search), ('connect_to_search_box', (self.search,
self.search_done)),
('connect_to_book_display', ('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): 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.memory_view.connect_dirtied_signal(self.upload_booklists)
self.card_a_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.match_any.setVisible(False)
self.popularity.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): def sync_cf_to_listview(self, index, *args):
if not hasattr(index, 'row') and \ if not hasattr(index, 'row') and \
self.library_view.currentIndex().row() != index: self.library_view.currentIndex().row() != index:

View File

@ -19,7 +19,7 @@ class WallStreetJournal(BasicNewsRecipe):
no_stylesheets = True no_stylesheets = True
extra_css = '''h1{color:#093D72 ; font-size:large ; font-family:Georgia,"Century Schoolbook","Times New Roman",Times,serif; } 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;} .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 } .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} .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_before = dict(name='h1')
remove_tags = [ remove_tags = [
dict(id=["articleTabs_tab_article", "articleTabs_tab_comments", "articleTabs_tab_interactive","articleTabs_tab_video","articleTabs_tab_map","articleTabs_tab_slideshow"]), 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'), dict(rel='shortcut icon'),
] ]
remove_tags_after = [dict(id="article_story_body"), {'class':"article story"},] 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']): for tag in soup.findAll(name=['table', 'tr', 'td']):
tag.name = 'div' 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() tag.extract()
return soup return soup