mirror of
https://github.com/ankitects/anki.git
synced 2026-01-07 02:53:54 -05:00
Merge 7ec43be046 into 8f2144534b
This commit is contained in:
commit
710ed50f25
2 changed files with 15 additions and 5 deletions
|
|
@ -255,6 +255,7 @@ Ranjit Odedra <ranjitodedra.dev@gmail.com>
|
||||||
Eltaurus <https://github.com/Eltaurus-Lt>
|
Eltaurus <https://github.com/Eltaurus-Lt>
|
||||||
jariji
|
jariji
|
||||||
Francisco Esteva <fr.esteva@duocuc.cl>
|
Francisco Esteva <fr.esteva@duocuc.cl>
|
||||||
|
Emma Plante <emmaplante04@gmail.com>
|
||||||
SelfishPig <https://github.com/SelfishPig>
|
SelfishPig <https://github.com/SelfishPig>
|
||||||
|
|
||||||
********************
|
********************
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,17 @@ class CustomStudy(QDialog):
|
||||||
def fetch_data_and_show(mw: aqt.AnkiQt) -> None:
|
def fetch_data_and_show(mw: aqt.AnkiQt) -> None:
|
||||||
def fetch_data(
|
def fetch_data(
|
||||||
col: Collection,
|
col: Collection,
|
||||||
) -> tuple[DeckId, CustomStudyDefaults]:
|
) -> tuple[DeckId, CustomStudyDefaults, Any]:
|
||||||
deck_id = mw.col.decks.get_current_id()
|
deck_id = mw.col.decks.get_current_id()
|
||||||
defaults = col.sched.custom_study_defaults(deck_id)
|
defaults = col.sched.custom_study_defaults(deck_id)
|
||||||
return (deck_id, defaults)
|
card_count = col.decks.card_count(deck_id, True)
|
||||||
|
return (deck_id, defaults, card_count)
|
||||||
|
|
||||||
def show_dialog(data: tuple[DeckId, CustomStudyDefaults]) -> None:
|
def show_dialog(data: tuple[DeckId, CustomStudyDefaults, Any]) -> None:
|
||||||
deck_id, defaults = data
|
deck_id, defaults, card_count = data
|
||||||
CustomStudy(mw=mw, deck_id=deck_id, defaults=defaults)
|
CustomStudy(
|
||||||
|
mw=mw, deck_id=deck_id, card_count=card_count, defaults=defaults
|
||||||
|
)
|
||||||
|
|
||||||
QueryOp(
|
QueryOp(
|
||||||
parent=mw, op=fetch_data, success=show_dialog
|
parent=mw, op=fetch_data, success=show_dialog
|
||||||
|
|
@ -52,12 +55,14 @@ class CustomStudy(QDialog):
|
||||||
self,
|
self,
|
||||||
mw: aqt.AnkiQt,
|
mw: aqt.AnkiQt,
|
||||||
deck_id: DeckId,
|
deck_id: DeckId,
|
||||||
|
card_count: Any,
|
||||||
defaults: CustomStudyDefaults,
|
defaults: CustomStudyDefaults,
|
||||||
) -> None:
|
) -> None:
|
||||||
"Don't call this directly; use CustomStudy.fetch_data_and_show()."
|
"Don't call this directly; use CustomStudy.fetch_data_and_show()."
|
||||||
QDialog.__init__(self, mw)
|
QDialog.__init__(self, mw)
|
||||||
self.mw = mw
|
self.mw = mw
|
||||||
self.deck_id = deck_id
|
self.deck_id = deck_id
|
||||||
|
self.card_count = card_count
|
||||||
self.defaults = defaults
|
self.defaults = defaults
|
||||||
self.form = aqt.forms.customstudy.Ui_Dialog()
|
self.form = aqt.forms.customstudy.Ui_Dialog()
|
||||||
self.form.setupUi(self)
|
self.form.setupUi(self)
|
||||||
|
|
@ -90,6 +95,7 @@ class CustomStudy(QDialog):
|
||||||
text_after_spinner = tr.custom_study_cards()
|
text_after_spinner = tr.custom_study_cards()
|
||||||
title_text = ""
|
title_text = ""
|
||||||
show_cram_type = False
|
show_cram_type = False
|
||||||
|
enable_ok_button = self.card_count is not None and self.card_count > 0
|
||||||
ok = tr.custom_study_ok()
|
ok = tr.custom_study_ok()
|
||||||
|
|
||||||
if idx == RADIO_NEW:
|
if idx == RADIO_NEW:
|
||||||
|
|
@ -102,6 +108,7 @@ class CustomStudy(QDialog):
|
||||||
text_before_spinner = tr.custom_study_increase_todays_new_card_limit_by()
|
text_before_spinner = tr.custom_study_increase_todays_new_card_limit_by()
|
||||||
current_spinner_value = self.defaults.extend_new
|
current_spinner_value = self.defaults.extend_new
|
||||||
min_spinner_value = -DYN_MAX_SIZE
|
min_spinner_value = -DYN_MAX_SIZE
|
||||||
|
enable_ok_button = True
|
||||||
elif idx == RADIO_REV:
|
elif idx == RADIO_REV:
|
||||||
title_text = tr.custom_study_available_review_cards_2(
|
title_text = tr.custom_study_available_review_cards_2(
|
||||||
count_string=self.count_with_children(
|
count_string=self.count_with_children(
|
||||||
|
|
@ -112,6 +119,7 @@ class CustomStudy(QDialog):
|
||||||
text_before_spinner = tr.custom_study_increase_todays_review_limit_by()
|
text_before_spinner = tr.custom_study_increase_todays_review_limit_by()
|
||||||
current_spinner_value = self.defaults.extend_review
|
current_spinner_value = self.defaults.extend_review
|
||||||
min_spinner_value = -DYN_MAX_SIZE
|
min_spinner_value = -DYN_MAX_SIZE
|
||||||
|
enable_ok_button = True
|
||||||
elif idx == RADIO_FORGOT:
|
elif idx == RADIO_FORGOT:
|
||||||
text_before_spinner = tr.custom_study_review_cards_forgotten_in_last()
|
text_before_spinner = tr.custom_study_review_cards_forgotten_in_last()
|
||||||
text_after_spinner = tr.scheduling_days()
|
text_after_spinner = tr.scheduling_days()
|
||||||
|
|
@ -149,6 +157,7 @@ class CustomStudy(QDialog):
|
||||||
ok_button = form.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
|
ok_button = form.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
|
||||||
assert ok_button is not None
|
assert ok_button is not None
|
||||||
ok_button.setText(ok)
|
ok_button.setText(ok)
|
||||||
|
ok_button.setEnabled(enable_ok_button)
|
||||||
|
|
||||||
self.radioIdx = idx
|
self.radioIdx = idx
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue