Edit Book: Add an option to turn off drag and drop editing of text (Preferences->Editor)

This commit is contained in:
Kovid Goyal 2015-09-09 22:47:17 +05:30
parent 9759944cc8
commit f95ddb76fd
3 changed files with 9 additions and 0 deletions

View File

@ -69,6 +69,7 @@ d['add_cover_preserve_aspect_ratio'] = False
d['templates'] = {} d['templates'] = {}
d['auto_close_tags'] = True d['auto_close_tags'] = True
d['restore_book_state'] = True d['restore_book_state'] = True
d['editor_accepts_drops'] = True
del d del d
ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)} ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)}

View File

@ -119,6 +119,7 @@ class TextEdit(PlainTextEdit):
def apply_settings(self, prefs=None, dictionaries_changed=False): # {{{ def apply_settings(self, prefs=None, dictionaries_changed=False): # {{{
prefs = prefs or tprefs prefs = prefs or tprefs
self.setAcceptDrops(prefs.get('editor_accepts_drops', True))
self.setLineWrapMode(QPlainTextEdit.WidgetWidth if prefs['editor_line_wrap'] else QPlainTextEdit.NoWrap) self.setLineWrapMode(QPlainTextEdit.WidgetWidth if prefs['editor_line_wrap'] else QPlainTextEdit.NoWrap)
theme = get_theme(prefs['editor_theme']) theme = get_theme(prefs['editor_theme'])
self.apply_theme(theme) self.apply_theme(theme)

View File

@ -220,6 +220,13 @@ class EditorSettings(BasicSettings):
' for easy correction as you type.')) ' for easy correction as you type.'))
l.addRow(lw) l.addRow(lw)
lw = self('editor_accepts_drops')
lw.setText(_('Allow drag and drop editing of text'))
lw.setToolTip('<p>' + _(
'Allow using drag and drop to move text around in the editor.'
' It can be useful to turn this off if you have a misbehaving touchpad.'))
l.addRow(lw)
self.dictionaries = d = QPushButton(_('Manage &spelling dictionaries'), self) self.dictionaries = d = QPushButton(_('Manage &spelling dictionaries'), self)
d.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) d.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
d.clicked.connect(self.manage_dictionaries) d.clicked.connect(self.manage_dictionaries)