de7e40537d
- a few issues to work out still, and editor changes not done yet - for communication between webengine and python code, we set window .location to 'http://anki/<something>' - the leading http is necessary for qt to call the link handler, which was introduced in qt5.5 - the designer files now use a promoted qobject to create instances of AnkiWebView - we use the css zoom property to alter webengine font size based on system dpi - prefs and addons folder stored in new location (at least for now)
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
# Copyright: Damien Elmes <anki@ichi2.net>
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
# fixme: make sure not to optimize imports on this file
|
|
|
|
import sip
|
|
import os
|
|
|
|
# fix buggy ubuntu12.04 display of language selector
|
|
os.environ["LIBOVERLAY_SCROLLBAR"] = "0"
|
|
|
|
from anki.utils import isWin, isMac
|
|
|
|
from PyQt5.QtCore import *
|
|
from PyQt5.QtGui import *
|
|
from PyQt5.QtWidgets import *
|
|
from PyQt5.QtWebEngineWidgets import *
|
|
|
|
from PyQt5.QtNetwork import QLocalServer, QLocalSocket
|
|
|
|
def debug():
|
|
from PyQt5.QtCore import pyqtRemoveInputHook
|
|
from pdb import set_trace
|
|
pyqtRemoveInputHook()
|
|
set_trace()
|
|
|
|
import sys, traceback
|
|
|
|
if os.environ.get("DEBUG"):
|
|
def info(type, value, tb):
|
|
from PyQt5.QtCore import pyqtRemoveInputHook
|
|
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
|
|
|
|
if qtmajor < 5 or (qtmajor == 5 and qtminor < 5):
|
|
raise Exception("Qt must be 5.5+")
|