Sync to trunk.

This commit is contained in:
John Schember 2009-06-07 15:10:53 -04:00
commit 5f4eae866f
3 changed files with 54 additions and 45 deletions

View File

@ -2,7 +2,7 @@ __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
__appname__ = 'calibre' __appname__ = 'calibre'
__version__ = '0.6.0b1' __version__ = '0.6.0b2'
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>" __author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
import re import re

View File

@ -229,6 +229,12 @@ class LocationModel(QAbstractListModel):
self.emit(SIGNAL('dataChanged(QModelIndex,QModelIndex)'), self.emit(SIGNAL('dataChanged(QModelIndex,QModelIndex)'),
self.index(0), self.index(self.rowCount(QModelIndex())-1)) self.index(0), self.index(self.rowCount(QModelIndex())-1))
def location_for_row(self, row):
if row == 0: return 'library'
if row == 1: return 'main'
if row == 3: return 'cardb'
return 'carda' if self.free[1] > -1 else 'cardb'
class LocationView(QListView): class LocationView(QListView):
def __init__(self, parent): def __init__(self, parent):
@ -252,7 +258,7 @@ class LocationView(QListView):
def current_changed(self, current, previous): def current_changed(self, current, previous):
if current.isValid(): if current.isValid():
i = current.row() i = current.row()
location = 'library' if i == 0 else 'main' if i == 1 else 'carda' if i == 2 else 'cardb' location = self.model().location_for_row(i)
self.emit(SIGNAL('location_selected(PyQt_PyObject)'), location) self.emit(SIGNAL('location_selected(PyQt_PyObject)'), location)
self.model().location_changed(i) self.model().location_changed(i)

View File

@ -151,7 +151,10 @@ class Feed(object):
link = None link = None
description = item.get('summary', None) description = item.get('summary', None)
content = '\n'.join(i.value for i in item.get('content', [])) content = [i.value for i in item.get('content', []) if i.value]
content = [i if isinstance(i, unicode) else i.decode('utf-8', 'replace')
for i in content]
content = u'\n'.join(content)
if not content.strip(): if not content.strip():
content = None content = None
if not link and not content: if not link and not content: