Commit Graph

271 Commits

Author SHA1 Message Date
Henrik Giesel
59d0e8f036 Add shortcut to new preview button 2021-01-10 00:00:19 +01:00
Henrik Giesel
28278fcc40 Remove preview button from browser.py top bar 2021-01-09 23:25:56 +01:00
Henrik Giesel
ece753991e Make button show its toggle state 2021-01-09 23:16:01 +01:00
Henrik Giesel
f5d429a5ca Put Preview button into editor inside browser 2021-01-09 22:34:53 +01:00
RumovZ
f83553c82a Merge branch 'master' into backend-filters
Adapt new formatting.
2021-01-09 19:03:43 +01:00
RumovZ
b763fc5b2a Use explicit wrapper functions to get filters 2021-01-09 16:48:47 +01:00
abdo
f7f509c70d Move tag collapse method to the backend 2021-01-09 17:10:16 +03:00
abdo
b33267f754 Do not check for missing tag parents at registration time 2021-01-09 17:10:16 +03:00
abdo
b276ce3dd5 Hierarchical tags 2021-01-09 17:10:13 +03:00
RumovZ
b99d9cda74 Prettify frontend filter code 2021-01-09 12:34:46 +01:00
RumovZ
fda2bfdb4e Use backend filters instead of literal searches 2021-01-09 10:51:15 +01:00
wallgrenen
e001cd4d3a remove unused variables and commented-out code 2021-01-08 20:53:27 +01:00
RumovZ
d30062a8a5 Compare and save filters normalised
When checking whether the current search is a saved filter, compare the
searches normalised to allow the detection of equivalent expressions.
Invalid searches are accepted unaltered to allow the deletion of invalid
saved filters.
As for saving new filters, do so normalised, respectively, reject
invalid searches.
2021-01-07 22:11:21 +01:00
RumovZ
478a3bd0bc Format 2021-01-07 18:20:14 +01:00
RumovZ
efd554ea29 Provide ConcatSeparator through rsbackend.py 2021-01-07 17:48:30 +01:00
Damien Elmes
b30b7c3073 fix qt/ pylints 2021-01-07 16:21:50 +10:00
Damien Elmes
94064b8230 convert setWindowFlags call into helper, and fix invalid variables
"type: ignore" was masking the invalid references to self in places
like showText()
2021-01-07 14:24:49 +10:00
Damien Elmes
a1c17d114a
Merge pull request #860 from RumovZ/norm-search
Normalise search
2021-01-07 10:51:36 +10:00
RumovZ
6ee9e4f58c Merge branch 'master' of https://github.com/ankitects/anki into norm-search 2021-01-06 20:57:24 +01:00
RumovZ
cbf68da630 Format 2021-01-06 20:35:11 +01:00
RumovZ
539f701573 Add exception handling for filter modifications 2021-01-06 20:25:13 +01:00
RumovZ
d9f7d2e70d Add tests for writer.rs
Also minor adjustments to concatenate_searches.
2021-01-06 19:39:34 +01:00
RumovZ
07499dd890 Implement search replacing via Ctrl+Shift combo
Also switch to using the new backend functions for concatenating and
negating searches.
2021-01-06 18:32:29 +01:00
BlueGreenMagick
6224658c0d remove context help button 2021-01-06 22:15:48 +09:00
RumovZ
6d6cd87b8f Adjust frontend to normalized search syntax 2021-01-06 14:05:28 +01:00
Damien Elmes
f3fa9daae2 do tag rename and tag clearing in background; move logic to tags.py
Because the logic is in rename_tag() now, it means we create a
checkpoint even if the tag is orphaned. This is because currently
checkpointing is a GUI responsibility. In the future we need to introduce
multi-level undo, and should move responsibility for managing it
to the backend.
2021-01-04 14:14:39 +10:00
Arthur Milchior
9166330618 NF: Add a hook to change the default search from reviewer
The goal here is to simplify my add-on which show a single card or the whole deck when the browser open
2021-01-02 19:49:11 +01:00
RumovZ
95b4e4cc84 Make function names more explicit and add docs 2020-12-29 11:18:49 +01:00
RumovZ
b712053c06 Norm search 2020-12-22 11:08:47 +01:00
Damien Elmes
0b848eae56 update remaining python format strings to Fluent 2020-11-22 14:57:53 +10:00
RumovZ
c185fb966b Merge branch 'master' into rework-search-parser
Conflicts:
    rslib/src/search/sqlwriter.rs
