Anki/aqt/qt.py
Damien Elmes bc758220a7 importing from the command line
- a file path provided on the command line now will now trigger the import
  process
- if anki was already running on win/lin, send the import to that process
- if no profile was open, wait until profile opened before importing
- don't do that for password-protected profiles, as it could be used abusively
  in a school environment
- drop the old pid-based instance check
2012-07-28 13:01:41 +09:00

31 lines
948 B
Python

# Copyright: Damien Elmes <anki@ichi2.net>
# 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
import sip, os
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)
sip.setapi('QUrl', 2)
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import QWebPage, QWebView, QWebSettings
from PyQt4.QtNetwork import QLocalServer, QLocalSocket
from PyQt4 import pyqtconfig
def debug():
from PyQt4.QtCore import pyqtRemoveInputHook
from pdb import set_trace
pyqtRemoveInputHook()
set_trace()
if os.environ.get("DEBUG"):
import sys, traceback
def info(type, value, tb):
from PyQt4.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