Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
PedroCI opened this issue Feb 22, 2023 · 10 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@PedroCI
Copy link

PedroCI commented Feb 22, 2023

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

  • read the "before you install instructions" and disabled all the known conflicted add-ons.
  • You've looked through previous issues to see if someone else had the same problem.

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):

  • OS: Windows
  • Anki Version 2.1.57
  • screen Resolution 1366 x 768

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])
    

@PedroCI PedroCI added the bug Something isn't working label Feb 22, 2023
@PedroCI PedroCI changed the title The top bar where create deck, browse, stats, etc; only shows %s. The top bar where browse, stats, etc; only shows %s. Feb 22, 2023
@PedroCI PedroCI changed the title The top bar where browse, stats, etc; only shows %s. The top bar where browse, stats, etc; are supposed to be only shows %s. Feb 22, 2023
@ormoyo
Copy link

ormoyo commented Mar 10, 2023

I would like to know that too

@Barthol-io
Copy link

Barthol-io commented Apr 9, 2023

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
Copy link

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

@Ahm3d-Saleh
Copy link

has anyone tried it with the new version of anki?

@nikogenix
Copy link

nikogenix commented May 17, 2023

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
Copy link

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
Copy link

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
Copy link

ROOMBON commented Jun 1, 2023

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?
#69

@nikogenix
Copy link

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
Copy link

@ROOMBON thanks bro for the information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants