mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Consistent package name for smarts
This commit is contained in:
parent
8e287bfac2
commit
872827f817
@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
from calibre.gui2.tweak_book.editor.smart import NullSmarts
|
from calibre.gui2.tweak_book.editor.smarts import NullSmarts
|
||||||
|
|
||||||
def find_rule(raw, rule_address):
|
def find_rule(raw, rule_address):
|
||||||
import tinycss
|
import tinycss
|
@ -17,7 +17,7 @@ from calibre.gui2 import error_dialog
|
|||||||
from calibre.gui2.tweak_book.editor.syntax.html import ATTR_NAME, ATTR_END, ATTR_START, ATTR_VALUE
|
from calibre.gui2.tweak_book.editor.syntax.html import ATTR_NAME, ATTR_END, ATTR_START, ATTR_VALUE
|
||||||
from calibre.utils.icu import utf16_length
|
from calibre.utils.icu import utf16_length
|
||||||
from calibre.gui2.tweak_book import tprefs
|
from calibre.gui2.tweak_book import tprefs
|
||||||
from calibre.gui2.tweak_book.editor.smart import NullSmarts
|
from calibre.gui2.tweak_book.editor.smarts import NullSmarts
|
||||||
|
|
||||||
get_offset = itemgetter(0)
|
get_offset = itemgetter(0)
|
||||||
PARAGRAPH_SEPARATOR = '\u2029'
|
PARAGRAPH_SEPARATOR = '\u2029'
|
@ -10,7 +10,7 @@ import re
|
|||||||
|
|
||||||
from PyQt5.Qt import Qt
|
from PyQt5.Qt import Qt
|
||||||
|
|
||||||
from calibre.gui2.tweak_book.editor.smart import NullSmarts
|
from calibre.gui2.tweak_book.editor.smarts import NullSmarts
|
||||||
|
|
||||||
def get_text_before_cursor(editor):
|
def get_text_before_cursor(editor):
|
||||||
cursor = editor.textCursor()
|
cursor = editor.textCursor()
|
@ -23,7 +23,7 @@ from calibre.gui2.tweak_book.editor import (
|
|||||||
SYNTAX_PROPERTY, SPELL_PROPERTY, SPELL_LOCALE_PROPERTY, store_locale, LINK_PROPERTY)
|
SYNTAX_PROPERTY, SPELL_PROPERTY, SPELL_LOCALE_PROPERTY, store_locale, LINK_PROPERTY)
|
||||||
from calibre.gui2.tweak_book.editor.themes import get_theme, theme_color, theme_format
|
from calibre.gui2.tweak_book.editor.themes import get_theme, theme_color, theme_format
|
||||||
from calibre.gui2.tweak_book.editor.syntax.base import SyntaxHighlighter
|
from calibre.gui2.tweak_book.editor.syntax.base import SyntaxHighlighter
|
||||||
from calibre.gui2.tweak_book.editor.smart import NullSmarts
|
from calibre.gui2.tweak_book.editor.smarts import NullSmarts
|
||||||
from calibre.spell.break_iterator import index_of
|
from calibre.spell.break_iterator import index_of
|
||||||
from calibre.utils.icu import safe_chr, string_length, capitalize, upper, lower, swapcase
|
from calibre.utils.icu import safe_chr, string_length, capitalize, upper, lower, swapcase
|
||||||
from calibre.utils.titlecase import titlecase
|
from calibre.utils.titlecase import titlecase
|
||||||
@ -40,7 +40,7 @@ def get_highlighter(syntax):
|
|||||||
def get_smarts(syntax):
|
def get_smarts(syntax):
|
||||||
smartsname = {'xml':'html'}.get(syntax, syntax)
|
smartsname = {'xml':'html'}.get(syntax, syntax)
|
||||||
try:
|
try:
|
||||||
return importlib.import_module('calibre.gui2.tweak_book.editor.smart.' + smartsname).Smarts
|
return importlib.import_module('calibre.gui2.tweak_book.editor.smarts.' + smartsname).Smarts
|
||||||
except (ImportError, AttributeError):
|
except (ImportError, AttributeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -814,7 +814,7 @@ class TextEdit(PlainTextEdit):
|
|||||||
return self.selected_text_from_cursor(c)
|
return self.selected_text_from_cursor(c)
|
||||||
|
|
||||||
def goto_css_rule(self, rule_address, sourceline_address=None):
|
def goto_css_rule(self, rule_address, sourceline_address=None):
|
||||||
from calibre.gui2.tweak_book.editor.smart.css import find_rule
|
from calibre.gui2.tweak_book.editor.smarts.css import find_rule
|
||||||
block = None
|
block = None
|
||||||
if self.syntax == 'css':
|
if self.syntax == 'css':
|
||||||
raw = unicode(self.toPlainText())
|
raw = unicode(self.toPlainText())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user