1

Improvements to text scanning and deinflection display

Former-commit-id: 94bfd5c174c2f68dfb85b2040a272e4523f9e799
This commit is contained in:
Alex Yatskov 2013-11-17 20:21:57 -08:00
parent 0c60eebf71
commit 46c99d7efb
2 changed files with 5 additions and 4 deletions

View File

@ -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)

View File

@ -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 = ' &lt; '.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: