2019-02-05 04:59:03 +01:00
|
|
|
# Copyright: Ankitects Pty Ltd and contributors
|
2012-12-21 08:51:59 +01:00
|
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
|
2019-03-04 08:25:19 +01:00
|
|
|
# make sure not to optimize imports on this file
|
|
|
|
# pylint: disable=unused-import
|
2013-12-18 23:41:29 +01:00
|
|
|
|
|
|
|
import os
|
2012-12-21 08:51:59 +01:00
|
|
|
|
2016-05-31 10:51:40 +02:00
|
|
|
# fix buggy ubuntu12.04 display of language selector
|
|
|
|
os.environ["LIBOVERLAY_SCROLLBAR"] = "0"
|
|
|
|
|
2013-06-10 08:03:19 +02:00
|
|
|
from anki.utils import isWin, isMac
|
2013-12-18 23:41:29 +01:00
|
|
|
|
2016-06-06 07:50:03 +02:00
|
|
|
from PyQt5.Qt import *
|
2016-07-08 04:34:30 +02:00
|
|
|
# trigger explicit message in case of missing libraries
|
|
|
|
# instead of silently failing to import
|
2019-02-15 13:55:35 +01:00
|
|
|
from PyQt5.QtWebEngineWidgets import *
|
2018-10-23 08:02:59 +02:00
|
|
|
try:
|
|
|
|
from PyQt5 import sip
|
|
|
|
except ImportError:
|
|
|
|
import sip
|
2013-12-18 23:41:29 +01:00
|
|
|
|
2019-03-04 02:22:40 +01:00
|
|
|
from PyQt5.QtCore import pyqtRemoveInputHook # pylint: disable=no-name-in-module
|
|
|
|
|
2012-12-21 08:51:59 +01:00
|
|
|
def debug():
|
2019-03-04 07:54:22 +01:00
|
|
|
from pdb import set_trace
|
|
|
|
pyqtRemoveInputHook()
|
|
|
|
set_trace()
|
2012-12-21 08:51:59 +01:00
|
|
|
|
2013-12-18 23:41:29 +01:00
|
|
|
import sys, traceback
|
|
|
|
|
2012-12-21 08:51:59 +01:00
|
|
|
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
|
|
|
|
|
2013-05-17 08:17:04 +02:00
|
|
|
qtmajor = (QT_VERSION & 0xff0000) >> 16
|
|
|
|
qtminor = (QT_VERSION & 0x00ff00) >> 8
|
2016-07-18 05:59:45 +02:00
|
|
|
qtpoint = QT_VERSION & 0xff
|
2012-12-21 08:51:59 +01:00
|
|
|
|
2018-10-25 06:48:08 +02:00
|
|
|
if qtmajor != 5 or qtminor < 9 or qtminor == 10:
|
2019-03-04 07:54:22 +01:00
|
|
|
raise Exception("Anki does not support your Qt version.")
|
2018-06-07 03:36:11 +02:00
|
|
|
|
|
|
|
# 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+")
|