ShoroukAziz / Beautify-Anki

An Anki addon that attempts to give Anki's deck browser and deck overview pages a material design look.
http://beautify-anki.shorouk.dev/
GNU Affero General Public License v3.0
150 stars 15 forks source link

The top bar where browse, stats, etc; are supposed to be only shows %s. #67

Open PedroCI opened 1 year ago

PedroCI commented 1 year ago

Before posting, please verify that you've done the following

Describe the bug The top bar where browse, stats, etc; are supposed to be only shows %s.

Screenshots image

Contex (please complete the following information):

Additional context In your Anki go to help > About > Copy Debug Log and paste it between the following backticks


    Anki 2.1.57 (6b7d372c) Python 3.9.15 Qt 6.4.2 PyQt 6.4.0
    Platform: Windows-10-10.0.22621
    Flags: frz=True ao=True sv=2
    Add-ons, last update check: 2023-02-21 21:04:07

    ===Add-ons (active)===
    (add-on provided name [Add-on folder, installed at, version, is config changed])
    '' ['Beautify Anki', 0, 'None', '']
    AnkiConnect ['2055492159', 2022-09-18T21:11, 'None', '']
    Kanji Grid ['909972618', 2019-01-09T19:40, 'None', '']
    Migaku Kanji GOD ['Migaku Kanji GOD', 0, 'None', mod]
    Review Heatmap ['1771074083', 2022-06-29T22:43, 'None', '']
    True Retention ['613684242', 2017-11-19T17:43, 'None', '']

    ===IDs of active AnkiWeb add-ons===
    1771074083 2055492159 613684242 909972618

    ===Add-ons (inactive)===
    (add-on provided name [Add-on folder, installed at, version, is config changed])
ormoyo commented 1 year ago

I would like to know that too

Barthol-io commented 1 year ago

It appears Anki 2.1.57 implemented new code for the Top toolbar. I installed 2.1.56 and got the toolbar back. Unfortunately it isn't a pretty toolbar, but I have addons that break further back I go.

I'm not super savvy with Python, but I do know deck_browser.py has a <nav> tag with the %s in question. If we could extract {toolbar_content} into it I think it might work? I should note that toolbar_content is def in Anki's toolbar.py in the draw function Commit dif between 2.1.57 and 2.1.56 firefox_2023-04-08_18-12-07 line 344 -> beautify-anki/deck_browser.py image

Russellzj commented 1 year ago

I can confirm that the toolbar is missing on my version of Anki as well

Ahm3d-Saleh commented 1 year ago

has anyone tried it with the new version of anki?

nikogenix commented 1 year ago

hey, I updated to Anki version 2.1.63 Qt6 and ran into this issue as well. starting based on @Barthol-io's findings, I think I managed to fix it, albeit in a spaghetti code style, since my experience with Python is almost non-existent.

Toolbar._body = """
<div style="font-size: 12px; text-align: {THEME[topbar-position]}; background-color: {THEME[topbar-color]}" width="100%">
""".format(THEME=THEME)

toolbar_content = "<div>{toolbar_content}</div>"
end_div = "</div>"

Toolbar._body = Toolbar._body + toolbar_content + end_div

in my extension files, this was on line 340 from beautify-anki/deck_browser.py.

so if anyone wants to try it out, just replace the 2nd snippet from Barthol with the stuff above.

for context, I ended up splitting the div because if I tried to apply the .format() to everything, including the {toolbar_content}, it would throw some error about the toolbar not being loaded yet, and I don't know what sort of callback/conditional would be needed to only run this code after the toolbar_content was actually available. tried to mess a bit with the __init__.py file as well, but that didn't go anywhere, so I figure this fix will have to suffice for now.

lastly, seeing how this repo has stopped being updated, did anyone else make a different one that's maintained so we could make a PR?

Ahm3d-Saleh commented 1 year ago

hey, I updated to Anki version 2.1.63 Qt6 and ran into this issue as well. starting based on @Barthol-io's findings, I think I managed to fix it, albeit in a spaghetti code style, since my experience with Python is almost non-existent.

Toolbar._body = """
<div style="font-size: 12px; text-align: {THEME[topbar-position]}; background-color: {THEME[topbar-color]}" width="100%">
""".format(THEME=THEME)

toolbar_content = "<div>{toolbar_content}</div>"
end_div = "</div>"

Toolbar._body = Toolbar._body + toolbar_content + end_div

in my extension files, this was on line 340 from beautify-anki/deck_browser.py.

so if anyone wants to try it out, just replace the 2nd snippet from Barthol with the stuff above.

for context, I ended up splitting the div because if I tried to apply the .format() to everything, including the {toolbar_content}, it would throw some error about the toolbar not being loaded yet, and I don't know what sort of callback/conditional would be needed to only run this code after the toolbar_content was actually available. tried to mess a bit with the __init__.py file as well, but that didn't go anywhere, so I figure this fix will have to suffice for now.

lastly, seeing how this repo has stopped being updated, did anyone else make a different one that's maintained so we could make a PR?

Screenshot (50) Thank you, it worked! Is there a way to get rid of that white line?

nikogenix commented 1 year ago

glad to hear that!

I have the white line too, it was reported in issue #66 and it was supposed to be fixed in PR #69, but since the project is not being updated, the PR was closed.

I tried to copy the changed file from that PR (user_files/assets/css/bootstrap.min.css), and it did fix the white line, but it also changed some other things regarding the formatting, which I didn't like, so I didn't keep the changes. if you wanna try it out, I'd recommend keeping a backup of your current file.

ROOMBON commented 1 year ago

Someone else took care of this addon and it solved all the above problems. https://ankiweb.net/shared/info/1116770498 Is it related to this? https://github.com/ShoroukAziz/Beautify-Anki/pull/69

nikogenix commented 1 year ago

oh right, I saw the new addon at some point, but I didn't test it out yet.

and yeah, the white line issue is related to #69.

sadikhossain69 commented 1 year ago

@ROOMBON thanks bro for the information