Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
5f9ebed
int to constants
Arthur-Milchior Jun 15, 2019
da931b3
Correcting parenthesis
Arthur-Milchior Jul 9, 2019
cebbd6a
Adding constants for leech actions
Arthur-Milchior Jul 9, 2019
f77d6a0
Colours are considered as constants
Arthur-Milchior Jul 10, 2019
3cebbe5
Correct typo
Arthur-Milchior Jul 11, 2019
908a3cf
Numbered custom study buttons
Arthur-Milchior Jul 11, 2019
e76521a
ignoring some things
Arthur-Milchior Jun 15, 2019
e16bd8c
dictionnary from name in code and name in manual
Arthur-Milchior Jun 15, 2019
50e21ba
dictionnary from variable to their meaning
Arthur-Milchior Jun 15, 2019
78ce41a
Documenting anki db check
Arthur-Milchior Jun 15, 2019
39efbc2
describing how schd v1 computes interval
Arthur-Milchior Jun 15, 2019
9c5f2e9
documenting deletion process
Arthur-Milchior Jun 15, 2019
bae13d6
documenting due
Arthur-Milchior Jun 15, 2019
78b0237
listing and documenting hooks
Arthur-Milchior Jun 15, 2019
a5825f1
link to other docs
Arthur-Milchior Jun 15, 2019
70b4da0
Documenting previewing cards
Arthur-Milchior Jun 15, 2019
0ff5d97
documenting collection's profile column
Arthur-Milchior Jun 15, 2019
8f18d15
documenting sync process
Arthur-Milchior Jun 15, 2019
1933baf
documenting how to decide which cards are generated
Arthur-Milchior Jun 15, 2019
3636807
Glossary
Arthur-Milchior Jun 15, 2019
b578519
delete and new same file ? Don't understand git
Arthur-Milchior Jun 15, 2019
8fb8dc8
Describing files in each folder
Arthur-Milchior Jun 15, 2019
84ad880
commenting python code
Arthur-Milchior Jun 15, 2019
9f36136
commenting js
Arthur-Milchior Jun 15, 2019
eb51c33
commenting import CSV
Arthur-Milchior Jul 6, 2019
2ea7e37
Factorizing both schedulers
Arthur-Milchior Jul 9, 2019
9407080
ask to build while runanki
Arthur-Milchior Jun 24, 2019
aa3c768
Create add-on class
Arthur-Milchior Jul 6, 2019
efce534
List of difference file
Arthur-Milchior Jul 6, 2019
86ea04e
Add-on folder
Arthur-Milchior Jul 6, 2019
96c4af9
Preferences: extra menu, and methods to update them
Arthur-Milchior Jul 6, 2019
37e5d80
Added today
Arthur-Milchior Jun 27, 2019
6f487b5
Batch edit
Arthur-Milchior Jul 6, 2019
ea4c1df
Merge
Arthur-Milchior Jun 17, 2019
c5903cd
Change note types without sync
Arthur-Milchior Jul 1, 2019
5c81d30
Constant instead of importMode
Arthur-Milchior Jul 6, 2019
1a70d22
Compile latex asap
Arthur-Milchior Jul 3, 2019
f26ad33
Copy note
Arthur-Milchior Jun 17, 2019
1f05a2e
Keep seen cards
Arthur-Milchior Jun 17, 2019
0dfde9f
Explain deletion
Arthur-Milchior Jun 17, 2019
7a52401
Export cards selected in the browser
Arthur-Milchior Jun 17, 2019
a73a0ba
«Map to» is removed
Arthur-Milchior Jul 6, 2019
01339f6
Ensure that even if model change, add cards keep the same value
Arthur-Milchior Jun 17, 2019
d388cd2
debugging
Arthur-Milchior Jul 11, 2019
cd63a6c
Keep the notes without cards
Arthur-Milchior Jun 17, 2019
a0f6f59
Merge new line in json
Arthur-Milchior Jun 17, 2019
18ebf45
Allow to open the same window multiple time
Arthur-Milchior Jun 17, 2019
b7b7a0e
Allow to postpone cards
Arthur-Milchior Jun 27, 2019
463552a
Quicker rendering of QA
Arthur-Milchior Jun 17, 2019
7bc6705
Tag missing media
Arthur-Milchior Jun 17, 2019
0827668
Allow complex card type
Arthur-Milchior Jul 6, 2019
3834b4a
Ensuring showAFied is used consistently
Arthur-Milchior Jul 11, 2019
f4058cd
Long term back-up
Arthur-Milchior Jul 5, 2019
5189b8c
limit card numbers using all cards
Arthur-Milchior Jul 9, 2019
8912ace
Consider name when changing type of a note
Arthur-Milchior Jun 17, 2019
d78133c
Explain branches
Arthur-Milchior Jul 12, 2019
e93ddd4
Explain how to add add-ons in code
Arthur-Milchior Jul 12, 2019
0c1ab34
Edit Readme for the fork
Arthur-Milchior Jul 12, 2019
7058256
Explodefixintegrity
Arthur-Milchior Jun 17, 2019
c971dad
Have a readable «empty cards» message
Arthur-Milchior Jun 17, 2019
9a33d6f
Correct new due
Arthur-Milchior Jun 27, 2019
02c3005
Quicker change model
Arthur-Milchior Jun 17, 2019
da41cba
Allow empty first field
Arthur-Milchior Jul 6, 2019
a7d2602
Merge multi column
Arthur-Milchior Jun 17, 2019
ffe775f
Ensure image fit in fields
Arthur-Milchior Jul 8, 2019
f10ae7d
Quicker change model
Arthur-Milchior Jun 17, 2019
d64af1f
Frozen fields using a single button
Arthur-Milchior Jun 17, 2019
6d6c9dd
merge correctNewDue
Arthur-Milchior Jul 12, 2019
936d7ba
merge addedToday
Arthur-Milchior Jul 12, 2019
c0f0a53
merge allowEmptyFirstField
Arthur-Milchior Jul 12, 2019
86401f3
merge batchEdit
Arthur-Milchior Jul 12, 2019
7fd4c97
merge changeDeckPrefix
Arthur-Milchior Jul 12, 2019
ee98c4b
merge changeNoteTypeWithoutSync
Arthur-Milchior Jul 12, 2019
aa2be67
merge compileLatex
Arthur-Milchior Jul 12, 2019
c2de7ec
merge considerNameWhenChangingTypeOfANote
Arthur-Milchior Jul 12, 2019
651779a
merge copyNote
Arthur-Milchior Jul 12, 2019
a0262db
merge emptyNewCard
Arthur-Milchior Jul 12, 2019
0604c0d
merge explainDeletion
Arthur-Milchior Jul 12, 2019
c9ec259
merge exportBrowser
Arthur-Milchior Jul 12, 2019
fd1b8ac
merge forkCommented
Arthur-Milchior Jul 12, 2019
0e00c2d
merge removeMapTo
Arthur-Milchior Jul 12, 2019
1481144
merge keepFieldsInAddCard
Arthur-Milchior Jul 12, 2019
70383d1
merge keepNoteWithoutCards
Arthur-Milchior Jul 12, 2019
42368c6
merge limitCardsNumberCountingEverything
Arthur-Milchior Jul 12, 2019
2d22d75
merge longTermBackup
Arthur-Milchior Jul 12, 2019
943e786
merge newlineJson
Arthur-Milchior Jul 12, 2019
1e8bad1
merge multipleWindow
Arthur-Milchior Jul 12, 2019
8afd4e7
merge postponeDays
Arthur-Milchior Jul 12, 2019
276676b
merge quickerRenderingOfQA
Arthur-Milchior Jul 12, 2019
774a031
merge tagMissingMedia
Arthur-Milchior Jul 12, 2019
d984602
merge consistentCardGeneration
Arthur-Milchior Jul 12, 2019
ec223e3
merge frozenFields
Arthur-Milchior Jul 12, 2019
c8bf8f7
Add license scan report and status
fossabot Jul 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
aqt/forms
locale
tools/runanki.system
/anki/ankiweb.certs
/tests/test_sched.py
aqt/buildhash.py
/__main__.py
anki/buildhash.py
*autosave
88 changes: 88 additions & 0 deletions FILES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
This document describe the different files and folders you'll find in this
folder. Files in subfolder are described in the file FILES.md in this
subfolder. I also indicate which files are in original anki source
code, and which are added by the author of those comments.

