Commit Graph

2093 Commits

Author SHA1 Message Date
Henrik Giesel
df7c597a8b Add option not include default css in stdHtml 2021-04-13 19:47:03 +02:00
Damien Elmes
18f03d5cb1
Merge pull request #1119 from hgiesel/reviewerdropjquery
Remove last jQuery from reviewer.ts / Remove fadeTime
2021-04-13 23:12:13 +10:00
Henrik Giesel
be7630648d Add setInnerHTML as a Replacement for $.html 2021-04-13 13:32:50 +02:00
Damien Elmes
e520e8df02 add missing copyright headers to *.ts 2021-04-13 18:57:08 +10:00
Damien Elmes
948fc5f777 add missing copyright headers to *.py 2021-04-13 18:45:35 +10:00
Henrik Giesel
c9fcf955f4 Remove display:none from mark and flag, and preset hidden attribute instead 2021-04-13 01:00:09 +02:00
Henrik Giesel
74a9d0b0a1 Make imageLoaded adhere to its function signature 2021-04-13 00:42:09 +02:00
Henrik Giesel
f4f0298378 Remove jQuery from mark and flag in reviewer.ts 2021-04-13 00:37:58 +02:00
Henrik Giesel
e131b70c4c Remove jQuery from _updateQA 2021-04-13 00:22:00 +02:00
RumovZ
2000c80fd2 Refactor browser and table into folders 2021-04-12 09:50:44 +02:00
Damien Elmes
12ce632605 handle missing default sort column in notes view
Switching to notes mode was throwing:

  File "/Users/dae/Work/code/dtop/bazel-copy/runanki.runfiles/net_ankiweb_anki/qt/aqt/browser.py", line 449, in on_table_state_changed
    self.table.toggle_state(checked, self._lastSearchTxt)
  File "/Users/dae/Work/code/dtop/bazel-copy/runanki.runfiles/net_ankiweb_anki/qt/aqt/table.py", line 206, in toggle_state
    self._state = self._model.toggle_state(
  File "/Users/dae/Work/code/dtop/bazel-copy/runanki.runfiles/net_ankiweb_anki/qt/aqt/table.py", line 996, in toggle_state
    self.search(context)
  File "/Users/dae/Work/code/dtop/bazel-copy/runanki.runfiles/net_ankiweb_anki/qt/aqt/table.py", line 1005, in search
    context.order = self.columns[self._state.sort_column]
2021-04-12 16:02:51 +10:00
RumovZ
d4159fef19 Save separate browser mode headers 2021-04-11 12:28:11 +02:00
RumovZ
fadec3dc5b Merge branch 'master' into backend-columns 2021-04-11 11:18:15 +02:00
RumovZ
db32179a25 Add browser_did_fetch_columns hook and some doc 2021-04-11 10:27:43 +02:00
RumovZ
eafa2afc0d Resolve config sort in table model 2021-04-10 11:33:59 +02:00
RumovZ
48b70873cb Rename column label fields 2021-04-10 09:14:20 +02:00
RumovZ
c74078ea9e Unify state columns
* Remove duplicate backend columns
* Remove duplicate column routines
* Move columns on frontend from state to model
* Generate available columns from Colum enum
* Add second column label for notes mode
2021-04-08 23:48:24 +02:00
RumovZ
8a131da9a2 Add enum for column sorting 2021-04-08 11:40:24 +02:00
RumovZ
d8a0aa922c Add enum for column alignment 2021-04-08 11:28:29 +02:00
RumovZ
f78401619a Remove Column class and use pb class instead 2021-04-08 11:17:25 +02:00
Damien Elmes
1ee4385fcf i18n tts error message 2021-04-08 09:35:19 +10:00
Damien Elmes
28f830730e fix '\\' being converted to single backslash
Appears the default changed in 3.x
https://github.com/mathjax/MathJax/issues/2532

https://forums.ankiweb.net/t/double-backslashes-in-text-of-notes-are-turned-into-single-backslashes-on-display/9048
2021-04-07 21:50:33 +10:00
RumovZ
6abb05d074 Save key for unsupported add-on columns 2021-04-06 23:02:58 +02:00
RumovZ
a5c02910a6 Use backend column objects on frontend 2021-04-06 19:47:03 +02:00
RumovZ
08226e2004 Change notes mode shortcut 2021-04-06 16:48:35 +02:00
Damien Elmes
6e954e82a5 current deck change is now undoable
- make sure we set flag in changes when config var changed
- move current deck get/set into backend
- set_config() now returns a bool indicating whether a change was
made, so other operations can be gated off it
- active decks generation is deferred until sched.reset()
2021-04-06 21:52:06 +10:00
RumovZ
4903a325d4 Fix get_item_from_card_id() 2021-04-06 12:06:08 +02:00
RumovZ
a1277b0919 Tweak new browsing strings 2021-04-06 11:41:18 +02:00
Damien Elmes
5676ad5101 update find&replace, and remove perform_op() 2021-04-06 17:07:38 +10:00
Damien Elmes
84fe309583 update scheduling ops
- migrate to CollectionOp()
- return actual change count when suspending/burying
- add helper to convert vec to vec of newtype
2021-04-06 16:38:42 +10:00
Damien Elmes
2de8cc1a94 update note ops
remove_note() now returns the count of removed cards, allowing us
to unify the tooltip between browser and review screen

I've left the old translation in - we'll need to write a script at
one point that gathers all references to translations in the code,
and shows ones that are unused.
2021-04-06 14:56:36 +10:00
Damien Elmes
bc78b6ef17 migrate more ops to CollectionOp 2021-04-06 14:36:13 +10:00
Damien Elmes
27c032a158 it seems mypy ignores the generic class bound if it's a type alias 2021-04-06 14:14:55 +10:00
Damien Elmes
b8fc195cdf start migrating perform_op() into builder in separate file
By passing back the builder to the calling code to run, we don't need
to plumb extra arguments like success= and handler= through each
operation, and the ability to override the default tooltip behaviour
comes free on all operations
2021-04-06 12:47:55 +10:00
Damien Elmes
1ece868d02 shift keep-current-selection logic into sidebar's refresh()
By calling refresh() manually after performing an op, we were refreshing
twice, and the selection was being lost when changes were made outside
of the sidebar.

Also drop the after_hooks arg to perform_op(), since nothing is using
it now.
2021-04-06 11:18:13 +10:00
Damien Elmes
3f62f54f14 more perform_op() tweaks
- pass the handler directly
- reviewer special-cases for flags and notes are now applied at
call site
- drop the kind attribute on OpChanges which is not needed
2021-04-06 10:14:11 +10:00
Damien Elmes
9c8148ff0d fix error when opening browser during review while notes mode active 2021-04-05 21:57:06 +10:00
Damien Elmes
758550ea17 fix row cache issues
I think this may have accidentally been changed in the refactoring.
If we discard self._rows, it will result in the entire table flashing
"..." until the new data is available. Instead, we leave the cached
rows alone, and just update the cutoff point, so we can serve stale
content (avoiding any visible redraw) until the new data is available.

I've updated search() to reset the rows there, so we free up memory
on a new search.
2021-04-05 14:42:04 +10:00
Damien Elmes
a18bb2af12 add booleans for various screens to OpChanges
The backend knows exactly which op has executed, and it saves us having
to re-implement this logic on each client.

Fixes the browser table refreshing when toggling decks.
2021-04-05 14:28:56 +10:00
Damien Elmes
f6ec5928ae allow ops to pass metadata into perform_op()
Instances can pass handled_by=self to more easily ignore events they
initiate.

Fixes ugly refresh when expanding/collapsing decks, but we're still
refreshing the card/notes area unnecessarily in that case.
2021-04-05 13:43:09 +10:00
Damien Elmes
996d9f9bbc undo support for tag collapse; expand->collapse for consistency w/ decks 2021-04-05 11:47:12 +10:00
Damien Elmes
2168dfe63d add routine to set deck collapse state
Updating a deck via protobuf is now exposed on the backend, but not
currently on the frontend - I suspect we'll be better off writing
separate routines for the actions we need instead, and we get a better
undo description for free.

This is currently causing an ugly redraw in the browse screen, which
will need fixing.
2021-04-05 11:19:04 +10:00
Damien Elmes
c60b88cd2f expose read-only access to new deck objects 2021-04-04 20:39:56 +10:00
Damien Elmes
12a3d9ec87 ensure page is shown when setHtml() called
https://forums.ankiweb.net/t/looked-into-the-bug-when-pressing-e-and-r-together-in-filtered-deck/8951
2021-04-03 16:59:23 +10:00
Damien Elmes
3a6f2a993e move operations into submodule 2021-04-03 16:26:10 +10:00
Damien Elmes
41c5a25dc8 simplify errors
- use a flat enum instead of oneof messages, most of which were empty
- tidy up the Python side
2021-04-03 16:06:46 +10:00
Damien Elmes
f666f15b63 use perform_op() for undo()
Instead of manually updating the UI after undoing, we just rely
on the same change notification infrastructure regular operations
use.
2021-04-03 14:38:49 +10:00
Damien Elmes
e73359510d move filtered deck labels to backend
- use strum to generate an iterator for the protobuf enum so we don't
forget to add new labels if extending in the future
- no add-ons appear to be using dynOrderLabels(), so it has been removed

@RumovZ perhaps a similar approach might work for listing the available
browser columns as well?
2021-04-01 23:53:38 +10:00
Damien Elmes
8449bbe469
Merge pull request #1108 from RumovZ/more-columns
Even more browser fixes and features
2021-04-01 15:59:06 +10:00
Damien Elmes
dd17da7d5c
Merge pull request #1106 from abdnh/fix-deprwarn
Fix deprecated implicit conversion from float to int using __int__()
2021-04-01 15:14:49 +10:00