2020-11-18 09:04:04 +01:00
Damien Elmes
98a4a1927a formatting fix 2020-11-18 13:48:23 +10:00
Damien Elmes
c1e6149a1b fix browser updateTitle() 2020-11-18 13:40:21 +10:00
Damien Elmes
ba336d5de3 update multi-line _() references 2020-11-18 11:32:22 +10:00
Damien Elmes
1255e7530c update some qt ngettext references 2020-11-18 09:22:27 +10:00
Damien Elmes
2453e5c488 update temporary val="%s" references to standard ftl 2020-11-17 22:00:44 +10:00
Damien Elmes
6418993840 merge bulk of qt/ - designer files still to do 2020-11-17 17:42:43 +10:00
RumovZ
8d24fb89bf Update frontend search escapes to new parsing 2020-11-14 20:37:40 +01:00
RumovZ
557616f36a Fix clicking filters with keyboard modifiers 2020-11-08 11:05:11 +01:00
Soren Bjornstad
7277e9485a start with default value in reposition text box highlighted
This saves a keystroke if you want to replace the default value. It's
hard to imagine a situation in which you would want to *prepend*
characters to the default value, as is the current behavior. If you want
to accept the default value, you can still hit enter or tab immediately.
2020-11-02 19:07:53 -06:00
RumovZ
aaf5770db9 Work around Qt's focus bug (fix help-wanted#22)
Manually hide the editor's completer popup before accepting a short cut which changes the focus widget. Thus, work around the bug in PyQt 5.15 where a QLineEdit with open QCompleter popup won't get notified about focus changes handled by the Main Window, leading to inconsistent focus.
2020-10-24 10:47:25 +02:00
Damien Elmes
3d95d9e3c6
Merge pull request #799 from hgiesel/cal
Introduce Browser.search_for and Browser.update_search
2020-10-21 21:31:21 +10:00
Damien Elmes
fe5c4a2593
Merge pull request #798 from abdnh/escape-quotes-in-search
Escape double quotes in search
2020-10-21 21:28:51 +10:00
Henrik Giesel
9e44b2be7f Turn update_search into its own method 2020-10-19 21:07:29 +02:00
Henrik Giesel
450e85d36d Add search prompt for setupSearch 2020-10-19 20:57:19 +02:00
Henrik Giesel
54dc97825e Add uses of search_for 2020-10-19 20:51:36 +02:00
Henrik Giesel
2d65e81b13 Add search_for method 2020-10-19 20:37:17 +02:00
abdo
5677a67025 Escape double quotes in search 2020-10-19 01:06:41 +03:00
abdo
cd0523712f Fix typing warning 2020-10-12 11:01:15 +03:00
abdo
7c1b855709 Do sidebar switch check in browser init
https://github.com/ankitects/help-wanted/issues/6#issuecomment-706880794
2020-10-12 10:28:21 +03:00
abdo
82993d16fd Merge branch 'sidebar-context-menu' of https://github.com/abdnh/anki into sidebar-context-menu 2020-10-12 10:15:23 +03:00
Damien Elmes
a4a461c17b
Merge pull request #782 from johan456789/patch-1
fix outdated help site
2020-10-12 12:15:46 +10:00
abdo
4f5fdc192a Move new sidebar code to a separate file
- Move the new sidebar code and SidebarTreeView implementation to a
  new file. Old sidebar can be accessed with the shift key. The "new" sidebar
  doesn't add much for now.
- Make rename_deck work with subdecks
- Fix an issue when trying to open context menu over areas not populated
  with sidebar items