This should helps an (add-on) developpers, by letting them know where
to search for informations.

# Folders

## [anki](anki/FILES.md)
This folder contains most of the back-end. That is it contains
everything related to the database and its content. It allows to
manipulate decks, decks' option, cards, notes, note type, templates,
tags, and so on. It also deals with synchronization.

## [aqt](aqt/FILES.md)
This folder contains most of the controller. It contains methods for
each possible actions in anki. It also contains the values associated
to each windows. It does not contains the actual code used to create
the window. However, it contains the code used to enter informatinos
into the window.

Note that running tools/build_ui.sh add a subfolder aqt/forms/. This
folder contains code compiled from designer/ which generates the window.

## designer
This folder contains the windows description, as .ui file, (a format
related to pyqt). When running tools/build_ui.sh, its content is
compiled into python code and sent into aqt/forms/. Those new files
are used to generate the window.

This folder also contains some images used by the GUI but not by its
HTML part.

## tests
As the name suggest it, this folder contains tests. Any change made to
anki must not break those tests. As any tests, they are not exhaustive
and a change may break them even if they do not detect anything.

## tools
Some script. Most of them are used to compile anki. The only exception
is tools/runanki.system.in. A copy of this file is used to start anki
from source.

## web
This title is kinda misleading. This file is not actually used for
ankiweb, nor for anything related to internet.

