KG updates

This commit is contained in:
GRiker 2011-06-06 12:03:48 -06:00
commit 3e54d2b089
6 changed files with 66 additions and 14 deletions

View File

@ -117,4 +117,6 @@ class NOOK_TSR(NOOK):
EBOOK_DIR_MAIN = EBOOK_DIR_CARD_A = 'My Files/Books' EBOOK_DIR_MAIN = EBOOK_DIR_CARD_A = 'My Files/Books'
WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = 'EBOOK_DISK' WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = 'EBOOK_DISK'
def upload_cover(self, path, filename, metadata, filepath):
pass

View File

@ -12,6 +12,7 @@ from PyQt4.Qt import (QWidget, QDialog, QLabel, QGridLayout, QComboBox, QSize,
QScrollArea, QPushButton, QVBoxLayout, QDialogButtonBox, QToolButton, QScrollArea, QPushButton, QVBoxLayout, QDialogButtonBox, QToolButton,
QListView, QAbstractListModel, pyqtSignal, QSizePolicy, QSpacerItem) QListView, QAbstractListModel, pyqtSignal, QSizePolicy, QSpacerItem)
from calibre import prepare_string_for_xml
from calibre.utils.icu import sort_key from calibre.utils.icu import sort_key
from calibre.gui2 import error_dialog from calibre.gui2 import error_dialog
from calibre.gui2.dialogs.template_dialog import TemplateDialog from calibre.gui2.dialogs.template_dialog import TemplateDialog
@ -430,7 +431,7 @@ class RulesModel(QAbstractListModel): # {{{
return _(''' return _('''
<p>Advanced Rule for column <b>%s</b>: <p>Advanced Rule for column <b>%s</b>:
<pre>%s</pre> <pre>%s</pre>
''')%(col, rule) ''')%(col, prepare_string_for_xml(rule))
conditions = [self.condition_to_html(c) for c in rule.conditions] conditions = [self.condition_to_html(c) for c in rule.conditions]
return _('''\ return _('''\
<p>Set the color of <b>%s</b> to <b>%s</b> if the following <p>Set the color of <b>%s</b> to <b>%s</b> if the following
@ -439,9 +440,10 @@ class RulesModel(QAbstractListModel): # {{{
''') % (col, rule.color, ''.join(conditions)) ''') % (col, rule.color, ''.join(conditions))
def condition_to_html(self, condition): def condition_to_html(self, condition):
c, a, v = condition
return ( return (
_('<li>If the <b>%s</b> column <b>%s</b> value: <b>%s</b>') % _('<li>If the <b>%s</b> column <b>%s</b> value: <b>%s</b>') %
tuple(condition)) (c, a, prepare_string_for_xml(v)))
# }}} # }}}

View File

@ -85,10 +85,10 @@ class Rule(object): # {{{
if dt == 'datetime': if dt == 'datetime':
return self.date_condition(col, action, val) return self.date_condition(col, action, val)
if dt in ('comments', 'series', 'text', 'enumeration'): if dt in ('comments', 'series', 'text', 'enumeration', 'composite'):
ism = m.get('is_multiple', False) ism = m.get('is_multiple', False)
if ism: if ism:
return self.multiple_condition(col, action, val, ism) return self.multiple_condition(col, action, val, ',' if ism == '|' else ism)
return self.text_condition(col, action, val) return self.text_condition(col, action, val)
def identifiers_condition(self, col, action, val): def identifiers_condition(self, col, action, val):
@ -127,10 +127,12 @@ class Rule(object): # {{{
val, lt, eq, gt) val, lt, eq, gt)
def multiple_condition(self, col, action, val, sep): def multiple_condition(self, col, action, val, sep):
if not sep or sep == '|':
sep = ','
if action == 'is set': if action == 'is set':
return "test('%s', '1', '')"%col return "test(field('%s'), '1', '')"%col
if action == 'is not set': if action == 'is not set':
return "test('%s', '', '1')"%col return "test(field('%s'), '', '1')"%col
if action == 'has': if action == 'has':
return "str_in_list(field('%s'), '%s', \"%s\", '1', '')"%(col, sep, val) return "str_in_list(field('%s'), '%s', \"%s\", '1', '')"%(col, sep, val)
if action == 'does not have': if action == 'does not have':
@ -142,9 +144,9 @@ class Rule(object): # {{{
def text_condition(self, col, action, val): def text_condition(self, col, action, val):
if action == 'is set': if action == 'is set':
return "test('%s', '1', '')"%col return "test(field('%s'), '1', '')"%col
if action == 'is not set': if action == 'is not set':
return "test('%s', '', '1')"%col return "test(field('%s'), '', '1')"%col
if action == 'is': if action == 'is':
return "strcmp(field('%s'), \"%s\", '', '1', '')"%(col, val) return "strcmp(field('%s'), \"%s\", '', '1', '')"%(col, val)
if action == 'is not': if action == 'is not':
@ -183,7 +185,7 @@ def conditionable_columns(fm):
m = fm[key] m = fm[key]
dt = m['datatype'] dt = m['datatype']
if m.get('name', False) and dt in ('bool', 'int', 'float', 'rating', 'series', if m.get('name', False) and dt in ('bool', 'int', 'float', 'rating', 'series',
'comments', 'text', 'enumeration', 'datetime'): 'comments', 'text', 'enumeration', 'datetime', 'composite'):
if key == 'sort': if key == 'sort':
yield 'title_sort' yield 'title_sort'
else: else:

View File

@ -74,10 +74,7 @@ Edit metadata
1. **Edit metadata individually**: This allows you to edit the metadata of books one-by-one, with the option of fetching metadata, including covers from the internet. It also allows you to add/remove particular ebook formats from a book. 1. **Edit metadata individually**: This allows you to edit the metadata of books one-by-one, with the option of fetching metadata, including covers from the internet. It also allows you to add/remove particular ebook formats from a book.
2. **Edit metadata in bulk**: This allows you to edit common metadata fields for large numbers of books simulataneously. It operates on all the books you have selected in the :ref:`Library view <search_sort>`. 2. **Edit metadata in bulk**: This allows you to edit common metadata fields for large numbers of books simulataneously. It operates on all the books you have selected in the :ref:`Library view <search_sort>`.
3. **Download metadata and covers**: Downloads metadata and covers (if available), for the books that are selected in the book list. 3. **Download metadata and covers**: Downloads metadata and covers (if available), for the books that are selected in the book list.
4. **Download only metadata**: Downloads only metadata (if available), for the books that are selected in the book list. 4. **Merge Book Records**: Gives you the capability of merging the metadata and formats of two or more book records together. You can choose to either delete or keep the records that were not clicked first.
5. **Download only covers**: Downloads only covers (if available), for the books that are selected in the book list.
6. **Download only social metadata**: Downloads only social metadata such as tags and reviews (if available), for the books that are selected in the book list.
7. **Merge Book Records**: Gives you the capability of merging the metadata and formats of two or more book records together. You can choose to either delete or keep the records that were not clicked first.
For more details see :ref:`metadata`. For more details see :ref:`metadata`.

View File

@ -11,7 +11,7 @@ You can "install" calibre onto a USB stick that you can take with you and use on
* Run a Mobile Calibre installation with both the Calibre binaries and your ebook library resident on a USB disk or other portable media. In particular it is not necessary to have Calibre installed on the Windows PC that is to run Calibre. This batch file also does not care what drive letter is assigned when you plug in the USB device. It also will not affect any settings on the host machine being a completely self-contained Calibre installation. * Run a Mobile Calibre installation with both the Calibre binaries and your ebook library resident on a USB disk or other portable media. In particular it is not necessary to have Calibre installed on the Windows PC that is to run Calibre. This batch file also does not care what drive letter is assigned when you plug in the USB device. It also will not affect any settings on the host machine being a completely self-contained Calibre installation.
* Run a networked Calibre installation optimised for performance when the ebook files are located on a networked share. * Run a networked Calibre installation optimised for performance when the ebook files are located on a networked share.
If you find setting up the bat file too challenging, there is a third party portable calibre build available at `portableapps.com http://portableapps.com`_. If you find setting up the bat file too challenging, there is a third party portable calibre build available at `portableapps.com <http://portableapps.com>`_.
This calibre-portable.bat file is intended for use on Windows based systems, but the principles are easily adapted for use on Linux or OS X based systems. Note that calibre requires the Microsoft Visual C++ 2008 runtimes to run. Most windows computers have them installed already, but it may be a good idea to have the installer for installing them on your USB stick. The installer is available from `Microsoft <http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en>`_. This calibre-portable.bat file is intended for use on Windows based systems, but the principles are easily adapted for use on Linux or OS X based systems. Note that calibre requires the Microsoft Visual C++ 2008 runtimes to run. Most windows computers have them installed already, but it may be a good idea to have the installer for installing them on your USB stick. The installer is available from `Microsoft <http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en>`_.

View File

@ -0,0 +1,49 @@
{#
basic/search.html
~~~~~~~~~~~~~~~~~
Template for the search page, using google adsense search
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
{% extends "layout.html" %}
{% set title = _('Search') %}
{% block extrahead %}
<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />
{{ super() }}
{% endblock %}
{% block body %}
<h1 id="search-documentation">{{ _('Search') }}</h1>
<div id="fallback" class="admonition warning">
<script type="text/javascript">$('#fallback').hide();</script>
<p>
{% trans %}Please activate JavaScript to enable the search
functionality.{% endtrans %}
</p>
</div>
<p>
{% trans %}From here you can search these documents. Enter your search
words into the box below and click "search". Note that the search
function will automatically search for all of the words. Pages
containing fewer words won't appear in the result list.{% endtrans %}
</p>
<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1');
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl('partner-pub-2595272032872519:0657791363');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.setAutoComplete(true);
customSearchControl.draw('cse', options);
var params = $.getQueryParameters();
if (params.q) {
var query = params.q[0];
$('input[name="search"]')[0].value = query;
$('input.gsc-search-button')[0].click();
}
}, true);
</script>
{% endblock %}