Commit Graph

209 Commits

Author SHA1 Message Date
Damien Elmes
da9426177d typing fixes 2019-12-20 10:21:20 +10:00
Damien Elmes
a45f029f3e call onExpanded() 2019-12-20 09:30:35 +10:00
Damien Elmes
879db95148 honor expand setting 2019-12-20 09:27:14 +10:00
Damien Elmes
b2ea4ee36c fix click to expand/contract 2019-12-20 08:52:03 +10:00
Damien Elmes
867136eace faster sidebar implementation
- qtreewidget is too slow on Qt5
- expanding/collapsing still todo
2019-12-19 21:11:12 +10:00
Damien Elmes
eee099c0b2 add a few hints to some commonly used code
and add the extra hints mypy wanted
2019-12-16 19:46:40 +10:00
Damien Elmes
a735ed19ae clearer name for invalid column
https://github.com/dae/anki/pull/360
2019-12-12 09:54:26 +10:00
Damien Elmes
b1267028e3 flagging requires a current card
https://anki.tenderapp.com/discussions/ankidesktop/37324-bug-report
2019-12-06 14:23:54 +10:00
Damien Elmes
0df937061e add hack to fix go>note
https://anki.tenderapp.com/discussions/ankidesktop/37328-browsergo-note
2019-12-06 14:22:49 +10:00
Damien Elmes
ba9ece83f1 try 300ms preview delay
https://github.com/dae/anki/pull/357#issuecomment-560018459
2019-12-05 17:05:20 +10:00
Håkon J D Johnsen
9be993c76d Remove unnecessary lambda
Changing the signature of _renderScheduledPreview() made the
use of a lambda in _renderPreview() unnecessary. Remove it
to prevent linting errors.
2019-11-29 21:31:27 +01:00
Håkon J D Johnsen
419456eacd Fix race condition in rendering of preview window
Previously, if repeated calls to _renderPreview() were throttled by
the throttling mechanism, only the most recent value of
cardChanged would take effect, even if the card had changed
in previous _renderPreview() calls.

After this patch, if any of the throttled _renderPreview() calls
were called with cardChanged=True, the final _renderScheduledPreview()
will happen with cardChanged=True
2019-11-29 21:27:50 +01:00
Damien Elmes
a4cb3debe2
Merge pull request #346 from Arthur-Milchior/dontTranslateShortcut
Tells QT not to translate shortcuts.
2019-11-03 08:50:04 +10:00
Arthur Milchior
35f42523d5 Ensuring value of sortBackwards is a Boolean
As far as Python is concerned, this commit does not change anything at
all. The purpose of this commit is to avoid a rare bug in
AnkiDroid. https://github.com/ankidroid/Anki-Android/issues/5523

Indeed, because of
hh.sortIndicatorChanged.connect(self.onSortChanged), onSortChanged may
be called with the values 0 or 1 instead of True or False. Which means
than the method getBoolean in Ankidroid may throw an exception,
stating that the value is an integer and not a Boolean.
2019-10-28 04:25:12 +01:00
Arthur Milchior
26acc412b1 Adding explanation to translators
Some strings are missing in French at least. And some are quite
complex to understand. Especially without context, without knowledge
of Python. I tried to copy the only indication I found and add more
indication, hoping I did it correctly.
2019-10-24 02:36:32 +02:00
Damien Elmes
1c47eb73d0 fix preview failing to appear when 'show both sides' enabled 2019-05-17 15:16:13 +10:00
Damien Elmes
d24d485f06 preview code shouldn't assume self.card is valid 2019-04-15 12:20:12 +10:00
Damien Elmes
dac5ea2a7a ensure card info is closed properly 2019-04-09 16:21:43 +10:00
Damien Elmes
838545b1d6 fix preview not updating when note edited 2019-04-08 15:18:40 +10:00
Damien Elmes
e4eaebe2fb fix note not displaying when preview toggled off & on 2019-04-08 15:18:27 +10:00
Damien Elmes
44952ff727 revert undo shortcut change in browser
when ctrl+z pressed in focused field and no undo history left, qt
triggers the menu item instead, causing data loss

I tried capturing the shortcut in JS and manually executing the undo,
and that seems to work on macOS, but not on Windows.