An important part of anki's user interface is coded in
html/css/javascript. The javascript and the python may interact and
call functions created in the other language. The python generate the
html, which imports the css, js and images files from this folder.

# Files
I do not any markdown file, readme file, makefile, and git
related file.

## anki.1
The unix manual (man) page

## anki.desktop
Description of anki used by the Gnome's window manager in UNIX
system to create an entry on the desktop. It may be used by any window
manager reading .desktop file.

## anki.png
Anki's logo

## anki.xml
Mime information. It states that .colpkg and .apkg files are anki's
file.

## anki.xpm
A X pixMap file, used to represent anki's logo in pixel art.

## pkgkey.asc
A public pgp key. It's not clear where it is used, if anywhere.

## requirements.txt
The list of python library used by anki. Used during installation from
source, during the step ```pip3 install -r requirements.txt```.

## runanki
A python file allowing to start anki from source.

## .travis.yml
A Yaml file ensuring that Travis know how to integrate anki.
126 changes: 126 additions & 0 deletions How to add an add-on in the code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# How to add a feature to this fork.

Create a branch, with parent baseFork. The name of this branch should
describe the feature you add. You then must modifies the code as
follow. See [branchs.md](branchs.md) to see what each branches are.

## Addon folder

In this folder, put a copy of the add-on, as it is in ankiweb when it
was added to this folder.

This ensure that, if an add-on is updated, you can check easily what
was updated. What's new today, and thus not what is not yet
incorporated in the fork code.

## differences.md

List your add-on in the list of change between this fork and regular
anki. Add the add-on number after the title.

Differences are listed in alphabetical order.

## Change to code.
In order to be as compatible as possible with Anki, I respected the
following rules. And I'll ensure that any pull request (if by luck,
anyone is interested in contributing), satisfies the same rules:

### Database
The database is not changed at all. Otherwise, it creates risk of
incompatibility with ankidroid, ios and ankiweb. However, I allow to
add element in json's dictionaries.


### Method return
All methods returns the same kind of values in the forked version and
in Anki. So that any add-on calling those methods will have the
expected result.

