mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
catch apple odoc load events
This commit is contained in:
parent
a6ee73decb
commit
6fa907f198
2 changed files with 14 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
import os, sys, shutil
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from anki.hooks import runHook
|
||||
|
||||
appName="Anki"
|
||||
appVersion="0.9.9.7.1"
|
||||
|
@ -64,6 +65,14 @@ color: #13486c;
|
|||
def finish(self, obj):
|
||||
self.splash.finish(obj)
|
||||
|
||||
class AnkiApp(QApplication):
|
||||
|
||||
def event(self, evt):
|
||||
if evt.type() == QEvent.FileOpen:
|
||||
runHook("macLoadEvent", unicode(evt.file()))
|
||||
return True
|
||||
return QApplication.event(self, evt)
|
||||
|
||||
def run():
|
||||
import config
|
||||
|
||||
|
@ -93,7 +102,7 @@ def run():
|
|||
"config.db.old"))
|
||||
except:
|
||||
pass
|
||||
app = QApplication(sys.argv)
|
||||
app = AnkiApp(sys.argv)
|
||||
|
||||
import forms
|
||||
import ui
|
||||
|
|
|
@ -2219,6 +2219,10 @@ Consider backing up your media directory first."""))
|
|||
def setupSystemHacks(self):
|
||||
self.setupDocumentDir()
|
||||
self.changeLayoutSpacing()
|
||||
addHook("macLoadEvent", self.onMacLoad)
|
||||
|
||||
def onMacLoad(self, fname):
|
||||
self.loadDeck(fname)
|
||||
|
||||
def setupDocumentDir(self):
|
||||
if sys.platform.startswith("win32"):
|
||||
|
|
Loading…
Reference in a new issue