mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
KG updates pre 0.7.36
This commit is contained in:
commit
db63ca555c
@ -1,7 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
__copyright__ = '2009-2010, Darko Miletic <darko.miletic at gmail.com>'
|
||||
'''
|
||||
www.businessworld.in
|
||||
'''
|
||||
@ -22,7 +20,11 @@ class BusinessWorldMagazine(BasicNewsRecipe):
|
||||
use_embedded_content = False
|
||||
encoding = 'utf-8'
|
||||
language = 'en_IN'
|
||||
|
||||
extra_css = """
|
||||
img{display: block; margin-bottom: 0.5em}
|
||||
body{font-family: Arial,Helvetica,sans-serif}
|
||||
h2{color: gray; display: block}
|
||||
"""
|
||||
|
||||
conversion_options = {
|
||||
'comment' : description
|
||||
@ -42,7 +44,26 @@ class BusinessWorldMagazine(BasicNewsRecipe):
|
||||
articles = []
|
||||
linklist = []
|
||||
soup = self.index_to_soup(self.INDEX)
|
||||
|
||||
|
||||
tough = soup.find('div', attrs={'id':'tough'})
|
||||
if tough:
|
||||
for item in tough.findAll('h1'):
|
||||
description = ''
|
||||
title_prefix = ''
|
||||
feed_link = item.find('a')
|
||||
if feed_link and feed_link.has_key('href'):
|
||||
url = self.ROOT + feed_link['href']
|
||||
if not self.is_in_list(linklist,url):
|
||||
title = title_prefix + self.tag_to_string(feed_link)
|
||||
date = strftime(self.timefmt)
|
||||
articles.append({
|
||||
'title' :title
|
||||
,'date' :date
|
||||
,'url' :url
|
||||
,'description':description
|
||||
})
|
||||
linklist.append(url)
|
||||
|
||||
for item in soup.findAll('div', attrs={'class':'nametitle'}):
|
||||
description = ''
|
||||
title_prefix = ''
|
||||
@ -62,8 +83,8 @@ class BusinessWorldMagazine(BasicNewsRecipe):
|
||||
return [(soup.head.title.string, articles)]
|
||||
|
||||
|
||||
keep_only_tags = [dict(name='div', attrs={'id':['register-panel','printwrapper']})]
|
||||
remove_tags = [dict(name=['object','link'])]
|
||||
keep_only_tags = [dict(name='div', attrs={'id':'printwrapper'})]
|
||||
remove_tags = [dict(name=['object','link','meta','base','iframe','link','table'])]
|
||||
|
||||
def print_version(self, url):
|
||||
return url.replace('/bw/','/bw/storyContent/')
|
||||
|
@ -612,8 +612,13 @@ class Py2App(object):
|
||||
dmg = os.path.join(destdir, volname+'.dmg')
|
||||
if os.path.exists(dmg):
|
||||
os.unlink(dmg)
|
||||
subprocess.check_call(['/usr/bin/hdiutil', 'create', '-srcfolder', os.path.abspath(d),
|
||||
tdir = tempfile.mkdtemp()
|
||||
shutil.copytree(d, os.path.join(tdir, os.path.basename(d)),
|
||||
symlinks=True)
|
||||
os.symlink('/Applications', os.path.join(tdir, 'Applications'))
|
||||
subprocess.check_call(['/usr/bin/hdiutil', 'create', '-srcfolder', tdir,
|
||||
'-volname', volname, '-format', format, dmg])
|
||||
shutil.rmtree(tdir)
|
||||
if internet_enable:
|
||||
subprocess.check_call(['/usr/bin/hdiutil', 'internet-enable', '-yes', dmg])
|
||||
size = os.stat(dmg).st_size/(1024*1024.)
|
||||
|
@ -27,8 +27,8 @@ class ANDROID(USBMS):
|
||||
0x040d : { 0x8510 : [0x0001], 0x0851 : [0x1] },
|
||||
|
||||
# Motorola
|
||||
0x22b8 : { 0x41d9 : [0x216], 0x2d67 : [0x100], 0x41db : [0x216],
|
||||
0x4285 : [0x216], 0x42a3 : [0x216] },
|
||||
0x22b8 : { 0x41d9 : [0x216], 0x2d61: [0x100], 0x2d67 : [0x100],
|
||||
0x41db : [0x216], 0x4285 : [0x216], 0x42a3 : [0x216] },
|
||||
|
||||
# Sony Ericsson
|
||||
0xfce : { 0xd12e : [0x0100]},
|
||||
@ -65,7 +65,7 @@ class ANDROID(USBMS):
|
||||
'__UMS_COMPOSITE', '_MB200', 'MASS_STORAGE', '_-_CARD', 'SGH-I897',
|
||||
'GT-I9000', 'FILE-STOR_GADGET', 'SGH-T959', 'SAMSUNG_ANDROID',
|
||||
'SCH-I500_CARD', 'SPH-D700_CARD', 'MB810', 'GT-P1000', 'DESIRE',
|
||||
'SGH-T849']
|
||||
'SGH-T849', '_MB300']
|
||||
WINDOWS_CARD_A_MEM = ['ANDROID_PHONE', 'GT-I9000_CARD', 'SGH-I897',
|
||||
'FILE-STOR_GADGET', 'SGH-T959', 'SAMSUNG_ANDROID', 'GT-P1000_CARD']
|
||||
|
||||
|
@ -493,6 +493,9 @@ class Editor(QWidget): # {{{
|
||||
self.toolbar1 = QToolBar(self)
|
||||
self.toolbar2 = QToolBar(self)
|
||||
self.toolbar3 = QToolBar(self)
|
||||
for i in range(1, 4):
|
||||
t = getattr(self, 'toolbar%d'%i)
|
||||
t.setIconSize(QSize(18, 18))
|
||||
self.editor = EditorWidget(self)
|
||||
self.tabs = QTabWidget(self)
|
||||
self.tabs.setTabPosition(self.tabs.South)
|
||||
|
@ -374,7 +374,13 @@ class TagTreeItem(object): # {{{
|
||||
elif self.type == self.TAG:
|
||||
icon_map[0] = data.icon
|
||||
self.tag, self.icon_state_map = data, list(map(QVariant, icon_map))
|
||||
self.tooltip = tooltip
|
||||
if tooltip:
|
||||
if tooltip.endswith(':'):
|
||||
self.tooltip = tooltip + ' '
|
||||
else:
|
||||
self.tooltip = tooltip + ': '
|
||||
else:
|
||||
self.tooltip = ''
|
||||
|
||||
def __str__(self):
|
||||
if self.type == self.ROOT:
|
||||
@ -436,8 +442,10 @@ class TagTreeItem(object): # {{{
|
||||
return QVariant('(%s) %s'%(tag.name, tag.tooltip))
|
||||
else:
|
||||
return QVariant(tag.name)
|
||||
if tag.tooltip is not None:
|
||||
return QVariant(tag.tooltip)
|
||||
if tag.tooltip:
|
||||
return QVariant(self.tooltip + tag.tooltip)
|
||||
else:
|
||||
return QVariant(self.tooltip)
|
||||
return NONE
|
||||
|
||||
def toggle(self):
|
||||
@ -736,10 +744,11 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
category_icon = category_node.icon,
|
||||
tooltip = None,
|
||||
category_key=category_node.category_key)
|
||||
t = TagTreeItem(parent=sub_cat, data=tag,
|
||||
t = TagTreeItem(parent=sub_cat, data=tag, tooltip=r,
|
||||
icon_map=self.icon_state_map)
|
||||
else:
|
||||
t = TagTreeItem(parent=category, data=tag, icon_map=self.icon_state_map)
|
||||
t = TagTreeItem(parent=category, data=tag, tooltip=r,
|
||||
icon_map=self.icon_state_map)
|
||||
self.endInsertRows()
|
||||
return True
|
||||
|
||||
@ -1186,6 +1195,13 @@ class TagBrowserWidget(QWidget): # {{{
|
||||
self.search_button.setToolTip(_('Find the first/next matching item'))
|
||||
self.search_button.setFixedWidth(40)
|
||||
search_layout.addWidget(self.search_button)
|
||||
|
||||
self.expand_button = QPushButton()
|
||||
self.expand_button.setText('-')
|
||||
self.expand_button.setFixedWidth(20)
|
||||
self.expand_button.setToolTip(_('Collapse all categories'))
|
||||
search_layout.addWidget(self.expand_button)
|
||||
|
||||
self.current_find_position = None
|
||||
self.search_button.clicked.connect(self.find)
|
||||
self.item_search.initialize('tag_browser_search')
|
||||
@ -1196,6 +1212,7 @@ class TagBrowserWidget(QWidget): # {{{
|
||||
|
||||
parent.tags_view = TagsView(parent)
|
||||
self.tags_view = parent.tags_view
|
||||
self.expand_button.clicked.connect(self.tags_view.collapseAll)
|
||||
self._layout.addWidget(parent.tags_view)
|
||||
|
||||
# Now the floating 'not found' box
|
||||
|
@ -1243,7 +1243,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
else:
|
||||
icon = icon_map[':custom']
|
||||
icon_map[category] = icon
|
||||
tooltip = self.custom_column_label_map[label]['name']
|
||||
|
||||
datatype = cat['datatype']
|
||||
avgr = lambda x: 0.0 if x.rc == 0 else x.rt/x.rc
|
||||
|
@ -1087,7 +1087,9 @@ class ZipFile:
|
||||
with open(targetpath, 'wb') as target:
|
||||
shutil.copyfileobj(source, target)
|
||||
except:
|
||||
targetpath = sanitize_file_name(targetpath)
|
||||
components = list(os.path.split(targetpath))
|
||||
components[-1] = sanitize_file_name(components[-1])
|
||||
targetpath = os.sep.join(components)
|
||||
with open(targetpath, 'wb') as target:
|
||||
shutil.copyfileobj(source, target)
|
||||
self.extract_mapping[member.filename] = targetpath
|
||||
|
Loading…
x
Reference in New Issue
Block a user