mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
tweak config and startup
This commit is contained in:
parent
f4ee17a5c6
commit
e28f5fe931
3 changed files with 11 additions and 42 deletions
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
# User configuration handling
|
# User configuration handling
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# The majority of the config is serialized into a string, both for easy access
|
# The majority of the config is serialized into a string, so we can access it
|
||||||
# and backwards compatibility. A separate table keeps track of seen decks, so
|
# easily and pickle objects like window state. A separate table keeps track of
|
||||||
# that multiple instances can update the recent decks list.
|
# seen decks, so that multiple instances can update the recent decks list.
|
||||||
|
|
||||||
import os, sys, time, random, cPickle
|
import os, sys, time, random, cPickle
|
||||||
from anki.db import DB
|
from anki.db import DB
|
||||||
|
@ -13,19 +13,11 @@ from anki.utils import isMac
|
||||||
|
|
||||||
defaultConf = {
|
defaultConf = {
|
||||||
'confVer': 3,
|
'confVer': 3,
|
||||||
# remove?
|
|
||||||
'colourTimes': True,
|
|
||||||
# too long?
|
|
||||||
'deckBrowserRefreshPeriod': 3600,
|
|
||||||
'factEditorAdvanced': False,
|
|
||||||
'showStudyScreen': True,
|
|
||||||
|
|
||||||
'interfaceLang': "en",
|
'interfaceLang': "en",
|
||||||
'fullSearch': False,
|
'fullSearch': False,
|
||||||
|
|
||||||
'autoplaySounds': True,
|
'autoplaySounds': True,
|
||||||
'searchHistory': [],
|
'searchHistory': [],
|
||||||
'checkForUpdates': True,
|
'checkForUpdates': True, # ui?
|
||||||
'created': time.time(),
|
'created': time.time(),
|
||||||
'deleteMedia': False,
|
'deleteMedia': False,
|
||||||
'documentDir': u"",
|
'documentDir': u"",
|
||||||
|
@ -33,7 +25,6 @@ defaultConf = {
|
||||||
'editFontFamily': 'Arial',
|
'editFontFamily': 'Arial',
|
||||||
'editFontSize': 12,
|
'editFontSize': 12,
|
||||||
'editLineSize': 20,
|
'editLineSize': 20,
|
||||||
'editorReverseOrder': False,
|
|
||||||
'iconSize': 32,
|
'iconSize': 32,
|
||||||
'id': random.randrange(0, 2**63),
|
'id': random.randrange(0, 2**63),
|
||||||
'lastMsg': -1,
|
'lastMsg': -1,
|
||||||
|
@ -48,19 +39,13 @@ defaultConf = {
|
||||||
'proxyPort': 8080,
|
'proxyPort': 8080,
|
||||||
'proxyUser': '',
|
'proxyUser': '',
|
||||||
'recentColours': ["#000000", "#0000ff"],
|
'recentColours': ["#000000", "#0000ff"],
|
||||||
'repeatQuestionAudio': True,
|
|
||||||
'scrollToAnswer': True,
|
|
||||||
'showCardTimer': True,
|
|
||||||
'showProgress': True,
|
'showProgress': True,
|
||||||
'showTimer': True,
|
|
||||||
'showToolbar': True,
|
'showToolbar': True,
|
||||||
'centerQA': True,
|
'centerQA': True,
|
||||||
'stripHTML': True,
|
'stripHTML': True,
|
||||||
'studyOptionsTab': 0,
|
|
||||||
'suppressEstimates': False,
|
'suppressEstimates': False,
|
||||||
'suppressUpdate': False,
|
'suppressUpdate': False,
|
||||||
'syncDisableWhenMoved': True,
|
'syncDisableWhenMoved': True,
|
||||||
'syncOnLoad': False,
|
|
||||||
'syncOnProgramOpen': True,
|
'syncOnProgramOpen': True,
|
||||||
'syncPassword': "",
|
'syncPassword': "",
|
||||||
'syncUsername': "",
|
'syncUsername': "",
|
||||||
|
@ -148,10 +133,3 @@ create table if not exists config (conf text not null);
|
||||||
os.mkdir(x)
|
os.mkdir(x)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _importOldData(self):
|
|
||||||
# compatability
|
|
||||||
def unpickleWxFont(*args):
|
|
||||||
pass
|
|
||||||
def pickleWxFont(*args):
|
|
||||||
pass
|
|
||||||
|
|
|
@ -27,13 +27,7 @@ class DeckBrowser(object):
|
||||||
self.web.setKeyHandler(self._keyHandler)
|
self.web.setKeyHandler(self._keyHandler)
|
||||||
self._setupToolbar()
|
self._setupToolbar()
|
||||||
# refresh or reorder
|
# refresh or reorder
|
||||||
if (time.time() - self._browserLastRefreshed >
|
|
||||||
self.mw.config['deckBrowserRefreshPeriod']):
|
|
||||||
t = time.time()
|
|
||||||
self._checkDecks()
|
self._checkDecks()
|
||||||
print "check decks", time.time() - t
|
|
||||||
else:
|
|
||||||
self._reorderDecks()
|
|
||||||
# show
|
# show
|
||||||
self._renderPage()
|
self._renderPage()
|
||||||
|
|
||||||
|
|
|
@ -53,15 +53,11 @@ class AnkiQt(QMainWindow):
|
||||||
# if self.config['syncOnProgramOpen']:
|
# if self.config['syncOnProgramOpen']:
|
||||||
# if self.syncDeck(interactive=False):
|
# if self.syncDeck(interactive=False):
|
||||||
# return
|
# 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
|
# delay load so deck errors don't cause program to close
|
||||||
self.progress.timer(10, lambda a=args: \
|
self.progress.timer(10, lambda a=args: \
|
||||||
self.maybeLoadLastDeck(a),
|
self.maybeLoadLastDeck(a),
|
||||||
False)
|
False)
|
||||||
else:
|
|
||||||
self.moveToState("deckBrowser")
|
|
||||||
except:
|
except:
|
||||||
showInfo("Error during startup:\n%s" % traceback.format_exc())
|
showInfo("Error during startup:\n%s" % traceback.format_exc())
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -343,6 +339,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
|
||||||
r = self.loadDeck(path, showErrors=False)
|
r = self.loadDeck(path, showErrors=False)
|
||||||
if r:
|
if r:
|
||||||
return r
|
return r
|
||||||
|
self.moveToState("deckBrowser")
|
||||||
|
|
||||||
# Open recent
|
# Open recent
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
Loading…
Reference in a new issue