mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00

Earlier today I pushed a change that split this code up into multiple repos, but that has proved to complicate things too much. So we're back to a single repo, except the individual submodules are better separated than they were before. The README files need updating again; I will push them out soon. Aside from splitting out the different modules, the sound code has moved from from anki to aqt.
58 lines
1.4 KiB
Python
58 lines
1.4 KiB
Python
# Copyright: Ankitects Pty Ltd and contributors
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
# make sure not to optimize imports on this file
|
|
# pylint: disable=unused-import
|
|
|
|
import os
|
|
import sys
|
|
import traceback
|
|
|
|
from PyQt5.Qt import * # type: ignore
|
|
from PyQt5.QtCore import *
|
|
from PyQt5.QtCore import pyqtRemoveInputHook # pylint: disable=no-name-in-module
|
|
from PyQt5.QtGui import * # type: ignore
|
|
from PyQt5.QtWebEngineWidgets import * # type: ignore
|
|
from PyQt5.QtWidgets import *
|
|
|
|
from anki.utils import isMac, isWin
|
|
|
|
# fix buggy ubuntu12.04 display of language selector
|
|
os.environ["LIBOVERLAY_SCROLLBAR"] = "0"
|
|
|
|
|
|
try:
|
|
from PyQt5 import sip
|
|
except ImportError:
|
|
import sip # type: ignore
|
|
|
|
|
|
def debug():
|
|
from pdb import set_trace
|
|
|
|
pyqtRemoveInputHook()
|
|
set_trace()
|
|
|
|
|
|
if os.environ.get("DEBUG"):
|
|
|
|
def info(type, value, tb):
|
|
for line in traceback.format_exception(type, value, tb):
|
|
sys.stdout.write(line)
|
|
pyqtRemoveInputHook()
|
|
from pdb import pm
|
|
|
|
pm()
|
|
|
|
sys.excepthook = info
|
|
|
|
qtmajor = (QT_VERSION & 0xFF0000) >> 16
|
|
qtminor = (QT_VERSION & 0x00FF00) >> 8
|
|
qtpoint = QT_VERSION & 0xFF
|
|
|
|
if qtmajor != 5 or qtminor < 9 or qtminor == 10:
|
|
raise Exception("Anki does not support your Qt version.")
|
|
|
|
# GUI code assumes python 3.6+
|
|
if sys.version_info[0] < 3 or sys.version_info[1] < 6:
|
|
raise Exception("Anki requires Python 3.6+")
|