Add button to show solution

This commit is contained in:
Andros Fenollosa 2024-01-03 13:32:56 +01:00
parent 3c261f518e
commit d3441e3617

View File

@ -18,279 +18,312 @@
;; Variables ;; Variables
(defvar learning-irregular-verbs-in-English--verbs '( (defvar lire--verbs '(
("beat" "beat" "beaten") ("beat" "beat" "beaten")
("become" "became" "become") ("become" "became" "become")
("begin" "began" "begun") ("begin" "began" "begun")
("bend" "bent" "bent") ("bend" "bent" "bent")
("bet" "bet" "bet") ("bet" "bet" "bet")
("bite" "bit" "bitten") ("bite" "bit" "bitten")
("bleed" "bled" "bled") ("bleed" "bled" "bled")
("blow" "blew" "blown") ("blow" "blew" "blown")
("break" "broke" "broken") ("break" "broke" "broken")
("bring" "brought" "brought") ("bring" "brought" "brought")
("build" "built" "built") ("build" "built" "built")
("burn" "burnt" "burnt") ("burn" "burnt" "burnt")
("buy" "bought" "bought") ("buy" "bought" "bought")
("catch" "caught" "caught") ("catch" "caught" "caught")
("choose" "chose" "chosen") ("choose" "chose" "chosen")
("come" "came" "come") ("come" "came" "come")
("cost" "cost" "cost") ("cost" "cost" "cost")
("cut" "cut" "cut") ("cut" "cut" "cut")
("dig" "dug" "dug") ("dig" "dug" "dug")
("do" "did" "done") ("do" "did" "done")
("draw" "drew" "drawn") ("draw" "drew" "drawn")
("dream" "dreamt" "dreamt") ("dream" "dreamt" "dreamt")
("drink" "drank" "drunk") ("drink" "drank" "drunk")
("drive" "drove" "driven") ("drive" "drove" "driven")
("eat" "ate" "eaten") ("eat" "ate" "eaten")
("fall" "fell" "fallen") ("fall" "fell" "fallen")
("feed" "fed" "fed") ("feed" "fed" "fed")
("feel" "felt" "felt") ("feel" "felt" "felt")
("fight" "fought" "fought") ("fight" "fought" "fought")
("find" "found" "found") ("find" "found" "found")
("fly" "flew" "flown") ("fly" "flew" "flown")
("forget" "forgot" "forgotten") ("forget" "forgot" "forgotten")
("forgive" "forgave" "forgiven") ("forgive" "forgave" "forgiven")
("freeze" "froze" "frozen") ("freeze" "froze" "frozen")
("get" "got" "got") ("get" "got" "got")
("give" "gave" "given") ("give" "gave" "given")
("go" "went" "gone") ("go" "went" "gone")
("grow" "grew" "grown") ("grow" "grew" "grown")
("hang" "hung" "hung") ("hang" "hung" "hung")
("have" "had" "had") ("have" "had" "had")
("hear" "heard" "heard") ("hear" "heard" "heard")
("hide" "hid" "hidden") ("hide" "hid" "hidden")
("hit" "hit" "hit") ("hit" "hit" "hit")
("hold" "held" "held") ("hold" "held" "held")
("hurt" "hurt" "hurt") ("hurt" "hurt" "hurt")
("keep" "kept" "kept") ("keep" "kept" "kept")
("know" "knew" "known") ("know" "knew" "known")
("lay" "laid" "laid") ("lay" "laid" "laid")
("lead" "led" "led") ("lead" "led" "led")
("learn" "learnt" "learnt") ("learn" "learnt" "learnt")
("leave" "left" "left") ("leave" "left" "left")
("lend" "lent" "lent") ("lend" "lent" "lent")
("let" "let" "let") ("let" "let" "let")
("lie" "lay" "lain") ("lie" "lay" "lain")
("light" "lit" "lit") ("light" "lit" "lit")
("lose" "lost" "lost") ("lose" "lost" "lost")
("make" "made" "made") ("make" "made" "made")
("mean" "meant" "meant") ("mean" "meant" "meant")
("meet" "met" "met") ("meet" "met" "met")
("pay" "paid" "paid") ("pay" "paid" "paid")
("put" "put" "put") ("put" "put" "put")
("read" "read" "read") ("read" "read" "read")
("ride" "rode" "ridden") ("ride" "rode" "ridden")
("ring" "rang" "rung") ("ring" "rang" "rung")
("rise" "rose" "risen") ("rise" "rose" "risen")
("run" "ran" "run") ("run" "ran" "run")
("say" "said" "said") ("say" "said" "said")
("see" "saw" "seen") ("see" "saw" "seen")
("sell" "sold" "sold") ("sell" "sold" "sold")
("send" "sent" "sent") ("send" "sent" "sent")
("set" "set" "set") ("set" "set" "set")
("shake" "shook" "shaken") ("shake" "shook" "shaken")
("shine" "shone" "shone") ("shine" "shone" "shone")
("shoot" "shot" "shot") ("shoot" "shot" "shot")
("show" "showed" "shown") ("show" "showed" "shown")
("shut" "shut" "shut") ("shut" "shut" "shut")
("sing" "sang" "sung") ("sing" "sang" "sung")
("sink" "sank" "sunk") ("sink" "sank" "sunk")
("sit" "sat" "sat") ("sit" "sat" "sat")
("sleep" "slept" "slept") ("sleep" "slept" "slept")
("smell" "smelt" "smelt") ("smell" "smelt" "smelt")
("speak" "spoke" "spoken") ("speak" "spoke" "spoken")
("spend" "spent" "spent") ("spend" "spent" "spent")
("spell" "spelt" "spelt") ("spell" "spelt" "spelt")
("spit" "spit" "spit") ("spit" "spit" "spit")
("stand" "stood" "stood") ("stand" "stood" "stood")
("steal" "stole" "stolen") ("steal" "stole" "stolen")
("swim" "swam" "swum") ("swim" "swam" "swum")
("take" "took" "taken") ("take" "took" "taken")
("teach" "taught" "taught") ("teach" "taught" "taught")
("tear" "tore" "torn") ("tear" "tore" "torn")
("tell" "told" "told") ("tell" "told" "told")
("think" "thought" "thought") ("think" "thought" "thought")
("throw" "threw" "thrown") ("throw" "threw" "thrown")
("understand" "understood" "understood") ("understand" "understood" "understood")
("wake" "woke" "woken") ("wake" "woke" "woken")
("wear" "wore" "worn") ("wear" "wore" "worn")
("win" "won" "won") ("win" "won" "won")
("write" "wrote" "written"))) ("write" "wrote" "written")))
;; learning-irregular-verbs-in-English ;; lire
(defvar learning-irregular-verbs-in-English--buffer-name "*Learning irregular verbs in English*") (defvar lire--buffer-name "*Learning irregular verbs in English*")
(defvar learning-irregular-verbs-in-English--state 1) ;; 1: start, 2: playing (before first check), 3: win (show success layout) (defvar lire--state 1) ;; 1: lire--start, 2: playing (before first check), 3: win (show success layout)
(defvar learning-irregular-verbs-in-English--verb-to-learn-infinitive nil) (defvar lire--verb-to-learn-infinitive nil)
(defvar learning-irregular-verbs-in-English--verb-to-learn-simple-past nil) (defvar lire--verb-to-learn-simple-past nil)
(defvar learning-irregular-verbs-in-English--verb-to-learn-past-participle nil) (defvar lire--verb-to-learn-past-participle nil)
(defvar learning-irregular-verbs-in-English--emoji-valid "") (defvar lire--emoji-valid "")
(defvar learning-irregular-verbs-in-English--emoji-error "👎") (defvar lire--emoji-error "👎")
(defvar learning-irregular-verbs-in-English--widget-title nil) (defvar lire--widget-title nil)
(defvar learning-irregular-verbs-in-English--text-title " 🧑‍🎓 Learning irregular verbs in English 🇬🇧") (defvar lire--text-title " 🧑‍🎓 Learning irregular verbs in English 🇬🇧")
(defvar learning-irregular-verbs-in-English--widget-item-verb nil) (defvar lire--widget-item-verb nil)
(defvar learning-irregular-verbs-in-English--widget-field-simple-past nil) (defvar lire--widget-field-simple-past nil)
(defvar learning-irregular-verbs-in-English--widget-label-check-simple-past nil) (defvar lire--widget-label-check-simple-past nil)
(defvar learning-irregular-verbs-in-English--widget-field-past-participle nil) (defvar lire--widget-field-past-participle nil)
(defvar learning-irregular-verbs-in-English--widget-label-check-past-participle nil) (defvar lire--widget-label-check-past-participle nil)
(defvar learning-irregular-verbs-in-English--text-button-check "Check") (defvar lire--text-button-check "Check")
(defvar learning-irregular-verbs-in-English--widget-button-check nil) (defvar lire--widget-button-check nil)
(defvar learning-irregular-verbs-in-English--widget-message-success nil) (defvar lire--widget-item-space-before-check nil)
(defvar learning-irregular-verbs-in-English--widget-item-space-before-success nil) (defvar lire--text-button-show-solution "Don't know")
(defvar learning-irregular-verbs-in-English--text-success "Nice!") (defvar lire--widget-button-show-solution nil)
(defvar learning-irregular-verbs-in-English--widget-item-space-after-success nil) (defvar lire--widget-message-success nil)
(defvar learning-irregular-verbs-in-English--widget-button-quit nil) (defvar lire--widget-item-space-before-success nil)
(defvar learning-irregular-verbs-in-English--text-button-quit "Quit") (defvar lire--text-success "Nice!")
(defvar learning-irregular-verbs-in-English--widget-item-space-between-buttons nil) (defvar lire--text-fail "Next time you will do better")
(defvar learning-irregular-verbs-in-English--widget-button-replay nil) (defvar lire--is-resolve t)
(defvar learning-irregular-verbs-in-English--text-button-replay "New challenge") (defvar lire--widget-item-space-after-success nil)
(defvar lire--widget-button-quit nil)
(defvar lire--text-button-quit "Quit")
(defvar lire--widget-item-space-between-buttons nil)
(defvar lire--widget-button-lire--replay nil)
(defvar lire--text-button-lire--replay "New challenge")
;; Functions ;; Functions
(defun learning-irregular-verbs-in-English--kill-app () (defun lire--kill-app ()
"Kill the application." "Kill the application."
(kill-buffer learning-irregular-verbs-in-English--buffer-name)) (kill-buffer lire--buffer-name))
(defun learning-irregular-verbs-in-English--value-field-simple-past () (defun lire--value-field-simple-past ()
(if (not (eq learning-irregular-verbs-in-English--widget-field-simple-past nil)) (widget-value learning-irregular-verbs-in-English--widget-field-simple-past) "")) (if (not (eq lire--widget-field-simple-past nil)) (widget-value lire--widget-field-simple-past) ""))
(defun learning-irregular-verbs-in-English--value-field-past-participle () (defun lire--value-field-past-participle ()
(if (not (eq learning-irregular-verbs-in-English--widget-field-past-participle nil)) (widget-value learning-irregular-verbs-in-English--widget-field-past-participle) "")) (if (not (eq lire--widget-field-past-participle nil)) (widget-value lire--widget-field-past-participle) ""))
(defun learning-irregular-verbs-in-English--set-verb-to-learn () (defun lire--set-verb-to-learn ()
"Set the verb to learn." "Set the verb to learn."
(let ((verbs-random (nth (random (length learning-irregular-verbs-in-English--verbs)) learning-irregular-verbs-in-English--verbs))) (let ((verbs-random (nth (random (length lire--verbs)) lire--verbs)))
(setq learning-irregular-verbs-in-English--verb-to-learn-infinitive (nth 0 verbs-random)) (setq lire--verb-to-learn-infinitive (nth 0 verbs-random))
(setq learning-irregular-verbs-in-English--verb-to-learn-simple-past (nth 1 verbs-random)) (setq lire--verb-to-learn-simple-past (nth 1 verbs-random))
(setq learning-irregular-verbs-in-English--verb-to-learn-past-participle (nth 2 verbs-random)))) (setq lire--verb-to-learn-past-participle (nth 2 verbs-random))))
(defun learning-irregular-verbs-in-English--format-value-infinitive () (defun lire--format-value-infinitive ()
"Format the value of the infinitive." "Format the value of the infinitive."
(format "Infinitive ➡️ %s" learning-irregular-verbs-in-English--verb-to-learn-infinitive)) (format "Infinitive ➡️ %s" lire--verb-to-learn-infinitive))
(defun learning-irregular-verbs-in-English--format-check-simple-past () (defun lire--format-check-simple-past ()
"Format the value of the simple past." "Format the value of the simple past."
(if (eq learning-irregular-verbs-in-English--state 1) (if (eq lire--state 1)
"" ""
(format " %s" (if (format " %s" (if
(and (and
(string= (learning-irregular-verbs-in-English--value-field-simple-past) learning-irregular-verbs-in-English--verb-to-learn-simple-past) (string= (lire--value-field-simple-past) lire--verb-to-learn-simple-past)
(not (string= (learning-irregular-verbs-in-English--value-field-simple-past) ""))) (not (string= (lire--value-field-simple-past) "")))
learning-irregular-verbs-in-English--emoji-valid learning-irregular-verbs-in-English--emoji-error)))) lire--emoji-valid lire--emoji-error))))
(defun learning-irregular-verbs-in-English--format-check-past-participle () (defun lire--format-check-past-participle ()
"Format the value of the past participle." "Format the value of the past participle."
(if (eq learning-irregular-verbs-in-English--state 1) (if (eq lire--state 1)
"" ""
(format " %s" (if (format " %s" (if
(and (and
(string= (learning-irregular-verbs-in-English--value-field-past-participle) learning-irregular-verbs-in-English--verb-to-learn-past-participle) (string= (lire--value-field-past-participle) lire--verb-to-learn-past-participle)
(not (string= (learning-irregular-verbs-in-English--value-field-past-participle) ""))) (not (string= (lire--value-field-past-participle) "")))
learning-irregular-verbs-in-English--emoji-valid learning-irregular-verbs-in-English--emoji-error)))) lire--emoji-valid lire--emoji-error))))
(defun learning-irregular-verbs-in-English--toggle-layout-success () (defun lire--toggle-layout-finish ()
"Toggle the layout to success." "Toggle the layout to success."
(if (eq learning-irregular-verbs-in-English--state 3) (if (eq lire--state 3)
(progn (progn
;; Cursor to end ;; Cursor to end
(goto-char (point-max)) (goto-char (point-max))
;; Remove check button ;; Remove check button
(widget-delete learning-irregular-verbs-in-English--widget-button-check) (widget-delete lire--widget-button-check)
(setq learning-irregular-verbs-in-English--widget-button-check nil) (setq lire--widget-button-check nil)
;; Remove space after check button
(widget-delete lire--widget-item-space-before-check)
(setq lire--widget-item-space-before-check nil)
;; Remove show solution button
(widget-delete lire--widget-button-show-solution)
(setq lire--widget-button-show-solution nil)
;; Text success ;; Text success
(setq learning-irregular-verbs-in-English--widget-item-space-before-success (widget-create 'item (setq lire--widget-item-space-before-success (widget-create 'item
"")) ""))
(setq learning-irregular-verbs-in-English--widget-message-success (widget-create 'item (setq lire--widget-message-success (widget-create 'item
learning-irregular-verbs-in-English--text-success (if lire--is-resolve lire--text-success lire--text-fail)))
)) (setq lire--widget-item-space-after-success (widget-create 'item
(setq learning-irregular-verbs-in-English--widget-item-space-after-success (widget-create 'item "\n"))
"\n")) ;; Lire--Replay button
;; Replay button (setq lire--widget-button-lire--replay (widget-create 'push-button
(setq learning-irregular-verbs-in-English--widget-button-replay (widget-create 'push-button
:size 20 :size 20
:notify (lambda (&rest ignore) :notify (lambda (&rest ignore)
(replay)) (lire--replay))
learning-irregular-verbs-in-English--text-button-replay)) lire--text-button-lire--replay))
;; Space ;; Space
(setq learning-irregular-verbs-in-English--widget-item-space-between-buttons (widget-create 'item (setq lire--widget-item-space-between-buttons (widget-create 'item
"\n")) "\n"))
;; Quit button ;; Quit button
(setq learning-irregular-verbs-in-English--widget-button-quit (widget-create 'push-button (setq lire--widget-button-quit (widget-create 'push-button
:size 20 :size 20
:notify (lambda (&rest ignore) :notify (lambda (&rest ignore)
(learning-irregular-verbs-in-English--kill-app)) (lire--kill-app))
learning-irregular-verbs-in-English--text-button-quit)) lire--text-button-quit))
(widget-backward 2) (widget-backward 2)
) )
(progn (progn
(when (not (eq learning-irregular-verbs-in-English--widget-item-space-before-success nil)) (widget-delete learning-irregular-verbs-in-English--widget-item-space-before-success)) (when (not (eq lire--widget-item-space-before-success nil)) (widget-delete lire--widget-item-space-before-success))
(when (not (eq learning-irregular-verbs-in-English--widget-message-success nil)) (widget-delete learning-irregular-verbs-in-English--widget-message-success)) (when (not (eq lire--widget-message-success nil)) (widget-delete lire--widget-message-success))
(when (not (eq learning-irregular-verbs-in-English--widget-item-space-after-success nil)) (widget-delete learning-irregular-verbs-in-English--widget-item-space-after-success)) (when (not (eq lire--widget-item-space-after-success nil)) (widget-delete lire--widget-item-space-after-success))
(when (not (eq learning-irregular-verbs-in-English--widget-button-replay nil)) (widget-delete learning-irregular-verbs-in-English--widget-button-replay)) (when (not (eq lire--widget-button-lire--replay nil)) (widget-delete lire--widget-button-lire--replay))
(when (not (eq learning-irregular-verbs-in-English--widget-item-space-between-buttons nil)) (widget-delete learning-irregular-verbs-in-English--widget-item-space-between-buttons)) (when (not (eq lire--widget-item-space-between-buttons nil)) (widget-delete lire--widget-item-space-between-buttons))
(when (not (eq learning-irregular-verbs-in-English--widget-button-quit nil)) (widget-delete learning-irregular-verbs-in-English--widget-button-quit)) (when (not (eq lire--widget-button-quit nil)) (widget-delete lire--widget-button-quit))
))) )))
(defun learning-irregular-verbs-in-English--make-button-check () (defun lire--make-button-check ()
"Make the button check." "Make the button check."
(setq learning-irregular-verbs-in-English--widget-button-check (widget-create 'push-button (setq lire--widget-button-check (widget-create 'push-button
:notify (lambda (&rest ignore) :notify (lambda (&rest ignore)
(update)) (lire--update))
learning-irregular-verbs-in-English--text-button-check))) lire--text-button-check)))
(defun lire--make-space-after-check ()
"Add space between Button check and Button show solution"
(setq lire--widget-item-space-before-check (widget-create 'item "\n")))
(defun learning-irregular-verbs-in-English--start () (defun lire--show-solutions ()
"Show solutions"
(setq lire--is-resolve nil)
(widget-value-set lire--widget-field-simple-past lire--verb-to-learn-simple-past)
(widget-value-set lire--widget-field-past-participle lire--verb-to-learn-past-participle))
(defun lire--make-button-show-solution ()
"Make the button show solution."
(setq lire--widget-button-show-solution (widget-create 'push-button
:notify (lambda (&rest ignore)
(lire--show-solutions)
(lire--update))
lire--text-button-show-solution)))
(defun lire--start ()
"Start challenge." "Start challenge."
;; Set the learning-irregular-verbs-in-English--state ;; Set the lire--state
(setq learning-irregular-verbs-in-English--state 1) (setq lire--state 1)
;; Get a new verb ;; Get a new verb
(learning-irregular-verbs-in-English--set-verb-to-learn) (lire--set-verb-to-learn)
;; Show the verb in infinitive ;; Show the verb in infinitive
(widget-value-set learning-irregular-verbs-in-English--widget-item-verb (learning-irregular-verbs-in-English--format-value-infinitive)) (widget-value-set lire--widget-item-verb (lire--format-value-infinitive))
;; Reset button check ;; Reset button check
(when (eq learning-irregular-verbs-in-English--widget-button-check nil) (learning-irregular-verbs-in-English--make-button-check)) (when (eq lire--widget-button-check nil) (lire--make-button-check))
;; Reset space after check
(when (eq lire--widget-item-space-before-check nil) (lire--make-space-after-check))
;; Reset button show solution
(when (eq lire--widget-button-show-solution nil) (lire--make-button-show-solution))
;; Clear the fields ;; Clear the fields
(widget-value-set learning-irregular-verbs-in-English--widget-field-simple-past "") (widget-value-set lire--widget-field-simple-past "")
(widget-value-set learning-irregular-verbs-in-English--widget-label-check-simple-past "") (widget-value-set lire--widget-label-check-simple-past "")
(widget-value-set learning-irregular-verbs-in-English--widget-field-past-participle "") (widget-value-set lire--widget-field-past-participle "")
(widget-value-set learning-irregular-verbs-in-English--widget-label-check-past-participle "") (widget-value-set lire--widget-label-check-past-participle "")
;; Update labels ;; Update labels
(update)) (lire--update))
(defun replay () (defun lire--replay ()
"Replay the challenge." "Replay the challenge."
(interactive) (interactive)
(learning-irregular-verbs-in-English--start) (lire--start)
(widget-backward 1)) (widget-backward 1))
(defun update () (defun lire--update ()
"Check the answers." "Update state and show temps layouts."
(interactive) (interactive)
;; Is playing? ;; Is playing?
(when (and (eq learning-irregular-verbs-in-English--state 1) (when (and (eq lire--state 1)
(or (or
(not (string= (learning-irregular-verbs-in-English--value-field-simple-past) "")) (not (string= (lire--value-field-simple-past) ""))
(not (string= (learning-irregular-verbs-in-English--value-field-past-participle) ""))) (not (string= (lire--value-field-past-participle) "")))
) )
(setq learning-irregular-verbs-in-English--state 2)) (setq lire--state 2))
;; Check the answers ;; Check the answers
(when (eq learning-irregular-verbs-in-English--state 2) (when (eq lire--state 2)
;; Is win? ;; Is win?
(when (and (when (and
(string= (learning-irregular-verbs-in-English--value-field-simple-past) learning-irregular-verbs-in-English--verb-to-learn-simple-past) (string= (lire--value-field-simple-past) lire--verb-to-learn-simple-past)
(string= (learning-irregular-verbs-in-English--value-field-past-participle) learning-irregular-verbs-in-English--verb-to-learn-past-participle)) (string= (lire--value-field-past-participle) lire--verb-to-learn-past-participle))
;; Set the learning-irregular-verbs-in-English--state ;; Set the lire--state
(setq learning-irregular-verbs-in-English--state 3)) (setq lire--state 3))
;; Update the check labels ;; Update the check labels
(widget-value-set learning-irregular-verbs-in-English--widget-label-check-simple-past (learning-irregular-verbs-in-English--format-check-simple-past)) (widget-value-set lire--widget-label-check-simple-past (lire--format-check-simple-past))
(widget-value-set learning-irregular-verbs-in-English--widget-label-check-past-participle (learning-irregular-verbs-in-English--format-check-past-participle))) (widget-value-set lire--widget-label-check-past-participle (lire--format-check-past-participle)))
;; Update the success layout if needed ;; Update the success layout if needed
(learning-irregular-verbs-in-English--toggle-layout-success)) (lire--toggle-layout-finish)
(setq lire--is-resolve t))
(defun learning-irregular-verbs-in-English--main-layout () (defun lire--main-layout ()
"Make widgets for the main layout." "Make widgets for the main layout."
;; Create the buffer ;; Create the buffer
(switch-to-buffer learning-irregular-verbs-in-English--buffer-name) (switch-to-buffer lire--buffer-name)
;; Clear the buffer ;; Clear the buffer
(kill-all-local-variables) (kill-all-local-variables)
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))
@ -298,49 +331,53 @@
(remove-overlays) (remove-overlays)
;; Create the widgets ;; Create the widgets
;; Title ;; Title
(insert (propertize (format "\n%s\n\n" learning-irregular-verbs-in-English--text-title) 'face '(:height 1.2 :weight bold))) (insert (propertize (format "\n%s\n\n" lire--text-title) 'face '(:height 1.2 :weight bold)))
;; Verb in infinitive ;; Verb in infinitive
(setq learning-irregular-verbs-in-English--widget-item-verb (widget-create 'item (setq lire--widget-item-verb (widget-create 'item
:value "")) :value ""))
;; Separator ;; Separator
(insert "\nSimple past ➡️ ") (insert "\nSimple past ➡️ ")
;; Simple past ;; Simple past
(setq learning-irregular-verbs-in-English--widget-field-simple-past (widget-create 'editable-field (setq lire--widget-field-simple-past (widget-create 'editable-field
:size 8 :size 8
:help-echo "Type a Simple past" :help-echo "Type a Simple past"
)) ))
;; Label check ;; Label check
(insert " ") (insert " ")
(setq learning-irregular-verbs-in-English--widget-label-check-simple-past (widget-create 'item (setq lire--widget-label-check-simple-past (widget-create 'item
(learning-irregular-verbs-in-English--format-check-simple-past))) (lire--format-check-simple-past)))
;; Separator ;; Separator
(insert "\nPast participle ➡️ ") (insert "\nPast participle ➡️ ")
;; Past participle ;; Past participle
(setq learning-irregular-verbs-in-English--widget-field-past-participle (widget-create 'editable-field (setq lire--widget-field-past-participle (widget-create 'editable-field
:size 8 :size 8
:help-echo "Type a Past participle")) :help-echo "Type a Past participle"))
;; Label check ;; Label check
(insert " ") (insert " ")
(setq learning-irregular-verbs-in-English--widget-label-check-past-participle (widget-create 'item (setq lire--widget-label-check-past-participle (widget-create 'item
(learning-irregular-verbs-in-English--format-check-past-participle))) (lire--format-check-past-participle)))
;; Separator ;; Separator
(insert "\n") (insert "\n")
;; Check button ;; Check button
(learning-irregular-verbs-in-English--make-button-check) (lire--make-button-check)
;; Separator
(lire--make-space-after-check)
;; Show solution button
(lire--make-button-show-solution)
;; Display the buffer ;; Display the buffer
(use-local-map widget-keymap) (use-local-map widget-keymap)
(widget-setup)) (widget-setup))
;; Keybindings ;; Keybindings
(define-key widget-keymap (kbd "q") 'learning-irregular-verbs-in-English--kill-app) (define-key widget-keymap (kbd "q") 'lire--kill-app)
;; Init ;; Init
(defun learning-irregular-verbs-in-English () (defun learning-irregular-verbs-in-English ()
"Application to learn and review irregular verbs in English." "Application to learn and review irregular verbs in English."
(interactive) (interactive)
(learning-irregular-verbs-in-English--main-layout) (lire--main-layout)
(learning-irregular-verbs-in-English--start) (lire--start)
(widget-backward 1)) (widget-backward 2))
(provide 'learning-irregular-verbs-in-English) (provide 'learning-irregular-verbs-in-English)