Commit Graph

926 Commits

Author SHA1 Message Date
kelciour
ae533fce71 Replace default mpv "quit" keybindings with "stop"
https://github.com/mpv-player/mpv/blob/master/etc/input.conf
2020-06-20 02:04:34 +03:00
evandrocoan
9867e5e1f7 Create the command line argument -v/--version to print version
https://forums.ankiweb.net/t/i-couldnt-open-anki-resetting-corrupt-global/190
2020-06-19 13:13:10 -03:00
Arthur Milchior
3eabe4c3f7 Strip name of added deck
There is currently what I believe to be a bug: create a deck "   ".
The creation is accepted and the name is renamed to "blank". Instead,
I believe you'd want to strip the deck name before testing its
emptiness.
2020-06-17 11:58:33 +02:00
Damien Elmes
b51f03085e migrate card stats to backend
Currently this renders the HTML directly like the previous Python
implementation - doing it in JS would probably make more sense in the
future.
2020-06-15 17:22:16 +10:00
Damien Elmes
2845941a28
Merge pull request #667 from BlueGreenMagick/refresh-deck-list
refresh deck list when adding deck via deckchooser
2020-06-12 09:12:51 +10:00
Damien Elmes
9e0494047e
Merge pull request #666 from BlueGreenMagick/studydeck-name
get deck name after adding deck
2020-06-12 09:12:21 +10:00
Damien Elmes
8f36a0fbb0
Merge pull request #665 from BlueGreenMagick/remove-a-var
Add type hints to deckchooser
2020-06-12 09:11:54 +10:00
Damien Elmes
37bf56c56e
remove ellipsis 2020-06-12 09:04:19 +10:00
BlueGreenMagick
e3889d49c9 add typehint to deckchooser.py
every occurunce of self.widget is type ignored
because QHBoxLayout has a method named widget
renaming this property will allow type hints
2020-06-11 14:19:36 +09:00
BlueGreenMagick
20da11f57e refresh deck list when adding deck via deckchooser 2020-06-11 13:00:10 +09:00
BlueGreenMagick
4e6ba4df78 get deck name after adding deck 2020-06-11 12:50:17 +09:00
BlueGreenMagick
552db2b94d remove self.deck set to mw.col as it isn't used 2020-06-11 11:59:27 +09:00
Quentin Nerden
86713d110e
Update message to match gui
The Change Note Type... command is under the Notes menu, not the Edit menu
2020-06-09 11:49:47 +02:00
Damien Elmes
f44597bb3a
Merge pull request #650 from evandroforks/remember_last_inputs
Remember last inputs for Find and Replace and Duplicates Find
2020-06-09 14:43:58 +10:00
Damien Elmes
3275aff335
Merge pull request #662 from gaul/screen/none
Handle None from QApplication.desktop().screen()
2020-06-09 14:42:59 +10:00
Damien Elmes
30a8d3260b
Merge pull request #655 from Arthur-Milchior/history_line
History line
2020-06-09 14:42:45 +10:00
Damien Elmes
62ab2ed36d remove unused import 2020-06-09 14:14:12 +10:00
Damien Elmes
1aaf1059b4 formatting 2020-06-09 14:07:39 +10:00
Damien Elmes
c77d017135 catch invalid regex in search
https://github.com/ankitects/anki/pull/652
2020-06-09 11:46:07 +10:00
Damien Elmes
43da12a445 (un)escape image references in HTML editor to fix ampersand handling
https://anki.tenderapp.com/discussions/ankidesktop/41479-image-names-with-are-breaking
2020-06-09 11:22:07 +10:00
Andrew Gaul
e366b86af2 Handle None from QApplication.desktop().screen()
This prevents a crash when Anki is open for multiple days.  Reference:
https://anki.tenderapp.com/discussions/ankidesktop/41879-qt-cannot-create-window-no-screens-available
2020-06-09 09:57:35 +09:00
Damien Elmes
5f2987d0f8 allow input.conf in Anki data folder
https://anki.tenderapp.com/discussions/beta-testing/1964-anki-2128-alpha#comment_48382756
2020-06-09 10:26:25 +10:00
Damien Elmes
4033f6d37e fix mistaken qconnect replacement 2020-06-09 10:20:16 +10:00
Damien Elmes
20ee0a8b1b fix 'NoneType' object has no attribute 'latest_progress'
https://anki.tenderapp.com/discussions/beta-testing/1964-anki-2128-alpha#comment_48382636
2020-06-09 09:07:41 +10:00
evandrocoan
947f58032f Moved the utils.py new save/restore functions together 2020-06-08 16:23:32 -03:00
evandrocoan
38fba41fb2 Renamed save_combo_index to save_combo_index_for_session 2020-06-08 16:23:28 -03:00
Arthur Milchior
c81a9b3d61 hook: history_line
I expect to use this hook to create an add-on which will simply remove
the ",,". By ignoring empty fields I expect to make this easier to
use.
2020-06-08 20:47:01 +02:00
Damien Elmes
7c444b4d35 add progress to db check 2020-06-08 21:07:36 +10:00
evandrocoan
1d32873869 Renamed new function on qt/aqt/utils.py to snake case 2020-06-08 01:35:31 -03:00
evandrocoan
b23b404f68 Created the profiles.py session attribute for things to forgot
each time Anki restarted and set to only fill the find and replace
dialogs when they were filled on the actual session.
2020-06-08 01:35:31 -03:00
evandrocoan
4bc895f7df Moved restoreComboHistory below saveComboHistory as others 2020-06-08 01:35:31 -03:00
evandrocoan
87d051fa71 Set to browser.py finddupes.ui remember the last selected field
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
bf55ebbd8a Added some type checking to utils.py QComboBox restore functions
# Conflicts:
#	qt/aqt/utils.py
2020-06-08 01:35:31 -03:00
evandrocoan
f27ad0c524 Moved restoreComboHistory closer to restoreComboIndex on utils.py 2020-06-08 01:35:31 -03:00
evandrocoan
6047c6ecc0 Renamed setupComboBoxHistory to restoreComboHisotory,
saveComboActiveIndex to saveComboIndex, saveComboBoxHistory to
saveComboHistory and restoreComboActiveIndex to restoreComboIndex.
2020-06-08 01:35:31 -03:00
evandrocoan
a78b3d522e Set to browser.py finddupes.ui remember the last search text
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
a74e43a515 Set to browser.py findreplace.ui remember the last selected field
by creating saveComboActiveIndex and restoreComboActiveIndex.

