tweak imports to work around tooling incorrectly finding module unused

fixes 'quit' from the profile menu, etc
This commit is contained in:
Damien Elmes 2013-12-19 07:41:29 +09:00
parent 33984b1f60
commit cc98ef3763
2 changed files with 9 additions and 3 deletions

View file

@ -2,9 +2,13 @@
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
# imports are all in this file to make moving to pyside easier in the future # imports are all in this file to make moving to pyside easier in the future
# fixme: make sure not to optimize imports on this file
import sip
import os
import sip, os
from anki.utils import isWin, isMac from anki.utils import isWin, isMac
sip.setapi('QString', 2) sip.setapi('QString', 2)
sip.setapi('QVariant', 2) sip.setapi('QVariant', 2)
sip.setapi('QUrl', 2) sip.setapi('QUrl', 2)
@ -18,14 +22,16 @@ from PyQt4.QtGui import *
from PyQt4.QtWebKit import QWebPage, QWebView, QWebSettings from PyQt4.QtWebKit import QWebPage, QWebView, QWebSettings
from PyQt4.QtNetwork import QLocalServer, QLocalSocket from PyQt4.QtNetwork import QLocalServer, QLocalSocket
def debug(): def debug():
from PyQt4.QtCore import pyqtRemoveInputHook from PyQt4.QtCore import pyqtRemoveInputHook
from pdb import set_trace from pdb import set_trace
pyqtRemoveInputHook() pyqtRemoveInputHook()
set_trace() set_trace()
import sys, traceback
if os.environ.get("DEBUG"): if os.environ.get("DEBUG"):
import sys, traceback
def info(type, value, tb): def info(type, value, tb):
from PyQt4.QtCore import pyqtRemoveInputHook from PyQt4.QtCore import pyqtRemoveInputHook
for line in traceback.format_exception(type, value, tb): for line in traceback.format_exception(type, value, tb):