mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 05:07:10 -05:00
FEAT/ADD: Option for colored answer buttons
This commit is contained in:
parent
aaa9f8c11e
commit
5da16c0f06
7 changed files with 40 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ preferences-scheduling = Scheduling
|
|||
preferences-show-learning-cards-with-larger-steps = Show learning cards with larger steps before reviews
|
||||
preferences-show-next-review-time-above-answer = Show next review time above answer buttons
|
||||
preferences-spacebar-rates-card = Spacebar (or enter) also answers card
|
||||
preferences-show-colored-buttons = Show colored border on answer buttons
|
||||
preferences-show-play-buttons-on-cards-with = Show play buttons on cards with audio
|
||||
preferences-show-remaining-card-count = Show remaining card count
|
||||
preferences-some-settings-will-take-effect-after = Some settings will take effect after you restart Anki.
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ message Preferences {
|
|||
uint32 time_limit_secs = 5;
|
||||
bool load_balancer_enabled = 6;
|
||||
bool fsrs_short_term_with_steps_enabled = 7;
|
||||
bool hide_colored_buttons = 8;
|
||||
}
|
||||
message Editing {
|
||||
bool adding_defaults_to_current_deck = 1;
|
||||
|
|
|
|||
|
|
@ -373,6 +373,19 @@
|
|||
<string>preferences_review</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideColoredButtons">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>preferences_show_colored_buttons</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showPlayButtons">
|
||||
<property name="sizePolicy">
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ class Preferences(QDialog):
|
|||
form.showEstimates.setChecked(reviewing.show_intervals_on_buttons)
|
||||
form.showProgress.setChecked(reviewing.show_remaining_due_counts)
|
||||
form.showPlayButtons.setChecked(not reviewing.hide_audio_play_buttons)
|
||||
form.hideColoredButtons.setChecked(not reviewing.hide_colored_buttons)
|
||||
form.interrupt_audio.setChecked(reviewing.interrupt_audio_when_answering)
|
||||
|
||||
editing = self.prefs.editing
|
||||
|
|
@ -172,6 +173,7 @@ class Preferences(QDialog):
|
|||
reviewing.show_intervals_on_buttons = form.showEstimates.isChecked()
|
||||
reviewing.time_limit_secs = form.timeLimit.value() * 60
|
||||
reviewing.hide_audio_play_buttons = not self.form.showPlayButtons.isChecked()
|
||||
reviewing.hide_colored_buttons = not self.form.hideColoredButtons.isChecked()
|
||||
reviewing.interrupt_audio_when_answering = self.form.interrupt_audio.isChecked()
|
||||
|
||||
editing = self.prefs.editing
|
||||
|
|
|
|||
|
|
@ -931,7 +931,20 @@ timerStopped = false;
|
|||
if aqt.mw.pm.get_answer_key(i)
|
||||
else ""
|
||||
)
|
||||
return """
|
||||
|
||||
if self.mw.col.conf["hideColor"]:
|
||||
return """
|
||||
<td align=center><button %s title="%s" data-ease="%s" onclick='pycmd("ease%d");'>\
|
||||
%s%s</button></td>""" % (
|
||||
extra,
|
||||
key,
|
||||
i,
|
||||
i,
|
||||
label,
|
||||
due,
|
||||
)
|
||||
else:
|
||||
return """
|
||||
<td align=center><button %s class="answerButton %s" title="%s" data-ease="%s" onclick='pycmd("ease%d");'>\
|
||||
%s%s</button></td>""" % (
|
||||
extra,
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ pub enum BoolKey {
|
|||
ShowRemainingDueCountsInStudy,
|
||||
#[strum(to_string = "addToCur")]
|
||||
AddingDefaultsToCurrentDeck,
|
||||
#[strum(to_string = "hideColor")]
|
||||
HideColoredButtons,
|
||||
}
|
||||
|
||||
/// This is a workaround for old clients that used ints to represent boolean
|
||||
|
|
@ -71,6 +73,7 @@ impl Collection {
|
|||
// some keys default to true
|
||||
BoolKey::InterruptAudioWhenAnswering
|
||||
| BoolKey::ShowIntervalsAboveAnswerButtons
|
||||
| BoolKey::HideColoredButtons
|
||||
| BoolKey::AddingDefaultsToCurrentDeck
|
||||
| BoolKey::FutureDueShowBacklog
|
||||
| BoolKey::ShowRemainingDueCountsInStudy
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ impl Collection {
|
|||
show_remaining_due_counts: self.get_config_bool(BoolKey::ShowRemainingDueCountsInStudy),
|
||||
show_intervals_on_buttons: self
|
||||
.get_config_bool(BoolKey::ShowIntervalsAboveAnswerButtons),
|
||||
hide_colored_buttons: self
|
||||
.get_config_bool(BoolKey::HideColoredButtons),
|
||||
time_limit_secs: self.get_answer_time_limit_secs(),
|
||||
load_balancer_enabled: self.get_config_bool(BoolKey::LoadBalancerEnabled),
|
||||
fsrs_short_term_with_steps_enabled: self
|
||||
|
|
@ -119,6 +121,10 @@ impl Collection {
|
|||
BoolKey::ShowIntervalsAboveAnswerButtons,
|
||||
s.show_intervals_on_buttons,
|
||||
)?;
|
||||
self.set_config_bool_inner(
|
||||
BoolKey::HideColoredButtons,
|
||||
s.hide_colored_buttons,
|
||||
)?;
|
||||
self.set_answer_time_limit_secs(s.time_limit_secs)?;
|
||||
self.set_config_bool_inner(BoolKey::LoadBalancerEnabled, s.load_balancer_enabled)?;
|
||||
self.set_config_bool_inner(
|
||||
|
|
|
|||
Loading…
Reference in a new issue