Improvements to text scanning and deinflection display
Former-commit-id: 94bfd5c174c2f68dfb85b2040a272e4523f9e799
This commit is contained in:
parent
0c60eebf71
commit
46c99d7efb
@ -20,6 +20,7 @@ from PyQt4 import QtGui, QtCore
|
|||||||
import about
|
import about
|
||||||
import constants
|
import constants
|
||||||
import gen.reader_ui
|
import gen.reader_ui
|
||||||
|
import japanese.util
|
||||||
import os
|
import os
|
||||||
import preferences
|
import preferences
|
||||||
import reader_util
|
import reader_util
|
||||||
@ -424,7 +425,7 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
|
|||||||
contentSample = content[samplePosStart:samplePosEnd]
|
contentSample = content[samplePosStart:samplePosEnd]
|
||||||
contentSampleFlat = contentSample.replace(u'\n', unicode())
|
contentSampleFlat = contentSample.replace(u'\n', unicode())
|
||||||
|
|
||||||
if len(contentSampleFlat) == 0:
|
if len(contentSampleFlat) == 0 or not japanese.util.isJapanese(contentSampleFlat[0]):
|
||||||
cursor.clearSelection()
|
cursor.clearSelection()
|
||||||
self.textContent.setTextCursor(cursor)
|
self.textContent.setTextCursor(cursor)
|
||||||
return
|
return
|
||||||
@ -451,7 +452,7 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
|
|||||||
if lengthMatched <= 0:
|
if lengthMatched <= 0:
|
||||||
break
|
break
|
||||||
lengthSelect += 1
|
lengthSelect += 1
|
||||||
if c not in [u'\n', u' ', u' ']:
|
if c != u'\n':
|
||||||
lengthMatched -= 1
|
lengthMatched -= 1
|
||||||
|
|
||||||
cursor.setPosition(samplePosStart, QtGui.QTextCursor.MoveAnchor)
|
cursor.setPosition(samplePosStart, QtGui.QTextCursor.MoveAnchor)
|
||||||
|
@ -168,8 +168,8 @@ def buildVocabDef(definition, index, query):
|
|||||||
|
|
||||||
rules = unicode()
|
rules = unicode()
|
||||||
if len(definition['rules']) > 0:
|
if len(definition['rules']) > 0:
|
||||||
rules = ' :: '.join(definition['rules'])
|
rules = ' < '.join(definition['rules'])
|
||||||
rules = '<span class = "rules">{0}<br/></span>'.format(rules)
|
rules = '<span class = "rules">({0})<br/></span>'.format(rules)
|
||||||
|
|
||||||
links = '<a href = "copyVocabDef:{0}"><img src = "://img/img/icon_copy_definition.png" align = "right"/></a>'.format(index)
|
links = '<a href = "copyVocabDef:{0}"><img src = "://img/img/icon_copy_definition.png" align = "right"/></a>'.format(index)
|
||||||
if query is not None:
|
if query is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user