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'
|
__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
|
www.businessworld.in
|
||||||
'''
|
'''
|
||||||
@ -22,7 +20,11 @@ class BusinessWorldMagazine(BasicNewsRecipe):
|
|||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
language = 'en_IN'
|
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 = {
|
conversion_options = {
|
||||||
'comment' : description
|
'comment' : description
|
||||||
@ -42,7 +44,26 @@ class BusinessWorldMagazine(BasicNewsRecipe):
|
|||||||
articles = []
|
articles = []
|
||||||
linklist = []
|
linklist = []
|
||||||
soup = self.index_to_soup(self.INDEX)
|
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'}):
|
for item in soup.findAll('div', attrs={'class':'nametitle'}):
|
||||||
description = ''
|
description = ''
|
||||||
title_prefix = ''
|
title_prefix = ''
|
||||||
@ -62,8 +83,8 @@ class BusinessWorldMagazine(BasicNewsRecipe):
|
|||||||
return [(soup.head.title.string, articles)]
|
return [(soup.head.title.string, articles)]
|
||||||
|
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'id':['register-panel','printwrapper']})]
|
keep_only_tags = [dict(name='div', attrs={'id':'printwrapper'})]
|
||||||
remove_tags = [dict(name=['object','link'])]
|
remove_tags = [dict(name=['object','link','meta','base','iframe','link','table'])]
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
return url.replace('/bw/','/bw/storyContent/')
|
return url.replace('/bw/','/bw/storyContent/')
|
||||||
|
@ -612,8 +612,13 @@ class Py2App(object):
|
|||||||
dmg = os.path.join(destdir, volname+'.dmg')
|
dmg = os.path.join(destdir, volname+'.dmg')
|
||||||
if os.path.exists(dmg):
|
if os.path.exists(dmg):
|
||||||
os.unlink(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])
|
'-volname', volname, '-format', format, dmg])
|
||||||
|
shutil.rmtree(tdir)
|
||||||
if internet_enable:
|
if internet_enable:
|
||||||
subprocess.check_call(['/usr/bin/hdiutil', 'internet-enable', '-yes', dmg])
|
subprocess.check_call(['/usr/bin/hdiutil', 'internet-enable', '-yes', dmg])
|
||||||
size = os.stat(dmg).st_size/(1024*1024.)
|
size = os.stat(dmg).st_size/(1024*1024.)
|
||||||
|
@ -27,8 +27,8 @@ class ANDROID(USBMS):
|
|||||||
0x040d : { 0x8510 : [0x0001], 0x0851 : [0x1] },
|
0x040d : { 0x8510 : [0x0001], 0x0851 : [0x1] },
|
||||||
|
|
||||||
# Motorola
|
# Motorola
|
||||||
0x22b8 : { 0x41d9 : [0x216], 0x2d67 : [0x100], 0x41db : [0x216],
|
0x22b8 : { 0x41d9 : [0x216], 0x2d61: [0x100], 0x2d67 : [0x100],
|
||||||
0x4285 : [0x216], 0x42a3 : [0x216] },
|
0x41db : [0x216], 0x4285 : [0x216], 0x42a3 : [0x216] },
|
||||||
|
|
||||||
# Sony Ericsson
|
# Sony Ericsson
|
||||||
0xfce : { 0xd12e : [0x0100]},
|
0xfce : { 0xd12e : [0x0100]},
|
||||||
@ -65,7 +65,7 @@ class ANDROID(USBMS):
|
|||||||
'__UMS_COMPOSITE', '_MB200', 'MASS_STORAGE', '_-_CARD', 'SGH-I897',
|
'__UMS_COMPOSITE', '_MB200', 'MASS_STORAGE', '_-_CARD', 'SGH-I897',
|
||||||
'GT-I9000', 'FILE-STOR_GADGET', 'SGH-T959', 'SAMSUNG_ANDROID',
|
'GT-I9000', 'FILE-STOR_GADGET', 'SGH-T959', 'SAMSUNG_ANDROID',
|
||||||
'SCH-I500_CARD', 'SPH-D700_CARD', 'MB810', 'GT-P1000', 'DESIRE',
|
'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',
|
WINDOWS_CARD_A_MEM = ['ANDROID_PHONE', 'GT-I9000_CARD', 'SGH-I897',
|
||||||
'FILE-STOR_GADGET', 'SGH-T959', 'SAMSUNG_ANDROID', 'GT-P1000_CARD']
|
'FILE-STOR_GADGET', 'SGH-T959', 'SAMSUNG_ANDROID', 'GT-P1000_CARD']
|
||||||
|
|
||||||
|
@ -493,6 +493,9 @@ class Editor(QWidget): # {{{
|
|||||||
self.toolbar1 = QToolBar(self)
|
self.toolbar1 = QToolBar(self)
|
||||||
self.toolbar2 = QToolBar(self)
|
self.toolbar2 = QToolBar(self)
|
||||||
self.toolbar3 = 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.editor = EditorWidget(self)
|
||||||
self.tabs = QTabWidget(self)
|
self.tabs = QTabWidget(self)
|
||||||
self.tabs.setTabPosition(self.tabs.South)
|
self.tabs.setTabPosition(self.tabs.South)
|
||||||
|
@ -374,7 +374,13 @@ class TagTreeItem(object): # {{{
|
|||||||
elif self.type == self.TAG:
|
elif self.type == self.TAG:
|
||||||
icon_map[0] = data.icon
|
icon_map[0] = data.icon
|
||||||
self.tag, self.icon_state_map = data, list(map(QVariant, icon_map))
|
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):
|
def __str__(self):
|
||||||
if self.type == self.ROOT:
|
if self.type == self.ROOT:
|
||||||
@ -436,8 +442,10 @@ class TagTreeItem(object): # {{{
|
|||||||
return QVariant('(%s) %s'%(tag.name, tag.tooltip))
|
return QVariant('(%s) %s'%(tag.name, tag.tooltip))
|
||||||
else:
|
else:
|
||||||
return QVariant(tag.name)
|
return QVariant(tag.name)
|
||||||
if tag.tooltip is not None:
|
if tag.tooltip:
|
||||||
return QVariant(tag.tooltip)
|
return QVariant(self.tooltip + tag.tooltip)
|
||||||
|
else:
|
||||||
|
return QVariant(self.tooltip)
|
||||||
return NONE
|
return NONE
|
||||||
|
|
||||||
def toggle(self):
|
def toggle(self):
|
||||||
@ -736,10 +744,11 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
category_icon = category_node.icon,
|
category_icon = category_node.icon,
|
||||||
tooltip = None,
|
tooltip = None,
|
||||||
category_key=category_node.category_key)
|
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)
|
icon_map=self.icon_state_map)
|
||||||
else:
|
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()
|
self.endInsertRows()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -1186,6 +1195,13 @@ class TagBrowserWidget(QWidget): # {{{
|
|||||||
self.search_button.setToolTip(_('Find the first/next matching item'))
|
self.search_button.setToolTip(_('Find the first/next matching item'))
|
||||||
self.search_button.setFixedWidth(40)
|
self.search_button.setFixedWidth(40)
|
||||||
search_layout.addWidget(self.search_button)
|
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.current_find_position = None
|
||||||
self.search_button.clicked.connect(self.find)
|
self.search_button.clicked.connect(self.find)
|
||||||
self.item_search.initialize('tag_browser_search')
|
self.item_search.initialize('tag_browser_search')
|
||||||
@ -1196,6 +1212,7 @@ class TagBrowserWidget(QWidget): # {{{
|
|||||||
|
|
||||||
parent.tags_view = TagsView(parent)
|
parent.tags_view = TagsView(parent)
|
||||||
self.tags_view = parent.tags_view
|
self.tags_view = parent.tags_view
|
||||||
|
self.expand_button.clicked.connect(self.tags_view.collapseAll)
|
||||||
self._layout.addWidget(parent.tags_view)
|
self._layout.addWidget(parent.tags_view)
|
||||||
|
|
||||||
# Now the floating 'not found' box
|
# Now the floating 'not found' box
|
||||||
|
@ -1243,7 +1243,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
else:
|
else:
|
||||||
icon = icon_map[':custom']
|
icon = icon_map[':custom']
|
||||||
icon_map[category] = icon
|
icon_map[category] = icon
|
||||||
tooltip = self.custom_column_label_map[label]['name']
|
|
||||||
|
|
||||||
datatype = cat['datatype']
|
datatype = cat['datatype']
|
||||||
avgr = lambda x: 0.0 if x.rc == 0 else x.rt/x.rc
|
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:
|
with open(targetpath, 'wb') as target:
|
||||||
shutil.copyfileobj(source, target)
|
shutil.copyfileobj(source, target)
|
||||||
except:
|
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:
|
with open(targetpath, 'wb') as target:
|
||||||
shutil.copyfileobj(source, target)
|
shutil.copyfileobj(source, target)
|
||||||
self.extract_mapping[member.filename] = targetpath
|
self.extract_mapping[member.filename] = targetpath
|
||||||
|
Loading…
x
Reference in New Issue
Block a user