krassowski / Anki-Night-Mode

Enabling studying at night with Anki - without eye strain
https://ankiweb.net/shared/info/1496166067
GNU General Public License v3.0
72 stars 13 forks source link

Incompatible with 2.1.17 beta 3 #90

Closed ghost closed 4 years ago

ghost commented 4 years ago

Problem description

According to the beta page, "add-on authors will need to modify their code to work with the new implementation. "

Checklist

Please put x inside brackets if following sentences apply to you:

Information about your Anki Setup

*Please open Anki, go to Help → About, look-up two lines, starting with `Version:` and `Qt` and copy-paste them below:* ``` Version:2.1.17 (da942617) Qt:5.14.0 PyQt 5.13.2 ``` *Please got to Night Mode → About now and copy-paste the first line from the pop-up window below:* ``` Night Mode 2.2.4 ``` *Please fill in your OS details (Linux/Mac/Windows):* ``` OS: Windows 10 ``` #### Backtrace (if any)
*If you had an error which resulted in producing exception with a backtrace, please paste the backtrace below:* Debug info: Anki 2.1.17 (da942617) Python 3.8.0 Qt 5.14.0 PyQt 5.13.2 Platform: Windows 10 Flags: frz=True ao=True sv=2 Caught exception: Traceback (most recent call last): File "aqt\progress.py", line 72, in handler File "aqt\browser.py", line 1001, in deferredDisplay File "", line 2, in buildTree File "anki\hooks.py", line 75, in decorator_wrapper File "anki\hooks.py", line 67, in repl File "C:\Users\John Smith\AppData\Roaming\Anki2\addons21\z1496166067\internals.py", line 218, in raw_new return wrapper(cls.instance, *args, **kwargs) File "C:\Users\John Smith\AppData\Roaming\Anki2\addons21\z1496166067\stylers.py", line 362, in buildTree for item in root.findItems('', Qt.MatchContains | Qt.MatchRecursive): AttributeError: 'SidebarTreeView' object has no attribute 'findItems'
krassowski commented 4 years ago

Thanks, will look into it.

On Fri, 20 Dec 2019 at 04:09, John Smith notifications@github.com wrote:

Problem description

According to the beta https://apps.ankiweb.net/docs/beta.html page, "add-on authors will need to modify their code to work with the new implementation. " Checklist

Please put x inside brackets if following sentences apply to you:

  • I verified that I use the lastest add-on version,
  • I verified that I use the lastest Anki version,
  • I tried to disable other add-ons to find the culprit,
  • I checked if anyone reported this problem before, as well as Known issues section on add-ons page,
  • My issue is solved when holding shift while starting Anki.

Information about your Anki Setup

Please open Anki, go to Help → About, look-up two lines, starting with Version: and Qt and copy-paste them below:

Version:2.1.17 (da942617)

Qt:5.14.0 PyQt 5.13.2

Please got to Night Mode → About now and copy-paste the first line from the pop-up window below:

Night Mode 2.2.4

Please fill in your OS details (Linux/Mac/Windows):

OS: Windows 10

Backtrace (if any)

If you had an error which resulted in producing exception with a backtrace, please paste the backtrace below:

Debug info: Anki 2.1.17 (da942617) Python 3.8.0 Qt 5.14.0 PyQt 5.13.2 Platform: Windows 10 Flags: frz=True ao=True sv=2

Caught exception: Traceback (most recent call last): File "aqt\progress.py", line 72, in handler File "aqt\browser.py", line 1001, in deferredDisplay File "<C:\Program Files\Anki\decorator.pyc:decorator-gen-146>", line 2, in buildTree File "anki\hooks.py", line 75, in decorator_wrapper File "anki\hooks.py", line 67, in repl File "C:\Users\John Smith\AppData\Roaming\Anki2\addons21\z1496166067\internals.py", line 218, in raw_new return wrapper(cls.instance, *args, **kwargs) File "C:\Users\John Smith\AppData\Roaming\Anki2\addons21\z1496166067\stylers.py", line 362, in buildTree for item in root.findItems('', Qt.MatchContains | Qt.MatchRecursive): AttributeError: 'SidebarTreeView' object has no attribute 'findItems'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/krassowski/Anki-Night-Mode/issues/90?email_source=notifications&email_token=ABMQBRTZQLFSHTBYTLW6FHTQZRAQXA5CNFSM4J5W3QS2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IB3CYBA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMQBRQIQM5K6U5B43R4IKTQZRAQXANCNFSM4J5W3QSQ .

