=== modified file 'mnemosyne/TODO' --- mnemosyne/TODO 2017-02-27 19:03:07 +0000 +++ mnemosyne/TODO 2017-03-01 18:28:52 +0000 @@ -1,7 +1,5 @@ --turned off event filter to speed up resizing? - --to combat slow resizing, option to have everything in one browser - +-ui setting +-scroll to answer (in Qt? on from SM2 controller?) -for sync, check only database version, not program version @@ -34,7 +32,8 @@ Minor bugs: --double check RTL on Android, + RTL tag (doesn't work on PC) +-RTL still does not work for first cloze, in the case the sentence is more than + 1 line http://dotancohen.com/howto/rtl_right_to_left.html -after sync, a cloze card type displays all hints -sister card not automatically updated when pg-dwn through card browser === modified file 'mnemosyne/mnemosyne/libmnemosyne/configuration.py' --- mnemosyne/mnemosyne/libmnemosyne/configuration.py 2017-02-21 18:13:03 +0000 +++ mnemosyne/mnemosyne/libmnemosyne/configuration.py 2017-03-01 18:28:52 +0000 @@ -73,10 +73,6 @@ # Latex dvipng command. dvipng = "dvipng -D 200 -T tight tmp.dvi" - -# Try to optimise height of Q and A window to show maximum amount of relevant -# information -optimise_Q_A_split = True """ class Configuration(Component, dict): @@ -150,7 +146,6 @@ "latex_postamble": "\\end{document}", "latex": "latex -interaction=nonstopmode", "dvipng": "dvipng -D 200 -T tight tmp.dvi", - "optimise_Q_A_split": True, "active_plugins": set(), # Plugin classes, not instances. "media_autoplay": True, "media_controls": False, === modified file 'mnemosyne/mnemosyne/libmnemosyne/render_chain.py' --- mnemosyne/mnemosyne/libmnemosyne/render_chain.py 2016-07-29 18:21:31 +0000 +++ mnemosyne/mnemosyne/libmnemosyne/render_chain.py 2017-03-01 18:28:52 +0000 @@ -134,11 +134,19 @@ def render_question(self, card, **render_args): fact_keys = card.fact_view.q_fact_keys decorators = card.fact_view.q_fact_key_decorators + if self.config()["QA_split"] == "single_window": + render_args["align_top"] = True return self._render(card, fact_keys, decorators, **render_args) def render_answer(self, card, **render_args): - fact_keys = card.fact_view.a_fact_keys - decorators = card.fact_view.a_fact_key_decorators + fact_keys, decorators = [], {} + if self.config()["QA_split"] == "single_window": + render_args["align_top"] = True + fact_keys += card.fact_view.q_fact_keys + fact_keys.append("__line__") + decorators.update(card.fact_view.q_fact_key_decorators) + fact_keys += card.fact_view.a_fact_keys + decorators.update(card.fact_view.a_fact_key_decorators) return self._render(card, fact_keys, decorators, **render_args) def _render(self, card, fact_keys, decorators, **render_args): @@ -146,6 +154,8 @@ # generated by the renderer, which would be much slower. fact_data = copy.copy(card.card_type.fact_data(card)) for fact_key in fact_keys: + if fact_key == "__line__": + fact_data[fact_key] = "
" if fact_key not in fact_data: # Optional key. continue for filter in self._filters: === modified file 'mnemosyne/mnemosyne/libmnemosyne/renderers/html_css.py' --- mnemosyne/mnemosyne/libmnemosyne/renderers/html_css.py 2017-02-27 19:03:07 +0000 +++ mnemosyne/mnemosyne/libmnemosyne/renderers/html_css.py 2017-03-01 18:28:52 +0000 @@ -28,7 +28,9 @@ self._css = {} # {card_type.id: render_args: css} def body_css(self, **render_args): - return "html, body { margin: 0px; height: 100%; width: 100%;}\n" + css = "html, body { margin: 0px; height: 100%; width: 100%;}\n" + css += "hr { background-color: black; height: 1px; border: 0; }\n" + return css def card_type_css(self, card_type, **render_args): # Set aligment of the table (but not the contents within the table). @@ -107,7 +109,10 @@ html = "" for fact_key in fact_keys: if fact_key in fact_data and fact_data[fact_key]: - line = "
%s
" % \ + line = "" + if render_args.get("align_top", False): + line +="
" + line += "
%s
" % \ (fact_key, fact_key, fact_data[fact_key]) # Honour paragraph style also in user-created tables. line = line.replace("", @@ -121,7 +126,9 @@ def render(self, fact_data, fact_keys, card_type, **render_args): css = self.css(card_type) + valign = "valign=\"top\"" if render_args.get("align_top", False) else "" body = self.body(fact_data, fact_keys, card_type, **render_args) + return """ @@ -133,10 +140,10 @@ - +
%s
- """ % (css, body) + """ % (css, valign, body) === modified file 'mnemosyne/mnemosyne/libmnemosyne/renderers/html_css_card_browser.py' --- mnemosyne/mnemosyne/libmnemosyne/renderers/html_css_card_browser.py 2017-02-27 19:03:07 +0000 +++ mnemosyne/mnemosyne/libmnemosyne/renderers/html_css_card_browser.py 2017-03-01 18:28:52 +0000 @@ -29,7 +29,8 @@ card_type.fact_key_format_proxies().items(): css += ".%s { " % true_fact_key # Font colours. - if "force_text_colour" in render_args and render_args["force_text_colour"]: + if "force_text_colour" in render_args and \ + render_args["force_text_colour"]: colour = render_args["force_text_colour"] else: colour = self.config().card_type_property(\ === modified file 'mnemosyne/mnemosyne/libmnemosyne/review_controllers/SM2_controller.py' --- mnemosyne/mnemosyne/libmnemosyne/review_controllers/SM2_controller.py 2016-11-30 20:26:00 +0000 +++ mnemosyne/mnemosyne/libmnemosyne/review_controllers/SM2_controller.py 2017-03-01 18:28:52 +0000 @@ -212,7 +212,8 @@ # answer in the question field to eliminate flicker. w.set_question_box_visible(True) if self.card is not None: - if self.card.fact_view.a_on_top_of_q: + if self.config()["QA_split"] == "single_window" or \ + self.card.fact_view.a_on_top_of_q: w.set_answer_box_visible(False) else: w.set_answer_box_visible(True) @@ -228,7 +229,8 @@ # Giving the widget info about the answer even before it is shown # allows it to optimise its layout. w.set_question(self.card.question(self.render_chain)) - if not self.card.fact_view.a_on_top_of_q: + if not self.config()["QA_split"] == "single_window" and \ + not self.card.fact_view.a_on_top_of_q: w.set_answer(self.card.answer(\ self.render_chain, no_side_effects=True)) w.reveal_question() @@ -236,7 +238,8 @@ if self.card is None or self._state == "SELECT SHOW": w.clear_answer() else: - if not self.card.fact_view.a_on_top_of_q: + if not self.config()["QA_split"] == "single_window" and \ + not self.card.fact_view.a_on_top_of_q: w.set_answer(self.card.answer(\ self.render_chain, no_side_effects=False)) w.reveal_answer() === modified file 'mnemosyne/mnemosyne/pyqt_ui/configuration.py' --- mnemosyne/mnemosyne/pyqt_ui/configuration.py 2016-05-26 19:05:30 +0000 +++ mnemosyne/mnemosyne/pyqt_ui/configuration.py 2017-03-01 18:28:52 +0000 @@ -24,6 +24,7 @@ "previous_configuration_wdgt": 0, "previous_variant_for_statistics_page": {}, # dict[page] = variant "main_window_state": None, + "QA_split": "fixed", # "fixed", "adaptive", "single_window" "add_cards_dlg_state": None, "preview_cards_dlg_state": None, "edit_card_dlg_state": None, === modified file 'mnemosyne/mnemosyne/pyqt_ui/mnemosyne' --- mnemosyne/mnemosyne/pyqt_ui/mnemosyne 2017-02-23 19:23:38 +0000 +++ mnemosyne/mnemosyne/pyqt_ui/mnemosyne 2017-03-01 18:28:52 +0000 @@ -154,12 +154,13 @@ QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_DisableHighDpiScaling) if options.qt_opengl: if options.qt_opengl not in ["desktop", "angle", "software"]: - print("Invalid argument for qt-opengl. Should be 'desktop', 'angle' or 'software'") + print(\ +"Invalid argument for qt-opengl. Should be 'desktop', 'angle' or 'software'") sys.exit(-1) if options.qt_opengl == "desktop": QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseDesktopOpenGL) elif options.qt_opengl == "angle": - QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseOpenGLES) + QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseOpenGLES) elif options.qt_opengl == "software": QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseSoftwareOpenGL) === modified file 'mnemosyne/mnemosyne/pyqt_ui/review_wdgt.py' --- mnemosyne/mnemosyne/pyqt_ui/review_wdgt.py 2017-02-27 19:03:07 +0000 +++ mnemosyne/mnemosyne/pyqt_ui/review_wdgt.py 2017-03-01 18:28:52 +0000 @@ -131,7 +131,7 @@ return number_of_rows * max_img_height + 24 def update_stretch_factors(self): - if self.config()["optimise_Q_A_split"] == False: + if self.config()["QA_split"] != "adaptive": return if 0: # Using prerendered html # Correct the required heights of question and answer for the @@ -313,9 +313,9 @@ def deactivate(self): self.stop_media() - def focusInEvent(self, event): - self.restore_focus() - super().focusInEvent(event) + #def focusInEvent(self, event): + # self.restore_focus() + # super().focusInEvent(event) def changeEvent(self, event): if hasattr(self, "show_button"): @@ -439,9 +439,10 @@ # After clicking on the question or the answer, that widget grabs the # focus, so that the keyboard shortcuts no longer work. This functions # is used to set the focus back to the correct widget. - if self.focus_widget: - self.focus_widget.setDefault(True) - self.focus_widget.setFocus() + if self.question.hasFocus() or self.answer.hasFocus(): + if self.focus_widget: + self.focus_widget.setDefault(True) + self.focus_widget.setFocus() def update_show_button(self, text, is_default, is_enabled): self.show_button.setText(text) === modified file 'mnemosyne/po/mnemosyne.pot' --- mnemosyne/po/mnemosyne.pot 2017-02-27 19:03:07 +0000 +++ mnemosyne/po/mnemosyne.pot 2017-03-01 18:28:52 +0000 @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2017-02-27 15:05+0100\n" +"POT-Creation-Date: 2017-02-28 13:10+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1696,15 +1696,15 @@ msgid "&Hide pronunciation field for this card type" msgstr "" -#: ../mnemosyne/pyqt_ui/review_wdgt.py:482 +#: ../mnemosyne/pyqt_ui/review_wdgt.py:483 msgid "Scheduled: %d " msgstr "" -#: ../mnemosyne/pyqt_ui/review_wdgt.py:483 +#: ../mnemosyne/pyqt_ui/review_wdgt.py:484 msgid "Not memorised: %d " msgstr "" -#: ../mnemosyne/pyqt_ui/review_wdgt.py:484 +#: ../mnemosyne/pyqt_ui/review_wdgt.py:485 msgid "Active: %d " msgstr ""