mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Add a setting to control cursor width under Preferences->Editor settings
This commit is contained in:
parent
4183627a7d
commit
1d73fabf59
@ -19,6 +19,7 @@ d['editor_font_family'] = None
|
||||
d['editor_font_size'] = 12
|
||||
d['editor_line_wrap'] = True
|
||||
d['editor_tab_stop_width'] = 2
|
||||
d['editor_cursor_width'] = 1
|
||||
d['editor_show_char_under_cursor'] = True
|
||||
d['replace_entities_as_typed'] = True
|
||||
d['preview_refresh_time'] = 2
|
||||
|
@ -7,6 +7,7 @@ import os
|
||||
import re
|
||||
import textwrap
|
||||
import unicodedata
|
||||
from contextlib import suppress
|
||||
|
||||
import regex
|
||||
from qt.core import (
|
||||
@ -229,6 +230,8 @@ class TextEdit(PlainTextEdit):
|
||||
prefs = prefs or tprefs
|
||||
self.setAcceptDrops(prefs.get('editor_accepts_drops', True))
|
||||
self.setLineWrapMode(QPlainTextEdit.LineWrapMode.WidgetWidth if prefs['editor_line_wrap'] else QPlainTextEdit.LineWrapMode.NoWrap)
|
||||
with suppress(Exception):
|
||||
self.setCursorWidth(int(prefs.get('editor_cursor_width', 1)))
|
||||
theme = get_theme(prefs['editor_theme'])
|
||||
self.apply_theme(theme)
|
||||
fm = self.fontMetrics()
|
||||
|
@ -197,6 +197,10 @@ class EditorSettings(BasicSettings): # {{{
|
||||
fs.setMinimum(8), fs.setSuffix(' pt'), fs.setMaximum(50)
|
||||
l.addRow(_('Editor font &size:'), fs)
|
||||
|
||||
cs = self('editor_cursor_width')
|
||||
cs.setMinimum(1), cs.setSuffix(' px'), cs.setMaximum(50)
|
||||
l.addRow(_('Editor cursor &width:'), cs)
|
||||
|
||||
choices = self.theme_choices()
|
||||
theme = self.choices_widget('editor_theme', choices, 'auto', 'auto')
|
||||
self.custom_theme_button = b = QPushButton(_('Create/edit &custom color schemes'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user