ttempe / chinese-support-addon

Addon for Anki2 that makes easier to input Chinese, in the spirit of batterseapower’s pinyin-toolkit for Anki1
https://github.com/ttempe/chinese-support-addon/wiki
47 stars 19 forks source link

[WIP] Steps towards Compatibility with Anki 2.1 #72

Closed Yorwba closed 6 years ago

Yorwba commented 6 years ago

The changes in this PR are not backwards-compatible, so it shouldn't be merged. Anki 2.1 changes a bunch of APIs and uses Python 3/Qt5 instead of Python 2/Qt4, so it would have been difficult not to break compatibility.

Things that work without uncaught exceptions:

Things that are currently broken:

In both cases, the internal interfaces used to implement these features were removed from Anki, apparently in favor of a solution based on HTML/JavaScript. It will be necessary either to hook into their replacements, or to reimplement them.

Although not yet complete, it works well enough that I'll be using it from now on. Hopefully I'll find time to iron out those missing features.

joeminicucci commented 6 years ago

So if I'm not mistaken the only remaining pieces which are breaking the colored editing functionality is cjklib? What is causing the submenu to not showup?

Yorwba commented 6 years ago

No, I don't think there's any issue with cjklib. I have been using this branch for the past few months, and essentially it works. It's just not very user-friendly due to the missing features (like convenient configuration, which is kind of important).

There are no colors in the editor because they require CSS to be injected, but Anki 2.1 has revamped their editor code, so the old CSS injection strategy no longer works. It should be possible to adapt it, though.

The submenu doesn't show up because there no longer is a simple addons menu to hook into, so I commented that code out. This functionality should probably be provided by the "config" button of the new addon manager. Currently that just opens an editor for the raw JSON.

I might have the time to make the necessary changes sometime next week, but no promises. If anyone else wants to try their hand, the code that needs replacing was commented out in a6df731 and 167c118

muellert commented 6 years ago

I'm confused. Can someone please help me understand what's missing for this addon to work with Anki 2.1? My previous impression was that it is cjklib, which I have started to port, but if this is not the case, then I might prefer to work on something else, eg. polishing other parts of this addon.

Yorwba commented 6 years ago

@muellert You might be better off looking at https://github.com/luoliyan/chinese-support-redux, since the port seems to be significantly more complete than mine.

It's probably better if I close this PR, since it's unlikely that I'll ever complete it at this point.