Skip to content

Commit

Permalink
Revert "Update Change_Font.py"
Browse files Browse the repository at this point in the history
This reverts commit 4f1e70d.
  • Loading branch information
noobj2 committed May 10, 2023
1 parent 4f1e70d commit 4d33384
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions Change_Font.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from aqt.webview import AnkiWebView
from aqt.webview import WebContent
from typing import Optional, List, Any
from aqt import mw, colors
from aqt import mw
from aqt import gui_hooks
from aqt.qt import *
from aqt.theme import theme_manager
from aqt.utils import showInfo
from anki import version
import anki
from anki.lang import is_rtl
from anki.utils import is_lin, is_mac, is_win
from anki.utils import isLin, isMac, isWin
anki_version = int(version.replace('.', ''))

config = mw.addonManager.getConfig(__name__)
Expand Down Expand Up @@ -82,10 +82,10 @@ def onApply(self):
showInfo("Changes will take effect after you restart anki.", title="Anki [Change Font]")

def restore_defaults(self):
if is_win:
if isWin:
font = "Segoe UI"
font_size = 12
elif is_mac:
elif isMac:
font = "Helvetica"
font_size = 15
else:
Expand Down Expand Up @@ -122,13 +122,13 @@ def stdHtml_new(
family = config["Interface Font"]
font_size = config["Font Size"]

if is_win:
if isWin:
# T: include a font for your language on Windows, eg: "Segoe UI", "MS Mincho"
# family = _('"Courier"')
widgetspec = "button { font-family:%s; }" % family
widgetspec += "\n:focus { outline: 1px solid %s; }" % color_hl
fontspec = "font-size:{}px; font-family:{};".format(font_size, family)
elif is_mac:
elif isMac:
# family = "Helvetica"
fontspec = 'font-size:{}px; font-family:"{}";'.format(font_size, family)
widgetspec = """
Expand Down Expand Up @@ -206,13 +206,13 @@ def stdHtml_old(self, body, css=None, js=None, head=""):
family = config["Interface Font"]
font_size = config["Font Size"]

if is_win:
if isWin:
#T: include a font for your language on Windows, eg: "Segoe UI", "MS Mincho"
# family = _('"Segoe UI"')
widgetspec = "button { font-size: 12px; font-family:%s; }" % family
widgetspec += "\n:focus { outline: 1px solid %s; }" % color_hl
fontspec = 'font-size:{}px; font-family:"{}";'.format(font_size, family)
elif is_mac:
elif isMac:
# family="Helvetica"
fontspec = 'font-size:{}px; font-family:"{}";'.format(font_size, family)
widgetspec = """
Expand Down Expand Up @@ -273,12 +273,12 @@ def standard_css_old(self) -> str:
family = config["Interface Font"]
font_size = config["Font Size"]

if is_win:
if isWin:
# T: include a font for your language on Windows, eg: "Segoe UI", "MS Mincho"
button_style = "button { font-size: 12px; font-family:%s; }" % family
button_style += "\n:focus { outline: 1px solid %s; }" % color_hl
font = "font-size:{}px;font-family:{};".format(font_size, family)
elif is_mac:
elif isMac:
font = 'font-size:{}px;font-family:"{}";'.format(font_size, family)
button_style = """
button { -webkit-appearance: none; background: #fff; border: 1px solid #ccc;
Expand Down Expand Up @@ -322,17 +322,18 @@ def standard_css_old(self) -> str:
"""

def standard_css_new(self) -> str:
color_hl = theme_manager.var(colors.BORDER_FOCUS)
palette = theme_manager.default_palette
color_hl = palette.color(QPalette.Highlight).name()

family = config["Interface Font"]
font_size = config["Font Size"]

if is_win:
if isWin:
# T: include a font for your language on Windows, eg: "Segoe UI", "MS Mincho"
button_style = "button { font-size: 12px; font-family:%s; }" % family
button_style += "\n:focus { outline: 1px solid %s; }" % color_hl
font = f"font-size:{font_size}px;font-family:{family};"
elif is_mac:
elif isMac:
font = f'font-size:{font_size}px;font-family:"{family}";'
button_style = """
button { -webkit-appearance: none; background: #fff; border: 1px solid #ccc;
Expand Down

0 comments on commit 4d33384

Please sign in to comment.