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.gui_translator", "NoGuiTranslation"),
         ("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.getcwd(), "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())
Пример #2
0
 def __init__(self):
     os.system("rm -fr dot_benchmark")
     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.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.review_controller().reset()        
     Client.__init__(self, "client_machine_id", self.mnemosyne.database(),
                     self.mnemosyne.main_widget())
Пример #3
0
 def sync(self, server, port, username, password, ui=None):
     if ui is None:
         ui = self.main_widget()
     from openSM2sync.client import Client
     client = Client(self.config().machine_id(), self.database(), ui)
     client.program_name = "Mnemosyne"
     import mnemosyne.version
     client.program_version = mnemosyne.version.version
     client.capabilities = "mnemosyne_dynamic_cards"
     client.check_for_edited_local_media_files = \
         self.config()["check_for_edited_local_media_files"]
     client.interested_in_old_reps = \
         self.config()["interested_in_old_reps"]
     client.store_pregenerated_data = \
         self.database().store_pregenerated_data
     client.do_backup = self.config()["backup_before_sync"]
     client.upload_science_logs = self.config()["upload_science_logs"]
     try:         
         client.sync(server, port, username, password)
     finally:
         client.database.release_connection()
Пример #4
0
 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())
Пример #5
0
 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())