https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
40f98a244f Set to browser.py findreplace.ui remember the last regex/case
by creating the saveIsChecked and restoreIsChecked.

https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
54d7f136cb Created the setupComboBoxHistory and saveComboBoxHistory to remove
duplicated/common code.
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
3971ea5518 Set to remember the last replace input for findreplace.ui
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
ba99c5ecb5 Set to remember the last find input for findreplace.ui
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
Damien Elmes
a0c1b68b86
Merge pull request #660 from brownbat/tooltip-positioning
Update tooltip() in utils.py
2020-06-08 11:40:43 +10:00
Damien Elmes
fd895c88ca
Merge pull request #659 from BlueGreenMagick/paste-typehint
add type hint to paste-related functions
2020-06-08 11:32:16 +10:00
Damien Elmes
26330da119
Merge pull request #657 from BlueGreenMagick/prof-name
don't allow addons21 as profile name
2020-06-08 11:30:27 +10:00
Damien Elmes
186ccc5f01 pin legacy modules
https://anki.tenderapp.com/discussions/ankidesktop/42248-potentially-serious-image-issue#comment_48388863
2020-06-08 11:12:51 +10:00
Thomas B
26b94e1948 Update tooltip() in utils.py
Allow x,y offsets to be specified for tooltip(), useful for accomodating longer tooltips.
2020-06-07 16:06:23 -04:00
BlueGreenMagick
6cf95d97e7 add type hint to paste-related functions 2020-06-07 12:06:11 +09:00
BlueGreenMagick
7df3c9f0b1 don't allow addons21 as profile name
because addons21 and profiles directory are stored in same directory
2020-06-05 22:44:59 +09:00
Damien Elmes
4a69b55a90 add note/card removal to backend 2020-06-04 18:21:04 +10:00
Damien Elmes
e1b0fe1832 add .count() to hooks, and list->sequence in note deletion 2020-06-04 18:20:03 +10:00
Damien Elmes
4c6bd7b037 lint fixes 2020-06-02 17:58:14 +10:00
Damien Elmes
59bbf02364 new stubs don't require as many ignores 2020-06-02 17:56:32 +10:00
Damien Elmes
b3752e8618 fix initial login 2020-06-02 15:10:58 +10:00
Damien Elmes
f0b6d13ead save browser columns when changed, not on each browser close 2020-06-02 13:39:15 +10:00
Damien Elmes
4d7e23111e change sync label to indicate sync state
- blue for normal sync, red for full sync required
- refactor status fetching code so we don't hold a collection lock
during the network request, which slows things down
- fix sync spinner restarting when returning to deck list
2020-06-02 13:23:01 +10:00
Damien Elmes
49971d0235 fix media sync progress not updating, and issues closing profile 2020-06-01 13:57:10 +10:00
Damien Elmes
00138c6ba0 make sure browser sidebar refreshes on reset()
if items are modified in a sync, the sidebar needs to reflect it
2020-06-01 13:57:10 +10:00
Damien Elmes
90e19daec2 handle aborting normal sync
- Use a separate abort handle, as the media sync is running
in the background and we need to be able to target them separately.
The current progress handling is going to need a rethink if we introduce
any other background tasks in the future.
- Roll back the transaction when interrupting.
2020-06-01 13:57:10 +10:00
Damien Elmes
c6f0710ce7 report normal sync progress
Also:
- provide a way for the progress handler to skip the throttling so that
we can ensure progress is updated at the end of a stage
- show 'checking' at the end of full sync
2020-06-01 13:57:10 +10:00
Damien Elmes
6bf9f5bc6c lint fixes 2020-06-01 13:57:10 +10:00
Damien Elmes
27a36482c0 unify sync error handling; handle interrupted 2020-06-01 13:57:10 +10:00
Damien Elmes
a8ad4abf37 add "immediate" progress back
on ops which we know are going to take time, it makes the interface
look more responsive to pop up the progress more quickly
2020-06-01 13:57:10 +10:00
Damien Elmes
7e221f0acf update auto-sync code 2020-06-01 13:57:10 +10:00
Damien Elmes
058ff1b71a show server message if present 2020-06-01 13:57:10 +10:00
Damien Elmes
87ca8e39a8 progress bar tweaks 2020-06-01 13:57:10 +10:00
Damien Elmes
0e5b7da62a login/full up/full down plugged in 2020-06-01 13:57:10 +10:00
Damien Elmes
ee6d7f82e7 rework progress handling
- client now polls status instead of backend pushing it
- supports multiple threads
- update throttling happens in one place
2020-06-01 13:57:10 +10:00
Damien Elmes
b254b1f722 another snapshot of sync work
progress handler is going to need to be reworked to function across
threads
2020-06-01 13:57:10 +10:00
Damien Elmes
8516ed8655 handle images served from directory + svg content type
https://anki.tenderapp.com/discussions/ankidesktop/41974-win-linux-when-pasting-some-html-i-get-error-in-_run_command-ankirsbackendioerror-ioerror
2020-06-01 13:40:17 +10:00
Damien Elmes
caf95742da handle unicode hostnames
https://anki.tenderapp.com/discussions/ankidesktop/41915-something-wrong-and-i-cant-start-anki
2020-06-01 13:40:17 +10:00
evandrocoan
5bec874a7b Set to also print the correct QT log message category 2020-05-31 19:38:02 -03:00
evandrocoan
25ff525cc9 Print qt context if it exists
https://stackoverflow.com/questions/42561295/qt-error-is-printed-on-the-console-how-to-see-where-it-originates-from
https://stackoverflow.com/questions/35894171/redirect-qdebug-output-to-file-with-pyqt5
https://anki.tenderapp.com/discussions/ankidesktop/42070-anki-closes-without-warning-when-importing-conflicting-shared-deck
https://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandler
2020-05-31 19:38:02 -03:00
Damien Elmes
9594a3ef9b add some more names to about.py
If you've contributed and are missing from the list, please send me
a PR!
2020-06-01 06:27:14 +10:00
Damien Elmes
268edc237a
Merge pull request #645 from evandroforks/resize_clayout_editor_and_preview
Allow to resize clayout.py horizontal space between the text editor and the card preview
2020-06-01 05:53:40 +10:00
evandrocoan
9257e75762 Save and restore the debug console window geometry and splitter 2020-05-30 20:58:55 -03:00
evandrocoan
6bd80fef67 Add saveSplitter and restoreSplitter to clayout.py
# Conflicts:
#	qt/aqt/clayout.py
2020-05-30 20:33:57 -03:00
evandrocoan
a5fd8398c4 Allow to resize clayout.py horizontal space between the text editor
and the card preview.

# Conflicts:
#	qt/aqt/clayout.py
2020-05-30 20:33:10 -03:00
Damien Elmes
cfc2a549f1
Merge pull request #641 from glutanimate/add-main-window-did-init-hook
Add main_window_did_init hook
2020-05-29 08:56:47 +10:00
Damien Elmes
36bc50d65f
Merge pull request #640 from evandroforks/fix_render_card_being_called_twice
Fixed previewer.py::render_card() being called twice in row
2020-05-29 08:48:35 +10:00
Damien Elmes
255ac3679b add maximize button to HTML editor
closes ankitects/help-wanted#1
2020-05-29 08:43:33 +10:00
Damien Elmes
f3a8bb28d5 fix progress window not disappearing when importing csv 2020-05-29 08:40:25 +10:00
Glutanimate
6147356330 Add main_window_did_init hook and clarify difference to profile_did_open 2020-05-28 13:30:22 +02:00
evandrocoan
f78166cda2 Fixed previewer.py::render_card() being called twice in row
Related to: https://github.com/ankitects/anki/pull 529
Ensuring "setNote" is called only once during changing of note type

After debugging the code, every time the cards changes, there are
two stacktraces generated and triggered when note cards change:

calling 1590591251.4621403
   File "qt/runanki", line 4, in <module>
  File "F:\anki\qt\aqt\__init__.py", line 365, in run
    _run()
  File "F:\anki\qt\aqt\__init__.py", line 515, in _run
    app.exec()
  File "F:\anki\qt\aqt\webview.py", line 467, in handler
    cb(val)
  File "F:\anki\qt\aqt\editor.py", line 477, in <lambda>
    self.web.evalWithCallback("saveNow(%d)" % keepFocus, lambda res: callback())
  File "F:\anki\qt\aqt\browser.py", line 858, in <lambda>
    self.editor.saveNow(lambda: self._onRowChanged(current, previous))
  File "F:\anki\qt\aqt\browser.py", line 880, in _onRowChanged
    self._renderPreview(True)
  File "F:\anki\qt\aqt\browser.py", line 1576, in _renderPreview
    self._previewer.render_card(cardChanged)
  File "F:\anki\qt\aqt\previewer.py", line 136, in render_card
    print('calling', time.time(), "\n", "".join( traceback.format_stack() ) )

calling 1590591251.4766161
   File "qt/runanki", line 4, in <module>
  File "F:\anki\qt\aqt\__init__.py", line 365, in run
    _run()
  File "F:\anki\qt\aqt\__init__.py", line 515, in _run
    app.exec()
  File "F:\anki\qt\aqt\webview.py", line 467, in handler
    cb(val)
  File "F:\anki\qt\aqt\editor.py", line 453, in oncallback
    gui_hooks.editor_did_load_note(self)
  File "F:\anki\qt\aqt\gui_hooks.py", line 1168, in __call__
    hook(editor)
  File "F:\anki\qt\aqt\browser.py", line 887, in onLoadNote
    self.refreshCurrentCard(editor.note)
  File "F:\anki\qt\aqt\browser.py", line 884, in refreshCurrentCard
    self._renderPreview(False)
  File "F:\anki\qt\aqt\browser.py", line 1576, in _renderPreview
    self._previewer.render_card(cardChanged)
  File "F:\anki\qt\aqt\previewer.py", line 136, in render_card
    print('calling', time.time(), "\n", "".join( traceback.format_stack() ) )