As an example, imagine that anki's method `foo` returns an
int. Imagine that you want to return a pair, with the same int, and
also a Boolean.

Then, you can rename this method as `fooAndBool`, return the
pair. Then you can defined `foo` as `fooAndBool()[0]`.

### Method arguments.
All methods takes the same arguments. Any other arguments are keyword
argument. Most of the time, the default value could either ensure that
Anki is imitated, unless there is a good reason not to do it.

### aqt/addons.py

Add your add-on to the set of add-ons.

## Configuration options

If there are options to configure, add the buttons to
designer/preferences.ui

A checkbox is done as follow:
```xml
<item>
<widget class="QCheckBox" name="NAME">
<property name="text">
<string>TEXT</string>
</property>
</widget>
</item>
```

A text as follows:
```xml
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>TEXT</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
```

They should be added between
```xml
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Extra&lt;/span&gt;&lt;br/&gt;Those options are not documented in anki's manual. They allow to configure the different add-ons incorporated in this special version of anki.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
```
and
```xml
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
```

#### Editing configuration
In `aqt.preferences` you should edit `extraOptions`, adding a tuple
(even if it contains a single value, it should be a tuple !), with the
following element:
* name of the widget in the profile manager,
* default value (False or 0 by default)
* whether it's a check box (True by default)
* whether this value should be synchronidez (True by default)

Default values works as in any method call.

You can access this value from anywhere in the code in two distinct
ways. If the value is not synchronized, it is in the profile manager,
and thus by:
```Python
from aqt import mw
mw.pm.profile.get("xMLName", DefaultValue) if mw else DefaultValue
```
Note that, during test, `mw` is `None`. Otherwise, if the value is
synchronized, it is in the collection's configuration, and thus it is
accessed by
```Python
col.conf.get("xMLName", DefaultValue)
```
40 changes: 31 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
Anki
# Forked Anki, Alpha version
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FArthur-Milchior%2Fanki.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FArthur-Milchior%2Fanki?ref=badge_shield)

-------------------------------------

