Commit Graph

120 Commits

Author SHA1 Message Date
Damien Elmes
89dde3aeb0 migrate the remaining methods 2020-05-24 08:36:50 +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
50fdf9b03d storage->collection 2020-05-20 17:58:28 +10: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
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
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
964a69e54e handle default deck and filtered deck suppression in the backend 2020-05-15 21:21:10 +10:00
evandrocoan
3f517c71e4 Remove unused t = time.time() variable on qt/aqt/browser.py 2020-05-12 15:09:22 -03: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
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
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
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
BlueGreenMagick
f23a361876 use variable names 2020-04-26 15:47:19 +09: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
c964be3961 make sure preview window is closed when browser closed 2020-04-10 20:32:48 +10:00
Damien Elmes
61793f92b8 fix preview closing
https://anki.tenderapp.com/discussions/beta-testing/1868-anki-2124-beta#comment_48228480
2020-04-08 16:21:20 +10:00
Arthur Milchior
bda2935de1 _basename to basename, since it's not private in use 2020-04-06 23:51:50 +02:00
Arthur Milchior
5315b717c0 _basename used where possible 2020-04-06 23:51:42 +02:00
Arthur Milchior
69a9425cd0 replace _path by path (because it's not private here) 2020-04-06 23:50:43 +02:00
Arthur Milchior
266c2022b5 uses _path where possible 2020-04-06 23:50:37 +02:00
Damien Elmes
676f4e74a8 store config in separate DB table
- mtime is tracked on each key individually, which will allow
merging of config changes when syncing in the future
- added col.(get|set|remove)_config()
- in order to support existing code that was mutating returned
values (eg col.conf["something"]["another"] = 5), the returned list/dict
will be automatically wrapped so that when the value is dropped, it
will save the mutated item back to the DB if it's changed. Code that
is fetching lists/dicts from the config like so:

col.conf["foo"]["bar"] = baz
col.setMod()

will continue to work in most case, but should be gradually updated to:

conf = col.get_config("foo")
conf["bar"] = baz
col.set_config("foo", conf)
2020-04-06 15:39:47 +10:00
Damien Elmes
ac4284b2de update tag handling
- tag list stored in a separate DB table
- non-wildcard searches now do full unicode case folding
(eg tag:masse matches 'Maße')
- wildcard matches do simple unicode case folding
- some functions haven't been updated yet, so ascii folding will
continue to be used in some operations
2020-04-03 19:34:46 +10:00
Damien Elmes
a359c27c25 use old name for preview dialog to avoid breaking add-ons 2020-04-03 09:00:18 +10:00
Damien Elmes
4790fec881 render() conflicts with Qt method 2020-04-03 08:29:35 +10:00
Arthur Milchior
cd1fd6f9a2 snake case 2020-04-02 17:44:06 +02:00
Arthur Milchior
31f2f60757 Methods used by browser are not public
As suggested by Glutanimate on https://github.com/ankitects/anki/pull/532#discussion_r401254100
2020-04-02 17:44:06 +02:00
Arthur Milchior
0e21978577 remove the word preview from previewer variable
As suggested by glutanimate https://github.com/ankitects/anki/pull/532#discussion_r401255290
2020-04-02 17:44:06 +02:00
Arthur Milchior
944e82211f Class PreviewerBrowser
This let a previewer class which can be used to display a single card,
and a previewer for the browser
2020-04-02 17:44:06 +02:00
Arthur Milchior
45ccd4aa3c move previewer to a different class.
This uses exactly the same code, with one exception. In the previewer
`self` became `self.parent` in order to have action on the
browser. And in the browser, some `self` become `self.previewer` to
access the previewer. (Some function having an action on the previewer
starting from the browser now are separated in two. One version in the
previewer doing the same thing. One version in the browser, calling
the version in the previewer if it exists.)

Preview dialog now takes a QWidget in general, not necesarrily a
Browser. The parameter is called parent
2020-04-02 17:44:06 +02:00
Damien Elmes
b5f0f459ce ignore row change events that arrive after browser closed
https://anki.tenderapp.com/discussions/ankidesktop/40148-bug-when-suspending-cards
2020-04-02 19:44:51 +10:00
Damien Elmes
5fe747f14a left-align tags
https://anki.tenderapp.com/discussions/ankidesktop/40068-tags-column-in-browser-is-centered
2020-04-01 13:29:42 +10:00
Damien Elmes
c050833aba always position selection in center after search
https://anki.tenderapp.com/discussions/beta-testing/1888-retaining-position-when-searching
2020-04-01 11:01:20 +10:00
Arthur Milchior
4bb49d404e hook browser_header_will_show_context_menu 2020-03-27 23:06:22 +01:00
Hk-tang
521b0e9e14 Change not not to bool 2020-03-23 11:16:39 -06:00
Damien Elmes
99416477ac allow customizing search order 2020-03-21 17:38:09 +10:00
Damien Elmes
dfa7f5e142 fix reversing sort order 2020-03-21 16:57:33 +10:00
Damien Elmes
9afbcd4178 remove old finder code; add search hooks to browser & remove old one 2020-03-21 16:38:46 +10:00
Damien Elmes
63ce44aaa7 enable sorting on the extra browser columns 2020-03-21 07:55:53 +10:00
Damien Elmes
9ee82d55b1 disable word wrap in browser rows 2020-03-20 21:15:23 +10:00
Damien Elmes
13f3719650 ensure endReset() is called even if an exception is raised 2020-03-20 21:15:23 +10:00
Damien Elmes
1318118461 flush config on sort order change 2020-03-20 21:15:23 +10:00
Damien Elmes
0f38514ad7 drop the DB progress handler code
This code was an awful hack to provide some semblance of UI
responsiveness while executing DB statements on the main thread.
Instead, we can just run DB statements in a background thread now,
keeping the UI responsive.
2020-03-20 21:15:23 +10:00
Arthur Milchior
97225a0364 Browser introduce method time_format
I expect to use this in my add-on 1243668133 (by monkey patching in
this case) where it would allow to show hours/minutes/seconds... in browser
2020-03-19 22:59:59 +01:00