本文整理汇总了Python中mnemosyne.libmnemosyne.Mnemosyne.config方法的典型用法代码示例。如果您正苦于以下问题:Python Mnemosyne.config方法的具体用法?Python Mnemosyne.config怎么用?Python Mnemosyne.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mnemosyne.libmnemosyne.Mnemosyne
的用法示例。
在下文中一共展示了Mnemosyne.config方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MyServer
# 需要导入模块: from mnemosyne.libmnemosyne import Mnemosyne [as 别名]
# 或者: from mnemosyne.libmnemosyne.Mnemosyne import config [as 别名]
class MyServer(Server):
program_name = "Mnemosyne"
program_version = "test"
capabilities = "TODO"
def __init__(self):
shutil.rmtree(os.path.abspath("dot_sync_server"), ignore_errors=True)
self.mnemosyne = Mnemosyne(upload_science_logs=False, interested_in_old_reps=True)
self.mnemosyne.components.insert(0, ("mnemosyne.libmnemosyne.translator",
"GetTextTranslator"))
self.mnemosyne.components.append(("test_sync", "Widget"))
self.mnemosyne.components.append(("mnemosyne_test", "TestReviewWidget"))
self.mnemosyne.initialise(os.path.abspath("dot_sync_server"), automatic_upgrades=False)
self.mnemosyne.config().change_user_id("user_id")
self.mnemosyne.review_controller().reset()
self.supports_binary_transfer = lambda x : False
# Add 20 cards to database.
card_type = self.mnemosyne.card_type_with_id("1")
for i in range (20):
fact_data = {"f": "question %d" % (i,),
"b": "answer"}
self.mnemosyne.controller().create_new_cards(fact_data, card_type,
grade=-1, tag_names=["default"])[0]
self.mnemosyne.database().save()
self.mnemosyne.database().release_connection()
def authorise(self, login, password):
return login == "user" and password == "pass"
def load_database(self, database_name):
self.mnemosyne.database().load(database_name)
return self.mnemosyne.database()
def unload_database(self, database):
self.mnemosyne.database().release_connection()
# Dirty way to make sure we restart the server and create a new database
# (as opposed to keep sending old history back and forth)'
self.wsgi_server.stop()
def run(self):
Server.__init__(self, "client_machine_id", 8186,
self.mnemosyne.main_widget())
self.serve_until_stopped()
示例2: MyServer
# 需要导入模块: from mnemosyne.libmnemosyne import Mnemosyne [as 别名]
# 或者: from mnemosyne.libmnemosyne.Mnemosyne import config [as 别名]
class MyServer(Server):
program_name = "Mnemosyne"
program_version = "test"
capabilities = "TODO"
stop_after_sync = True
def __init__(self):
os.system("rm -rf sync_from_here")
self.mnemosyne = Mnemosyne()
self.mnemosyne.components.insert(0, ("mnemosyne.libmnemosyne.translator",
"GetTextTranslator"))
self.mnemosyne.components.append(("test_sync", "Widget"))
self.mnemosyne.components.append(\
("mnemosyne.libmnemosyne.ui_components.dialogs", "ProgressDialog"))
self.mnemosyne.components.append(\
("mnemosyne.libmnemosyne.ui_components.review_widget", "ReviewWidget"))
self.mnemosyne.initialise(os.path.abspath("sync_from_here"))
self.mnemosyne.config().change_user_id("user_id")
self.mnemosyne.review_controller().reset()
# Add 20 cards to database.
card_type = self.mnemosyne.card_type_by_id("1")
for i in range (20):
fact_data = {"q": "question %d" % (i,),
"a": "answer"}
self.mnemosyne.controller().create_new_cards(fact_data, card_type,
grade=-1, tag_names=["default"])[0]
self.mnemosyne.database().save()
def authorise(self, login, password):
return login == "user" and password == "pass"
def open_database(self, database_name):
return self.mnemosyne.database()
def run(self):
Server.__init__(self, "client_machine_id", "192.168.2.54", 8186,
self.mnemosyne.main_widget())
# Because we stop_after_sync is True, serve_forever will actually stop
# after one sync.
self.serve_forever()
self.mnemosyne.finalise()
示例3: TestMemImport
# 需要导入模块: from mnemosyne.libmnemosyne import Mnemosyne [as 别名]
# 或者: from mnemosyne.libmnemosyne.Mnemosyne import config [as 别名]
#.........这里部分代码省略.........
(EventTypes.ADDED_CARD, )).fetchone()[0] == 1
assert self.database().con.execute(\
"select count() from log where object_id=?",
("4b59b830", )).fetchone()[0] == 3
def test_logs_corrupt_2(self): # Wrong data, isolated deletion event.
self.database().update_card_after_log_import = (lambda x, y, z: 0)
self.database().before_1x_log_import()
filename = os.path.join(os.getcwd(), "tests", "files", "corrupt_2.txt")
ScienceLogParser(self.database()).parse(filename)
assert self.database().con.execute(\
"select count() from log where event_type=?",
(EventTypes.ADDED_CARD, )).fetchone()[0] == 0
assert self.database().con.execute(\
"select count() from log where object_id=?",
("4b59b830", )).fetchone()[0] == 0
def test_two_mem_files_sharing_same_logs(self):
filename = os.path.join(os.getcwd(), "tests", "files", "basedir_2_mem",
"deck1.mem")
self.mem_importer().do_import(filename)
assert self.database().con.execute(\
"select count() from log where event_type=?",
(EventTypes.REPETITION, )).fetchone()[0] == 1
filename = os.path.join(os.getcwd(), "tests", "files", "basedir_2_mem",
"deck2.mem")
self.mem_importer().do_import(filename)
assert self.database().con.execute(\
"select count() from log where event_type=?",
(EventTypes.REPETITION, )).fetchone()[0] == 3
assert self.database().con.execute(\
"select count() from log where event_type=?",
(EventTypes.ADDED_CARD, )).fetchone()[0] == 2
card = self.database().card("4c8fff73", is_id_internal=False)
assert self.database().average_thinking_time(card) == 1.5
assert self.database().total_thinking_time(card) == 3.0
assert self.database().card_count_for_grade(0, active_only=True) == 2
tag = self.database().get_or_create_tag_with_name("666")
assert self.database().card_count_for_grade_and_tag(0, tag, active_only=True) == 0
from mnemosyne.libmnemosyne.statistics_pages.grades import Grades
page = Grades(self.mnemosyne.component_manager)
page.prepare_statistics(tag._id)
assert page.y == [0, 0, 0, 0, 0, 0, 0]
page.prepare_statistics(-1)
assert page.y == [0, 2, 0, 0, 0, 0, 0]
def test_bz2(self):
filename = os.path.join(os.getcwd(), "tests", "files", "basedir_bz2",
"default.mem")
self.mem_importer().do_import(filename)
assert self.database().con.execute(\
"select count() from log where event_type=?",
(EventTypes.REPETITION, )).fetchone()[0] == 0
assert self.database().con.execute(\
"select count() from log where event_type=?",
(EventTypes.ADDED_CARD, )).fetchone()[0] == 1
assert self.database().con.execute(\
"select count() from log where object_id=?",
("82f2ed0d", )).fetchone()[0] == 0
def test_sch(self):
self.controller().show_import_file_dialog()
assert self.database().card_count_scheduled_n_days_ago(0) == 1
def test_upgrade(self):
old_data_dir = os.path.join(os.getcwd(), "tests", "files", "basedir_bz2")
from mnemosyne.libmnemosyne.upgrades.upgrade1 import Upgrade1
Upgrade1(self.mnemosyne.component_manager).upgrade_from_old_data_dir(old_data_dir)
assert self.config()["dvipng"].rstrip() == \
"dvipng -D 300 -T tight tmp.dvi\necho"
assert "14pt" in self.config()["latex_preamble"]
assert self.config()["user_id"] == "f3fb13c7"
assert self.log().log_index_of_last_upload() == 2
assert os.path.exists(os.path.join(old_data_dir,
"DIRECTORY_NO_LONGER_USED_BY_MNEMOSYNE2"))
assert os.path.exists(os.path.join(self.mnemosyne.config().data_dir,
"history", "a_2.bz2"))
log = file(os.path.join(self.mnemosyne.config().data_dir, "log.txt"))
assert log.readline().strip() == \
"2005-11-01 09:29:08 : Imported item 82f2ed0d 0 0 0 0 0"
def teardown(self):
filename = os.path.join(os.getcwd(), "tests", "files", "basedir_bz2",
"DIRECTORY_NO_LONGER_USED_BY_MNEMOSYNE2")
if os.path.exists(filename):
os.remove(filename)
filename = os.path.join(os.getcwd(), "tests", "files", "a.png")
if os.path.exists(filename):
os.remove(filename)
filename = os.path.join(os.getcwd(), "tests", "files", "a.ogg")
if os.path.exists(filename):
os.remove(filename)
dirname = os.path.join(os.getcwd(), "tests", "files", "figs")
if os.path.exists(dirname):
shutil.rmtree(dirname)
dirname = os.path.join(os.getcwd(), "tests", "files", "soundfiles")
if os.path.exists(dirname):
shutil.rmtree(dirname)
MnemosyneTest.teardown(self)
示例4: WebServer
# 需要导入模块: from mnemosyne.libmnemosyne import Mnemosyne [as 别名]
# 或者: from mnemosyne.libmnemosyne.Mnemosyne import config [as 别名]
class WebServer(Component):
def __init__(self, component_manager, port, data_dir, config_dir,
filename, is_server_local=False):
Component.__init__(self, component_manager)
self.port = port
self.data_dir = data_dir
self.config_dir = config_dir
self.filename = filename
self.is_server_local = is_server_local
# When restarting the server, make sure we discard info from the
# browser resending the form from the previous session.
self.is_just_started = True
self.is_mnemosyne_loaded = False
self.is_shutting_down = False
self.wsgi_server = wsgiserver.CherryPyWSGIServer(\
("0.0.0.0", port), self.wsgi_app, server_name="localhost",
numthreads=1, timeout=5)
# We need to set the timeout relatively low, otherwise it will take
# too long for the server to process a 'stop' request.
def serve_until_stopped(self):
try:
self.wsgi_server.start() # Sets self.wsgi_server.ready
except KeyboardInterrupt:
self.wsgi_server.stop()
self.unload_mnemosyne()
def stop(self):
self.wsgi_server.stop()
self.unload_mnemosyne()
def load_mnemosyne(self):
self.mnemosyne = Mnemosyne(upload_science_logs=True,
interested_in_old_reps=True)
self.mnemosyne.components.insert(0, (
("mnemosyne.libmnemosyne.translators.gettext_translator",
"GetTextTranslator")))
self.mnemosyne.components.append(\
("mnemosyne.libmnemosyne.ui_components.main_widget",
"MainWidget"))
self.mnemosyne.components.append(\
("mnemosyne.web_server.review_wdgt",
"ReviewWdgt"))
self.mnemosyne.components.append(\
("mnemosyne.web_server.web_server_render_chain",
"WebServerRenderChain"))
self.mnemosyne.initialise(self.data_dir, config_dir=self.config_dir,
filename=self.filename, automatic_upgrades=False)
self.mnemosyne.review_controller().set_render_chain("web_server")
self.save_after_n_reps = self.mnemosyne.config()["save_after_n_reps"]
self.mnemosyne.config()["save_after_n_reps"] = 1
self.mnemosyne.start_review()
self.mnemosyne.review_widget().set_is_server_local(\
self.is_server_local)
self.is_mnemosyne_loaded = True
self.release_database_after_timeout = \
ReleaseDatabaseAfterTimeout(self.port)
self.release_database_after_timeout.start()
def unload_mnemosyne(self):
if not self.is_mnemosyne_loaded:
return
self.mnemosyne.config()["save_after_n_reps"] = self.save_after_n_reps
self.mnemosyne.finalise()
self.is_mnemosyne_loaded = False
def wsgi_app(self, environ, start_response):
filename = environ["PATH_INFO"].decode("utf-8")
if filename == "/status":
response_headers = [("Content-type", "text/html")]
start_response("200 OK", response_headers)
return ["200 OK"]
# Sometimes, even after the user has clicked 'exit' in the page,
# a browser sends a request for e.g. an audio file.
if self.is_shutting_down and filename != "/release_database":
response_headers = [("Content-type", "text/html")]
start_response("503 Service Unavailable", response_headers)
return ["Server stopped"]
# Load database if needed.
if not self.is_mnemosyne_loaded and filename != "/release_database":
self.load_mnemosyne()
self.release_database_after_timeout.ping()
# All our request return to the root page, so if the path is '/',
# return the html of the review widget.
if filename == "/":
# Process clicked buttons in the form.
form = cgi.FieldStorage(fp=environ["wsgi.input"], environ=environ)
if "show_answer" in form and not self.is_just_started:
self.mnemosyne.review_widget().show_answer()
page = self.mnemosyne.review_widget().to_html()
elif "grade" in form and not self.is_just_started:
grade = int(form["grade"].value)
self.mnemosyne.review_widget().grade_answer(grade)
page = self.mnemosyne.review_widget().to_html()
elif "star" in form:
self.mnemosyne.controller().star_current_card()
page = self.mnemosyne.review_widget().to_html()
elif "exit" in form:
self.unload_mnemosyne()
#.........这里部分代码省略.........
示例5: MyClient
# 需要导入模块: from mnemosyne.libmnemosyne import Mnemosyne [as 别名]
# 或者: from mnemosyne.libmnemosyne.Mnemosyne import config [as 别名]
class MyClient(Client):
program_name = "Mnemosyne"
program_version = "test"
capabilities = "TODO"
def __init__(self):
shutil.rmtree(os.path.abspath("dot_sync_client"), ignore_errors=True)
self.mnemosyne = Mnemosyne(upload_science_logs=False, interested_in_old_reps=True)
self.mnemosyne.components = [
("mnemosyne.libmnemosyne.translator",
"NoTranslation"),
("mnemosyne.libmnemosyne.databases.SQLite",
"SQLite"),
("mnemosyne.libmnemosyne.configuration",
"Configuration"),
("mnemosyne.libmnemosyne.loggers.database_logger",
"DatabaseLogger"),
("mnemosyne.libmnemosyne.schedulers.SM2_mnemosyne",
"SM2Mnemosyne"),
("mnemosyne.libmnemosyne.stopwatch",
"Stopwatch"),
("mnemosyne.libmnemosyne.card_types.front_to_back",
"FrontToBack"),
("mnemosyne.libmnemosyne.card_types.both_ways",
"BothWays"),
("mnemosyne.libmnemosyne.card_types.vocabulary",
"Vocabulary"),
("mnemosyne.libmnemosyne.renderers.html_css",
"HtmlCss"),
("mnemosyne.libmnemosyne.filters.escape_to_html",
"EscapeToHtml"),
("mnemosyne.libmnemosyne.filters.expand_paths",
"ExpandPaths"),
("mnemosyne.libmnemosyne.filters.latex",
"Latex"),
("mnemosyne.libmnemosyne.render_chains.default_render_chain",
"DefaultRenderChain"),
("mnemosyne.libmnemosyne.render_chains.plain_text_chain",
"PlainTextChain"),
("mnemosyne.libmnemosyne.controllers.default_controller",
"DefaultController"),
("mnemosyne.libmnemosyne.review_controllers.SM2_controller",
"SM2Controller"),
("mnemosyne.libmnemosyne.card_types.map",
"MapPlugin"),
("mnemosyne.libmnemosyne.card_types.cloze",
"ClozePlugin"),
("mnemosyne.libmnemosyne.criteria.default_criterion",
"DefaultCriterion"),
("mnemosyne.libmnemosyne.databases.SQLite_criterion_applier",
"DefaultCriterionApplier"),
("mnemosyne.libmnemosyne.plugins.cramming_plugin",
"CrammingPlugin") ]
self.mnemosyne.components.append(("benchmark_sync_client", "Widget"))
self.mnemosyne.components.append(("benchmark_sync_client", "MyReviewWidget"))
self.mnemosyne.initialise(os.path.abspath(os.path.join(os.getcwdu(),
"dot_sync_client")), automatic_upgrades=False)
self.mnemosyne.config().change_user_id("user_id")
self.check_for_edited_local_media_files = False
self.do_backup = False
self.mnemosyne.review_controller().reset()
# Do 200 reviews.
card_type = self.mnemosyne.card_type_with_id("1")
fact_data = {"f": "question",
"b": "answer"}
card = self.mnemosyne.controller().create_new_cards(fact_data, card_type,
grade=-1, tag_names=["default"])[0]
self.mnemosyne.database().save()
self.mnemosyne.review_controller().show_new_question()
for i in range(200):
self.mnemosyne.review_controller().show_answer()
self.mnemosyne.review_controller().grade_answer(0)
Client.__init__(self, "client_machine_id", self.mnemosyne.database(),
self.mnemosyne.main_widget())
def do_sync(self):
#self.BUFFER_SIZE = 10*8192
#self.behind_proxy = True
self.sync("localhost", 8186, "user", "pass")
self.mnemosyne.database().save()
示例6:
# 需要导入模块: from mnemosyne.libmnemosyne import Mnemosyne [as 别名]
# 或者: from mnemosyne.libmnemosyne.Mnemosyne import config [as 别名]
"ThreeSided"),
("mnemosyne.libmnemosyne.renderers.html_css_old",
"HtmlCssOld"),
("mnemosyne.libmnemosyne.filters.escape_to_html",
"EscapeToHtml"),
("mnemosyne.libmnemosyne.filters.latex",
"Latex"),
("mnemosyne.libmnemosyne.filters.expand_paths",
"ExpandPaths"),
("mnemosyne.libmnemosyne.controllers.default_controller",
"DefaultController"),
("mnemosyne.libmnemosyne.review_controllers.SM2_controller",
"SM2Controller"),
("mnemosyne.libmnemosyne.card_types.map",
"MapPlugin"),
("mnemosyne.libmnemosyne.card_types.cloze",
"ClozePlugin"),
("mnemosyne.libmnemosyne.activity_criteria.default_criterion",
"DefaultCriterion"),
("mnemosyne.libmnemosyne.databases.SQLite_criterion_applier",
"DefaultCriterionApplier"),
("mnemosyne.libmnemosyne.plugins.cramming_plugin",
"CrammingPlugin") ]
# Run Mnemosyne.
mnemosyne.initialise(basedir=basedir)
mnemosyne.config()["upload_science_logs"] = False
app.mainframe = mnemosyne.main_widget()
app.run()
mnemosyne.finalise()
示例7:
# 需要导入模块: from mnemosyne.libmnemosyne import Mnemosyne [as 别名]
# 或者: from mnemosyne.libmnemosyne.Mnemosyne import config [as 别名]
("mnemosyne.libmnemosyne.statistics_pages.easiness",
"Easiness"),
("mnemosyne.libmnemosyne.statistics_pages.current_card",
"CurrentCard"),
("main_wdgt",
"MainWdgt")]
mnemosyne.initialise(data_dir, filename=filename)
# Sync before starting the review server.
if mnemosyne.main_widget().show_question(\
"Perform sync?", "Yes", "No", "") == 0:
mnemosyne.controller().sync(sync_server, sync_port,
sync_username, sync_password)
# Make sure the config gets picked up when starting a new
# Mnemosyne instance in the web server.
mnemosyne.config().save()
# Start review server.
mnemosyne.database().release_connection()
from mnemosyne.web_server.web_server import WebServerThread
web_server_thread = WebServerThread\
(mnemosyne.component_manager, is_server_local=True)
web_server_thread.daemon = True
web_server_thread.start()
if mnemosyne.main_widget().show_question(\
"Review server started. Either let Mnemosyne start Chrome, or, if you have problems with sound, start Firefox yourself and go to 127.0.0.1:8513, otherwise click below to start Chrome.",
"Start Chrome", "Don't start Chrome", "") == 0:
mnemosyne.main_widget().start_native_browser()
web_server_thread.join()
# Sync again after the user has closed the program from the web server.
示例8: TestLogging
# 需要导入模块: from mnemosyne.libmnemosyne import Mnemosyne [as 别名]
# 或者: from mnemosyne.libmnemosyne.Mnemosyne import config [as 别名]
#.........这里部分代码省略.........
"select * from log where _id=20").fetchone()
assert sql_res[1] == EventTypes.STARTED_PROGRAM
sql_res = self.database().con.execute(\
"select * from log where _id=21").fetchone()
assert sql_res[1] == EventTypes.STARTED_SCHEDULER
sql_res = self.database().con.execute(\
"select * from log where _id=22").fetchone()
assert sql_res[1] == EventTypes.LOADED_DATABASE
assert sql_res[6] == 0
assert sql_res[7] == 0
assert sql_res[8] == 1
sql_res = self.database().con.execute(\
"select * from log where _id=30").fetchone()
assert sql_res[1] == EventTypes.ADDED_FACT
assert sql_res[3] is not None
sql_res = self.database().con.execute(\
"select * from log where _id=31").fetchone()
assert sql_res[1] == EventTypes.ADDED_CARD
sql_res = self.database().con.execute(\
"select * from log where _id=32").fetchone()
assert sql_res[1] == EventTypes.DELETED_CARD
assert sql_res[3] is not None
sql_res = self.database().con.execute(\
"select * from log where _id=33").fetchone()
assert sql_res[1] == EventTypes.DELETED_FACT
assert sql_res[3] is not None
self.config()["upload_science_logs"] = True
self.database().dump_to_science_log()
logfile = os.path.join(os.path.abspath("dot_test"), "log.txt")
found = False
for line in file(logfile):
if "R " + card_id_1 + " 4" in line:
found = True
assert str(new_interval) + " 0 | 0.0" in line
assert found == True
def test_unique_index(self):
fact_data = {"f": "question",
"b": "answer"}
card_type_2 = self.card_type_with_id("2")
card_1, card_2 = self.controller().create_new_cards(fact_data, card_type_2,
grade=-1, tag_names=["default"])
log_index = self.database().con.execute(\
"""select _id from log order by _id desc limit 1""").fetchone()[0]
# Note: we need to keep the last log entry intact, otherwise indexes
# start again at 1 and mess up the sync.
self.database().con.execute("""delete from log where _id <?""", (log_index,))
self.database().con.execute("""vacuum""")
fact_data = {"f": "question2",
"b": "answer2"}
card_type_2 = self.card_type_with_id("1")
card_1 = self.controller().create_new_cards(fact_data, card_type_2,
grade=-1, tag_names=["default"])
assert self.database().con.execute(\
"""select _id from log order by _id limit 1""").fetchone()[0] \
== log_index
def test_recover_user_id(self):
示例9: MyClient
# 需要导入模块: from mnemosyne.libmnemosyne import Mnemosyne [as 别名]
# 或者: from mnemosyne.libmnemosyne.Mnemosyne import config [as 别名]
class MyClient(Client):
program_name = "Mnemosyne"
program_version = "test"
capabilities = "TODO"
def __init__(self):
self.mnemosyne = Mnemosyne()
self.mnemosyne.components = [
("mnemosyne.libmnemosyne.translator",
"NoTranslation"),
("mnemosyne.libmnemosyne.databases.SQLite",
"SQLite"),
("mnemosyne.libmnemosyne.configuration",
"Configuration"),
("mnemosyne.libmnemosyne.loggers.database_logger",
"DatabaseLogger"),
("mnemosyne.libmnemosyne.schedulers.SM2_mnemosyne",
"SM2Mnemosyne"),
("mnemosyne.libmnemosyne.stopwatch",
"Stopwatch"),
("mnemosyne.libmnemosyne.card_types.front_to_back",
"FrontToBack"),
("mnemosyne.libmnemosyne.card_types.both_ways",
"BothWays"),
("mnemosyne.libmnemosyne.card_types.three_sided",
"ThreeSided"),
("mnemosyne.libmnemosyne.renderers.html_css_old",
"HtmlCssOld"),
("mnemosyne.libmnemosyne.filters.escape_to_html",
"EscapeToHtml"),
("mnemosyne.libmnemosyne.filters.expand_paths",
"ExpandPaths"),
("mnemosyne.libmnemosyne.filters.latex",
"Latex"),
("mnemosyne.libmnemosyne.controllers.default_controller",
"DefaultController"),
("mnemosyne.libmnemosyne.review_controllers.SM2_controller",
"SM2Controller"),
("mnemosyne.libmnemosyne.card_types.map",
"MapPlugin"),
("mnemosyne.libmnemosyne.card_types.cloze",
"ClozePlugin"),
("mnemosyne.libmnemosyne.activity_criteria.default_criterion",
"DefaultCriterion"),
("mnemosyne.libmnemosyne.databases.SQLite_criterion_applier",
"DefaultCriterionApplier"),
("mnemosyne.libmnemosyne.plugins.cramming_plugin",
"CrammingPlugin") ]
self.mnemosyne.components.append(("benchmark_sync_client", "Widget"))
self.mnemosyne.components.append(\
("mnemosyne.libmnemosyne.ui_components.review_widget", "ReviewWidget"))
self.mnemosyne.components.append(\
("mnemosyne.libmnemosyne.ui_components.dialogs", "ProgressDialog"))
self.mnemosyne.initialise(os.path.abspath(os.path.join(os.getcwdu(),
"dot_benchmark")))
self.mnemosyne.config().change_user_id("user_id")
self.mnemosyne.review_controller().reset()
# Do 200 reviews.
card_type = self.mnemosyne.card_type_by_id("1")
fact_data = {"q": "question",
"a": "answer"}
card = self.mnemosyne.controller().create_new_cards(fact_data, card_type,
grade=-1, tag_names=["default"])[0]
self.mnemosyne.database().save()
self.mnemosyne.review_controller().new_question()
for i in range(200):
self.mnemosyne.review_controller().show_answer()
self.mnemosyne.review_controller().grade_answer(0)
Client.__init__(self, "client_machine_id", self.mnemosyne.database(),
self.mnemosyne.main_widget())
def do_sync(self):
self.sync("192.168.2.54", 8186, "user", "pass")
self.mnemosyne.database().save()