mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Improve formatting of help in Preferences->Tweaks
Lines are now wrapped by default and blockquotes are formatted uniformly with four leading spaces.
This commit is contained in:
parent
c1ef1a8557
commit
46f19333c9
@ -18,12 +18,10 @@ defaults.
|
|||||||
# next - First available integer larger than the largest existing number
|
# next - First available integer larger than the largest existing number
|
||||||
# first_free - First available integer larger than 0
|
# first_free - First available integer larger than 0
|
||||||
# next_free - First available integer larger than the smallest existing number
|
# next_free - First available integer larger than the smallest existing number
|
||||||
# last_free - First available integer smaller than the largest existing number
|
# last_free - First available integer smaller than the largest existing number. Return largest existing + 1 if no free number is found
|
||||||
# Return largest existing + 1 if no free number is found
|
|
||||||
# const - Assign the number 1 always
|
# const - Assign the number 1 always
|
||||||
# no_change - Do not change the series index
|
# no_change - Do not change the series index
|
||||||
# a number - Assign that number always. The number is not in quotes. Note that
|
# a number - Assign that number always. The number is not in quotes. Note that 0.0 can be used here.
|
||||||
# 0.0 can be used here.
|
|
||||||
# Examples:
|
# Examples:
|
||||||
# series_index_auto_increment = 'next'
|
# series_index_auto_increment = 'next'
|
||||||
# series_index_auto_increment = 'next_free'
|
# series_index_auto_increment = 'next_free'
|
||||||
@ -51,7 +49,7 @@ use_series_auto_increment_tweak_when_importing = False
|
|||||||
authors_completer_append_separator = False
|
authors_completer_append_separator = False
|
||||||
|
|
||||||
#: Author sort name algorithm
|
#: Author sort name algorithm
|
||||||
# The algorithm used to copy author to author_sort
|
# The algorithm used to copy author to author_sort.
|
||||||
# Possible values are:
|
# Possible values are:
|
||||||
# invert: use "fn ln" -> "ln, fn"
|
# invert: use "fn ln" -> "ln, fn"
|
||||||
# copy : copy author to author_sort without modification
|
# copy : copy author to author_sort without modification
|
||||||
@ -132,11 +130,11 @@ tag_browser_category_order = {'*':1}
|
|||||||
|
|
||||||
|
|
||||||
#: Specify columns to sort the booklist by on startup
|
#: Specify columns to sort the booklist by on startup
|
||||||
# Provide a set of columns to be sorted on when calibre starts
|
# Provide a set of columns to be sorted on when calibre starts.
|
||||||
# The argument is None if saved sort history is to be used
|
# The argument is None if saved sort history is to be used
|
||||||
# otherwise it is a list of column,order pairs. Column is the
|
# otherwise it is a list of column,order pairs. Column is the
|
||||||
# lookup/search name, found using the tooltip for the column
|
# lookup/search name, found using the tooltip for the column
|
||||||
# Order is 0 for ascending, 1 for descending
|
# Order is 0 for ascending, 1 for descending.
|
||||||
# For example, set it to [('authors',0),('title',0)] to sort by
|
# For example, set it to [('authors',0),('title',0)] to sort by
|
||||||
# title within authors.
|
# title within authors.
|
||||||
sort_columns_at_startup = None
|
sort_columns_at_startup = None
|
||||||
@ -261,7 +259,7 @@ per_language_title_sort_articles = {
|
|||||||
'ell' : (r'O\s+', r'I\s+', r'To\s+', r'Ta\s+', r'Tus\s+', r'Tis\s+',
|
'ell' : (r'O\s+', r'I\s+', r'To\s+', r'Ta\s+', r'Tus\s+', r'Tis\s+',
|
||||||
r"'Enas\s+", r"'Mia\s+", r"'Ena\s+", r"'Enan\s+", ),
|
r"'Enas\s+", r"'Mia\s+", r"'Ena\s+", r"'Enan\s+", ),
|
||||||
# Hungarian
|
# Hungarian
|
||||||
'hun' : (r'A\s+', 'Az\s+', 'Egy\s+',),
|
'hun' : (r'A\s+', r'Az\s+', r'Egy\s+',),
|
||||||
}
|
}
|
||||||
default_language_for_title_sort = None
|
default_language_for_title_sort = None
|
||||||
title_sort_articles=r'^(A|The|An)\s+'
|
title_sort_articles=r'^(A|The|An)\s+'
|
||||||
@ -362,10 +360,13 @@ add_new_book_tags_when_importing_books = False
|
|||||||
# Defaults:
|
# Defaults:
|
||||||
# content_server_will_display = ['*']
|
# content_server_will_display = ['*']
|
||||||
# content_server_wont_display = []
|
# content_server_wont_display = []
|
||||||
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
|
#
|
||||||
# To display only the custom fields #mytags and #genre:
|
# To display only the custom fields #mytags and #genre:
|
||||||
# content_server_will_display = ['#mytags', '#genre']
|
# content_server_will_display = ['#mytags', '#genre']
|
||||||
# content_server_wont_display = []
|
# content_server_wont_display = []
|
||||||
|
#
|
||||||
# To display all fields except #mycomments:
|
# To display all fields except #mycomments:
|
||||||
# content_server_will_display = ['*']
|
# content_server_will_display = ['*']
|
||||||
# content_server_wont_display['#mycomments']
|
# content_server_wont_display['#mycomments']
|
||||||
|
@ -28,6 +28,27 @@ from PyQt5.Qt import (
|
|||||||
ROOT = QModelIndex()
|
ROOT = QModelIndex()
|
||||||
|
|
||||||
|
|
||||||
|
def format_doc(doc):
|
||||||
|
current_indent = default_indent = None
|
||||||
|
lines = ['']
|
||||||
|
for line in doc.splitlines():
|
||||||
|
if not line.strip():
|
||||||
|
lines.append('')
|
||||||
|
continue
|
||||||
|
line = line[1:]
|
||||||
|
indent = len(line) - len(line.lstrip())
|
||||||
|
if indent != current_indent:
|
||||||
|
lines.append('')
|
||||||
|
if default_indent is None:
|
||||||
|
default_indent = indent
|
||||||
|
current_indent = indent
|
||||||
|
if indent == default_indent:
|
||||||
|
lines[-1] += ' ' + line
|
||||||
|
else:
|
||||||
|
lines.append(' ' + line.strip())
|
||||||
|
return '\n'.join(lines).lstrip()
|
||||||
|
|
||||||
|
|
||||||
class AdaptSQP(SearchQueryParser):
|
class AdaptSQP(SearchQueryParser):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -58,9 +79,10 @@ class Tweak(object): # {{{
|
|||||||
self.doc = doc.strip()
|
self.doc = doc.strip()
|
||||||
if self.doc:
|
if self.doc:
|
||||||
self.doc = translate(self.doc)
|
self.doc = translate(self.doc)
|
||||||
|
self.doc = ' ' + self.doc
|
||||||
self.var_names = var_names
|
self.var_names = var_names
|
||||||
if self.var_names:
|
if self.var_names:
|
||||||
self.doc = u"%s: %s\n\n%s"%(_('ID'), self.var_names[0], self.doc)
|
self.doc = u"%s: %s\n\n%s"%(_('ID'), self.var_names[0], format_doc(self.doc))
|
||||||
self.default_values = OrderedDict()
|
self.default_values = OrderedDict()
|
||||||
for x in var_names:
|
for x in var_names:
|
||||||
self.default_values[x] = defaults[x]
|
self.default_values[x] = defaults[x]
|
||||||
@ -181,7 +203,7 @@ class Tweaks(QAbstractListModel, AdaptSQP): # {{{
|
|||||||
line = lines[pos]
|
line = lines[pos]
|
||||||
if not line.startswith('#'):
|
if not line.startswith('#'):
|
||||||
break
|
break
|
||||||
doc.append(line[1:].strip())
|
doc.append(line[1:].rstrip())
|
||||||
doc = '\n'.join(doc)
|
doc = '\n'.join(doc)
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
@ -394,7 +416,6 @@ class ConfigWidget(ConfigWidgetBase):
|
|||||||
hb.l = l2 = QVBoxLayout(hb)
|
hb.l = l2 = QVBoxLayout(hb)
|
||||||
self.help = h = QPlainTextEdit(self)
|
self.help = h = QPlainTextEdit(self)
|
||||||
l2.addWidget(h)
|
l2.addWidget(h)
|
||||||
h.setLineWrapMode(QPlainTextEdit.NoWrap)
|
|
||||||
h.setReadOnly(True)
|
h.setReadOnly(True)
|
||||||
g.addWidget(hb, 1, 0, 1, 3)
|
g.addWidget(hb, 1, 0, 1, 3)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user