fixes
https://anki.tenderapp.com/discussions/ankidesktop/33064-how-to-undo-reverted-to-state-deleting-my-cards
2019-03-11 13:43:25 +10:00
Damien Elmes
d0985a4e7c preview state depends on card id, not note id
fixes
https://anki.tenderapp.com/discussions/ankidesktop/32952-commit-c07f2d07474b52c065539fe9e56cbc6047856ad8-causes-preview-to-not-work-with-multiples-cards-of-same-note-cloze-deletions
2019-03-05 07:50:54 +10:00
Damien Elmes
ebdd8dae4b tidy up unused imports 2019-03-04 17:25:19 +10:00
Damien Elmes
4037a034aa fix inconsistent indentation 2019-03-04 16:54:22 +10:00
Damien Elmes
f6b2135129 fix some warnings 2019-03-04 16:01:10 +10:00
Damien Elmes
da2ddcc6e2 explicitly import _ and ngettext 2019-03-04 11:58:34 +10:00
Damien Elmes
fed15f5b90 include note id in state
to make sure we refresh when multiple notes have same mod time
2019-02-26 11:21:25 +10:00
Damien Elmes
c07f2d0747 avoid refreshing preview when nothing has changed
fixes visible redraw when:
- opening preview screen while cursor in field (as editTimer
fires even if note has not changed)
- moving between cards (as loadNote and rowChanged hooks are both
fired)
2019-02-26 11:18:32 +10:00
Damien Elmes
1603a5224e fix context menu in editor, and move workaround into shared function 2019-02-05 14:37:07 +10:00
Damien Elmes
372d5ed6e8 update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
Damien Elmes
ba9ebcf8f9 make sure change note type clears up hooks
if an error occurred after QDialog.accept() had been called,
the hook was left lying around and caused errors when reset later
fired

File "aqt\main.py", line 1028, in onCheckDB
  File "aqt\main.py", line 516, in reset
  File "anki\hooks.py", line 28, in runHook
  File "aqt\modelchooser.py", line 47, in onReset
  File "aqt\modelchooser.py", line 82, in updateModels
<class 'RuntimeError'>: wrapped C/C++ object of type QPushButton has been deleted
2018-12-15 12:45:17 +10:00
Damien Elmes
0769bf7ac9 apply stylesheet app wide, and add border to win10 menu
the night mode add-on may need updating with this change, but with
a global stylesheet it may be easier to style widgets in the future

menu bar issue:

https://anki.tenderapp.com/discussions/beta-testing/1313-anki-216-beta-1#comment_46664932
2018-12-14 20:35:12 +10:00
Damien Elmes
ed665557d5 ensure card list updated when editing html
using an extra hook is ugly, but there's a risk re-purposing
the editTimer hook will break an add-on that assumes the note
has already been loaded

https://anki.tenderapp.com/discussions/ankidesktop/30972-bug-editing-html-in-browser-not-saved-unless-tabbingclicking-to-other-field
2018-11-27 18:00:57 +10:00
Damien Elmes
35360df68d case-insensitive field sort in find dupes 2018-11-27 16:44:23 +10:00
Damien Elmes
5bce218312 limit find&replace fields to selected notes 2018-11-27 16:42:00 +10:00
Damien Elmes
d3c0ea46e2 normalize search text
https://anki.tenderapp.com/discussions/ankidesktop/30614-diacritics-changed-on-card-save-anki-21
2018-11-12 12:43:54 +10:00
Damien Elmes
fea23177e8 skip scroll if the number of cards has not changed
The scrolling behaviour is useful when cards are deleted, but
annoying in other cases such as when changing flags.
2018-11-12 12:26:23 +10:00
Damien Elmes
6609dfda7b prevent hiding of shortcuts in browser context menu 2018-11-12 12:13:58 +10:00
Damien Elmes
4acce5f96b checkmark on flags in browser 2018-11-12 12:10:50 +10:00
Damien Elmes
d2765eadd5 toggle flags instead of using separate clear action in browser 2018-11-12 11:55:37 +10:00
Damien Elmes
997cc95fc7 use a semi transparent, neutral selection in browser
As the base colour of rows is now visible, actions like flagging
now provide immediate feedback about what they've changed.
2018-11-12 11:02:01 +10:00
Damien Elmes
5e5d35e9c1 change purple flag to orange 2018-11-01 14:58:41 +10:00
Damien Elmes
2483e9c89e sidebar now visible by default 2018-10-28 12:24:54 +10:00
Damien Elmes
098434ff38 we can use the old undo shortcut on 5.11
webviews no longer propagate the captured shortcut
2018-10-23 18:40:58 +10:00
Damien Elmes
9ba8f9784d add rowChanged hook and ensure singleCard attr exists 2018-09-24 17:29:19 +10:00
Damien Elmes
18a7fb9dcd prioritize marked/flagged card colour over suspended colour 2018-09-05 16:55:26 +10:00
Damien Elmes
0acf9b38a4 support rtl text in sort field in browser 2018-08-08 10:39:54 +10:00
Damien Elmes
9c85e17628
Merge pull request #245 from glutanimate/fix-findreplace-showinfo-focus
Set showInfo parent explicitly in in browser find and replace
2018-07-26 16:31:13 +10:00
Damien Elmes
5f9a8f7960
Merge pull request #244 from glutanimate/fix-togglefield-reset
Make sure to end model reset when prematurely returning from toggleField
2018-07-26 16:25:01 +10:00
Glutanimate
7ea02d5ea9 Set showInfo parent explicitly in in browser find and replace
Fixes an issue where focus would be passed over to mw after longer
find and replace processing times.
2018-07-25 12:00:08 +02:00