Merge lp:~kevang/mnemosyne-proj/grade_only_if_showing into lp:~peter-bienstman/mnemosyne-proj/trunk

Proposed by Kilian Evang on 2014-09-23
Status: Rejected
Rejected by: Peter Bienstman on 2015-05-12
Proposed branch: lp:~kevang/mnemosyne-proj/grade_only_if_showing
Merge into: lp:~peter-bienstman/mnemosyne-proj/trunk
Diff against target: 17 lines (+4/-3)
1 file modified
mnemosyne/mnemosyne/pyqt_ui/review_wdgt.py (+4/-3)
To merge this branch: bzr merge lp:~kevang/mnemosyne-proj/grade_only_if_showing
Reviewer Review Type Date Requested Status
Kilian Evang (community) Disapprove on 2015-05-12
Peter Bienstman 2014-09-23 Pending
Review via email: mp+235605@code.launchpad.net

Description of the change

Despite https://code.launchpad.net/~kevang/mnemosyne-proj/number_keys_show_answer/+merge/234210, I was still having issues with accidentally grading two cards in a row by pressing two number keys at the same time. I found that what happens is this: one of the two buttons will cause grade_answer to be called, which grades the answer and brings up the next card. In this process, the grade buttons are disabled and a further number key press should not lead to grading anymore. However, since the two key presses happened at the same time, PyQT is already processing them, and grade_answer will also be called for the other button, grading the next card.

This simple fix seems to do the trick: grade_answer now only acts if the answer is currently showing, thereby ignoring the second key press.

To post a comment you must log in.
Peter Bienstman (peter-bienstman) wrote :

Thanks, I will commit this.

There is still the remaining issue though that if you press and hold down a number key, it will show the answer and immediately grade it...

Peter

> -----Original Message-----
> From: <email address hidden> [mailto:<email address hidden>] On Behalf
> Of Kilian Evang
> Sent: 23 September 2014 12:39
> To: <email address hidden>
> Subject: [Merge] lp:~kevang/mnemosyne-proj/grade_only_if_showing into
> lp:mnemosyne-proj
>
> Kilian Evang has proposed merging lp:~kevang/mnemosyne-
> proj/grade_only_if_showing into lp:mnemosyne-proj.
>
> Requested reviews:
> Peter Bienstman (peter-bienstman)
>
> For more details, see:
> https://code.launchpad.net/~kevang/mnemosyne-
> proj/grade_only_if_showing/+merge/235605
>
> Despite https://code.launchpad.net/~kevang/mnemosyne-
> proj/number_keys_show_answer/+merge/234210, I was still having issues
> with accidentally grading two cards in a row by pressing two number keys at
> the same time. I found that what happens is this: one of the two buttons will
> cause grade_answer to be called, which grades the answer and brings up the
> next card. In this process, the grade buttons are disabled and a further
> number key press should not lead to grading anymore. However, since the
> two key presses happened at the same time, PyQT is already processing
> them, and grade_answer will also be called for the other button, grading the
> next card.
>
> This simple fix seems to do the trick: grade_answer now only acts if the
> answer is currently showing, thereby ignoring the second key press.
> --
> https://code.launchpad.net/~kevang/mnemosyne-
> proj/grade_only_if_showing/+merge/235605
> You are requested to review the proposed merge of
> lp:~kevang/mnemosyne-proj/grade_only_if_showing into lp:mnemosyne-
> proj.

Kilian Evang (kevang) wrote :

I found a fix that fixes both issues, "two keys at once" and "hold down one key". See https://code.launchpad.net/~kevang/mnemosyne-proj/grade-shortcuts-improvements/+merge/258885

I rescind the present merge proposal in favor of the new one.

review: Disapprove

Unmerged revisions

1816. By Kilian Evang <email address hidden> on 2014-09-23

grade_answer now only acts if the answer is showing. This to prevent accidental grading of the next card when hitting two number keys at once.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mnemosyne/mnemosyne/pyqt_ui/review_wdgt.py'
2--- mnemosyne/mnemosyne/pyqt_ui/review_wdgt.py 2014-02-13 20:16:53 +0000
3+++ mnemosyne/mnemosyne/pyqt_ui/review_wdgt.py 2014-09-23 10:38:57 +0000
4@@ -304,9 +304,10 @@
5 self.review_controller().show_answer()
6
7 def grade_answer(self, grade):
8- self.vertical_layout.setStretchFactor(self.question_box, 50)
9- self.vertical_layout.setStretchFactor(self.answer_box, 50)
10- self.review_controller().grade_answer(grade)
11+ if self.is_answer_showing:
12+ self.vertical_layout.setStretchFactor(self.question_box, 50)
13+ self.vertical_layout.setStretchFactor(self.answer_box, 50)
14+ self.review_controller().grade_answer(grade)
15
16 def set_question_box_visible(self, is_visible):
17 if is_visible:

Subscribers

People subscribed via source and target branches