Cleanup
This commit is contained in:
parent
e293289a55
commit
9090c19c62
@ -51,7 +51,7 @@ def sanitize(text, kana=True, wildcards=False):
|
|||||||
text = re.sub(u'[\??]', u'_', text)
|
text = re.sub(u'[\??]', u'_', text)
|
||||||
overrides = [u'%', u'_']
|
overrides = [u'%', u'_']
|
||||||
else:
|
else:
|
||||||
overrides = list()
|
overrides = []
|
||||||
|
|
||||||
result = u''
|
result = u''
|
||||||
for c in text:
|
for c in text:
|
||||||
|
@ -24,7 +24,7 @@ import sqlite3
|
|||||||
|
|
||||||
def decodeContent(content):
|
def decodeContent(content):
|
||||||
encodings = ['utf-8', 'shift_jis', 'euc-jp', 'utf-16']
|
encodings = ['utf-8', 'shift_jis', 'euc-jp', 'utf-16']
|
||||||
errors = dict()
|
errors = {}
|
||||||
|
|
||||||
for encoding in encodings:
|
for encoding in encodings:
|
||||||
try:
|
try:
|
||||||
@ -41,8 +41,8 @@ def stripReadings(content):
|
|||||||
|
|
||||||
|
|
||||||
def findSentence(content, position):
|
def findSentence(content, position):
|
||||||
quotesFwd = {u'「': u'」', u'『': u'』', u"'": u"'", u'"': u'"'}
|
quotesFwd = {u'「': u'」', u'『': u'』', u"'": u"'", u'"': u'"'}
|
||||||
quotesBwd = {u'」': u'「', u'』': u'『', u"'": u"'", u'"': u'"'}
|
quotesBwd = {u'」': u'「', u'』': u'『', u"'": u"'", u'"': u'"'}
|
||||||
terminators = u'。..??!!'
|
terminators = u'。..??!!'
|
||||||
|
|
||||||
quoteStack = []
|
quoteStack = []
|
||||||
@ -89,6 +89,8 @@ def formatFields(fields, markup):
|
|||||||
result[field] = value.format(**markup)
|
result[field] = value.format(**markup)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -126,16 +128,9 @@ def markupVocabReading(definition):
|
|||||||
def copyVocabDef(definition):
|
def copyVocabDef(definition):
|
||||||
glossary = '; '.join(definition['glossary'])
|
glossary = '; '.join(definition['glossary'])
|
||||||
if definition['reading']:
|
if definition['reading']:
|
||||||
result = u'{0}\t{1}\t{2}\n'.format(
|
result = u'{0}\t{1}\t{2}\n'.format(definition['expression'], definition['reading'], glossary)
|
||||||
definition['expression'],
|
|
||||||
definition['reading'],
|
|
||||||
glossary
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
result = u'{0}\t{1}\n'.format(
|
result = u'{0}\t{1}\n'.format(definition['expression'], glossary)
|
||||||
definition['expression'],
|
|
||||||
glossary
|
|
||||||
)
|
|
||||||
|
|
||||||
QtGui.QApplication.clipboard().setText(result)
|
QtGui.QApplication.clipboard().setText(result)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class UpdateFinder(QtCore.QThread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
latest = constants.c['appVersion']
|
latest = constants.c['appVersion']
|
||||||
updates = list()
|
updates = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fp = urllib2.urlopen('https://foosoft.net/projects/yomichan/dl/updates.json')
|
fp = urllib2.urlopen('https://foosoft.net/projects/yomichan/dl/updates.json')
|
||||||
|
Loading…
Reference in New Issue
Block a user