New toolkit and packaging test (Windows)

Hi all,

A test version of Anki built with the latest graphics toolkit and updated packaging is available. I’d appreciate it if you could give it a test and let me know if it runs correctly on your machine, and any regressions/improvements you notice.

Notes/known issues:

  • Windows 10 or 11 is required.
  • The toolkit has reworked their graphics handling, which should theoretically offer better performance and compatibility. There is no option to choose the video driver anymore.
  • Many add-ons are likely to fail to load with this test version, and you may be best off starting Anki with add-ons disabled.
  • As this is a snapshot of the current development code, it also includes other interface changes such as the editor work Henrik has been doing.
  • A generic icon is currently shown instead of the Anki icon.
  • Anki will currently display a separate console window when it is run.

Add-on authors:

  • The two main breakages are the renaming of PyQt5 to PyQt6 (you can support both by importing from aqt.qt instead), and the requirement that enums are qualified.
  • If you’re using Qt Designer to generate UI files, the Qt5 and Qt6 versions need to be generated separately if you want to support both at once.
  • The way Anki is packaged has changed. More of the standard library should be available by default, but it’s possible some libraries have not been packaged correctly - if something that used to work has broken, please let us know.
  • Python has been updated to 3.9.

Download:

https://apps.ankiweb.net/downloads/beta/

7 Likes

On Windows 10 everything works great, except for the things listed as known issues and for the gear icon, which appears as a blank square

image

The new editor is awesome, both the look and the MathJax preview / editor. :+1:

2 Likes

On windows 11,anki is running well.new-designed card editor and and tag are great,i like it!thanks for great works.

as @Ab_Bc describes,deck gear icon seems completely transparent.
Quicker_20211012_122245

And,error info in cmd appears after an empty deck created and the deck clicked though this has no influence on anki

Qt info:

GLImplementation:
Surface Type: OpenGL
Surface Profile: NoProfile
Surface Version: 3.0
Using Default SG Backend: yes
Using Software Dynamic GL: yes
Using Angle: no

Init Parameters:
  *  application-name Anki
  *  browser-subprocess-path C:\Program Files\Anki\lib\PyQt6\Qt6\bin\QtWebEngineProcess.exe
  *  disable-features DnsOverHttpsUpgrade,ConsolidatedMovementXY,InstalledApp,BackgroundFetch,WebOTP,WebPayments,WebUSB,PictureInPicture
  *  disable-gpu
  *  disable-speech-api
  *  enable-features TracingServiceInProcess
  *  enable-threaded-compositing

ignored late bridge cmd domDone
ignored late bridge cmd domDone
collection not open, ignore request for favicon.ico
JS error /_anki/pages/congrats.html:1 Uncaught SyntaxError: Identifier 'style' has already been declared

@hengiesel I didn’t want to submit a PR for such a trivial change, so I’m suggesting it here:


The editor is currently showing a rather ugly browser-default scrollbar - and there is about 2px of padding between fields and footer. It’s especially jarring in night mode. I noticed it on @ankibaby’s screenshot too, so it doesn’t seem to be limited to Linux.

image

It can be resolved by removing overflow-x: hidden; from this definition:

Then the much better looking Qt scrollbar will be used, like in previous versions.

image

That 2px padding between field and footer is also removed:
imageimage

2 Likes

@kleinerpirat
In the current dev version, there are some styling regressions in the editor. You can also see it when hovering over the buttons: the text/icons will change color. That is not intended :slight_smile: All of these regressions will certainly be adressed before a 2.1.49 release.

With the scrollbar, the intended effect was to exclusively move the scrollbar into the fields container, rather than having it on the toolbar and tag editor as well.

1 Like

Other than the known issues, so far so good.

I have the feeling (not 100% sure, maybe other users can confirm) that, while the first launch of the program takes more time, the rendering and the keyboard response are a little bit faster and smoother.