2020-10-10 04:42:49 +03:00
abdo
3708279f31 Merge commit 'refs/pull/590/head' of https://github.com/ankitects/anki into sidebar2 2020-10-10 04:11:54 +03:00
johan456789
06f1aeb052 fix help url paths 2020-10-10 00:38:07 +08:00
abdo
994d167fdb Fix 'Filter' menu item in deck filters not working 2020-10-07 14:32:21 +03:00
abdo
176126417e Escape ampersands in filter menu
Fixes ankitects/help-wanted#20
2020-10-07 13:44:33 +03:00
Damien Elmes
49ebb193cf
Merge pull request #769 from abdnh/escape-sidebar-terms
Escape browser sidebar search terms
2020-09-27 16:06:10 +10:00
Damien Elmes
2f654bcb88 fix old content appearing when flagging
https://forums.ankiweb.net/t/very-specific-but-quite-consistent-bug-in-browser/3685
2020-09-27 12:31:25 +10:00
abdo
e212df2160 Escape sidebar search terms 2020-09-25 21:05:34 +03:00
abdo
fc797f63c2 Fix previewer not refreshing when selecting multiple cards in browser 2020-09-24 07:05:16 +03:00
Damien Elmes
56ceb6ba76 set_deck() 2020-09-03 17:42:46 +10:00
Damien Elmes
d3dede057a move bury/suspend into backend 2020-09-01 10:24:38 +10:00
Henrik Giesel
dcf82fb403
Merge branch 'master' into resethook 2020-08-17 12:39:09 +02:00
Damien Elmes
06275478e0 close edit current window when card deleted
https://forums.ankiweb.net/t/bug-report-editor-updating-non-existing-card/2117
2020-08-17 20:07:48 +10:00
Henrik Giesel
7f503895d7 Create ResetReason enum 2020-08-16 18:56:32 +02:00
Henrik Giesel
db0a18106f Reorder + make all parameters optional 2020-08-16 18:56:32 +02:00
Henrik Giesel
ccc56d4355 Satisfy formatter 2020-08-16 18:56:32 +02:00
Henrik Giesel
dd515e65e7 Add new use of requireReset 2020-08-16 18:56:32 +02:00
Arthur Milchior
ae078d4fd0 Search_model has context
I have an add-on which allow to open multiple windows. So would like to know which browser has done the search. This
would allow me to have browser with various setting. In particular, I've an add-on which allow to show a single line by
note, and I would like for some browser to have this feature on and for some other to have this feature off.
2020-08-13 19:46:14 +02:00
Damien Elmes
05e90bcd23 find/replace completer should be case sensitive
https://forums.ankiweb.net/t/bug-report-search-and-replace/2037
2020-08-09 12:10:34 +10:00
Damien Elmes
cd72d6807a refresh tag list after clearing unused 2020-07-31 13:33:41 +10:00
Matt Krump
baa033bc78 Fix browser.py import sorting 2020-07-26 13:16:06 -06:00
Matt Krump
4239c2dfdc Cast set to list to fix mypy failure in browser.py 2020-07-26 13:00:06 -06:00
Matt Krump
b5222f935d Turn on check_untyped_defs for aqt.browser
* Turn on check_untyped_defs for aqt.browser
* Add type hints to browser
2020-07-25 17:31:49 -06:00
Damien Elmes
26426cb11e fix preview not updating on edit
https://forums.ankiweb.net/t/modification-and-preview/1331
2020-07-24 11:57:22 +10:00
Damien Elmes
f3febea4b0 update edited/changed column labels
https://github.com/ankitects/anki/pull/674/files
2020-06-29 18:34:03 +10: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
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
c77d017135 catch invalid regex in search
https://github.com/ankitects/anki/pull/652
2020-06-09 11:46:07 +10:00
evandrocoan
38fba41fb2 Renamed save_combo_index to save_combo_index_for_session 2020-06-08 16:23:28 -03:00
evandrocoan
1d32873869 Renamed new function on qt/aqt/utils.py to snake case 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
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
4a69b55a90 add note/card removal to backend 2020-06-04 18:21:04 +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
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
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
Damien Elmes
f9f07a7d55 allow hook to modify search text 2020-05-25 16:54:57 +10:00
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