1
This commit is contained in:
Alex Yatskov 2016-05-18 09:30:57 -07:00
parent e293289a55
commit 9090c19c62
3 changed files with 9 additions and 14 deletions

View File

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

View File

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

View File

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