By the way, the new features are great, I love the new preview from the editor button in particular. Thanks!

Edit:

The gear icon doesn’t appear in my system, no matter if using night mode or not:
image

2 Likes

There is an empty select item in the preferences dialog, not sure what was there before. I guess it was the graphics driver select.

image

I get this at startup:

Qt warning: QT_OPENGL=angle is no longer supported in Qt 6
Qt warning: Invalid value set for  QT_OPENGL :  "angle"

Thats a bummer, because using angle was the only thing which helped with the memory leak issues
described in

Solution that worked was in this thread:
https://forums.ankiweb.net/t/ram-usage-goes-up-with-each-review-leading-to-slowdown

A quick test shows that resizing the main or add window now eats up my RAM again and never releases it.

1 Like

@hengiesel I like the look of the new editor, is it still coded in Svelte ?

It is, and there’s a PR that aims to complete the transition to Svelte with a few very nice extra additions such as the ability to collapse/hide field conponents and synchronized (side-by-side) editing between HTML editor (codable) and regular view (editable).

2 Likes

I just noticed that in the browser, when the order of a criterion is set to descending, clicking to change it to ascending doesn’t do anything and the following error appears in the console:
JS error /_anki/legacyPageData?id=2337858221392:0 ResizeObserver loop limit exceeded.

This happens with all the add-ons disabled as well.

3 Likes

Same problem here, but I don’t get any error in the console.

Going back to 2.1.48, it seems that I’ve been lost that funcionality there completely: I’m unable to sort the cards by column anymore (in card mode clickng on a column has no effect at all; note mode works as expected), and the captions of the columns are not centered:


Reinstalling 2.1.48 doesn’t work.

3 Likes

Pretty sure that is emitted by the Image resizing functionality. I’ve also seen that from time to time. I’ll give it a look.

2 Likes

I had the same problem after running the PyQt6 branch. The column header was broken for all prior Anki versions.
Sorry guys, I could have warned you, but I hadn’t realised until now what the issue was.

Solution

While the browser is closed, run the following in the Debug Console:

del self.pm.profile["editorHeader"]
del self.pm.profile["editorNotesModeHeader"]

No worries, this will only reset the order and width of columns as well as the sort column.

3 Likes

Hmm, that’s no good. Please test some things for me. in cmd.exe, run:

echo auto > %APPDATA%\Anki2\gldriver

Does that improve things when you start Anki again?

If not, other things you could try are:

set QSG_RHI_BACKEND=d3d11
"\program files\anki\anki"

or replacing d3d11 with vulkan or opengl

or closing and reopening the cmd.exe, and then using

set QSG_RHI_PREFER_SOFTWARE_RENDERER=1
"\program files\anki\anki"

At each step of the process, you can also get some debug info on the video driver by running the following in a debug console:

mw.web.set_open_links_externally(False)
mw.web.setUrl(QUrl("chrome://gpu"))

https://docs.ankiweb.net/misc.html#debug-console

1 Like

This seems to imply the saveState() calls are not forwards compatible - perhaps we need to be adding a Qt major version into the key in places where we use saveState()? We’d probably want to keep Qt5 using the existing key names.

And it isn’t backward compatible, either. Only PyQt6 doesn’t break reading a PyQt5 state.
It seems to be specifically about the QHeaderView though. Saving splitter states definitely works.

To confirm, do you mean Qt6 reads the Qt5 saved headers fine, but not vice versa?

No, Qt6 cannot read Qt5 headers, either. But it just ignores them, so it doesn’t break like Qt5 does in the inverse case.
Sorry, my intention was to say that the old saved headers can’t be carried over anyway, but it looks like I’ve achieved the opposite.

@Rumo gotcha, thanks.

@prollo the “echo auto” line was incorrect above; I have edited the post to correct it.

I can’t use <style> elements inside the HTML code of a field because as soon as I exit the HTML editor they are discarded. Is that intended?