mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Move supportText() to utils in order to allow use outside of errors
This commit is contained in:
parent
3b4ed41c5b
commit
569f42c0f5
2 changed files with 30 additions and 27 deletions
|
@ -7,7 +7,7 @@ import re
|
|||
|
||||
from anki.lang import _
|
||||
from aqt.qt import *
|
||||
from aqt.utils import showText, showWarning
|
||||
from aqt.utils import showText, showWarning, supportText
|
||||
from aqt import mw
|
||||
|
||||
if not os.environ.get("DEBUG"):
|
||||
|
@ -126,10 +126,10 @@ add-ons section</a> of our support site.
|
|||
""")
|
||||
if self.mw.addonManager.dirty:
|
||||
txt = pluginText
|
||||
error = self._supportText() + self._addonText(error) + "\n" + error
|
||||
error = supportText() + self._addonText(error) + "\n" + error
|
||||
else:
|
||||
txt = stdText
|
||||
error = self._supportText() + "\n" + error
|
||||
error = supportText() + "\n" + error
|
||||
|
||||
# show dialog
|
||||
txt = txt + "<div style='white-space: pre-wrap'>" + error + "</div>"
|
||||
|
@ -146,27 +146,3 @@ add-ons section</a> of our support site.
|
|||
# highlight importance of first add-on:
|
||||
addons[0] = "<b>{}</b>".format(addons[0])
|
||||
return txt.format(", ".join(addons))
|
||||
|
||||
def _supportText(self):
|
||||
import platform
|
||||
from aqt.utils import versionWithBuild
|
||||
|
||||
if isWin:
|
||||
platname = "Windows " + platform.win32_ver()[0]
|
||||
elif isMac:
|
||||
platname = "Mac " + platform.mac_ver()[0]
|
||||
else:
|
||||
platname = "Linux"
|
||||
|
||||
def schedVer():
|
||||
try:
|
||||
return self.mw.col.schedVer()
|
||||
except:
|
||||
return "?"
|
||||
|
||||
return """\
|
||||
Anki {} Python {} Qt {} PyQt {}
|
||||
Platform: {}
|
||||
Flags: frz={} ao={} sv={}
|
||||
""".format(versionWithBuild(), platform.python_version(), QT_VERSION_STR, PYQT_VERSION_STR, platname,
|
||||
getattr(sys, "frozen", False), self.mw.addonManager.dirty, schedVer())
|
||||
|
|
27
aqt/utils.py
27
aqt/utils.py
|
@ -567,6 +567,33 @@ def versionWithBuild():
|
|||
build = "dev"
|
||||
return "%s (%s)" % (appVersion, build)
|
||||
|
||||
def supportText():
|
||||
import platform
|
||||
from aqt import mw
|
||||
from aqt.utils import versionWithBuild
|
||||
|
||||
if isWin:
|
||||
platname = "Windows " + platform.win32_ver()[0]
|
||||
elif isMac:
|
||||
platname = "Mac " + platform.mac_ver()[0]
|
||||
else:
|
||||
platname = "Linux"
|
||||
|
||||
def schedVer():
|
||||
try:
|
||||
return mw.col.schedVer()
|
||||
except:
|
||||
return "?"
|
||||
|
||||
return """\
|
||||
Anki {} Python {} Qt {} PyQt {}
|
||||
Platform: {}
|
||||
Flags: frz={} ao={} sv={}
|
||||
""".format(versionWithBuild(), platform.python_version(),
|
||||
QT_VERSION_STR, PYQT_VERSION_STR, platname,
|
||||
getattr(sys, "frozen", False),
|
||||
mw.addonManager.dirty, schedVer())
|
||||
|
||||
######################################################################
|
||||
|
||||
# adapted from version detection in qutebrowser
|
||||
|
|
Loading…
Reference in a new issue