-- Best regards, Michał Krassowski

twwn commented 4 years ago

Card browser fails with

"…/stylers.py", line 362, in buildTree
    for item in root.findItems('', Qt.MatchContains | Qt.MatchRecursive):
AttributeError: 'SidebarTreeView' object has no attribute 'findItems'

… due to the sidebar rewrite switching out QTreeWidget/SidebarTreeWidget with QTreeView/SidebarTreeView, that being the former's super class.

Maybe the only immediate breakage though, at least after commenting out the buildTree the rest seems to run as before.

ijgnd commented 4 years ago

just a heads-up: 2.1.17 was released today.

krassowski commented 4 years ago

Saw it, thanks for the remainder. Sadly, I won't have time to update the addon this week. If anyone has time and skills please do PR!

krassowski commented 4 years ago

Many thanks to @zjosua for providing a quick fix. This is a huge improvement (no errors), but the styling requires some work as the sidebar text is currently unredable for me:

Screenshot from 2020-01-12 17-20-19

ijgnd commented 4 years ago

maybe relevant: I think lovac42's commit to his fork wasn't mentioned here: https://github.com/lovac42/Anki-Night-Mode/commit/10d9830a9a581425458d73c44f94d57c6bb13ef3 and he released: Night Mode T1 (2.1.17 compatible)

krassowski commented 4 years ago

Good find, thanks! @lovac42 I am happy to merge your fix on top of the @zjosua's if it works better

(PS. I did not disappear, just doing some other stuff most of my weekends ;) I still do Anki to learn fast)

lovac42 commented 4 years ago

Good to hear from you krassowski and thanks for the merge.

I wanted to wait some time and test things properly before making a PR for this ticket. It looks like the current version have some compatibility issues on windows.

image image

This can be fixed like so: https://github.com/lovac42/Anki-Night-Mode/blob/add_2.1.17_support/night_mode/stylers.py#L359-L379

You can do a quick fix now, or I can make a PR some time later.

omega3 commented 4 years ago

On 2.1.19 Linux tar.gz version, after last Manjaro update I have some display problem: a white frame. I didn't experience this before this update. I have Nvidia 340.108 on 5.4.12-1 kernel. https://i.imgur.com/5h6Fn1L.png

I am not sure what was the cause of the problem but I returned to anki-2.1.15-linux-amd64.tar.bz2 and I don't experience this anymore. So, I guess it is not kernel or nvidia problem but maybe something with qt.

Operating System: Manjaro Linux KDE Plasma Version: 5.17.5 KDE Frameworks Version: 5.66.0 Qt Version: 5.14.0 Kernel Version: 5.4.12-1-MANJARO OS Type: 64-bit

Maybe it is not related directly to add-on. I also reported on Anki site: https://anki.tenderapp.com/discussions/beta-testing/1683-anki-2117-beta-4-all-platforms#comment_48012093

Edition: My problem also appears without Nitghmode add-on.

In Version 2.1.19 (3c8690ae) Python 3.8.1 Qt 5.14.0 PyQt 5.13.2 the problem appears even when I disabled all add-ons. Both with built in Anki feature "Show cards as white on black) enabled and when it is disabled:

https://i.imgur.com/VJUKo1Q.png https://i.imgur.com/uAycpSk.png

When I run 2.1.15 with the same add-on versions (all updated), there is no problem.

It appears also in browser. https://i.imgur.com/eiq9ylN.png

krassowski commented 4 years ago

@omega3 I would report it on the Anki support page.

krassowski commented 4 years ago

Thank you all for providing info and fixes, I've just released a new version with the @lovac42's fix and it seems perfect. Many thanks again!