tweak config and startup

This commit is contained in:
Damien Elmes 2011-04-24 12:06:20 +09:00
parent f4ee17a5c6
commit e28f5fe931
3 changed files with 11 additions and 42 deletions

View file

@ -3,9 +3,9 @@
# User configuration handling
##########################################################################
# The majority of the config is serialized into a string, both for easy access
# and backwards compatibility. A separate table keeps track of seen decks, so
# that multiple instances can update the recent decks list.
# The majority of the config is serialized into a string, so we can access it
# easily and pickle objects like window state. A separate table keeps track of
# seen decks, so that multiple instances can update the recent decks list.
import os, sys, time, random, cPickle
from anki.db import DB
@ -13,19 +13,11 @@ from anki.utils import isMac
defaultConf = {
'confVer': 3,
# remove?
'colourTimes': True,
# too long?
'deckBrowserRefreshPeriod': 3600,
'factEditorAdvanced': False,
'showStudyScreen': True,
'interfaceLang': "en",
'fullSearch': False,
'autoplaySounds': True,
'searchHistory': [],
'checkForUpdates': True,
'checkForUpdates': True, # ui?
'created': time.time(),
'deleteMedia': False,
'documentDir': u"",
@ -33,7 +25,6 @@ defaultConf = {
'editFontFamily': 'Arial',
'editFontSize': 12,
'editLineSize': 20,
'editorReverseOrder': False,
'iconSize': 32,
'id': random.randrange(0, 2**63),
'lastMsg': -1,
@ -48,19 +39,13 @@ defaultConf = {
'proxyPort': 8080,
'proxyUser': '',
'recentColours': ["#000000", "#0000ff"],
'repeatQuestionAudio': True,
'scrollToAnswer': True,
'showCardTimer': True,
'showProgress': True,
'showTimer': True,
'showToolbar': True,
'centerQA': True,
'stripHTML': True,
'studyOptionsTab': 0,
'suppressEstimates': False,
'suppressUpdate': False,
'syncDisableWhenMoved': True,
'syncOnLoad': False,
'syncOnProgramOpen': True,
'syncPassword': "",
'syncUsername': "",
@ -148,10 +133,3 @@ create table if not exists config (conf text not null);
os.mkdir(x)
except:
pass
def _importOldData(self):
# compatability
def unpickleWxFont(*args):
pass
def pickleWxFont(*args):
pass

View file

@ -27,13 +27,7 @@ class DeckBrowser(object):
self.web.setKeyHandler(self._keyHandler)
self._setupToolbar()
# refresh or reorder
if (time.time() - self._browserLastRefreshed >
self.mw.config['deckBrowserRefreshPeriod']):
t = time.time()
self._checkDecks()
print "check decks", time.time() - t
else:
self._reorderDecks()
self._checkDecks()
# show
self._renderPage()

View file

@ -53,15 +53,11 @@ class AnkiQt(QMainWindow):
# if self.config['syncOnProgramOpen']:
# if self.syncDeck(interactive=False):
# return
# load a deck?
if (args or self.config['loadLastDeck'] or
len(self.config['recentDeckPaths']) == 1):
# delay load so deck errors don't cause program to close
self.progress.timer(10, lambda a=args: \
self.maybeLoadLastDeck(a),
False)
else:
self.moveToState("deckBrowser")
# delay load so deck errors don't cause program to close
self.progress.timer(10, lambda a=args: \
self.maybeLoadLastDeck(a),
False)
except:
showInfo("Error during startup:\n%s" % traceback.format_exc())
sys.exit(1)
@ -343,6 +339,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
r = self.loadDeck(path, showErrors=False)
if r:
return r
self.moveToState("deckBrowser")
# Open recent
##########################################################################