mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -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-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-show-next-review-time-above-answer = Show next review time above answer buttons
|
||||||
preferences-spacebar-rates-card = Spacebar (or enter) also answers card
|
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-play-buttons-on-cards-with = Show play buttons on cards with audio
|
||||||
preferences-show-remaining-card-count = Show remaining card count
|
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.
|
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;
|
uint32 time_limit_secs = 5;
|
||||||
bool load_balancer_enabled = 6;
|
bool load_balancer_enabled = 6;
|
||||||
bool fsrs_short_term_with_steps_enabled = 7;
|
bool fsrs_short_term_with_steps_enabled = 7;
|
||||||
|
bool hide_colored_buttons = 8;
|
||||||
}
|
}
|
||||||
message Editing {
|
message Editing {
|
||||||
bool adding_defaults_to_current_deck = 1;
|
bool adding_defaults_to_current_deck = 1;
|
||||||
|
|
|
||||||
|
|
@ -373,6 +373,19 @@
|
||||||
<string>preferences_review</string>
|
<string>preferences_review</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<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>
|
<item>
|
||||||
<widget class="QCheckBox" name="showPlayButtons">
|
<widget class="QCheckBox" name="showPlayButtons">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ class Preferences(QDialog):
|
||||||
form.showEstimates.setChecked(reviewing.show_intervals_on_buttons)
|
form.showEstimates.setChecked(reviewing.show_intervals_on_buttons)
|
||||||
form.showProgress.setChecked(reviewing.show_remaining_due_counts)
|
form.showProgress.setChecked(reviewing.show_remaining_due_counts)
|
||||||
form.showPlayButtons.setChecked(not reviewing.hide_audio_play_buttons)
|
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)
|
form.interrupt_audio.setChecked(reviewing.interrupt_audio_when_answering)
|
||||||
|
|
||||||
editing = self.prefs.editing
|
editing = self.prefs.editing
|
||||||
|
|
@ -172,6 +173,7 @@ class Preferences(QDialog):
|
||||||
reviewing.show_intervals_on_buttons = form.showEstimates.isChecked()
|
reviewing.show_intervals_on_buttons = form.showEstimates.isChecked()
|
||||||
reviewing.time_limit_secs = form.timeLimit.value() * 60
|
reviewing.time_limit_secs = form.timeLimit.value() * 60
|
||||||
reviewing.hide_audio_play_buttons = not self.form.showPlayButtons.isChecked()
|
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()
|
reviewing.interrupt_audio_when_answering = self.form.interrupt_audio.isChecked()
|
||||||
|
|
||||||
editing = self.prefs.editing
|
editing = self.prefs.editing
|
||||||
|
|
|
||||||
|
|
@ -931,6 +931,19 @@ timerStopped = false;
|
||||||
if aqt.mw.pm.get_answer_key(i)
|
if aqt.mw.pm.get_answer_key(i)
|
||||||
else ""
|
else ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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 """
|
return """
|
||||||
<td align=center><button %s class="answerButton %s" title="%s" data-ease="%s" onclick='pycmd("ease%d");'>\
|
<td align=center><button %s class="answerButton %s" title="%s" data-ease="%s" onclick='pycmd("ease%d");'>\
|
||||||
%s%s</button></td>""" % (
|
%s%s</button></td>""" % (
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ pub enum BoolKey {
|
||||||
ShowRemainingDueCountsInStudy,
|
ShowRemainingDueCountsInStudy,
|
||||||
#[strum(to_string = "addToCur")]
|
#[strum(to_string = "addToCur")]
|
||||||
AddingDefaultsToCurrentDeck,
|
AddingDefaultsToCurrentDeck,
|
||||||
|
#[strum(to_string = "hideColor")]
|
||||||
|
HideColoredButtons,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is a workaround for old clients that used ints to represent boolean
|
/// This is a workaround for old clients that used ints to represent boolean
|
||||||
|
|
@ -71,6 +73,7 @@ impl Collection {
|
||||||
// some keys default to true
|
// some keys default to true
|
||||||
BoolKey::InterruptAudioWhenAnswering
|
BoolKey::InterruptAudioWhenAnswering
|
||||||
| BoolKey::ShowIntervalsAboveAnswerButtons
|
| BoolKey::ShowIntervalsAboveAnswerButtons
|
||||||
|
| BoolKey::HideColoredButtons
|
||||||
| BoolKey::AddingDefaultsToCurrentDeck
|
| BoolKey::AddingDefaultsToCurrentDeck
|
||||||
| BoolKey::FutureDueShowBacklog
|
| BoolKey::FutureDueShowBacklog
|
||||||
| BoolKey::ShowRemainingDueCountsInStudy
|
| BoolKey::ShowRemainingDueCountsInStudy
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,8 @@ impl Collection {
|
||||||
show_remaining_due_counts: self.get_config_bool(BoolKey::ShowRemainingDueCountsInStudy),
|
show_remaining_due_counts: self.get_config_bool(BoolKey::ShowRemainingDueCountsInStudy),
|
||||||
show_intervals_on_buttons: self
|
show_intervals_on_buttons: self
|
||||||
.get_config_bool(BoolKey::ShowIntervalsAboveAnswerButtons),
|
.get_config_bool(BoolKey::ShowIntervalsAboveAnswerButtons),
|
||||||
|
hide_colored_buttons: self
|
||||||
|
.get_config_bool(BoolKey::HideColoredButtons),
|
||||||
time_limit_secs: self.get_answer_time_limit_secs(),
|
time_limit_secs: self.get_answer_time_limit_secs(),
|
||||||
load_balancer_enabled: self.get_config_bool(BoolKey::LoadBalancerEnabled),
|
load_balancer_enabled: self.get_config_bool(BoolKey::LoadBalancerEnabled),
|
||||||
fsrs_short_term_with_steps_enabled: self
|
fsrs_short_term_with_steps_enabled: self
|
||||||
|
|
@ -119,6 +121,10 @@ impl Collection {
|
||||||
BoolKey::ShowIntervalsAboveAnswerButtons,
|
BoolKey::ShowIntervalsAboveAnswerButtons,
|
||||||
s.show_intervals_on_buttons,
|
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_answer_time_limit_secs(s.time_limit_secs)?;
|
||||||
self.set_config_bool_inner(BoolKey::LoadBalancerEnabled, s.load_balancer_enabled)?;
|
self.set_config_bool_inner(BoolKey::LoadBalancerEnabled, s.load_balancer_enabled)?;
|
||||||
self.set_config_bool_inner(
|
self.set_config_bool_inner(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue