This commit is contained in:
Kovid Goyal 2014-06-14 10:44:10 +05:30
parent 82f9182f95
commit 3bc9e7c534
4 changed files with 77 additions and 77 deletions

View File

@ -106,7 +106,7 @@ class AddAction(InterfaceAction):
ids = [view.model().id(r) for r in rows] ids = [view.model().id(r) for r in rows]
if len(ids) > 1 and not question_dialog(self.gui, if len(ids) > 1 and not question_dialog(self.gui,
_('Are you sure'), _('Are you sure?'),
_('Are you sure you want to add the same' _('Are you sure you want to add the same'
' files to all %d books? If the format' ' files to all %d books? If the format'
' already exists for a book, it will be replaced.')%len(ids)): ' already exists for a book, it will be replaced.')%len(ids)):
@ -128,7 +128,7 @@ class AddAction(InterfaceAction):
title = db.title(ids[0], index_is_id=True) title = db.title(ids[0], index_is_id=True)
msg = _('The {0} format(s) will be replaced in the book {1}. Are you sure?').format( msg = _('The {0} format(s) will be replaced in the book {1}. Are you sure?').format(
', '.join(override), title) ', '.join(override), title)
if not confirm(msg, 'confirm_format_override_on_add', title=_('Are you sure'), parent=self.gui): if not confirm(msg, 'confirm_format_override_on_add', title=_('Are you sure?'), parent=self.gui):
return return
for id_ in ids: for id_ in ids:

View File

@ -120,7 +120,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
_('You do not have read/write permissions for ' _('You do not have read/write permissions for '
'the folder: %s')%path, show=True) 'the folder: %s')%path, show=True)
raise AbortCommit('invalid auto-add folder') raise AbortCommit('invalid auto-add folder')
if not question_dialog(self, _('Are you sure'), if not question_dialog(self, _('Are you sure?'),
_('<b>WARNING:</b> Any files you place in %s will be ' _('<b>WARNING:</b> Any files you place in %s will be '
'automatically deleted after being added to ' 'automatically deleted after being added to '
'calibre. Are you sure?')%path): 'calibre. Are you sure?')%path):

View File

@ -252,8 +252,7 @@ class TagBrowserMixin(object): # {{{
if not question_dialog(self.tags_view, if not question_dialog(self.tags_view,
title=_('Delete item'), title=_('Delete item'),
msg='<p>'+ msg='<p>'+
_('%s will be deleted from all books. Are you sure?') _('%s will be deleted from all books. Are you sure?') %orig_name,
%orig_name,
skip_dialog_name='tag_item_delete', skip_dialog_name='tag_item_delete',
skip_dialog_msg=_('Show this confirmation again')): skip_dialog_msg=_('Show this confirmation again')):
return return
@ -436,7 +435,7 @@ class TagBrowserWidget(QWidget): # {{{
'match any or all of them')) 'match any or all of them'))
ma.setStatusTip(ma.toolTip()) ma.setStatusTip(ma.toolTip())
mt = l.m.addAction(_('Manage authors, tags, etc')) mt = l.m.addAction(_('Manage authors, tags, etc.'))
mt.setToolTip(_('All of these category_managers are available by right-clicking ' mt.setToolTip(_('All of these category_managers are available by right-clicking '
'on items in the tag browser above')) 'on items in the tag browser above'))
mt.m = l.manage_menu = QMenu(l.m) mt.m = l.manage_menu = QMenu(l.m)

View File

