Anki 2.1.45 Beta

I personally would use this feature quite often. I’m not sure how many others would but maybe better as a top menu item so it’s available, just not right on the surface?

@Rumo We already expose the full names in the editor tag field, so I’m not sure we’re saving the user from much complexity in this case, and it means we’re making things less flexible for power users. I’m not really fond of the idea of adding another option either, but maybe it’s worth considering changing the current behaviour to show the full name instead? Presumably Qt will show it scrolled to the right, so the part users likely want to change should be in view.

We’re currently using QAbstractItemView.edit() which doesn’t allow for setting a custom text. I assume that writing our own inline editor wouldn’t be trivial.
Of course, we could go back to opening a separate dialogue, but I find that cumbersome, and it would be redundant for saved searches, where the node text is already the full name.

Also, users who’ve never used hierarchical tags, but want to edit imported ones, can easily destroy the hierarchy if they’re prompted to enter a new full name, because they could reasonably assume that they are only going to replace the name of the node, which they have right-clicked.

1 Like

Bug: Trying to add an option preset in the new deckoptions, will let you write text on a write background. I’m on it.

1 Like

Settings are not showing up in Beta 3 when I go to Preferences on Mac. It just brings up a font selector.

Beta 4 is now available.

@basiskarten sorry, I meant to reply earlier. You make a decent argument for it, and if Anki already stored a permanent position for each card, I would probably add it. But unfortunately we’re limited to card creation order at the moment, and users need to rewrite their card ids+do a full sync when the order is incorrect. I’d prefer not to encourage that, so it’s probably best to wait until Anki adds a permanent ordering in some future update.

@Rumo hmm, good points too. So I guess we’re left with either leaving things as they are, or adding a separate context item like “rename full tag?”

@cso it’s good forum etiquette to post the solution when you discover it - I presume in this case you had some add-on causing the problem.

Well, Find & Replace already facilitates this. What about making it more user-friendly by adding tag completers when the dropdown menu is set to Tags, and maybe presetting the name of the current tag if there is one?

Beta 4 causes another startup error on Linux:

Traceback (most recent call last):
  File "runanki.py", line 3, in <module>
  File "/home/dae/venv/lib/python3.8/site-packages/PyInstaller-4.0.dev0+g2886519-py3.8.egg/PyInstaller/loader/pyimod03_importers.py", line 625, in exec_module
  File "aqt/__init__.py", line 15, in <module>
  File "/home/dae/venv/lib/python3.8/site-packages/PyInstaller-4.0.dev0+g2886519-py3.8.egg/PyInstaller/loader/pyimod03_importers.py", line 625, in exec_module
  File "anki/__init__.py", line 7, in <module>
  File "/home/dae/venv/lib/python3.8/site-packages/PyInstaller-4.0.dev0+g2886519-py3.8.egg/PyInstaller/loader/pyimod03_importers.py", line 625, in exec_module
  File "anki/collection.py", line 13, in <module>
  File "/home/dae/venv/lib/python3.8/site-packages/PyInstaller-4.0.dev0+g2886519-py3.8.egg/PyInstaller/loader/pyimod03_importers.py", line 625, in exec_module
  File "anki/_legacy.py", line 12, in <module>
ModuleNotFoundError: No module named 'stringcase'
[5152] Failed to execute script runanki

That fixed it, thanks!

These are nice ideas. However, I believe Find & Replace is an underused feature, mainly because it’s hidden up there in the notes menu. Also, I don’t think many people will know that replacing tags is supported.

Perhaps one could swap it with the redundant (at least in search mode) Search entry in this context menu, giving it a bit more prominence and also indicating that it can be used with tags now:

image


I’m thinking of an addition to _maybe_add_search_actions, that would add a context menu entry in the same category as Search (or replace it) and enable direct access to a prefilled Find & Replace dialog for the selected item.

