diff options
author | ache <ache@ache.one> | 2020-02-21 06:01:13 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2020-02-21 06:01:13 +0100 |
commit | d9ffc8393bcf57c8f365ad5be32b095f5c99c87e (patch) | |
tree | 85b6b0832b2b2042a9890987e119863b27712aac /ui.py |
Init commit
Diffstat (limited to 'ui.py')
-rw-r--r-- | ui.py | 51 |
1 files changed, 51 insertions, 0 deletions
@@ -0,0 +1,51 @@ +# Define the function that will present the definition + +tui_indent = 3 +tui_show_example = True + + +def show_terminal(word): + """Display the definition to the terminal + + @word Format: + { + mot: '' + cat-gram: '' + def: [{ + def: '' + ex: ['', ''] + }] + API: '' + infos: ['', ''] + genre: '' + accord: '' + } + """ + indent = tui_indent * ' ' + print(indent + word['mot']) + + line = "" + if 'API' in word: + line += '/' + word['API'] + '/, ' + if 'cat-gram' not in word: + line += 'Nature inconnue' + else: + line += word['cat-gram'] + + print(indent + line) + + if 'genre' in word: + line += ', ' + word['genre'] + + for def_w in word['def']: + if 'def' in def_w: + print(indent + '\t' + def_w['def']) + if 'ex' in def_w: + for ex in def_w['ex']: + print(indent + '\t\t * ' + ex) + print('') + + +def show_web(word): + """Display the definition in HTML format""" + pass |