From 4194570cd42b7afdcd1b76bb13082e0e47cd1759 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 22 Dec 2013 13:57:05 -0800 Subject: [PATCH] Fixing bugs related to adding kana-only cards, bumping version Former-commit-id: 298b5275a85d3f60b118846c6fc7b9885702c48a --- yomi_base/constants.py | 2 +- yomi_base/reader.py | 3 +++ yomi_base/reader_util.py | 26 ++++++++++++++++---------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/yomi_base/constants.py b/yomi_base/constants.py index 98c688f..7ef7115 100644 --- a/yomi_base/constants.py +++ b/yomi_base/constants.py @@ -17,5 +17,5 @@ c = { - 'appVersion': '0.11b', + 'appVersion': '0.12b', } diff --git a/yomi_base/reader.py b/yomi_base/reader.py index 9da443e..8d3a1b4 100644 --- a/yomi_base/reader.py +++ b/yomi_base/reader.py @@ -398,6 +398,9 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader): def ankiIsFactValid(self, profile, markup): + if markup is None: + return False + if self.anki is None: return False diff --git a/yomi_base/reader_util.py b/yomi_base/reader_util.py index b341c72..83df133 100644 --- a/yomi_base/reader_util.py +++ b/yomi_base/reader_util.py @@ -96,30 +96,36 @@ def splitTags(tags): def markupVocabExp(definition): + if definition['reading']: + summary = u'{expression} [{reading}]'.format(**definition) + else: + summary = u'{expression}'.format(**definition) + return { 'expression': definition['expression'], - 'reading': definition['reading'], + 'reading': definition['reading'] or unicode(), 'glossary': definition['glossary'], 'sentence': definition.get('sentence'), - 'summary': u'{expression} [{reading}]'.format(**definition) + 'summary': summary } def markupVocabReading(definition): - return { - 'expression': definition['reading'], - 'reading': unicode(), - 'glossary': definition['glossary'], - 'sentence': definition.get('sentence'), - 'summary': definition['reading'] - } + if definition['reading']: + return { + 'expression': definition['reading'], + 'reading': unicode(), + 'glossary': definition['glossary'], + 'sentence': definition.get('sentence'), + 'summary': definition['reading'] + } def copyVocabDef(definition): if definition['reading']: result = u'{expression}\t{reading}\t{glossary}\n'.format(**definition) else: - result = u'{expression}\t{meanings}\n'.format(**definition) + result = u'{expression}\t{glossary}\n'.format(**definition) QtGui.QApplication.clipboard().setText(result)