@ -6,7 +6,6 @@ from __future__ import (unicode_literals, division, absolute_import,
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import textwrap
from collections import namedtuple from collections import namedtuple
from PyQt4.Qt import ( from PyQt4.Qt import (
@ -450,48 +449,8 @@ class Property(QWidget):
self.data['underline'] = unicode(self.underline.currentText()) or None self.data['underline'] = unicode(self.underline.currentText()) or None
self.changed.emit() self.changed.emit()
class ThemeEditor(Dialog): # Help text {{{
HELP_TEXT = '''\
def __init__(self, parent=None):
Dialog.__init__(self, _('Create/edit custom theme'), 'custom-theme-editor', parent=parent)
def setup_ui(self):
self.block_show = False
self.properties = []
self.l = l = QVBoxLayout(self)
self.setLayout(l)
h = QHBoxLayout()
l.addLayout(h)
self.la = la = QLabel(_('&Edit theme:'))
h.addWidget(la)
self.theme = t = QComboBox(self)
la.setBuddy(t)
t.addItems(sorted(custom_theme_names()))
t.setMinimumWidth(200)
if t.count() > 0:
t.setCurrentIndex(0)
t.currentIndexChanged[int].connect(self.show_theme)
h.addWidget(t)
self.add_button = b = QPushButton(QIcon(I('plus.png')), _('Add &new theme'), self)
b.clicked.connect(self.create_new_theme)
h.addWidget(b)
self.remove_button = b = QPushButton(QIcon(I('minus.png')), _('&Remove theme'), self)
b.clicked.connect(self.remove_theme)
h.addWidget(b)
h.addStretch(1)
self.scroll = s = QScrollArea(self)
self.w = w = QWidget(self)
s.setWidget(w), s.setWidgetResizable(True)
self.cl = cl = QVBoxLayout()
w.setLayout(cl)
from calibre.gui2.tweak_book.editor.text import TextEdit
self.preview = p = TextEdit(self, expected_geometry=(73, 50))
p.load_text(textwrap.dedent(_(
'''\
<h2>Creating a custom theme</h2> <h2>Creating a custom theme</h2>
<p id="attribute" lang="und">You can create a custom syntax highlighting <p id="attribute" lang="und">You can create a custom syntax highlighting
@ -559,7 +518,49 @@ class ThemeEditor(Dialog):
line-height: 1.2; line-height: 1.2;
}} }}
</style> </style>
''')).format( ''' # }}}
class ThemeEditor(Dialog):
def __init__(self, parent=None):
Dialog.__init__(self, _('Create/edit custom theme'), 'custom-theme-editor', parent=parent)
def setup_ui(self):
self.block_show = False
self.properties = []
self.l = l = QVBoxLayout(self)
self.setLayout(l)
h = QHBoxLayout()
l.addLayout(h)
self.la = la = QLabel(_('&Edit theme:'))
h.addWidget(la)
self.theme = t = QComboBox(self)
la.setBuddy(t)
t.addItems(sorted(custom_theme_names()))
t.setMinimumWidth(200)
if t.count() > 0:
t.setCurrentIndex(0)
t.currentIndexChanged[int].connect(self.show_theme)
h.addWidget(t)
self.add_button = b = QPushButton(QIcon(I('plus.png')), _('Add &new theme'), self)
b.clicked.connect(self.create_new_theme)
h.addWidget(b)
self.remove_button = b = QPushButton(QIcon(I('minus.png')), _('&Remove theme'), self)
b.clicked.connect(self.remove_theme)
h.addWidget(b)
h.addStretch(1)
self.scroll = s = QScrollArea(self)
self.w = w = QWidget(self)
s.setWidget(w), s.setWidgetResizable(True)
self.cl = cl = QVBoxLayout()
w.setLayout(cl)
from calibre.gui2.tweak_book.editor.text import TextEdit
self.preview = p = TextEdit(self, expected_geometry=(73, 50))
p.load_text(HELP_TEXT.format(
*['<b>%s</b>' % x for x in ( *['<b>%s</b>' % x for x in (
'Normal', 'Visual', 'CursorLine', 'LineNr', 'MatchParen', 'Normal', 'Visual', 'CursorLine', 'LineNr', 'MatchParen',
'Function', 'Type', 'Statement', 'Constant', 'SpecialCharacter', 'Error', 'SpellError', 'Comment' 'Function', 'Type', 'Statement', 'Constant', 'SpecialCharacter', 'Error', 'SpellError', 'Comment'