mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
merge from trunk
This commit is contained in:
commit
088f5e9552
BIN
resources/images/news/avto-magazin.png
Normal file
BIN
resources/images/news/avto-magazin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
resources/images/news/dnevnik.png
Normal file
BIN
resources/images/news/dnevnik.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 861 B |
46
resources/recipes/avto-magazin.recipe
Normal file
46
resources/recipes/avto-magazin.recipe
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2010, BlonG'
|
||||||
|
'''
|
||||||
|
avto-magazin.si
|
||||||
|
'''
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
class Dnevnik(BasicNewsRecipe):
|
||||||
|
title = u'Avto Magazin'
|
||||||
|
__author__ = u'BlonG'
|
||||||
|
description = u'Za avtomobilisti\xc4\x8dne frike, poznavalce in nedeljske \xc5\xa1oferje.'
|
||||||
|
oldest_article = 7
|
||||||
|
max_articles_per_feed = 20
|
||||||
|
labguage = 'sl'
|
||||||
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
|
|
||||||
|
conversion_options = {'linearize_tables' : True}
|
||||||
|
|
||||||
|
|
||||||
|
cover_url = 'https://sites.google.com/site/javno2010/home/avto_magazin_cover.jpg'
|
||||||
|
|
||||||
|
extra_css = '''
|
||||||
|
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
||||||
|
h2{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
||||||
|
p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||||
|
body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
|
||||||
|
'''
|
||||||
|
|
||||||
|
keep_only_tags = [
|
||||||
|
dict(name='div', attrs={'id':'_iprom_inStream'}),
|
||||||
|
# dict(name='div', attrs={'class':'entry-content'}),
|
||||||
|
]
|
||||||
|
|
||||||
|
remove_tags = [
|
||||||
|
dict(name='div', attrs={'id':'voteConfirmation'}),
|
||||||
|
dict(name='div', attrs={'id':'InsideVote'}),
|
||||||
|
dict(name='div', attrs={'class':'Zone234'}),
|
||||||
|
dict(name='div', attrs={'class':'Comments'}),
|
||||||
|
dict(name='div', attrs={'class':'sorodneNovice'}),
|
||||||
|
dict(name='div', attrs={'id':'footer'}),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
(u'Novice', u'http://www.avto-magazin.si/rss/')
|
||||||
|
]
|
@ -25,7 +25,7 @@ class Danas(BasicNewsRecipe):
|
|||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
extra_css = """ @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)}
|
extra_css = """ @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)}
|
||||||
@font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)}
|
@font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)}
|
||||||
.article_description,body,.lokacija{font-family: Tahoma,Arial,Helvetica,sans1,sans-serif}
|
.article,.articledescription,body,.lokacija,.feed{font-family: Tahoma,Arial,Helvetica,sans1,sans-serif}
|
||||||
.nadNaslov,h1,.preamble{font-family: Georgia,"Times New Roman",Times,serif1,serif}
|
.nadNaslov,h1,.preamble{font-family: Georgia,"Times New Roman",Times,serif1,serif}
|
||||||
.antrfileText{border-left: 2px solid #999999;
|
.antrfileText{border-left: 2px solid #999999;
|
||||||
margin-left: 0.8em;
|
margin-left: 0.8em;
|
||||||
@ -66,7 +66,7 @@ class Danas(BasicNewsRecipe):
|
|||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'id':'left'})]
|
keep_only_tags = [dict(name='div', attrs={'id':'left'})]
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name='div', attrs={'class':['width_1_4','metaClanka','baner']})
|
dict(name='div', attrs={'class':['width_1_4','metaClanka','baner','listaVesti','article_nav']})
|
||||||
,dict(name='div', attrs={'id':'comments'})
|
,dict(name='div', attrs={'id':'comments'})
|
||||||
,dict(name=['object','link','iframe','meta'])
|
,dict(name=['object','link','iframe','meta'])
|
||||||
]
|
]
|
||||||
|
63
resources/recipes/dnevnik.recipe
Normal file
63
resources/recipes/dnevnik.recipe
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2010, BlonG'
|
||||||
|
'''
|
||||||
|
dnevnik.si
|
||||||
|
'''
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
class Dnevnik(BasicNewsRecipe):
|
||||||
|
title = u'Dnevnik.si'
|
||||||
|
__author__ = u'BlonG'
|
||||||
|
description = u'''Dnevnik je \u010dasnik z ve\u010d kot polstoletno zgodovino.
|
||||||
|
Pod sloganom \xbb\u017divljenje ima besedo\xab na svojih straneh prina\u0161a
|
||||||
|
bralcem bogastvo informacij, komentarjev in kolumen in raznovrstnost
|
||||||
|
pogledov, zaznamovanih z odgovornostjo do posameznika in \u0161ir\u0161e
|
||||||
|
dru\u017ebe.'''
|
||||||
|
oldest_article = 3
|
||||||
|
max_articles_per_feed = 20
|
||||||
|
language = 'sl'
|
||||||
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
|
|
||||||
|
cover_url = 'https://sites.google.com/site/javno2010/home/dnevnik_cover.jpg'
|
||||||
|
|
||||||
|
extra_css = '''
|
||||||
|
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
||||||
|
h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
|
||||||
|
p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||||
|
body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
|
||||||
|
'''
|
||||||
|
|
||||||
|
keep_only_tags = [
|
||||||
|
dict(name='div', attrs={'id':'_iprom_inStream'}),
|
||||||
|
dict(name='div', attrs={'class':'entry-content'}),
|
||||||
|
]
|
||||||
|
|
||||||
|
remove_tags = [
|
||||||
|
dict(name='div', attrs={'class':'fb_article_top'}),
|
||||||
|
dict(name='div', attrs={'class':'related'}),
|
||||||
|
dict(name='div', attrs={'class':'fb_article_foot'}),
|
||||||
|
dict(name='div', attrs={'class':'spreading'}),
|
||||||
|
dict(name='dl', attrs={'class':'ad'}),
|
||||||
|
dict(name='p', attrs={'class':'report'}),
|
||||||
|
dict(name='div', attrs={'class':'hfeed comments'}),
|
||||||
|
dict(name='dl', attrs={'id':'entryPanel'}),
|
||||||
|
dict(name='dl', attrs={'class':'infopush ip_wide'}),
|
||||||
|
dict(name='div', attrs={'class':'sidebar'}),
|
||||||
|
dict(name='dl', attrs={'class':'bottom'}),
|
||||||
|
dict(name='div', attrs={'id':'footer'}),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
(u'Slovenija', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=13')
|
||||||
|
,(u'Svet', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=14')
|
||||||
|
,(u'EU', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=116')
|
||||||
|
,(u'Poslovni dnevnik', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=5')
|
||||||
|
,(u'Kronika', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=15')
|
||||||
|
,(u'Kultura', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=17')
|
||||||
|
,(u'Zdravje', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=18')
|
||||||
|
,(u'Znanost in IT', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=19')
|
||||||
|
,(u'(Ne)verjetno', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=20')
|
||||||
|
,(u'E-strada', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=21')
|
||||||
|
,(u'Svet vozil', u'http://www.dnevnik.si/rss/?articleType=1&articleSection=22')
|
||||||
|
]
|
38
resources/recipes/hola.recipe
Normal file
38
resources/recipes/hola.recipe
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2010, Brendan Sleight <bms.calibre at barwap.com>'
|
||||||
|
'''
|
||||||
|
hola.com
|
||||||
|
'''
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class Hackaday(BasicNewsRecipe):
|
||||||
|
title = u'Hola'
|
||||||
|
__author__ = 'bmsleight'
|
||||||
|
description = 'diario de actualidad, moda y belleza.'
|
||||||
|
oldest_article = 10
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
language = 'es'
|
||||||
|
|
||||||
|
use_embedded_content = False
|
||||||
|
|
||||||
|
keep_only_tags = [
|
||||||
|
dict(name='div', attrs={'id':'cuerpo'})
|
||||||
|
]
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
(u'Famosos' , u'http://www.hola.com/famosos/rss.xml' ),
|
||||||
|
(u'Realeza' , u'http://www.hola.com/realeza/rss.xml' ),
|
||||||
|
(u'Cine' , u'http://www.hola.com/cine/rss.xml' ),
|
||||||
|
(u'Música' , u'http://www.hola.com/musica/rss.xml' ),
|
||||||
|
(u'Moda y modelos' , u'http://www.hola.com/moda/portada/rss.xml' ),
|
||||||
|
(u'Belleza y salud', u'http://www.hola.com/belleza/portada/rss.xml' ),
|
||||||
|
(u'Niños' , u'http://www.hola.com/ninos/rss.xml' ),
|
||||||
|
(u'Todas las noticias', u'http://int2.hola.com/app/feeds/rss_hola.php'),
|
||||||
|
]
|
||||||
|
|
||||||
|
def get_article_url(self, article):
|
||||||
|
url = article.get('guid', None)
|
||||||
|
return url
|
57
resources/recipes/mmc_rtv.recipe
Normal file
57
resources/recipes/mmc_rtv.recipe
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2010, BlonG'
|
||||||
|
'''
|
||||||
|
www.rtvslo.si
|
||||||
|
'''
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class MMCRTV(BasicNewsRecipe):
|
||||||
|
title = u'MMC RTV Slovenija'
|
||||||
|
__author__ = u'BlonG'
|
||||||
|
description = u"Prvi interaktivni multimedijski portal, MMC RTV Slovenija"
|
||||||
|
oldest_article = 3
|
||||||
|
max_articles_per_feed = 20
|
||||||
|
language = 'sl'
|
||||||
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
|
|
||||||
|
cover_url = 'https://sites.google.com/site/javno2010/home/rtv_slo_cover.jpg'
|
||||||
|
|
||||||
|
extra_css = '''
|
||||||
|
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
||||||
|
h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
|
||||||
|
p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||||
|
body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
|
||||||
|
'''
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
split_url = url.split("/")
|
||||||
|
print_url = 'http://www.rtvslo.si/index.php?c_mod=news&op=print&id=' + split_url[-1]
|
||||||
|
return print_url
|
||||||
|
|
||||||
|
keep_only_tags = [
|
||||||
|
dict(name='div', attrs={'class':'title'}),
|
||||||
|
dict(name='div', attrs={'id':'newsbody'}),
|
||||||
|
dict(name='div', attrs={'id':'newsblocks'}),
|
||||||
|
]
|
||||||
|
# remove_tags=[
|
||||||
|
# 40 dict(name='div', attrs={'id':'newsblocks'}),
|
||||||
|
# ]
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
(u'Slovenija', u'http://www.rtvslo.si/feeds/01.xml'),
|
||||||
|
(u'Svet', u'http://www.rtvslo.si/feeds/02.xml'),
|
||||||
|
(u'Evropska unija', u'http://www.rtvslo.si/feeds/16.xml'),
|
||||||
|
(u'Gospodarstvo', u'http://www.rtvslo.si/feeds/04.xml'),
|
||||||
|
(u'\u010crna kronika', u'http://www.rtvslo.si/feeds/08.xml'),
|
||||||
|
(u'Okolje', u'http://www.rtvslo.si/feeds/12.xml'),
|
||||||
|
(u'Znanost in tehnologija', u'http://www.rtvslo.si/feeds/09.xml'),
|
||||||
|
(u'Zabava', u'http://www.rtvslo.si/feeds/06.xml'),
|
||||||
|
(u'Ture avanture', u'http://www.rtvslo.si/feeds/28.xml'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# def preprocess_html(self, soup):
|
||||||
|
# newsblocks = soup.find('div',attrs = ['id':'newsblocks'])
|
||||||
|
# soup.find('div', attrs = {'id':'newsbody'}).insert(-1, newsblocks)
|
||||||
|
# return soup
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
from calibre.web.feeds.recipes import BasicNewsRecipe, LoginFailed
|
from calibre.web.feeds.news import BasicNewsRecipe, LoginFailed
|
||||||
|
|
||||||
class SCPrintMagazine(BasicNewsRecipe):
|
class SCPrintMagazine(BasicNewsRecipe):
|
||||||
title = u'SC Print Magazine'
|
title = u'SC Print Magazine'
|
||||||
|
@ -5,18 +5,17 @@ __copyright__ = '2010, BlonG'
|
|||||||
www.siol.si
|
www.siol.si
|
||||||
'''
|
'''
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class Siol(BasicNewsRecipe):
|
class Siol(BasicNewsRecipe):
|
||||||
title = u'Siol.net'
|
title = u'Siol.net'
|
||||||
__author__ = u'BlonG'
|
__author__ = u'BlonG'
|
||||||
description = "Multimedijski portal z aktualnimi vsebinami, intervjuji, komentarji iz Slovenije in sveta, sportal, trendi, avtomoto, blogos"
|
description = "Multimedijski portal z aktualnimi vsebinami, intervjuji, komentarji iz Slovenije in sveta, sportal, trendi, avtomoto, blogos"
|
||||||
oldest_article = 3
|
oldest_article = 3
|
||||||
|
language = 'sl'
|
||||||
max_articles_per_feed = 20
|
max_articles_per_feed = 20
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
language = 'sl'
|
|
||||||
|
|
||||||
cover_url = 'http://farm4.static.flickr.com/3540/3401820496_c771550fe6.jpg'
|
cover_url = 'https://sites.google.com/site/javno2010/home/siol_cover.jpg'
|
||||||
|
|
||||||
extra_css = '''
|
extra_css = '''
|
||||||
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
||||||
@ -25,6 +24,8 @@ class Siol(BasicNewsRecipe):
|
|||||||
body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
|
body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
html2lrf_options = ['--base-font-size', '10']
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
dict(name='div', attrs={'id':'idContent'}),
|
dict(name='div', attrs={'id':'idContent'}),
|
||||||
]
|
]
|
||||||
@ -52,4 +53,3 @@ class Siol(BasicNewsRecipe):
|
|||||||
,(u'Tehnologija', u'http://www.siol.net/rss.aspx?path=Tehnologija')
|
,(u'Tehnologija', u'http://www.siol.net/rss.aspx?path=Tehnologija')
|
||||||
,(u'TV / Film', u'http://www.siol.net/rss.aspx?path=TV')
|
,(u'TV / Film', u'http://www.siol.net/rss.aspx?path=TV')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -444,6 +444,9 @@ xml_entity_to_unicode = partial(entity_to_unicode, result_exceptions = {
|
|||||||
def replace_entities(raw):
|
def replace_entities(raw):
|
||||||
return _ent_pat.sub(entity_to_unicode, raw)
|
return _ent_pat.sub(entity_to_unicode, raw)
|
||||||
|
|
||||||
|
def xml_replace_entities(raw):
|
||||||
|
return _ent_pat.sub(xml_entity_to_unicode, raw)
|
||||||
|
|
||||||
def prepare_string_for_xml(raw, attribute=False):
|
def prepare_string_for_xml(raw, attribute=False):
|
||||||
raw = _ent_pat.sub(entity_to_unicode, raw)
|
raw = _ent_pat.sub(entity_to_unicode, raw)
|
||||||
raw = raw.replace('&', '&').replace('<', '<').replace('>', '>')
|
raw = raw.replace('&', '&').replace('<', '<').replace('>', '>')
|
||||||
|
@ -213,11 +213,13 @@ class BookInfo(QWebView):
|
|||||||
f = QFontInfo(QApplication.font(self.parent())).pixelSize()
|
f = QFontInfo(QApplication.font(self.parent())).pixelSize()
|
||||||
p = unicode(QApplication.palette().color(QPalette.Normal,
|
p = unicode(QApplication.palette().color(QPalette.Normal,
|
||||||
QPalette.Base).name())
|
QPalette.Base).name())
|
||||||
|
c = unicode(QApplication.palette().color(QPalette.Normal,
|
||||||
|
QPalette.Text).name())
|
||||||
templ = u'''\
|
templ = u'''\
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body, td {background-color: %s; font-size: %dpx}
|
body, td {background-color: %s; font-size: %dpx; color: %s }
|
||||||
a { text-decoration: none; color: blue }
|
a { text-decoration: none; color: blue }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@ -225,7 +227,7 @@ class BookInfo(QWebView):
|
|||||||
%%s
|
%%s
|
||||||
</body>
|
</body>
|
||||||
<html>
|
<html>
|
||||||
'''%(p, f)
|
'''%(p, f, c)
|
||||||
if self.vertical:
|
if self.vertical:
|
||||||
if comments:
|
if comments:
|
||||||
rows += u'<tr><td colspan="2">%s</td></tr>'%comments
|
rows += u'<tr><td colspan="2">%s</td></tr>'%comments
|
||||||
|
104
src/calibre/gui2/comments_editor.py
Normal file
104
src/calibre/gui2/comments_editor.py
Normal file
File diff suppressed because one or more lines are too long
@ -1,15 +1,19 @@
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
import re
|
|
||||||
|
import re, copy
|
||||||
|
|
||||||
from PyQt4.QtGui import QDialog, QDialogButtonBox
|
from PyQt4.QtGui import QDialog, QDialogButtonBox
|
||||||
from PyQt4 import QtCore
|
|
||||||
|
|
||||||
from calibre.gui2.dialogs.search_ui import Ui_Dialog
|
from calibre.gui2.dialogs.search_ui import Ui_Dialog
|
||||||
from calibre.library.caches import CONTAINS_MATCH, EQUALS_MATCH
|
from calibre.library.caches import CONTAINS_MATCH, EQUALS_MATCH
|
||||||
|
from calibre.gui2 import gprefs
|
||||||
|
|
||||||
|
box_values = {}
|
||||||
|
|
||||||
class SearchDialog(QDialog, Ui_Dialog):
|
class SearchDialog(QDialog, Ui_Dialog):
|
||||||
|
|
||||||
def __init__(self, parent, db, box_values, current_tab):
|
def __init__(self, parent, db):
|
||||||
QDialog.__init__(self, parent)
|
QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.mc = ''
|
self.mc = ''
|
||||||
@ -18,26 +22,38 @@ class SearchDialog(QDialog, Ui_Dialog):
|
|||||||
y if y[0] != '#' else y[1:]))
|
y if y[0] != '#' else y[1:]))
|
||||||
self.general_combo.addItems(searchables)
|
self.general_combo.addItems(searchables)
|
||||||
|
|
||||||
if (box_values):
|
self.box_last_values = copy.deepcopy(box_values)
|
||||||
for k,v in box_values.items():
|
if self.box_last_values:
|
||||||
|
for k,v in self.box_last_values.items():
|
||||||
if k == 'general_index':
|
if k == 'general_index':
|
||||||
continue
|
continue
|
||||||
getattr(self, k).setText(v)
|
getattr(self, k).setText(v)
|
||||||
self.general_combo.setCurrentIndex(
|
self.general_combo.setCurrentIndex(
|
||||||
self.general_combo.findText(box_values['general_index']))
|
self.general_combo.findText(self.box_last_values['general_index']))
|
||||||
self.box_last_values = box_values
|
|
||||||
|
|
||||||
self.buttonBox.accepted.connect(self.advanced_search_button_pushed)
|
self.buttonBox.accepted.connect(self.advanced_search_button_pushed)
|
||||||
self.tab_2_button_box.accepted.connect(self.box_search_accepted)
|
self.tab_2_button_box.accepted.connect(self.accept)
|
||||||
self.tab_2_button_box.rejected.connect(self.box_search_rejected)
|
self.tab_2_button_box.rejected.connect(self.reject)
|
||||||
self.clear_button.clicked.connect(self.clear_button_pushed)
|
self.clear_button.clicked.connect(self.clear_button_pushed)
|
||||||
self.adv_search_used = False
|
self.adv_search_used = False
|
||||||
self.box_search_used = False
|
|
||||||
|
|
||||||
|
current_tab = gprefs.get('advanced search dialog current tab', 0)
|
||||||
self.tabWidget.setCurrentIndex(current_tab)
|
self.tabWidget.setCurrentIndex(current_tab)
|
||||||
self.tabWidget.currentChanged[int].connect(self.tab_changed)
|
self.tabWidget.currentChanged[int].connect(self.tab_changed)
|
||||||
self.tab_changed(current_tab)
|
self.tab_changed(current_tab)
|
||||||
|
|
||||||
|
def save_state(self):
|
||||||
|
gprefs['advanced search dialog current tab'] = \
|
||||||
|
self.tabWidget.currentIndex()
|
||||||
|
|
||||||
|
def accept(self):
|
||||||
|
self.save_state()
|
||||||
|
return QDialog.accept(self)
|
||||||
|
|
||||||
|
def reject(self):
|
||||||
|
self.save_state()
|
||||||
|
return QDialog.reject(self)
|
||||||
|
|
||||||
def tab_changed(self, idx):
|
def tab_changed(self, idx):
|
||||||
if idx == 1:
|
if idx == 1:
|
||||||
self.tab_2_button_box.button(QDialogButtonBox.Ok).setDefault(True)
|
self.tab_2_button_box.button(QDialogButtonBox.Ok).setDefault(True)
|
||||||
@ -46,16 +62,7 @@ class SearchDialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def advanced_search_button_pushed(self):
|
def advanced_search_button_pushed(self):
|
||||||
self.adv_search_used = True
|
self.adv_search_used = True
|
||||||
self.current_tab = 0
|
self.accept()
|
||||||
QDialog.accept(self)
|
|
||||||
|
|
||||||
def box_search_accepted(self):
|
|
||||||
self.box_search_used = True
|
|
||||||
self.current_tab = 1
|
|
||||||
QDialog.accept(self)
|
|
||||||
|
|
||||||
def box_search_rejected(self):
|
|
||||||
QDialog.reject(self)
|
|
||||||
|
|
||||||
def clear_button_pushed(self):
|
def clear_button_pushed(self):
|
||||||
self.title_box.setText('')
|
self.title_box.setText('')
|
||||||
@ -139,6 +146,8 @@ class SearchDialog(QDialog, Ui_Dialog):
|
|||||||
self.box_last_values['general_box'] = general
|
self.box_last_values['general_box'] = general
|
||||||
general_index = unicode(self.general_combo.currentText())
|
general_index = unicode(self.general_combo.currentText())
|
||||||
self.box_last_values['general_index'] = general_index
|
self.box_last_values['general_index'] = general_index
|
||||||
|
global box_values
|
||||||
|
box_values = copy.deepcopy(self.box_last_values)
|
||||||
if general:
|
if general:
|
||||||
ans.append(unicode(self.general_combo.currentText()) + ':"' + general + '"')
|
ans.append(unicode(self.general_combo.currentText()) + ':"' + general + '"')
|
||||||
if ans:
|
if ans:
|
||||||
|
@ -6,22 +6,22 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>686</width>
|
<width>731</width>
|
||||||
<height>360</height>
|
<height>384</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Advanced Search</string>
|
<string>Advanced Search</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset>
|
<iconset resource="../../../../resources/images.qrc">
|
||||||
<normaloff>:/images/search.png</normaloff>:/images/search.png</iconset>
|
<normaloff>:/images/search.png</normaloff>:/images/search.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -187,16 +187,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -210,6 +200,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_2">
|
<widget class="QWidget" name="tab_2">
|
||||||
@ -217,7 +217,7 @@
|
|||||||
<string>Titl&e/Author/Series ...</string>
|
<string>Titl&e/Author/Series ...</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Title:</string>
|
<string>&Title:</string>
|
||||||
@ -227,84 +227,71 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="title_box">
|
<widget class="QLineEdit" name="title_box">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enter the title.</string>
|
<string>Enter the title.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Author</string>
|
<string>&Author:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>authors_box</cstring>
|
<cstring>authors_box</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_9">
|
<widget class="QLabel" name="label_9">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Series</string>
|
<string>&Series:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>series_box</cstring>
|
<cstring>series_box</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_10">
|
<widget class="QLabel" name="label_10">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Ta&gs</string>
|
<string>Ta&gs:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>tags_box</cstring>
|
<cstring>tags_box</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLineEdit" name="authors_box">
|
<widget class="QLineEdit" name="authors_box">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enter an author's name. Only one author can be used.</string>
|
<string>Enter an author's name. Only one author can be used.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLineEdit" name="series_box">
|
<widget class="QLineEdit" name="series_box">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enter a series name, without an index. Only one series name can be used.</string>
|
<string>Enter a series name, without an index. Only one series name can be used.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QLineEdit" name="tags_box">
|
<widget class="QLineEdit" name="tags_box">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enter tags separated by spaces</string>
|
<string>Enter tags separated by spaces</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QLineEdit" name="general_box"/>
|
<widget class="QLineEdit" name="general_box"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="6" column="0">
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QComboBox" name="general_combo"/>
|
<widget class="QComboBox" name="general_combo"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="8" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="clear_button">
|
<widget class="QPushButton" name="clear_button">
|
||||||
@ -322,6 +309,26 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string>Search only in specific fields:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -346,7 +353,7 @@
|
|||||||
<tabstop>tabWidget</tabstop>
|
<tabstop>tabWidget</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../CBH_Data/calibre_development/calibre/resources/images.qrc"/>
|
<include location="../../../../resources/images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
@ -167,7 +167,7 @@ class SearchBar(QWidget): # {{{
|
|||||||
x.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
x.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
||||||
|
|
||||||
parent.advanced_search_button = x = QToolButton(self)
|
parent.advanced_search_button = x = QToolButton(self)
|
||||||
parent.advanced_search_button.setShortcut(_("Ctrl+s"))
|
parent.advanced_search_button.setShortcut(_("Shift+Ctrl+F"))
|
||||||
x.setIcon(QIcon(I('search.png')))
|
x.setIcon(QIcon(I('search.png')))
|
||||||
l.addWidget(x)
|
l.addWidget(x)
|
||||||
x.setToolTip(_("Advanced search"))
|
x.setToolTip(_("Advanced search"))
|
||||||
|
@ -381,8 +381,6 @@ class SearchBoxMixin(object):
|
|||||||
unicode(self.search.toolTip())))
|
unicode(self.search.toolTip())))
|
||||||
self.advanced_search_button.setStatusTip(self.advanced_search_button.toolTip())
|
self.advanced_search_button.setStatusTip(self.advanced_search_button.toolTip())
|
||||||
self.clear_button.setStatusTip(self.clear_button.toolTip())
|
self.clear_button.setStatusTip(self.clear_button.toolTip())
|
||||||
self.search_last_values = None
|
|
||||||
self.search_current_tab = 0
|
|
||||||
|
|
||||||
def search_box_cleared(self):
|
def search_box_cleared(self):
|
||||||
self.tags_view.clear()
|
self.tags_view.clear()
|
||||||
@ -394,12 +392,9 @@ class SearchBoxMixin(object):
|
|||||||
self.tags_view.clear()
|
self.tags_view.clear()
|
||||||
|
|
||||||
def do_advanced_search(self, *args):
|
def do_advanced_search(self, *args):
|
||||||
d = SearchDialog(self, self.library_view.model().db,
|
d = SearchDialog(self, self.library_view.model().db)
|
||||||
self.search_last_values, self.search_current_tab)
|
|
||||||
if d.exec_() == QDialog.Accepted:
|
if d.exec_() == QDialog.Accepted:
|
||||||
self.search.set_search_string(d.search_string())
|
self.search.set_search_string(d.search_string())
|
||||||
self.search_last_values = d.box_last_values
|
|
||||||
self.search_current_tab = d.current_tab
|
|
||||||
|
|
||||||
class SavedSearchBoxMixin(object):
|
class SavedSearchBoxMixin(object):
|
||||||
|
|
||||||
|
@ -380,6 +380,8 @@ Calibre has several keyboard shortcuts to save you time and mouse movement. Thes
|
|||||||
- Show books in the same series as current book
|
- Show books in the same series as current book
|
||||||
* - :kbd:`/, Ctrl+F`
|
* - :kbd:`/, Ctrl+F`
|
||||||
- Focus the search bar
|
- Focus the search bar
|
||||||
|
* - :kbd:`Shift+Ctrl+F`
|
||||||
|
- Open the advanced search dialog
|
||||||
* - :kbd:`Ctrl+D`
|
* - :kbd:`Ctrl+D`
|
||||||
- Download metadata and shortcuts
|
- Download metadata and shortcuts
|
||||||
* - :kbd:`Ctrl+R`
|
* - :kbd:`Ctrl+R`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user