diff --git a/yomi_base/japanese/dictionary.py b/yomi_base/japanese/dictionary.py index b7985f7..4aceb0a 100644 --- a/yomi_base/japanese/dictionary.py +++ b/yomi_base/japanese/dictionary.py @@ -34,11 +34,11 @@ class Dictionary: cursor.execute('SELECT * FROM Terms WHERE expression {0} ? OR reading=?'.format('LIKE' if partial else '='), (word, word)) results = list() - for expression, reading, definitions, tags in cursor.fetchall(): + for expression, reading, glossary, tags in cursor.fetchall(): results.append({ 'expression': expression, 'reading': reading, - 'definitions': definitions, + 'glossary': glossary, 'tags': tags.split() }) @@ -51,12 +51,12 @@ class Dictionary: query = cursor.fetchone() if query is not None: - character, kunyomi, onyomi, meanings = result + character, kunyomi, onyomi, glossary = query return { 'character': character, 'kunyomi': kunyomi, 'onyomi': onyomi, - 'meanings': meanings + 'glossary': glossary } diff --git a/yomi_base/japanese/translate.py b/yomi_base/japanese/translate.py index 94ca936..f3df471 100644 --- a/yomi_base/japanese/translate.py +++ b/yomi_base/japanese/translate.py @@ -54,17 +54,17 @@ class Translator: root = root or source for entry in self.dictionary.findTerm(root, partial): - key = entry['expression'], entry['reading'], entry['definitions'] + key = entry['expression'], entry['reading'], entry['glossary'] if key not in groups: groups[key] = entry, source, rules def formatResult(self, group): - (expression, reading, definition), (entry, source, rules) = group + (expression, reading, glossary), (entry, source, rules) = group return { 'expression': expression, 'reading': reading, - 'definitions': definition, + 'glossary': glossary, 'rules': rules, 'source': source } diff --git a/yomi_base/reader.py b/yomi_base/reader.py index 95745ab..8928c5c 100644 --- a/yomi_base/reader.py +++ b/yomi_base/reader.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2011 Alex Yatskov +# Copyright (C) 2013 Alex Yatskov # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -252,14 +252,14 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader): markup = reader_util.buildFactMarkupExpression( definition['expression'], definition['reading'], - definition['definitions'], + definition['glossary'], definition['sentence'] ) self.ankiAddFact(markup) if command == 'addReading': markup = reader_util.buildFactMarkupReading( definition['reading'], - definition['definitions'], + definition['glossary'], definition['sentence'] ) self.ankiAddFact(markup) diff --git a/yomi_base/reader_util.py b/yomi_base/reader_util.py index 191953a..2c3a964 100644 --- a/yomi_base/reader_util.py +++ b/yomi_base/reader_util.py @@ -95,20 +95,20 @@ def replaceMarkupInFields(fields, markup): return result -def buildFactMarkupExpression(expression, reading, definitions, sentence=None): +def buildFactMarkupExpression(expression, reading, glossary, sentence=None): return { '%e': expression, '%r': reading, - '%g': definitions, + '%g': glossary, '%s': sentence } -def buildFactMarkupReading(reading, definitions, sentence=None): +def buildFactMarkupReading(reading, glossary, sentence=None): return { '%e': reading, '%r': None, - '%g': definitions, + '%g': glossary, '%s': sentence } @@ -130,7 +130,7 @@ def copyDefinitions(definitions): for definition in definitions: if definition['reading']: - text += u'{expression}\t{reading}\t{definitions}\n'.format(**definition) + text += u'{expression}\t{reading}\t{glossary}\n'.format(**definition) else: text += u'{expression}\t{meanings}\n'.format(**definition) @@ -149,9 +149,9 @@ def buildDefinitionHtml(definition, factIndex, factQuery): links = ''.format(factIndex) if factQuery: - if factQuery(buildFactMarkupExpression(definition['expression'], definition['reading'], definition['definitions'])): + if factQuery(buildFactMarkupExpression(definition['expression'], definition['reading'], definition['glossary'])): links += ''.format(factIndex) - if factQuery(buildFactMarkupReading(definition['reading'], definition['definitions'])): + if factQuery(buildFactMarkupReading(definition['reading'], definition['glossary'])): links += ''.format(factIndex) html = u""" @@ -159,7 +159,7 @@ def buildDefinitionHtml(definition, factIndex, factQuery): {1} {2}
{3}
{4} -
""".format(links, definition['expression'], reading, definition['definitions'], conjugations) +
""".format(links, definition['expression'], reading, definition['glossary'], conjugations) return html