2020-05-27 14:41:07 -03:00
sandersantema
8f993c8e31 remove unused variable 'w' from '_onHtmlEdit' 2020-05-27 12:04:49 +02:00
sandersantema
3407fb7b2b add saveGeom and restoreGeom to htmlEditor 2020-05-27 12:04:00 +02:00
Damien Elmes
835d1eb994
Merge pull request #637 from BlueGreenMagick/field-drag-drop-fix
fix drag drop field repositioning
2020-05-27 10:24:07 +10:00
Damien Elmes
4c89d0cc5e
Merge pull request #636 from BlueGreenMagick/typing-contextmenuevent
add evt type for contextMenuEvent method
2020-05-27 10:23:44 +10:00
Damien Elmes
7ef884d3b9
Merge pull request #635 from BlueGreenMagick/typing
add typehint for eventFilter method
2020-05-27 10:23:28 +10:00
Damien Elmes
d04699ad06 try mpv on Windows again
https://github.com/ankitects/anki/pull/621
2020-05-27 09:21:41 +10:00
Damien Elmes
c37390ae14 apply mpv fix
c0d9544812
2020-05-27 09:19:20 +10:00
Damien Elmes
97618564f4 fix typechecking breaking with latest mypy_protobuf
the change that caused it:
https://github.com/dropbox/mypy-protobuf/issues/118

This is more awkward to handle now, as the types are only available
at type-checking time. Python's static typing is such a mess :-(
2020-05-27 09:14:02 +10:00
BlueGreenMagick
ce512014f2 do nothing if dropPos == idx
since such move won't change the field position
and when trying to move the field below itself
may lead to it being moved below the next field
2020-05-26 18:59:53 +09:00
BlueGreenMagick
6f3ebafc46 fix drag drop field repositioning 2020-05-26 18:27:38 +09:00
BlueGreenMagick
8f4469d5e9 add evt type for contextMenuEvent method 2020-05-26 17:12:39 +09:00
BlueGreenMagick
99663be358 add typehint for eventFilter method 2020-05-26 17:08:55 +09:00
Damien Elmes
f9f07a7d55 allow hook to modify search text 2020-05-25 16:54:57 +10:00
Damien Elmes
6b05272ed4
Merge pull request #633 from hgiesel/dconf_hooks
Add three deck config hooks
2020-05-24 09:53:22 +10:00
Damien Elmes
38508c3ad7 use keyword args for calls with more than one argument 2020-05-24 09:12:47 +10:00
Damien Elmes
89dde3aeb0 migrate the remaining methods 2020-05-24 08:36:50 +10:00
Henrik Giesel
788a3eeced Satisfy black reformatter 2020-05-23 11:14:52 +02:00
Damien Elmes
081a61a438 more methods 2020-05-23 14:01:36 +10:00
Henrik Giesel
2074ffcf51 Add three deck config hooks
- gui_hooks.deck_conf_did_add_config
- gui_hooks.deck_conf_will_remove_config
- gui_hooks.deck_conf_will_rename_config
2020-05-22 21:24:05 +02:00
Damien Elmes
175afa9fee migrate more methods to service 2020-05-22 22:09:33 +10:00
Damien Elmes
6144317736 hook expected an int, not a str 2020-05-22 11:27:40 +10:00
Damien Elmes
cecf363c38 fix custom study not saving 2020-05-22 11:25:11 +10:00
Damien Elmes
0bf4fe400a fix deletion of decks; allow deleting cards from default
https://anki.tenderapp.com/discussions/beta-testing/1967-2126-189-g7384df8f-crash-at-note-types-fields-save#comment_48353232
2020-05-22 11:24:56 +10:00
Damien Elmes
9baa8530d5 move deck/notetype update hooks to gui
We need to migrate away from firing hooks in libanki, since libanki
methods may be running on a background thread, and hook consumers
typically expect the code to run in the main thread. We could document
it, but it would frequently be forgotten about, and could lead to
crashes.

