mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge prior to trunk merge.
This commit is contained in:
parent
62759f161b
commit
4cc1d11fde
@ -4,7 +4,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
import time, os
|
||||
|
||||
from PyQt4.Qt import SIGNAL, QUrl, QAbstractListModel, Qt, \
|
||||
QVariant, QInputDialog
|
||||
QVariant, QInputDialog, QSortFilterProxyModel
|
||||
|
||||
from calibre.web.feeds.recipes import compile_recipe
|
||||
from calibre.web.feeds.news import AutomaticNewsRecipe
|
||||
@ -19,11 +19,20 @@ class CustomRecipeModel(QAbstractListModel):
|
||||
def __init__(self, recipe_model):
|
||||
QAbstractListModel.__init__(self)
|
||||
self.recipe_model = recipe_model
|
||||
self.proxy_model = QSortFilterProxyModel()
|
||||
self.proxy_model.setSourceModel(recipe_model)
|
||||
self.proxy_model.sort(0, Qt.AscendingOrder)
|
||||
self.proxy_model.setDynamicSortFilter(True)
|
||||
|
||||
def title(self, index):
|
||||
row = index.row()
|
||||
if row > -1 and row < self.rowCount():
|
||||
print 'index is: ', index
|
||||
print 'row is: ', row
|
||||
#print 'recipe_model title return is: ', self.recipe_model.custom_recipe_collection[row].get('title', '')
|
||||
#print 'proxy_model title return is: ', self.proxy_model.custom_recipe_collection[row].get('title', '')
|
||||
return self.recipe_model.custom_recipe_collection[row].get('title', '')
|
||||
#return self.proxy_model.custom_recipe_collection[row].get('title', '')
|
||||
|
||||
def script(self, index):
|
||||
row = index.row()
|
||||
@ -80,7 +89,14 @@ class UserProfiles(ResizableDialog, Ui_Dialog):
|
||||
ResizableDialog.__init__(self, parent)
|
||||
|
||||
self._model = self.model = CustomRecipeModel(recipe_model)
|
||||
#self._model = self.model = CustomRecipeModel(proxy_model)
|
||||
self.available_profiles.setModel(self._model)
|
||||
#proxy = QSortFilterProxyModel()
|
||||
#proxy.setSourceModel(self._model)
|
||||
#proxy.sort(0, Qt.AscendingOrder)
|
||||
#proxy.setDynamicSortFilter(True)
|
||||
#self.available_profiles.setModel(proxy)
|
||||
|
||||
self.available_profiles.currentChanged = self.current_changed
|
||||
|
||||
self.connect(self.remove_feed_button, SIGNAL('clicked(bool)'),
|
||||
|
@ -667,6 +667,7 @@ class BasicNewsRecipe(Recipe):
|
||||
|
||||
|
||||
def _postprocess_html(self, soup, first_fetch, job_info):
|
||||
print 'soup in _postprocess_html is: ', soup
|
||||
if self.no_stylesheets:
|
||||
for link in list(soup.findAll('link', type=re.compile('css')))+list(soup.findAll('style')):
|
||||
link.extract()
|
||||
|
@ -61,9 +61,14 @@ def serialize_recipe(urn, recipe_class):
|
||||
|
||||
def serialize_collection(mapping_of_recipe_classes):
|
||||
collection = E.recipe_collection()
|
||||
'''
|
||||
for urn in sorted(mapping_of_recipe_classes.keys(), key = lambda key: mapping_of_recipe_classes[key].title):
|
||||
recipe = serialize_recipe(urn, mapping_of_recipe_classes[urn])
|
||||
collection.append(recipe)
|
||||
'''
|
||||
for urn, recipe_class in mapping_of_recipe_classes.items():
|
||||
recipe = serialize_recipe(urn, recipe_class)
|
||||
collection.append(recipe)
|
||||
collection.set('count', str(len(collection)))
|
||||
return etree.tostring(collection, encoding='utf-8', xml_declaration=True,
|
||||
pretty_print=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user