That would make sense for the following item types:

  • SidebarItemType.TAG
    – prefill → Find: selected::tag
    – select → In: Tags
  • SidebarItemType.NOTETYPE_FIELD (PR #1238)
    – select → In: selectedField

Sigh, thanks. Beta 5 is now available.

Sounds good to me. But wouldn’t the “editing” section be more appropriate?
I’d prefer to keep Search, because it’s the only context action for some items, you can have a multi-selection in search mode, and it might be unnecessarily confusing to condition the available actions on the mode as well.

That would be fine too. Search section was just my intuition because in text editors, Find & Replace is usually located somewhere in the Find/Search tab, not the Edit tab.

Fair enough :+1:

Couple add-on errors on beta5. @dae perhaps these can be fixed within Anki rather than the add-ons?

AMBOSS (I think this has actually been broken for a while, i just never tried it. @glutanimate may know about it already)

File “aqt/webview.py”, line 229, in init
File “/Users/Nick/Library/Application Support/Anki2/addons21/1044112126/web.py”, line 190, in setPage
page.setBackgroundColor(self._getWindowColor())
AttributeError: ‘WebView’ object has no attribute ‘_getWindowColor’

Rebuild all filtered decks enhanced fork

File “/Users/Nick/Library/Application Support/Anki2/addons21/104518886/RebuildAll.py”, line 148, in
Card.flushSched = wrap(Card.flushSched, postSched)
AttributeError: type object ‘Card’ has no attribute ‘flushSched’

Auto rebuild (looks like same error as above)

File “/Users/Nick/Library/Application Support/Anki2/addons21/autoRebuild/RebuildAll.py”, line 70, in
Card.flushSched = wrap(Card.flushSched, postSched)
AttributeError: type object ‘Card’ has no attribute ‘flushSched’

The fancy html editor that @hengiesel added doesn’t work with Customize Keyboard Shortcuts toggled on as well. This was not an issue in beta3 so I’m not sure what’s going on. I can’t get any actual errors, it just reverts to the old html editor. @dae do you have any idea what’s causing this? If its something on your end to fix, great, but if not I can let the author know (they’re usually pretty responsive to version updates but it’d be best to let them know exactly what’s going on)

The error is due to my PR. I think it would be easier to fix the code on the add-on side. Here is a fix for the error:

diff --git a/web.py b/web.py
index 5f66da7..b15e39e 100644
--- a/web.py
+++ b/web.py
@@ -20,6 +20,7 @@
 import time
 from typing import TYPE_CHECKING, Any, Callable, List, NamedTuple, Optional

+from aqt.theme import theme_manager
 from aqt.utils import openLink
 from aqt.webview import AnkiWebPage, AnkiWebView
 from PyQt5.QtCore import QDateTime, QObject, QUrl, pyqtSignal
@@ -187,7 +188,7 @@ class WebView(AnkiWebView):
         super().load(url)

     def setPage(self, page: WebPage):
-        page.setBackgroundColor(self._getWindowColor())
+        page.setBackgroundColor(self.get_window_bg_color(theme_manager.night_mode))
         super().setPage(page)

     def navigate_forward(self):
2 Likes

This needs to be done by the add-on author. The code for the old HTML editor is still there (exactly because we don’t want to break add-ons), so this is not surprising.

1 Like

Ah that makes sense. I’ll add an issue for them

This was unintended, and I’ll try address this in the next beta. If you notice any other “no attribute” issues apart from flushSched, please let me know.

Edit: having looking into it further, I think in this case it’s best that the the add-ons be updated. The add-ons are overriding a method that is no longer used by Anki, so that functionality won’t have been working in previous stable releases either, even though no error was reported.

While I can undersand the idea behind, I personally find that presenting the deck options in two columns is rather confusing:

Just my two cents.

I think you’ll get used to it quickly :slight_smile:

The upside is you can now share (almost) all your options with one screenshot.
Also, you can still reduce the window width so it only shows one column.


My two cents is it makes it less confusing, because now you have a better overview.

Column-rule

If the main problem is the content flow from top to bottom instead of left to right, a vertical separator like this could help:

That would be a one-line CSS addition:

column-rule: 1px solid var(--medium-border);
2 Likes