https://anki.tenderapp.com/discussions/ankidesktop/41748-qobject-cannot-create-children-for-a-parent-that-is-in-a-different-thread-when-hitting-the-save-button-on-clayoutpy-window
2020-05-22 10:47:14 +10:00
Damien Elmes
16eceb5260 show 'changes saved' in parent window 2020-05-22 10:43:41 +10:00
Damien Elmes
9358c78bad show message when search fails 2020-05-22 10:43:28 +10:00
Damien Elmes
a4efd9910e monospace font in clayout 2020-05-22 09:58:20 +10:00
Damien Elmes
a3ac96443b use context manager in retrieveURL 2020-05-21 10:58:42 +10:00
Damien Elmes
d5d5ca9c3d clearer variable names in retrieveURL 2020-05-21 09:22:34 +10:00
evandrocoan
b388c43454 Fixed HttpClient session not being closed 2020-05-20 19:20:41 -03:00
Damien Elmes
300fba156e fix shortcut keys in clayout 2020-05-21 07:51:35 +10:00
Damien Elmes
e2bb5cd14a update missed storage._Collection references 2020-05-20 19:45:46 +10:00
Damien Elmes
50fdf9b03d storage->collection 2020-05-20 17:58:28 +10:00
Damien Elmes
c49c378296 move storage logic into collection.py; fix export bug
https://anki.tenderapp.com/discussions/ankidesktop/41495-using-file-export-closes-the-collection-on-mwcoldb-if-the-browser-window-is-open
2020-05-20 17:43:34 +10:00
Damien Elmes
eb0c9f6e0a fix progress bar getting stuck on image paste 2020-05-20 16:12:41 +10:00
Damien Elmes
6ae55a7a77 deprecate removeTempNote() 2020-05-20 15:01:05 +10:00
Damien Elmes
8da69c5d39 fix HTML editor in add screen 2020-05-20 14:59:22 +10:00
Damien Elmes
8f207cc900 drop mw.weakref usage in models.py for now
https://anki.tenderapp.com/discussions/beta-testing/1967-2126-189-g7384df8f-crash-at-note-types-fields-save
2020-05-20 13:53:34 +10:00
Damien Elmes
4fd8a4cf2d update empty cards hook
Closes #515
2020-05-20 13:41:09 +10:00
Damien Elmes
9876c30d89 tidy up Qt import 2020-05-20 13:38:55 +10:00
Damien Elmes
e564a47504
Merge pull request #625 from evandroforks/fixed_check_box_called_twice
Fixed clayout.py rendering the contents twice when clicked
2020-05-20 12:48:48 +10:00
Damien Elmes
1d4fd50d8b
Merge pull request #626 from evandroforks/fix_previewer_button
Fixed previewer button not resetting the state when the preview
2020-05-20 12:48:17 +10:00
evandrocoan
64a90a457c Fixed clayout.py rendering the contents twice when clicked
https://stackoverflow.com/questions/36808257/pyqt-radiobutton-ischecked-is-executed-twice
2020-05-19 20:17:20 -03:00
evandrocoan
3ea6f685b2 Added missing Anki icon to qt/aqt/previewer.py 2020-05-19 19:43:18 -03:00
evandrocoan
3dcfd57b07 Fixed previewer button not resetting the state when the preview
window is closed by its X button
2020-05-19 19:24:54 -03:00
evandrocoan
200bad3714 Explicitly close the importer file descriptor
https://github.com/ankitects/anki/pull 613
2020-05-18 15:54:20 -03:00
evandrocoan
efb62b9528 Add missing close file descriptors using context managers 2020-05-18 15:54:20 -03:00
Damien Elmes
31ceb5d730 simplify the migration popup
Avoid presenting the user with a wall of text they may not understand,
default to proceeding, and quit if the user cancels.
2020-05-18 20:15:59 +10:00
Damien Elmes
a53aac40f8
Merge pull request #610 from evandroforks/ask_confirmation_before_moving_anki_collection
Ask user confirmation before moving the Anki directory
2020-05-18 19:44:27 +10:00
Damien Elmes
e323a8f902
Merge pull request #619 from evandroforks/fix_empty_sound_tags
Also fix legacy.py::anki.sound._soundReg accepting empty tags
2020-05-18 19:31:22 +10:00
Damien Elmes
fe196bc1df
Merge pull request #620 from evandroforks/remove_unused_var
Remove unused t = time.time() variable on qt/aqt/browser.py
2020-05-18 19:20:08 +10:00
Damien Elmes
1fc951471c fix python3.7 lint issue 2020-05-18 18:08:57 +10:00
Damien Elmes
252eb3a444 fix shared deck conf warning 2020-05-17 14:37:59 +10:00
Damien Elmes
8b57a61746 use deck tree for new/review count calculation
- wins back the performance lost by the decks and dconf not being
in memory, and the overhead of serializing data for DB calls
- card counts are no longer capped to 1000
- learn counts are currently still calculated separately - can't merge
v1 counts without changing the existing behaviour
- partially rendering the tree may yield more savings
2020-05-16 20:28:03 +10:00
Damien Elmes
8eada2b57d add find_deck_in_tree() 2020-05-16 13:05:20 +10:00
Damien Elmes
578b60c104 save profile stats to file instead of generating report
Can use an external tool like snakeviz to query them after a run.
2020-05-16 12:53:01 +10:00
Damien Elmes
f6767d1cff fix lint issues 2020-05-16 12:20:20 +10:00
Damien Elmes
0c340eba64 fix+speed up deck list from Filters button
I don't think it makes much sense to keep these lists that largely
duplicate the sidebar functionality, but they remain for now.
2020-05-16 11:54:08 +10:00
Damien Elmes
f2086fc2e3 switch to new deck tree in deck browser
Saves us having to look up collapsed/filtered as we render, and gives
us type completion.
2020-05-16 10:52:14 +10:00
Damien Elmes
75d3eebafe drop usage of nameMap in deckbrowser
It was unnecessary, and being called multiple times as we recursed
downwards, slowing things down.
2020-05-16 10:02:08 +10:00
Damien Elmes
83adfb60cf avoid duplicate reset in overview 2020-05-15 21:54:56 +10:00
Damien Elmes
964a69e54e handle default deck and filtered deck suppression in the backend 2020-05-15 21:21:10 +10:00
Damien Elmes
2ac33500eb fetch stock notetypes from backend 2020-05-15 17:08:24 +10:00
Damien Elmes
f650e5557f add back card deletion count
cheaper to look up now that there's an index on notes.mid
2020-05-15 15:28:07 +10:00
Damien Elmes
00db72e365 show (Deck) when card hasn't been added 2020-05-15 15:01:28 +10:00
Damien Elmes
ed52a4dc3f when previewing cards, use the default deck for now
Replay code needs to be able to retrieve deck options. We should
probably use the current deck or pass it in in the future.
2020-05-15 14:50:57 +10:00
Damien Elmes
68e1303880 update replay suppression in clayout 2020-05-15 14:26:00 +10:00
Damien Elmes
46c363d4aa track changes in fields dialog as well
And avoid bumping schema until user actually saves, but warn at
start.
2020-05-15 13:59:44 +10:00
Damien Elmes
f1c5c88c10 no longer need to check addNote's return value 2020-05-14 21:59:42 +10:00
Damien Elmes
24ffb6ab76 check for empty cloze cards when rendering as well 2020-05-14 21:56:45 +10:00
Damien Elmes
782911471b add "fill empty" checkbox 2020-05-14 20:58:45 +10:00
Damien Elmes
9a222e620a update Add Field button 2020-05-14 18:01:15 +10:00
Damien Elmes
c5d574e9f4 use group box instead of tabs in card layout screen 2020-05-14 17:26:40 +10:00
Damien Elmes
5167bb57be start reworking card layout screen
- front/back/css shown in tabs
- front/back preview switchable; only one webview needs to be loaded
- dropdown to select cloze number in preview
- search box to search in front/back/css
2020-05-14 15:24:29 +10:00
Damien Elmes
f23eb350e4 drop availOrds(), and use backend for getting cloze numbers 2020-05-14 12:14:00 +10:00
Damien Elmes
c601dcef24 remove obsolete preview code 2020-05-14 09:22:53 +10:00
Damien Elmes
6680cdf1d3 update the card layout screen
- changes are now committed in bulk when closing the dialog,
and can be canceled
- it's not necessary to save the note to the database to preview it
- duplicate fields are now shown as duplicates in the top list
- redraw preview more quickly
- use + instead of _ when deduplicating names, as the latter is a
glob character
2020-05-13 17:24:49 +10:00
Damien Elmes
12b8fe6147 don't hide static template text when card is empty 2020-05-13 11:17:44 +10:00
evandrocoan
3f517c71e4 Remove unused t = time.time() variable on qt/aqt/browser.py 2020-05-12 15:09:22 -03:00
evandrocoan
f8c6300e27 Also fix legacy.py::anki.sound._soundReg accepting empty tags 2020-05-12 12:43:35 -03:00
Damien Elmes
9317cee9ba handle scheduling preferences in the backend 2020-05-12 21:13:34 +10:00
Damien Elmes
70cc1699a6 rewrite DB check
- notes with wrong field count are now recovered instead of
being deleted
- notes with missing note types are now recovered
- notes with missing cards are now recovered
- recover_missing_deck() still needs implementing
- checks required
2020-05-12 21:13:34 +10:00
Damien Elmes
2413f286b1 bulk tag add/remove/update; canonify on note save
also remove the tag list updated hook - we'll need a better solution in
the future than having the library code call back into the GUI code
2020-05-12 21:13:34 +10:00
Damien Elmes
7bab99d873 support disabling unicode normalization in notes 2020-05-12 21:13:34 +10:00
Damien Elmes
05ca797ee6 add pep8 name for findReplace 2020-05-12 21:13:34 +10:00
Damien Elmes
1852e32183 update find&replace in browser
sadly the UI still stutters on large selections - the calls
to get the selected rows from Qt are really slow.
2020-05-12 21:13:34 +10:00
Damien Elmes
c51ca666c3 catch schema mod in background
If the schema confirmation dialog is shown on a background thread it
will crash the app, so we convert this to an assertion error that gets
caught by the error handler. Code still needs to be updated to modify
the schema prior to moving to the background, but at least this way
it doesn't crash.
2020-05-12 21:13:34 +10:00
Damien Elmes
6e6d9ee1a3 check untyped in clayout 2020-05-12 21:13:34 +10:00
Damien Elmes
9f585d4d38 remove an unused import 2020-05-12 21:13:34 +10:00
Damien Elmes
25f122bf5c update fields and models diags
- field changes are now applied when user closes dialog with save
button, in bulk
- models diag now fetches note type and saves it as required, instead
of holding on top a copy that can grow stale as changes are made in
subdialogs
- both dialogs now perform operations in the backend
- note.model() now fetches the note type on the fly, instead of
holding on to a copy that may become stale
2020-05-12 21:13:34 +10:00
Damien Elmes
f6931197d2 add helper to run background task with progress 2020-05-12 21:13:34 +10:00
Damien Elmes
36c1d1cf8c reuse existing use count in note types screen 2020-05-12 21:13:33 +10:00
Damien Elmes
ce104d16a3 mypy/isort fixes 2020-05-12 21:13:33 +10:00
Damien Elmes
238441f2d9 use the backend for the deck due tree
- approx 3x faster on a large test deck
- counts are no longer capped to 1000 in the tree
2020-05-12 21:13:33 +10:00
Damien Elmes
67421e02ec add browserCollapsed as part of tree build 2020-05-12 21:13:33 +10:00
Damien Elmes
a0160d7f1e fix mypy issues 2020-05-12 21:13:33 +10:00
Damien Elmes
a88bc1e836 speed up browser load by rendering deck tree in Rust and skipping counts 2020-05-12 21:13:33 +10:00
Damien Elmes
0bb80329e8 ensure collection doesn't get stuck open if loading fails 2020-05-12 21:13:33 +10:00
Damien Elmes
23586ffe90 catch template errors, and start on discarding changes to fields/cards
This is only a first step - all the current methods that implicitly
save need to be updated.
2020-05-12 21:13:33 +10:00
Damien Elmes
6e8860cafa hook the empty cards code up to the GUI 2020-05-12 21:13:33 +10:00
Damien Elmes
f637ac957d hook up new note and note type handling
- notetypes are fetched from the DB as needed, and cached in Python
- handle note type changes in the backend. Multiple operations can now
be performed in one go, but this is not currently exposed in the GUI.
- extra methods to grab sorted note type names quickly, and fetch by
name
- col.models.save() without a provided notetype is now a no-op
- note loading/saving handled in the backend
- notes with no valid cards can now be added
- templates can now be deleted even if they would previously
orphan notes

