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

Proposed by Kilian Evang
Status: Merged
Merge reported by: Peter Bienstman
Merged at revision: not available
Proposed branch: lp:~kevang/mnemosyne-proj/number_keys_show_answer
Merge into: lp:~peter-bienstman/mnemosyne-proj/trunk
Diff against target: 21 lines (+3/-1)
1 file modified
mnemosyne/mnemosyne/pyqt_ui/review_wdgt.py (+3/-1)
To merge this branch: bzr merge lp:~kevang/mnemosyne-proj/number_keys_show_answer
Reviewer Review Type Date Requested Status
Peter Bienstman Pending
Review via email: mp+234210@code.launchpad.net

Description of the change

In the default review widget, the number keys can be used for showing the answer. While this behavior can be useful, it can also cause unintended showing and even unintended grading when the user accidentally presses a number key two or three times in a row.

This branch makes the abovementioned behavior dependent on the attribute "number_keys_show_answer" so that the behavior can easily be changed by a plugin. This is analoguous to the already existing attribute "auto_focus_grades", which controls the behavior of grading by pressing the space bar.

To post a comment you must log in.
Revision history for this message
Peter Bienstman (peter-bienstman) wrote :

Not sure this is a good idea. I think it's much better to prevent the fact that pressing and holding a number key counts as two presses at the moment. For the enter key, pressing and holding counts as one, so I need to investigate why it does not work for the number keys.

Cheers,

Peter

> -----Original Message-----
> From: <email address hidden> [mailto:<email address hidden>] On Behalf
> Of Kilian Evang
> Sent: 10 September 2014 23:41
> To: <email address hidden>
> Subject: [Merge] lp:~kevang/mnemosyne-
> proj/number_keys_show_answer into lp:mnemosyne-proj
>
> Kilian Evang has proposed merging lp:~kevang/mnemosyne-
> proj/number_keys_show_answer into lp:mnemosyne-proj.
>
> Requested reviews:
> Peter Bienstman (peter-bienstman)
>
> For more details, see:
> https://code.launchpad.net/~kevang/mnemosyne-
> proj/number_keys_show_answer/+merge/234210
>
> In the default review widget, the number keys can be used for showing the
> answer. While this behavior can be useful, it can also cause unintended
> showing and even unintended grading when the user accidentally presses a
> number key two or three times in a row.
>
> This branch makes the abovementioned behavior dependent on the
> attribute "number_keys_show_answer" so that the behavior can easily be
> changed by a plugin. This is analoguous to the already existing attribute
> "auto_focus_grades", which controls the behavior of grading by pressing the
> space bar.
> --
> https://code.launchpad.net/~kevang/mnemosyne-
> proj/number_keys_show_answer/+merge/234210
> You are requested to review the proposed merge of
> lp:~kevang/mnemosyne-proj/number_keys_show_answer into
> lp:mnemosyne-proj.

Revision history for this message
Kilian Evang (kevang) wrote :

> Not sure this is a good idea.

Why not? What's the harm?

I'm not asking to change Mnemosyne's behavior. I'm just asking to make it possible for plugins to change it without overriding keyPressEvent.

> I think it's much better to prevent the fact
> that pressing and holding a number key counts as two presses at the moment.

What if there really are two or more consecutive key presses, for example, by hitting both keys "3" and "4"? Take it from someone to whom this happens *all the time*...

Revision history for this message
Peter Bienstman (peter-bienstman) wrote :

OK, I'll add this to my development branch them, but personally, I don't plan to distribute an official plugin making use of it, since I still think the cleaner approach is fixing the repeat issue, and I don't think people hitting two keys at the same time is an extremely widespread issue.

Feel free to create your own plugin, though :-)

Cheers,

Peter

> -----Original Message-----
> From: <email address hidden> [mailto:<email address hidden>] On Behalf
> Of Kilian Evang
> Sent: 11 September 2014 11:13
> To: <email address hidden>
> Subject: Re: RE: [Merge] lp:~kevang/mnemosyne-
> proj/number_keys_show_answer into lp:mnemosyne-proj
>
> > Not sure this is a good idea.
>
> Why not? What's the harm?
>
> I'm not asking to change Mnemosyne's behavior. I'm just asking to make it
> possible for plugins to change it without overriding keyPressEvent.
>
> > I think it's much better to prevent the fact that pressing and holding
> > a number key counts as two presses at the moment.
>
> What if there really are two or more consecutive key presses, for example,
> by hitting both keys "3" and "4"? Take it from someone to whom this
> happens *all the time*...
> --
> https://code.launchpad.net/~kevang/mnemosyne-
> proj/number_keys_show_answer/+merge/234210
> You are requested to review the proposed merge of
> lp:~kevang/mnemosyne-proj/number_keys_show_answer into
> lp:mnemosyne-proj.

Revision history for this message
Kilian Evang (kevang) wrote :

> OK, I'll add this to my development branch them

Thanks! :)

> Feel free to create your own plugin, though :-)

I alreadyd did: https://github.com/texttheater/clumsy_fingers :D

Revision history for this message
Kilian Evang (kevang) wrote :

The change has been integrated in revision <email address hidden>, so this proposal can be closed.

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:10:36 +0000
4@@ -182,6 +182,7 @@
5 class ReviewWdgt(QtGui.QWidget, QAOptimalSplit, Ui_ReviewWdgt, ReviewWidget):
6
7 auto_focus_grades = True
8+ number_keys_show_answer = True
9
10 def __init__(self, component_manager):
11 ReviewWidget.__init__(self, component_manager)
12@@ -233,7 +234,8 @@
13 QtCore.Qt.Key_2, QtCore.Qt.Key_3, QtCore.Qt.Key_4,
14 QtCore.Qt.Key_5] and \
15 self.review_controller().is_question_showing():
16- self.show_answer()
17+ if self.number_keys_show_answer:
18+ self.show_answer()
19 elif not event.isAutoRepeat() and event.key() \
20 == QtCore.Qt.Key_QuoteLeft and \
21 not self.review_controller().is_question_showing():

Subscribers

People subscribed via source and target branches