remove format literals so we can support python 3.5
This commit is contained in:
parent
4f0e6561e8
commit
118326df1e
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if sys.version_info[0] < 3 or sys.version_info[1] < 6:
|
if sys.version_info[0] < 3 or sys.version_info[1] < 5:
|
||||||
raise Exception("Anki requires Python 3.6+")
|
raise Exception("Anki requires Python 3.5+")
|
||||||
|
|
||||||
if sys.getfilesystemencoding().lower() in ("ascii", "ansi_x3.4-1968"):
|
if sys.getfilesystemencoding().lower() in ("ascii", "ansi_x3.4-1968"):
|
||||||
raise Exception("Anki requires a UTF-8 locale.")
|
raise Exception("Anki requires a UTF-8 locale.")
|
||||||
|
@ -330,7 +330,7 @@ class AddonsDialog(QDialog):
|
|||||||
if not addon:
|
if not addon:
|
||||||
return
|
return
|
||||||
if re.match(r"^\d+$", addon):
|
if re.match(r"^\d+$", addon):
|
||||||
openLink(aqt.appShared + f"info/{addon}")
|
openLink(aqt.appShared + "info/{}".format(addon))
|
||||||
else:
|
else:
|
||||||
showWarning(_("Add-on was not downloaded from AnkiWeb."))
|
showWarning(_("Add-on was not downloaded from AnkiWeb."))
|
||||||
|
|
||||||
|
@ -1383,7 +1383,7 @@ where id in %s""" % ids2str(sf))
|
|||||||
|
|
||||||
self._updatePreviewButtons()
|
self._updatePreviewButtons()
|
||||||
self._previewWeb.eval(
|
self._previewWeb.eval(
|
||||||
f"{func}({json.dumps(txt)},'{bodyclass}');")
|
"{}({},'{}');".format(func, json.dumps(txt), bodyclass))
|
||||||
|
|
||||||
def _onPreviewShowBothSides(self, toggle):
|
def _onPreviewShowBothSides(self, toggle):
|
||||||
self._previewBothSides = toggle
|
self._previewBothSides = toggle
|
||||||
|
@ -145,8 +145,9 @@ add-ons section</a> of our support site.
|
|||||||
else:
|
else:
|
||||||
platname = "Linux"
|
platname = "Linux"
|
||||||
|
|
||||||
return f"""\
|
return """\
|
||||||
Anki {appVersion} Python {platform.python_version()} Qt {QT_VERSION_STR} PyQt {PYQT_VERSION_STR}
|
Anki {} Python {} Qt {} PyQt {}
|
||||||
Platform: {platname}
|
Platform: {}
|
||||||
Flags: frz={getattr(sys, "frozen", False)} ao={self.mw.addonManager.dirty}
|
Flags: frz={} ao={}
|
||||||
"""
|
""".format(appVersion, platform.python_version(), QT_VERSION_STR, PYQT_VERSION_STR, platname,
|
||||||
|
getattr(sys, "frozen", False), self.mw.addonManager.dirty)
|
||||||
|
@ -288,7 +288,7 @@ close the profile or restart Anki."""))
|
|||||||
if getattr(w, "silentlyClose", None):
|
if getattr(w, "silentlyClose", None):
|
||||||
w.close()
|
w.close()
|
||||||
else:
|
else:
|
||||||
showWarning(f"Window should have been closed: {w}")
|
showWarning("Window should have been closed: {}".format(w))
|
||||||
|
|
||||||
def unloadProfileAndExit(self):
|
def unloadProfileAndExit(self):
|
||||||
self.unloadProfile(self.cleanupAndExit)
|
self.unloadProfile(self.cleanupAndExit)
|
||||||
|
@ -119,12 +119,12 @@ class Reviewer:
|
|||||||
|
|
||||||
def revHtml(self):
|
def revHtml(self):
|
||||||
extra = self.mw.col.conf.get("reviewExtra", "")
|
extra = self.mw.col.conf.get("reviewExtra", "")
|
||||||
return f"""
|
return """
|
||||||
<div id=_mark>★</div>
|
<div id=_mark>★</div>
|
||||||
<div id=_flag>⚑</div>
|
<div id=_flag>⚑</div>
|
||||||
<div id=qa></div>
|
<div id=qa></div>
|
||||||
{extra}
|
{}
|
||||||
"""
|
""".format(extra)
|
||||||
|
|
||||||
def _initWeb(self):
|
def _initWeb(self):
|
||||||
self._reps = 0
|
self._reps = 0
|
||||||
|
@ -503,7 +503,7 @@ class MenuList:
|
|||||||
end = items[-1].title
|
end = items[-1].title
|
||||||
prefix = os.path.commonprefix([start.upper(), end.upper()])
|
prefix = os.path.commonprefix([start.upper(), end.upper()])
|
||||||
n = len(prefix)+1
|
n = len(prefix)+1
|
||||||
return f"{start[:n].upper()}-{end[:n].upper()}"
|
return "{}-{}".format(start[:n].upper(), end[:n].upper())
|
||||||
|
|
||||||
class SubMenu(MenuList):
|
class SubMenu(MenuList):
|
||||||
def __init__(self, title):
|
def __init__(self, title):
|
||||||
|
@ -217,21 +217,21 @@ border-radius:5px; font-family: Helvetica }"""
|
|||||||
from aqt import mw
|
from aqt import mw
|
||||||
head = mw.baseHTML() + head + csstxt + jstxt
|
head = mw.baseHTML() + head + csstxt + jstxt
|
||||||
|
|
||||||
html=f"""
|
html = """
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html><head>
|
<html><head>
|
||||||
<title>{self.title}</title>
|
<title>{}</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {{ zoom: {self.zoomFactor()}; {fontspec} }}
|
body {{ zoom: {}; {} }}
|
||||||
{buttonspec}
|
{}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
{head}
|
{}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>{body}</body>
|
<body>{}</body>
|
||||||
</html>"""
|
</html>""".format(self.title, self.zoomFactor(), fontspec, buttonspec, head, body)
|
||||||
#print(html)
|
#print(html)
|
||||||
self.setHtml(html)
|
self.setHtml(html)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user