a number of fixmes have been left in notes.py and models.py
2020-05-12 21:13:33 +10:00
Damien Elmes
1ca7fb4a80 use quick check instead of full integrity check on collection close 2020-05-12 21:13:33 +10:00
evandrocoan
5f9dbf9b7d Set to restart Anki application after profile directory migration
Ask user confirmation before moving the Anki directory
https://github.com/ankitects/anki/pull 610
2020-05-10 18:30:58 -03:00
Damien Elmes
7078415405 avoid renaming completer_, as add-ons depend on it 2020-05-08 18:17:57 +10:00
Damien Elmes
c02716ccd8 python formatting+lints 2020-05-08 17:30:27 +10:00
Damien Elmes
2a0d40e15d stats area grouping box fix
https://anki.tenderapp.com/discussions/beta-testing/1928-cosmetic-issue
2020-05-08 16:03:29 +10:00
Damien Elmes
4a26e2ba77 bundle socks
https://anki.tenderapp.com/discussions/ankidesktop/39801-sync-error
2020-05-08 15:26:19 +10:00
evandrocoan
9f5c69ee94 Keep an window open showing the migration is in progress 2020-05-07 15:03:43 -03:00
evandrocoan
453da45c99 Ask user confirmation before moving the Anki directory
https://anki.tenderapp.com/discussions/ankidesktop/41245-unwanted-file-movingdeleting-behavior
2020-05-07 14:59:19 -03:00
Damien Elmes
961833a137 avoid mention of pip 2020-05-05 16:30:22 +10:00
Damien Elmes
2f57c646e0 benchmark->profile, and remove from error branches 2020-05-05 16:28:49 +10:00
Damien Elmes
e7ebcc7c75
Merge pull request #605 from evandroforks/benchmark_option
Created the --benchmark command line option
2020-05-05 16:23:00 +10:00
Damien Elmes
16d0bf24b4
Merge pull request #608 from evandroforks/fix_missing_pyaudio_import
Fix missing pyaudio blocking Anki from running
2020-05-05 16:22:34 +10:00
evandrocoan
0006269c01 Used showWarning asking the user to install pyaudio 2020-05-05 00:00:48 -03:00
evandrocoan
338e904bd4 Created the ANKI_RUN_BENCHMARK environment variable replacing
the command line argument.
2020-05-04 23:46:13 -03:00
evandrocoan
2e11a596aa Fixed profiler word misspelling and stopped trimming the output 2020-05-04 23:15:23 -03:00
Damien Elmes
08f894735a
Merge pull request #607 from Arthur-Milchior/remove_a_try
Simplify the copying of field contents when resetting
2020-05-05 11:36:17 +10:00
Damien Elmes
b932333246 fix card layout screen on qt 5.9 regression (#592) 2020-05-05 11:26:13 +10:00
evandrocoan
b671c8e627 Fix missing pyaudio blocking Anki from running
https://github.com/ankitects/anki/pull 606
Remove pyaudio as mandatory dependency
2020-05-04 13:44:12 -03:00
Damien Elmes
5236e20a7a
Merge pull request #580 from Arthur-Milchior/debug_diag
mw.debug_diag is the dialog and not the window
2020-05-04 14:07:15 +10:00
Damien Elmes
9502fe790f
Merge pull request #584 from Arthur-Milchior/onModelchangeUsed
On modelchange used
2020-05-04 14:06:35 +10:00
Damien Elmes
6c20e5a7df
Merge pull request #585 from Arthur-Milchior/addButtonSaveNewFunction
addButton always save function
2020-05-04 13:58:46 +10:00
Damien Elmes
eec3fcf87a use qconnect everywhere, and fix some typing issues
a step towards check_untyped_defs in aqt, but there's still 100+
issues to resolve
2020-05-04 13:23:08 +10:00
Damien Elmes
164fdb37d5 fix saving searches in browser 2020-05-04 12:26:50 +10:00
evandrocoan
b63bfc83d8 Created the --benchmark command line option
https://anki.tenderapp.com/discussions/ankidesktop/41106-card-audio-playback-changes-bug-in-212x
Based on the snippet: https://gist.github.com/evandrocoan/961d46e10424e53ba8946fac66e0efac
2020-05-03 20:34:43 -03:00
Arthur Milchior
f2fbf667cd onModelChange: replacing try by if 2020-05-03 01:53:00 +02:00
Arthur Milchior
d427e1028b single try in onModelChange 2020-05-03 01:53:00 +02:00
Arthur Milchior
936bb31997 onModelChange save note
I like the way onModelChange is done. Except that you forget to use
the note you computed.
2020-05-03 01:53:00 +02:00
Damien Elmes
9645b85df8 fix deck confs not deleting
https://anki.tenderapp.com/discussions/ankidesktop/41044-bug-report-anki-2124-macos-deleting-unused-option-groups
2020-04-30 08:10:29 +10:00
BlueGreenMagick
be6a5e2f13 Set tab width to 4 spaces
setTabStopWidth is deprecated, and setTabStopDistance is preferred
It's not entirely accurate however, which you can see
when you compare 10 tabs and 40 spaces
2020-04-29 11:34:09 +09:00
Arthur Milchior
3378daeca3 remove an useless asignment
Because fields of new notes are empty by default
2020-04-28 00:31:30 +02:00
Arthur Milchior
93d83e760b remove a try, for code clarity 2020-04-28 00:31:24 +02:00
Damien Elmes
0c8f6ced09 Revert "Merge pull request #583 from Arthur-Milchior/remove_a_try"
This reverts commit e9ca61d1eb, reversing
changes made to abb80231a5.
2020-04-28 07:38:23 +10:00
Arthur Milchior
e86817305a mw.debug_diag is the dialog and not the window
This will allow, for example, for add-ons to do self.debugDiag.text
and access the debugger text. I see very little reason to have a
direct access to the dialog window.

I should note that self.debugDiag is never used anywhere in the code,
so I think it should be deleted; unless you've heard of some add-on
using it.
2020-04-27 11:55:33 +02:00
Damien Elmes
e9ca61d1eb
Merge pull request #583 from Arthur-Milchior/remove_a_try
Simplify the code slightly
2020-04-27 19:12:00 +10:00
Arthur Milchior
31164adaec addButton always save function 2020-04-26 17:01:47 +02:00
Arthur Milchior
e4a0ccc059 remove an useless asignment
Because fields of new notes are empty by default
2020-04-26 14:49:16 +02:00
Arthur Milchior
1771be8f1e remove a try, for code clarity 2020-04-26 14:49:11 +02:00
BlueGreenMagick
f23a361876 use variable names 2020-04-26 15:47:19 +09:00
Damien Elmes
ce589fb975 Revert "Merge pull request #562 from ijgnd/master"
This reverts commit 4fb9dc734b, reversing
changes made to c8fb409a49.

https://anki.tenderapp.com/discussions/beta-testing/1920-config-can-copy-paste-but-cant-click-links-now
2020-04-21 09:10:45 +10:00
Damien Elmes
683f664d85 fix deleting deck configs 2020-04-20 13:23:05 +10:00
Damien Elmes
335815ab9c fix renaming not updating dropdown 2020-04-20 13:17:55 +10:00
Damien Elmes
c023bdd78e fix adding deck configs 2020-04-20 13:15:23 +10:00
evandrocoan
38fabcef52 Cache webview.py console regex expression and disable multiline 2020-04-17 03:43:16 -03:00
Damien Elmes
aa562f490c fix delays caused by console.log regression in PR #560
https://anki.tenderapp.com/discussions/beta-testing/1918-reliably-reproduced-bug-in-2124beta6
2020-04-17 10:51:03 +10:00
Damien Elmes
394f7c630c
Merge pull request #560 from evandroforks/fix_javascript_console_output
Fixed javaScriptConsoleMessage showing 'error on line'
2020-04-16 10:15:56 +10:00
Damien Elmes
4fb9dc734b
Merge pull request #562 from ijgnd/master
make help text selectable
2020-04-16 10:14:02 +10:00
Damien Elmes
a7d5d27778 catch and report issues when downgrading 2020-04-16 10:11:16 +10:00
Damien Elmes
07343f6c9f show a clearer error if the schema is too new
will hold off on making it translatable for now
2020-04-16 09:47:34 +10:00
Damien Elmes
d24cb66be9 downgrade manually
- A regular collection open/close no longer goes through the
upgrade/downgrade steps each time. This avoids wasted cycles, and will
become more important in the future when decks and note types are
split into separate tables.
- Added a downgrade button to the profiles screen to downgrade all
profiles and close the app.
- Downgrading is still automatic when exporting/doing a full sync.
2020-04-16 09:00:49 +10:00
Damien Elmes
a6b676039b work around full sync on start closing the app
This is just a temporary solution until the syncing code can be
reworked.

https://anki.tenderapp.com/discussions/ankidesktop/39761-anki-crashing-after-sync-and-download
2020-04-16 08:10:17 +10:00
evandrocoan
2f174b40a6 Set to use a regular expression to remove the server name because
it is less prone to break in future updates.
2020-04-15 16:27:41 -03:00
evandrocoan
7061aac16d Set to javaScriptConsoleMessage output to stdout because it
may raise error messages on the anki GUI.
2020-04-15 16:06:45 -03:00
ijgnd
e745677145
make help text selectable
This allows the user to copy e.g. values so that they don't have to retype them which might introduce typos.
2020-04-15 18:59:04 +02:00
Damien Elmes
16be20e2fa don't write log files when exporting 2020-04-15 21:45:32 +10:00
Damien Elmes
65cfcf9226 pare back dark mode support
Anki now solely relies on the night mode setting in the preferences
to decide whether to show in light or dark mode. Some users wanted
to run Anki in light mode while keeping the rest of their system dark,
and there were various display problems when dark mode was changed
after Anki started that couldn't be easily worked around.

NSRequiresAquaAppearance is set again, which means we can rely on
the interface appearing properly and not changing as the macOS theme
is changed.

Users who only use dark mode, and preferred the native look of widgets
in dark mode, can achieve the previous appearance by running the
following command in the terminal:

defaults write net.ankiweb.dtop NSRequiresAquaSystemAppearance -bool no

And the following in the debug console:

mw.pm.meta["dark_mode_widgets"] = True

This is hidden behind a debug console command because it requires the
user ensure their system is always set to the same light/dark mode
as Anki.
2020-04-15 21:44:56 +10:00
Damien Elmes
a552abe688 update if a compatible branch is found, even if mtime is wrong
https://anki.tenderapp.com/discussions/ankiweb/4668-addon-auto-update-problems
2020-04-15 18:47:04 +10:00
evandrocoan
f3c561b6d9 Fixed javaScriptConsoleMessage showing 'error on line' for
all lines. The new output format is:
JS info /_anki/reviewer.js:166 autoadd
JS error /_anki/reviewer.js:240 Uncaught (in promise) NotAllowedError: play() can only be initiated by a user gesture.
2020-04-15 04:12:47 -03:00
Damien Elmes
351d8a309f move autoplay() into card 2020-04-13 09:04:30 +10:00
Damien Elmes
10eb947402 fix replay audio again, and decouple the code from the reviewer 2020-04-13 08:59:36 +10:00
Damien Elmes
0c5f22f4ae avoid adjusting position if selected row is visible
https://anki.tenderapp.com/discussions/beta-testing/1868-anki-2124-beta#comment_48227037
2020-04-11 15:54:52 +10:00
Damien Elmes
698bf9c780
Merge pull request #550 from BlueGreenMagick/debugDiag-contextMenu
add clear actions to context menu in debug console
2020-04-11 14:19:46 +10:00
Damien Elmes
a068fcdc9f
Update main.py 2020-04-11 14:19:27 +10:00
Damien Elmes
8b3f0100e4 fix error when replaying audio in preview screen 2020-04-10 20:33:48 +10:00
Damien Elmes
c964be3961 make sure preview window is closed when browser closed 2020-04-10 20:32:48 +10:00
Damien Elmes
26f5b9250c grey out spinner if max=0
https://anki.tenderapp.com/discussions/ankidesktop/32710-custom-study
2020-04-10 20:32:48 +10:00
BlueGreenMagick
653f5765b8 add clear actions to context menu in debug console 2020-04-10 15:45:25 +09:00