This is the development branch of Anki.
This is the development branch of a forked version of Anki. For the official, please see [https://apps.ankiweb.net](https://apps.ankiweb.net).

## Description
This is a version of anki in which multiple add-ons are already incorporated. I only incorporated non-disruptive add-ons with respect to the way Anki works fundamentally. Examples of feature added include Copy notes, Batch edit, Exporting from browser, Postponing cards, Increasing speed of some operations, Keeping some long term back-up, Giving the name of cards which will be deleted instead of their index... For a complete list of change in Forked, please see [https://github.com/Arthur-Milchior/anki/blob/fork/difference.md](difference.md).

I believe this fork is a crucial addition to Anki, because it allows you to have plenty of new and convinient features without having to wade through the list of all add-ons. Furthermore, it deals with the issue of incompatibility between add-ons, which can be difficult to manage. Finally, it also allows for graphical configuration instead of a json-edit based one.

### Add-on compatibility
This fork is theoritically equivalent to anki and should therefore be fully compatible with any add-ons. Any already installed add-ons that is being installed again will simply be ignored

For stable builds, please see https://apps.ankiweb.net.
### Alpha specificity
This fork is still in alpha and in a very early stage. This mean it is not as ready-to-use as I would like - you need to download the github code and execute runanki on it instead of having an archive ready, as of now.
If you want to be an alpha-tester, please do notify me, I am still in need for some.

For non-developers who want to try this development code,
the easiest way is to use a binary package - please see
https://anki.tenderapp.com/discussions/beta-testing
## Notes for devs:
### Why fork is easier than add-on
Honestly, I find that incorporating code in Anki is far easier than add-ons. Because:
* I often need to monkey patch a method by copying anki's method, adding it in an add-on, and changing a single line. This is a problem because it means I have copied the method from Anki and am detached from its code - if Anki does change the method the changes are not pushed through. This leads to unexpected bugs that are hard to track down, and that only appears when Anki is updated to a newer version. By using a fork, and merging regularly Anki with the forked version, this is no longer an issue.
* There is no problem of add-on compatibility. Indeed, if many add-ons change the same method, I can just do all the change in one file, instead of having to find an arcane way to merge them. Currently with add-ons, I have to create yet another add-on, merging the many incompatible add-ons in a new one. This is what I did, for example, when I created an add-on merging «multiple column editor» and «frozen fields», which is not an elegant solution.
* Some methods are extremely lengthy, such as ``fixintegrity`` (i.e. "Check database"). With a fork, I can now split this method in many smaller ones.
* I can use anki's preference window to configure everything, instead of having to relies on json files or in specialized configuration windows.

### How to add features
For a detailled explanation, see [How to add an add-on in the code.md](How to add an add-on in the code)

### Branches

To run from source, please see README.development.

If you are interested in contributing changes to Anki, please
see README.contributing before you begin work.
If you are interested in contributing changes to this Fork, just contact arthur@milchior.fr


[![Build Status](https://travis-ci.org/dae/anki.svg?branch=master)](https://travis-ci.org/dae/anki)
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FArthur-Milchior%2Fanki.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FArthur-Milchior%2Fanki?ref=badge_large)
8 changes: 8 additions & 0 deletions README.name
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Note that some names are distinct in the manual and in the code.

Code |Manual
----------------------------
cramming deck |Dynamic deck
model |note type
template |card type
conf/dconf |deck option
12 changes: 12 additions & 0 deletions VARS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Variable |Object of class
------------------------------------
col |Collection
mm |Model Managers
mw |Main window
b |browser
FOOid |Identifier of an object of type foo
n |note
c |card
m |model (note type)
d |deck
pm |profile manager
49 changes: 49 additions & 0 deletions addons/112201952/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# New line in strings in configurations/json
## Rationale
In standard json, string should not contain newlines. They should
contain "\n" instead, the standard symbols to represents a
newline. Which clearly create a readability problem. In particular
when an add-on configuration contains code (python, latex, whatever).

Thus, I wanted to have the right to have newlines in strings in
json. And when I use the configuration editor, I want to see new
lines insteads of \n.
## Usage

This add-on allow you to write new line in your string. The add-on
will replace them by "\n" before json load the configuration. This
works both for configuration in the file meta.json, and for the the
add-on manager's configuration editor.

## Warning
Note that it will not put newlines in the configuration written
in meta.conf. Indeed, this would create at least two problems:
* We can't control the order in which add-ons are loaded. Thus all
add-ons loaded before this current add-on would fail when trying to
read their configuration.
* If you decide to uninstall this add-on, no configuration with new
lines could be read anymore. (In particular, this would happen if you
synchronize your configuration using another add-on).
## Internal
This add-on has an effect on ALL json strings read by the
program. New lines in strings will always be removed and replaced by
\n. Thus this add-on may affect more than configurations. However,
this add-on call the standard json.loads() function, thus even another
add-on affecting json.loads() should still be compatible with the
current addon. Futhermore, this add-on has no effect on valid
json. Thus the potential change would only be that some invalid json
would be accepted, it seems harmless.

Furthermore, this add-on change ConfigEditor.updateText in module
aqt.addons. It does not call the previous function, thus the current
add-on will be incompatible with another add-on changing this method.

## Links, licence and credits

Key |Value
------------|-------------------------------------------------------------------
Copyright | Arthur Milchior <arthur@milchior.fr>
Based on | Anki code by Damien Elmes <anki@ichi2.net>
License | GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
Source in | https://github.com/Arthur-Milchior/anki-json-new-line
Addon number| [112201952](https://ankiweb.net/shared/info/112201952)
8 changes: 8 additions & 0 deletions addons/112201952/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright: Arthur Milchior <arthur@milchior.fr>
# Based on anki code by Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
# Source in https://github.com/Arthur-Milchior/anki-json-new-line
# Addon 112201952

from . import newline
Loading