コード例 #1
0
ファイル: main.py プロジェクト: jdeut/ankiqt
 def __init__(self, app, profileManager, args):
     QMainWindow.__init__(self)
     self.state = "startup"
     aqt.mw = self
     self.app = app
     self.pm = profileManager
     # running 2.0 for the first time?
     if self.pm.meta['firstRun']:
         # load the new deck user profile
         self.pm.load(self.pm.profiles()[0])
         # upgrade if necessary
         from aqt.upgrade import Upgrader
         u = Upgrader(self)
         u.maybeUpgrade()
         self.pm.meta['firstRun'] = False
         self.pm.save()
     # init rest of app
     try:
         self.setupUI()
         self.setupAddons()
     except:
         showInfo(_("Error during startup:\n%s") % traceback.format_exc())
         sys.exit(1)
     # were we given a file to import?
     if args and args[0]:
         self.onAppMsg(unicode(args[0], "utf8", "ignore"))
     # Load profile in a timer so we can let the window finish init and not
     # close on profile load error.
     self.progress.timer(10, self.setupProfile, False)
コード例 #2
0
ファイル: main.py プロジェクト: mstange/anki
 def __init__(self, app, profileManager, args):
     QMainWindow.__init__(self)
     self.state = "startup"
     aqt.mw = self
     self.app = app
     if isWin:
         self._xpstyle = QStyleFactory.create("WindowsXP")
         self.app.setStyle(self._xpstyle)
     self.pm = profileManager
     # running 2.0 for the first time?
     if self.pm.meta['firstRun']:
         # load the new deck user profile
         self.pm.load(self.pm.profiles()[0])
         # upgrade if necessary
         from aqt.upgrade import Upgrader
         u = Upgrader(self)
         u.maybeUpgrade()
         self.pm.meta['firstRun'] = False
         self.pm.save()
     # init rest of app
     try:
         self.setupUI()
         self.setupAddons()
     except:
         showInfo(_("Error during startup:\n%s") % traceback.format_exc())
         sys.exit(1)
     # were we given a file to import?
     if args and args[0]:
         self.onAppMsg(unicode(args[0], "utf8", "ignore"))
     # Load profile in a timer so we can let the window finish init and not
     # close on profile load error.
     self.progress.timer(10, self.setupProfile, False)
コード例 #3
0
 def __init__(self, app, profileManager, args):
     QMainWindow.__init__(self)
     self.state = "startup"
     aqt.mw = self
     self.app = app
     if isWin:
         self._xpstyle = QStyleFactory.create("WindowsXP")
         self.app.setStyle(self._xpstyle)
     self.pm = profileManager
     # running 2.0 for the first time?
     if self.pm.meta['firstRun']:
         # load the new deck user profile
         self.pm.load(self.pm.profiles()[0])
         # upgrade if necessary
         from aqt.upgrade import Upgrader
         u = Upgrader(self)
         u.maybeUpgrade()
         self.pm.meta['firstRun'] = False
         self.pm.save()
     # init rest of app
     if qtmajor == 4 and qtminor < 8:
         # can't get modifiers immediately on qt4.7, so no safe mode there
         self.safeMode = False
     else:
         self.safeMode = self.app.queryKeyboardModifiers(
         ) & Qt.ShiftModifier
     try:
         self.setupUI()
         self.setupAddons()
     except:
         showInfo(_("Error during startup:\n%s") % traceback.format_exc())
         sys.exit(1)
     # must call this after ui set up
     if self.safeMode:
         tooltip(
             _("Shift key was held down. Skipping automatic "
               "syncing and add-on loading."))
     # were we given a file to import?
     if args and args[0]:
         self.onAppMsg(unicode(args[0], "utf8", "ignore"))
     # Load profile in a timer so we can let the window finish init and not
     # close on profile load error.
     self.progress.timer(10, self.setupProfile, False)
コード例 #4
0
ファイル: main.py プロジェクト: amarkhor/anki
 def __init__(self, app, profileManager, args):
     QMainWindow.__init__(self)
     self.state = "startup"
     aqt.mw = self
     self.app = app
     if isWin:
         self._xpstyle = QStyleFactory.create("WindowsXP")
         self.app.setStyle(self._xpstyle)
     self.pm = profileManager
     # running 2.0 for the first time?
     if self.pm.meta['firstRun']:
         # load the new deck user profile
         self.pm.load(self.pm.profiles()[0])
         # upgrade if necessary
         from aqt.upgrade import Upgrader
         u = Upgrader(self)
         u.maybeUpgrade()
         self.pm.meta['firstRun'] = False
         self.pm.save()
     # init rest of app
     if qtmajor == 4 and qtminor < 8:
         # can't get modifiers immediately on qt4.7, so no safe mode there
         self.safeMode = False
     else:
         self.safeMode = self.app.queryKeyboardModifiers() & Qt.ShiftModifier
     try:
         self.setupUI()
         self.setupAddons()
     except:
         showInfo(_("Error during startup:\n%s") % traceback.format_exc())
         sys.exit(1)
     # must call this after ui set up
     if self.safeMode:
         tooltip(_("Shift key was held down. Skipping automatic "
                 "syncing and add-on loading."))
     # were we given a file to import?
     if args and args[0]:
         self.onAppMsg(unicode(args[0], "utf8", "ignore"))
     # Load profile in a timer so we can let the window finish init and not
     # close on profile load error.
     self.progress.timer(10, self.setupProfile, False)