Coder Social home page Coder Social logo

gryzus24 / anki-dodawacz Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 1000 KB

Console/curses English dictionary look-up tool with Anki integration

License: GNU General Public License v3.0

Python 99.78% Makefile 0.22%
anki python cli-app english-learning anki-flashcards english-dictionary curses

anki-dodawacz's Introduction

Ankidodawacz

PolishEnglish

A curses dictionary look-up tool with Anki integration.

query result screen

Installation

Windows

  1. install Python from the official website
    during installation tick the "Add Python to PATH" box
  2. download and extract the zip archive
  3. open the terminal (Win+R "cmd" or type "cmd" into the file manager's path box)
  4. cd into the extracted directory (e.g. cd Downloads\anki-dodawacz-main)
  5. install the required dependencies: pip install --no-deps -r requirements.txt windows-curses
  6. run the program: python ankidodawacz.py
    if you are lucky it might even run without the python prefix!

You can also create a shortcut and run the program this way, however in case of an unexpected error the program will crash immediately.

Linux

Most GNU/Linux distributions come with Python preinstalled.

  1. cd into the directory you want the source code downloaded into
  2. download and extract the tar.gz archive, then download the dependencies and install the program into the /usr/local/bin directory:
curl -sL https://github.com/gryzus24/anki-dodawacz/archive/refs/heads/main.tar.gz | tar xfz -
cd anki-dodawacz-main
pip install --no-deps -r requirements.txt -t lib
sudo make install

Configuration

All the configuration and history files are saved into ~/.local/share/ankidodawacz on Linux and equivalent %USER%\Appdata\Local\Ankidodawacz on Windows.

The program has a quick Anki configuration wizard and a built-in configuration menu. No need to edit config files by hand.

configuration screen

Optional features

  • mpv – for playing pronunciations (press a)
  • xsel or xclip – for pasting the contents of the primary selection (Linux only).
    On Windows, pasting the contents of the clipboard should work out of the box

Anki notes

The program will try to guess where to put certain elements based on the names of the fields in your note.
Names it definitely understands are:

  • Definition
  • Synonyms
  • Sentence
  • Phrase
  • Examples (usage)
  • Parts of speech (pos)
  • Etymology
  • Audio

Custom note

The Anki configuration wizard adds a custom note that can serve as a base for your own customization.

note in Anki

The note in a copy-pastable form: https://pastebin.com/9ZfWMpNu


This is my first programming project, suggestions and contributions are welcome!

anki-dodawacz's People

Contributors

gryzus24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

anki-dodawacz's Issues

[curses] garbled output in less on Windows

Commands that redirect their output to less do not display properly on any terminal on Windows.

Less barely manages to work in a clean terminal session on Windows, making it inherit the program's curses environment just asks for something to break. This is yet another reason to consider implementing a simpler pager that supports only scrolling and searching.

[curses] Tab completion in the search prompt

After using readline's tab completion in the normal Search prompt it's annoying to have to type the whole thing when using the curses prompt.

It would be cool to have this feature especially as in the future the whole program might be in curses. Then, tab completion would be cross-platform (assuming better curses experience on Windows in general)

[curses] less cannot determine the size of the window after resizing

Reproduction

  • make the window small
  • enter curses
  • make the window bigger
  • type "--help" or any other command that produces output big enough to redirect it to less

Cause
This is caused by readline which is imported in a completer.py file while running the program on Linux.
Less is being run in a subprocess which inherits all the environment variables like "COLS" and "LINES" which are set to None because of readline and that's probably why it has a problem with resizing.

I tried running less in a new shell instead of a subprocess, but then it has some problems with interpreting ANSI color characters. Explicitly setting these environment variables does not help and incurs other problems.

Python's readline API does not expose certain variables and functions responsible for readline's rampant behavior and makes it hard to reconcile many conflicting features in a curses context.

Possible solution
Write a simpler pager (only scrolling and searching) and not rely on less at all.

Czy można wybrać pozycję spoza zakresu 1-20 wyniku?

Wcześnie można było ograniczyć liczbę pozycji w wyniku wybierając np. rzeczownik, ale w nowej wersji aplikacji chyba nie ma takiej możliwości :(. Nie łatwiej było by pozwolić przescrollować się po wszystkicg pozycjach i np. spacją wybrać te które nas interesują ?

[curses] more advanced line editing in prompt

With the possibility of pasting selection/clipboard and the contents of the Phrase field more advanced editing features might sometimes come in handy like:

  • Ctrl-Backspace to delete the whole word
  • [Ctrl-T or ???] to delete everything except the word under the cursor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.