Class: Studium::GUI::UniversalWidgets::ExamTrainer
- Inherits:
-
UniversalWidgets::Base
- Object
- UniversalWidgets::Base
- Studium::GUI::UniversalWidgets::ExamTrainer
- Includes:
- UniversalWidgets::BaseModule
- Defined in:
- lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb
Overview
Studium::GUI::UniversalWidgets::ExamTrainer
Constant Summary collapse
- TITLE =
#
TITLE
#
'Simple Exam Trainer'
- WIDTH =
#
WIDTH
#
'95% or minimum 2250px'
- HEIGHT =
#
Studium::GUI::UniversalWidgets::ExamTrainer::HEIGHT
1080px is the highest for my large monitor, so I set this below.
#
'90% or minimum 1060px'
- DEFAULT_DELAY =
#
DEFAULT_DELAY
This constant specifies how long to wait before the answer is revealed, if the user has set the checkbutton to “automatically answer the question”.
#
'15.0'
- N_EXAM_QUESTIONS_IN_TOTAL =
#
Studium::GUI::UniversalWidgets::ExamTrainer::N_EXAM_QUESTIONS_IN_TOTAL
#
'n exam-questions in total'
- N_ANSWERED_EXAM_QUESTIONS =
#
Studium::GUI::UniversalWidgets::N_ANSWERED_EXAM_QUESTIONS
#
'n answered exam-questions'
- N_UNANSWERED_EXAM_QUESTIONS =
#
Studium::GUI::UniversalWidgets::N_UNANSWERED_EXAM_QUESTIONS
#
'n unanswered exam-questions'
- N_PERCENT_SOLVED =
#
Studium::GUI::UniversalWidgets::N_PERCENT_SOLVED
An alternative name would be ‘percentage solved’.
#
'n % solved'
- SLEEP_N_SECONDS =
#
Studium::GUI::UniversalWidgets::SLEEP_N_SECONDS
#
'sleep n seconds'
- PANEL_TOOLTIP_TEXT =
#
PANEL_TOOLTIP_TEXT
#
'Exam Trainer Widget'
- SQLITE_DATABASE_FILE =
#
SQLITE_DATABASE_FILE
This is experimental - one day we may want to query from a sqlite database rather than flat files. Or, at the least, offer this as a possibility.
#
'/Depot/jjjj/exam_questions.db'
- USE_THIS_FONT =
#
USE_THIS_FONT
The older font was :dejavu_condensed_20 and the oldest font was :deja_vu_sans_25. Before December 2023 the font was :hack_20, but now it is :hack_22.
It is recommended to use the method main_font? rather than this constant directly.
#
:hack_22
- LARGER_FONT =
#
LARGER_FONT
#
:hack_26
- SMALLER_FONT =
#
SMALLER_FONT
This one should be matched onto the larger font defined above.
#
:hack_20
- SMALLEST_FONT =
#
SMALLEST_FONT
#
:hack_15
- WORD_WRAP_AT_N_CHARACTERS =
#
WORD_WRAP_AT_N_CHARACTERS
Specify after n characters a given text has to be wrapped via newlines, e. g. “n”.
#
76
- DEFAULT_PLACEHOLDER_TEXT =
#
DEFAULT_PLACEHOLDER_TEXT
#
'You can input your answer to the exam question here.'
- USE_THIS_MARGIN =
#
USE_THIS_MARGIN
#
12
- USE_THIS_AS_THE_DEFAULT_EXAM_TOPIC =
#
USE_THIS_AS_THE_DEFAULT_EXAM_TOPIC
This constant can be used to specify the default exam topic to be used on startup of this application.
#
'toxikologie'
- HASH_DESIGNATED_KEY_COMBINATIONS =
#
HASH_DESIGNATED_KEY_COMBINATIONS
#
{ 'strg+s': 'save_the_buffer', 'alt+y': 'activate_the_third_textview' }
- AskExamQuestion =
#
Last but not least, add two “compatibility constants”:
#
ExamTrainer
- SimpleExamTrainer =
And add a helper “alias” here.
ExamTrainer
Class Method Summary collapse
-
.[](i = ARGV) ⇒ Object
# === Studium::GUI::UniversalWidgets::ExamTrainer[] ========================================================================= #.
-
.gtk_accel_group ⇒ Object
# === Studium::GUI::UniversalWidgets::ExamTrainer.gtk_accel_group ========================================================================= #.
-
.run(i = ARGV) ⇒ Object
# === Studium::GUI::UniversalWidgets::ExamTrainer.run ========================================================================= #.
Instance Method Summary collapse
-
#activate_the_third_textview ⇒ Object
# === activate_the_third_textview ========================================================================= #.
-
#add_the_status_icon ⇒ Object
# === add_the_status_icon ========================================================================= #.
-
#all_questions_have_been_answered_in_this_topic?(this_topic = current_exam_topic? ) ⇒ Boolean
# === all_questions_have_been_answered_in_this_topic?.
-
#all_textviews? ⇒ Boolean
# === all_textviews? ========================================================================= #.
-
#allow_external_applications? ⇒ Boolean
# === allow_external_applications?.
-
#always_reset_the_delay_before_using_another_delay ⇒ Object
# === always_reset_the_delay_before_using_another_delay ========================================================================= #.
-
#always_reveal_the_exam_answer_via_this_method ⇒ Object
# === always_reveal_the_exam_answer_via_this_method.
-
#answer_is? ⇒ Boolean
# === answer_is? ========================================================================= #.
-
#array_all_exam_questions? ⇒ Boolean
(also: #all_exam_questions)
# === array_all_exam_questions?.
-
#available_exam_topics_in_short_form? ⇒ Boolean
(also: #return_available_exam_topics, #available_exam_topics?, #exam_topics_short_form?)
# === available_exam_topics_in_short_form? ========================================================================= #.
-
#border_size? ⇒ Boolean
# === border_size? ========================================================================= #.
-
#button_ask_the_exam_question? ⇒ Boolean
(also: #question_button?, #button_ask_the_question?)
# === button_ask_the_exam_question? ========================================================================= #.
-
#button_ask_the_exam_question_was_clicked(use_this_topic = :obtain_the_exam_topic_from_the_relevant_entry) ⇒ Object
(also: #do_handle_the_click_event_for_the_ask_question_button, #ask_an_exam_question, #do_ask_the_exam_question, #do_ask_a_new_question, #trigger_the_event_when_the_ask_exam_question_button_was_clicked, #do_ask_an_exam_question, #do_ask_a_new_exam_question, #the_button_ask_the_question_was_clicked, #the_button_ask_the_exam_question_was_clicked)
# === button_ask_the_exam_question_was_clicked (clicked tag).
-
#button_clear? ⇒ Boolean
# === button_clear? ========================================================================= #.
-
#button_clear_was_clicked ⇒ Object
# === button_clear_was_clicked ========================================================================= #.
-
#button_reveal_the_answer? ⇒ Boolean
# === button_reveal_the_answer? ========================================================================= #.
-
#button_reveal_the_answer_was_clicked ⇒ Object
(also: #the_button_reveal_the_answer_was_clicked)
# === button_reveal_the_answer_was_clicked ========================================================================= #.
-
#button_solve_the_exam_question? ⇒ Boolean
# === button_solve_the_exam_question? ========================================================================= #.
-
#button_solve_the_exam_question_was_clicked ⇒ Object
(also: #mark_the_exam_question_as_solved, #do_solve_the_exam_question, #the_current_exam_question_is_now_solved)
# === button_solve_the_exam_question_was_clicked (solved tag, solve tag) ========================================================================= #.
-
#button_update_n_questions_were_answered? ⇒ Boolean
# === button_update_n_questions_were_answered? ========================================================================= #.
-
#button_use_random_entry_from_the_ten_aliases? ⇒ Boolean
# === button_use_random_entry_from_the_ten_aliases? ========================================================================= #.
-
#change_to_a_happy_smiley_before_reverting_to_the_prior_default_again(delay_to_use = 5_000) ⇒ Object
# === change_to_a_happy_smiley_before_reverting_to_the_prior_default_again.
-
#clear_the_exam_answer ⇒ Object
(also: #clear_reveal_the_answer, #clear_answers, #clear_answers_buffer, #clear_answer_buffer, #clear_the_answer_buffer)
# === clear_the_exam_answer (clear tag).
-
#combobox_available_exam_topics? ⇒ Boolean
(also: #return_the_combobox, #combo_box_available_exam_topics?, #main_combo_box?, #combo_box?, #return_combo_box_showing_all_exam_questions, #return_combo_box_available_exam_topics)
# === combobox_available_exam_topics?.
-
#connect_the_notebook_tab(window = main_window?, , padding_to_use = 2) ⇒ Object
# === connect_the_notebook_tab.
-
#connect_the_skeleton ⇒ Object
# === connect_the_skeleton (connect tag) ========================================================================= #.
-
#consider_making_available_the_show_ten_aliases_widget ⇒ Object
# === consider_making_available_the_show_ten_aliases_widget ========================================================================= #.
-
#consider_running_rinstall2 ⇒ Object
# === consider_running_rinstall2 ========================================================================= #.
-
#context_menu? ⇒ Boolean
# === context_menu? ========================================================================= #.
-
#control_panel? ⇒ Boolean
# === control_panel? ========================================================================= #.
-
#create_entry_n_total_exam_questions ⇒ Object
(also: #create_the_entry_containing_n_questions)
# === create_entry_n_total_exam_questions ========================================================================= #.
-
#create_scrolled_window3(i = textview3? ) ⇒ Object
# === create_scrolled_window3.
-
#create_text_buffer_for_the_answer ⇒ Object
# === create_text_buffer_for_the_answer ========================================================================= #.
-
#create_the_button_ask_the_exam_question ⇒ Object
(also: #create_the_ask_the_exam_question_button)
# === create_the_button_ask_the_exam_question ========================================================================= #.
-
#create_the_button_solve_the_question ⇒ Object
# === create_the_button_solve_the_question ========================================================================= #.
-
#create_the_button_update_n_questions_were_answered ⇒ Object
# === create_the_button_update_n_questions_were_answered (update tag) ========================================================================= #.
-
#create_the_button_use_random_entry_from_the_ten_aliases ⇒ Object
# === create_the_button_use_random_entry_from_the_ten_aliases ========================================================================= #.
-
#create_the_buttons ⇒ Object
# === create_the_buttons (buttons tag, button tag) ========================================================================= #.
-
#create_the_checkbox_shall_we_reveal_the_answer(entry_delay_to_use = entry_delay_to_use? ) ⇒ Object
# === create_the_checkbox_shall_we_reveal_the_answer ========================================================================= #.
-
#create_the_combobox(use_these_exam_topics = :default_exam_topics) ⇒ Object
# === create_the_combobox.
-
#create_the_context_menu ⇒ Object
# === create_the_context_menu.
-
#create_the_editor ⇒ Object
# === create_the_editor (editor tag).
-
#create_the_emoji_toggle_widget ⇒ Object
# === create_the_emoji_toggle_widget.
-
#create_the_entries(use_this_font = :default_font) ⇒ Object
# === create_the_entries (entries tag, entry tag) ========================================================================= #.
-
#create_the_entry_for_sleeping_n_seconds ⇒ Object
# === create_the_entry_for_sleeping_n_seconds ========================================================================= #.
-
#create_the_entry_for_the_current_exam_topic ⇒ Object
# === create_the_entry_for_the_current_exam_topic ========================================================================= #.
-
#create_the_entry_n_answered_exam_questions(use_this_font = :default_font) ⇒ Object
(also: #create_the_entry_containing_n_answered_exam_questions)
# === create_the_entry_n_answered_exam_questions ========================================================================= #.
-
#create_the_entry_n_unanswered_questions ⇒ Object
(also: #create_the_entry_containing_n_unanswered_questions, #create_the_entry_containing_n_unanswered_exam_questions)
# === create_the_entry_n_unanswered_questions ========================================================================= #.
-
#create_the_entry_percentage(use_this_font = smaller_font? ) ⇒ Object
# === create_the_entry_percentage ========================================================================= #.
-
#create_the_labels ⇒ Object
# === create_the_labels ========================================================================= #.
-
#create_the_notebook_tab ⇒ Object
# === create_the_notebook_tab (notebook tag) ========================================================================= #.
-
#create_the_reveal_the_answer_button ⇒ Object
(also: #create_the_reveal_button)
# === create_the_reveal_the_answer_button.
-
#create_the_skeleton ⇒ Object
(also: #create_skeleton)
# === create_the_skeleton (create tag, skeleton tag) ========================================================================= #.
-
#create_the_textview_that_will_contain_the_exam_question(text_buffer_for_the_question = :default_buffer) ⇒ Object
# === create_the_textview_that_will_contain_the_exam_question ========================================================================= #.
-
#create_the_textviews ⇒ Object
# === create_the_textviews ========================================================================= #.
-
#create_the_thumbs_up_emoji ⇒ Object
# === create_the_thumbs_up_emoji ========================================================================= #.
-
#create_the_widget_for_the_exam_answer(use_this_text_buffer = @text_buffer_for_the_answer) ⇒ Object
(also: #create_text_view_for_the_answer)
# === create_the_widget_for_the_exam_answer (answer tag, answers tags) ========================================================================= #.
-
#create_the_widget_for_the_freeform_textview ⇒ Object
# === create_the_widget_for_the_freeform_textview ========================================================================= #.
-
#create_then_return_the_default_grid ⇒ Object
(also: #create_the_main_grid)
# === create_then_return_the_default_grid ========================================================================= #.
-
#current_exam_topic_from_the_entry? ⇒ Boolean
(also: #current_exam_topic_as_a_string?)
# === current_exam_topic_from_the_entry? ========================================================================= #.
-
#debug ⇒ Object
# === debug ========================================================================= #.
-
#default_exam_topic? ⇒ Boolean
# === default_exam_topic? ========================================================================= #.
-
#delay_to_use? ⇒ Boolean
(also: #default_delay?)
# === default_delay? ========================================================================= #.
-
#deselect_the_entry_containing_the_exam_topic(i = entry_for_the_current_exam_topic? ) ⇒ Object
# === deselect_the_entry_containing_the_exam_topic ========================================================================= #.
-
#do_assign_a_new_exam_topic ⇒ Object
# === do_assign_a_new_exam_topic ========================================================================= #.
-
#do_assign_the_default_exam_topic_to_the_correct_entry ⇒ Object
# === do_assign_the_default_exam_topic_to_the_correct_entry ======================================================================= #.
-
#do_clear_the_free_form_textarea ⇒ Object
# === do_clear_the_free_form_textarea ========================================================================= #.
-
#do_clear_the_question_buffer ⇒ Object
(also: #clear_question_buffer, #clear_questions_buffer)
# === do_clear_the_question_buffer.
-
#do_interactively_change_the_font ⇒ Object
# === do_interactively_change_the_font.
-
#do_jump_into_the_entry_containing_the_current_exam_topic ⇒ Object
# === do_jump_into_the_entry_containing_the_current_exam_topic ========================================================================= #.
-
#do_open_the_current_exam_topic_file(use_this_as_exam_topic = current_exam_topic_from_the_entry? ) ⇒ Object
# === do_open_the_current_exam_topic_file.
-
#do_popup_the_array_of_all_exam_questions(array = :infer) ⇒ Object
# === do_popup_the_array_of_all_exam_questions.
-
#do_popup_the_you_have_to_provide_an_exam_topic ⇒ Object
# === do_popup_the_you_have_to_provide_an_exam_topic ========================================================================= #.
-
#do_sleep_now(i = :default, use_this_as_timeout = 0) ⇒ Object
# === do_sleep_now (sleep tag) ========================================================================= #.
-
#do_style_all_buttons_uniformly(i = return_all_buttons) ⇒ Object
# === do_style_all_buttons_uniformly (style tag) ========================================================================= #.
-
#do_update_the_entries_n_answered_and_n_unanswered ⇒ Object
# === do_update_the_entries_n_answered_and_n_unanswered ========================================================================= #.
-
#do_update_the_entry_n_questions(current_exam_topic = current_exam_topic? ) ⇒ Object
# === do_update_the_entry_n_questions ========================================================================= #.
-
#do_update_the_entry_n_unanswered_questions ⇒ Object
(also: #update_the_entry_n_unanswered_questions, #update_n_unanswered)
# === do_update_the_entry_n_unanswered_questions.
-
#enable_all_key_combinations ⇒ Object
# === enable_all_key_combinations ========================================================================= #.
-
#enable_alt_1_key_combination ⇒ Object
# === enable_alt_1_key_combination ========================================================================= #.
-
#enable_alt_w_key_combination(i = @accel_group) ⇒ Object
# === enable_alt_w_key_combination.
-
#enable_alt_y_key_combination ⇒ Object
# === enable_alt_y_key_combination ========================================================================= #.
-
#enable_the_main_key_combinations(use_this_hash = HASH_DESIGNATED_KEY_COMBINATIONS) ⇒ Object
# === enable_the_main_key_combinations ========================================================================= #.
-
#enhance_entry_n_answered_exam_questions(use_this_font = :default_font, entry = entry_n_answered_exam_questions? ) ⇒ Object
# === enhance_entry_n_answered_exam_questions.
-
#enhance_the_entry_containing_n_questions(use_this_font = smaller_font?, , entry = ) ⇒ Object
# === enhance_the_entry_containing_n_questions ========================================================================= #.
-
#enhance_the_entry_for_sleeping_n_seconds(i = entry_for_sleeping_n_seconds? ) ⇒ Object
# === enhance_the_entry_for_sleeping_n_seconds ========================================================================= #.
-
#enhance_the_entry_percentage(use_this_font = nil) ⇒ Object
# === enhance_the_entry_percentage ========================================================================= #.
-
#entry_delay_value? ⇒ Boolean
# === entry_delay_value? ========================================================================= #.
-
#entry_exam_topic_in_use? ⇒ Boolean
(also: #entry_for_the_current_exam_topic?, #entry_for_the_exam_topic?, #entry_holding_all_exam_topics?, #entry_current_exam_topic?)
# === entry_exam_topic_in_use? ======================================================================= #.
-
#entry_for_sleeping_n_seconds? ⇒ Boolean
(also: #entry_delay_to_use?, #entry_sleep_n_seconds?, #entry_delay?, #return_entry_for_sleeping_n_seconds, #return_the_entry_sleep_n_seconds)
# === entry_for_sleeping_n_seconds? ========================================================================= #.
-
#entry_n_answered_exam_questions? ⇒ Boolean
(also: #entry_containing_n_answers?)
# === entry_n_answered_exam_questions? ========================================================================= #.
-
#entry_n_total_exam_questions? ⇒ Boolean
(also: #entry_containing_n_questions?)
# === entry_n_total_exam_questions? ========================================================================= #.
-
#entry_n_unanswered_questions? ⇒ Boolean
(also: #entry_containing_n_unanswered_questions?, #entry_containing_n_unanswered_questions)
# === entry_n_unanswered_questions? ========================================================================= #.
-
#entry_percentage? ⇒ Boolean
(also: #return_entry_percentage)
# === entry_percentage? ========================================================================= #.
-
#exam_answer? ⇒ Boolean
# === exam_answer? ========================================================================= #.
-
#exam_question? ⇒ Boolean
(also: #current_exam_question?)
# === exam_question? ========================================================================= #.
-
#exam_question_object? ⇒ Boolean
# === exam_question_object? ========================================================================= #.
-
#exam_topic_from_the_correct_entry? ⇒ Boolean
(also: #entry_ask_questions_from_this_topic?, #current_exam_topic?, #main_exam_topic?, #exam_topic?, #current_topic?, #entry_exam_topic?, #entry_ask_questions?, #entry_exam_topic_as_string?)
# === exam_topic_from_the_correct_entry?.
-
#find_completion_for_the_entry_for_the_current_exam_topic ⇒ Object
# === find_completion_for_the_entry_for_the_current_exam_topic ========================================================================= #.
-
#handle_CSS ⇒ Object
# === handle_CSS (CSS tag) ========================================================================= #.
-
#handle_the_combo_box_available_exam_topics_on_changed_event ⇒ Object
(also: #do_handle_the_combobox_available_exam_topics_on_changed_event, #sync_the_current_exam_topic_onto_the_exam_topic_entry)
# === handle_the_combo_box_available_exam_topics_on_changed_event ======================================================================= #.
-
#hash_dataset_of_all_lectures? ⇒ Boolean
# === hash_dataset_of_all_lectures? ========================================================================= #.
-
#initialize(commandline_arguments = nil, run_already = true) ⇒ ExamTrainer
constructor
# === initialize ========================================================================= #.
-
#instantiate_the_control_panel ⇒ Object
# === instantiate_the_control_panel.
-
#label_n_questions_were_answered? ⇒ Boolean
# === label_n_questions_were_answered? ========================================================================= #.
-
#larger_font? ⇒ Boolean
# === larger_font? ========================================================================= #.
-
#let_the_scrolled_window_for_the_answer_parse_URLs(scrolled_window_for_the_answer = scrolled_window_for_the_answer? ) ⇒ Object
# === let_the_scrolled_window_for_the_answer_parse_URLs ========================================================================= #.
-
#main_font? ⇒ Boolean
# === main_font? ========================================================================= #.
-
#main_grid? ⇒ Boolean
# === main_grid? ========================================================================= #.
-
#may_we_reveal_the_answer_after_a_delay? ⇒ Boolean
(also: #may_we_reveal_the_answer?)
# === may_we_reveal_the_answer_after_a_delay? ========================================================================= #.
-
#notify_the_user_that_all_questions_have_been_answered_in_this_topic(this_topic = current_exam_topic?, , this_widget = button_reveal_the_answer? ) ⇒ Object
# === notify_the_user_that_all_questions_have_been_answered_in_this_topic ========================================================================= #.
-
#one_two_three(use_this_topic = exam_topic_from_the_correct_entry? ) ⇒ Object
(also: #update_n_questions, #update_three_important_widgets)
# === one_two_three (one_two_three tag) ========================================================================= #.
-
#original_return_available_exam_topics ⇒ Object
# === original_return_available_exam_topics.
-
#padding? ⇒ Boolean
# === padding? ========================================================================= #.
-
#parse_for_URL(i = text_view_for_the_answer?.buffer.text) ⇒ Object
# === parse_for_URL.
-
#parse_the_commandline_arguments ⇒ Object
# === parse_the_commandline_arguments ========================================================================= #.
-
#populate_the_main_grid(grid = main_grid? ) ⇒ Object
# === populate_the_main_grid (grid tag, populate tag).
-
#populate_the_notebook_tab ⇒ Object
# === populate_the_notebook_tab ========================================================================= #.
-
#popup_pick_a_new_font ⇒ Object
# === popup_pick_a_new_font ========================================================================= #.
-
#question_is? ⇒ Boolean
# === question_is? ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#reset_the_shared_module ⇒ Object
# === reset_the_shared_module ========================================================================= #.
-
#reset_the_shared_variables ⇒ Object
# === reset_the_shared_variables ========================================================================= #.
-
#resize_the_notebook_tab_towards_the_primary_width_and_height ⇒ Object
# === resize_the_notebook_tab_towards_the_primary_width_and_height ========================================================================= #.
-
#return_button_ask_the_exam_question(use_emoji = false) ⇒ Object
(also: #return_button_ask_an_exam_question)
# === return_button_ask_the_exam_question (ask tag) ========================================================================= #.
-
#return_button_open_exam_topic_file ⇒ Object
# === return_button_open_exam_topic_file.
-
#return_button_solve_the_question ⇒ Object
# === return_button_solve_the_question.
-
#return_checkbox_shall_we_reveal_the_answer ⇒ Object
(also: #checkbox?, #checkbox_shall_we_reveal_the_answer?)
# === return_checkbox_shall_we_reveal_the_answer.
-
#return_event_box_for_asking_a_random_exam_topic ⇒ Object
# === return_event_box_for_asking_a_random_exam_topic.
-
#return_event_box_with_face_glasses ⇒ Object
# === return_event_box_with_face_glasses.
-
#return_eventbox_with_an_image_to_exit_the_application ⇒ Object
# === return_eventbox_with_an_image_to_exit_the_application.
-
#return_frame_containing_the_label_exam_topic ⇒ Object
# === return_frame_containing_the_label_exam_topic ========================================================================= #.
-
#return_hbox_containing_two_icons_and_instructions_what_to_do_with_the_free_form_textarea ⇒ Object
# === return_hbox_containing_two_icons_and_instructions_what_to_do_with_the_free_form_textarea.
-
#return_n_answers_from_the_currently_selected_topic(i = current_exam_topic_as_a_string? ) ⇒ Object
# === return_n_answers_from_the_currently_selected_topic ========================================================================= #.
-
#return_n_questions_from_the_currently_selected_topic(i = current_exam_topic? ) ⇒ Object
# === return_n_questions_from_the_currently_selected_topic.
-
#return_string_how_many_exam_questions_are_already_answered ⇒ Object
# === return_string_how_many_exam_questions_are_already_answered ========================================================================= #.
-
#return_wikipedia_widget ⇒ Object
# === return_wikipedia_widget (wikipedia tag).
-
#reveal_the_exam_answer(may_we_reveal_the_exam_answer = may_we_reveal_the_answer_after_a_delay? ) ⇒ Object
# === reveal_the_exam_answer ========================================================================= #.
-
#rinstall2 ⇒ Object
(also: #r2)
# === rinstall2 ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#sanitize_the_answer(i, apply_these_filters = []) ⇒ Object
(also: #sanitize_this_answer)
# === sanitize_the_answer.
-
#save_the_buffer ⇒ Object
# === save_the_buffer ========================================================================= #.
-
#scrolled_window1? ⇒ Boolean
# === scrolled_window1? ========================================================================= #.
-
#scrolled_window2? ⇒ Boolean
(also: #return_scrolled_window_containing_the_text_view_for_the_answer, #scrolled_window_for_the_answer?, #scrolled_window_containing_the_textarea2?)
# === scrolled_window2? ========================================================================= #.
-
#scrolled_window3? ⇒ Boolean
(also: #return_widget_for_the_freeform_textview, #scrolled_window_containing_the_textarea3, #return_scrolled_window3, #return_scrolled_window_containing_the_textarea3)
# === scrolled_window3? ========================================================================= #.
-
#select_not_yet_completed_exam_topics(i) ⇒ Object
# === select_not_yet_completed_exam_topics ========================================================================= #.
-
#set_delay_to_use(i = DEFAULT_DELAY) ⇒ Object
# === set_delay_to_use ========================================================================= #.
-
#set_editor_buffer(i) ⇒ Object
# === set_editor_buffer ========================================================================= #.
-
#set_exam_answer(i = answer_is?, , apply_these_filters = [:filter_away_tags]) ⇒ Object
(also: #set_answer, #reveal_the_answer_to_the_exam_question)
# === set_exam_answer (answer tag) ========================================================================= #.
-
#set_exam_question(i = exam_question_object?.question?, apply_these_filters = [:remove_tags]) ⇒ Object
(also: #set_question)
# === set_exam_question.
-
#set_exam_topic(i = :default) ⇒ Object
(also: #set_current_exam_topic)
# === set_exam_topic.
-
#set_n_exam_questions_are_unanswered(i) ⇒ Object
(also: #set_n_unanswered_questions)
# === set_n_exam_questions_are_unanswered ========================================================================= #.
-
#set_n_exam_questions_exist_in_total(i) ⇒ Object
# === set_n_exam_questions_exist_in_total.
-
#set_n_exam_questions_were_already_answered(i) ⇒ Object
# === set_n_exam_questions_were_already_answered ========================================================================= #.
-
#set_n_percentage_of_questions_answered(i) ⇒ Object
(also: #set_n_percentage, #update_the_percentage_entry, #do_update_this_entry_with_that_exam_topic_for_its_percentage_value)
# === set_n_percentage_of_questions_answered.
-
#set_save_into_this_local_file(i) ⇒ Object
# === set_save_into_this_local_file.
-
#shall_we_create_the_gtk_editor? ⇒ Boolean
# === shall_we_create_the_gtk_editor? ========================================================================= #.
-
#show_ten_aliases? ⇒ Boolean
# === show_ten_aliases? ========================================================================= #.
-
#simply_assign_this_as_the_new_exam_topic_onto_the_primary_combobox(i) ⇒ Object
# === simply_assign_this_as_the_new_exam_topic_onto_the_primary_combobox.
-
#smallest_font? ⇒ Boolean
# === smallest_font? ========================================================================= #.
-
#sync_combo_box_entry_onto_the_current_exam_entry(i = combo_box?.entry?) ⇒ Object
# === sync_combo_box_entry_onto_the_current_exam_entry ======================================================================= #.
-
#sync_entry_holding_all_exam_topics_onto_the_combo_box(value = Studium.find_corresponding_exam_topic( entry_for_the_current_exam_topic?.text? )) ⇒ Object
(also: #sync_entry_holding_all_exam_topics_onto_the_main_combo_box)
# === sync_entry_holding_all_exam_topics_onto_the_combo_box ========================================================================= #.
-
#textview1? ⇒ Boolean
(also: #widget_for_the_questions?, #text_view_for_the_question?, #return_widget_for_the_questions, #return_text_view_for_the_question, #return_scrolled_window_for_the_text_view_for_the_question, #text_view_containing_the_current_question?, #text_buffer_for_the_question?, #textarea1?, #question_buffer, #question_buffer?)
# === textview1? ========================================================================= #.
-
#textview2? ⇒ Boolean
(also: #return_widget_for_the_answers, #text_view_for_the_answer, #text_view_for_the_answer?, #textarea2?, #answer_buffer?, #answer_buffer)
# === textview2? ========================================================================= #.
-
#textview3? ⇒ Boolean
(also: #text_view_for_the_freeform_input?, #text_view_for_the_freeform_input, #free_form_textarea?, #return_textarea_number_three)
# === textview3? ========================================================================= #.
-
#the_first_notebook_tab_is_active ⇒ Object
# === the_first_notebook_tab_is_active ========================================================================= #.
-
#top_textbuffer? ⇒ Boolean
# === top_textbuffer? ========================================================================= #.
-
#update_array_all_exam_questions ⇒ Object
# === update_array_all_exam_questions ========================================================================= #.
-
#update_hash_dataset_of_all_lectures ⇒ Object
# === update_hash_dataset_of_all_lectures ========================================================================= #.
-
#update_n_answered(i = :infer) ⇒ Object
(also: #do_update_the_entry_n_answered)
# === update_n_answered ========================================================================= #.
-
#update_the_label_n_questions_were_answered(i = @label_n_questions_were_answered) ⇒ Object
(also: #update_the_label_containing_the_last_exam_question)
# === update_the_label_n_questions_were_answered ========================================================================= #.
-
#use_emoji? ⇒ Boolean
# === use_emoji? ========================================================================= #.
-
#use_the_internal_editor? ⇒ Boolean
# === use_the_internal_editor? ========================================================================= #.
-
#use_this_editor? ⇒ Boolean
# === use_this_editor? ========================================================================= #.
-
#we_may_not_reveal_the_exam_answer_anymore ⇒ Object
# === we_may_not_reveal_the_exam_answer_anymore ========================================================================= #.
-
#we_may_reveal_the_exam_answer ⇒ Object
# === we_may_reveal_the_exam_answer ========================================================================= #.
Constructor Details
#initialize(commandline_arguments = nil, run_already = true) ⇒ ExamTrainer
#
initialize
#
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 180 def initialize( commandline_arguments = nil, run_already = true ) # ======================================================================= # # We first have to determine the GUI that is to be used, even before # calling reset(). The reason is that this will also require some # files, such as the Gdk namespace, which may be used by the GUI # related parts for ruby-gtk3, for instance. # ======================================================================= # determine_the_GUI_to_be_used(commandline_arguments) # super(:vertical) This should be for ruby-gtk3, for a BaseModuleBox. reset set_commandline_arguments( commandline_arguments ) run if run_already end |
Class Method Details
.[](i = ARGV) ⇒ Object
#
Studium::GUI::UniversalWidgets::ExamTrainer[]
#
3252 3253 3254 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3252 def self.[](i = ARGV) new(i) end |
.gtk_accel_group ⇒ Object
#
Studium::GUI::UniversalWidgets::ExamTrainer.gtk_accel_group
#
1645 1646 1647 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1645 def self.gtk_accel_group ::Gtk::AccelGroup.new end |
.run(i = ARGV) ⇒ Object
#
Studium::GUI::UniversalWidgets::ExamTrainer.run
#
2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2606 def self.run( i = ARGV ) require 'gtk_paradise/run' _ = ::Studium::GUI::UniversalWidgets::ExamTrainer.new(i) r = ::Gtk.run r << _ _.(r) # Designate it as the parent widget. _.enable_the_main_key_combinations r. r. { |, event| if ::Gtk.right_mouse_click?(event) # right mouse click event. _..popup_based_on_this_event(event) end } r.automatic_size_then_automatic_title r.enable_quick_exit r.move_to(x: 15, y: 0) r.run end |
Instance Method Details
#activate_the_third_textview ⇒ Object
#
activate_the_third_textview
#
1724 1725 1726 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1724 def activate_the_third_textview free_form_textarea?.do_focus_on_it end |
#add_the_status_icon ⇒ Object
#
add_the_status_icon
#
1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1541 def add_the_status_icon if use_gtk3? status_icon = return_status_icon status_icon.favicon = Studium.project_base_directory?+ 'images/studies_favicon.png' status_icon.hint = 'Exam-question widget: train your brain!' begin # Need to fix this later. = = (stock: ::Gtk::Stock::FIND) .signal_connect(:activate) { e 'A click-event has been detected.' } << = (stock: ::Gtk::Stock::QUIT) .signal_connect(:activate) { ::Gtk.main_quit } .append() .show_all status_icon.signal_connect(:popup_menu) { |icon, , time| .popup(nil, nil, , time) } rescue Exception => error pp error end end end |
#all_questions_have_been_answered_in_this_topic?(this_topic = current_exam_topic? ) ⇒ Boolean
#
all_questions_have_been_answered_in_this_topic?
This method has to determine how many questions have been answered in the current exam topic.
#
1265 1266 1267 1268 1269 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1265 def all_questions_have_been_answered_in_this_topic?( this_topic = current_exam_topic? ) (Studium.return_n_percent_solved_from_this_topic(this_topic).to_i == 100) end |
#all_textviews? ⇒ Boolean
#
all_textviews?
#
490 491 492 493 494 495 496 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 490 def all_textviews? [ textview1?, textview2?, textview3? ] end |
#allow_external_applications? ⇒ Boolean
#
allow_external_applications?
This is mostly useful when the main application allows add-ons, such as the TenAliases widget. It is not so important for standalone widgets.
#
1574 1575 1576 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1574 def allow_external_applications? true end |
#always_reset_the_delay_before_using_another_delay ⇒ Object
#
always_reset_the_delay_before_using_another_delay
#
3167 3168 3169 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3167 def always_reset_the_delay_before_using_another_delay we_may_not_reveal_the_exam_answer_anymore end |
#always_reveal_the_exam_answer_via_this_method ⇒ Object
#
always_reveal_the_exam_answer_via_this_method
This method will ALWAYS reveal the exam-answer.
#
2942 2943 2944 2945 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2942 def always_reveal_the_exam_answer_via_this_method set_exam_answer always_reset_the_delay_before_using_another_delay end |
#answer_is? ⇒ Boolean
#
answer_is?
#
1938 1939 1940 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1938 def answer_is? @internal_hash[:exam_question_object].answer? end |
#array_all_exam_questions? ⇒ Boolean Also known as: all_exam_questions
#
array_all_exam_questions?
Query-method to keep track of all exam-questions that were asked in the current run.
#
2665 2666 2667 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2665 def array_all_exam_questions? @internal_hash[:array_all_exam_questions] end |
#available_exam_topics_in_short_form? ⇒ Boolean Also known as: return_available_exam_topics, available_exam_topics?, exam_topics_short_form?
#
available_exam_topics_in_short_form?
#
1581 1582 1583 1584 1585 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1581 def available_exam_topics_in_short_form? array = Studium.available_exam_topics_in_short_form? array = array.sort_by {|entry| entry.downcase } return array end |
#border_size? ⇒ Boolean
#
border_size?
#
303 304 305 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 303 def border_size? 0 end |
#button_ask_the_exam_question? ⇒ Boolean Also known as: ,
#
button_ask_the_exam_question?
#
1390 1391 1392 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1390 def @internal_hash[:button_ask_the_exam_question] end |
#button_ask_the_exam_question_was_clicked(use_this_topic = :obtain_the_exam_topic_from_the_relevant_entry) ⇒ Object Also known as: ask_an_exam_question, do_ask_the_exam_question, do_ask_a_new_question, , do_ask_an_exam_question, do_ask_a_new_exam_question, , ,
#
button_ask_the_exam_question_was_clicked (clicked tag)
This is the most important button of this GUI.
#
2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2839 def ( use_this_topic = :obtain_the_exam_topic_from_the_relevant_entry ) case use_this_topic # ======================================================================= # # === :obtain_the_exam_topic_from_the_relevant_entry # ======================================================================= # when :obtain_the_exam_topic_from_the_relevant_entry use_this_topic = entry_exam_topic_in_use?.text?.to_s end we_may_reveal_the_exam_answer one_two_three(use_this_topic) end |
#button_clear? ⇒ Boolean
#
button_clear?
#
1652 1653 1654 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1652 def @button_clear end |
#button_clear_was_clicked ⇒ Object
#
button_clear_was_clicked
#
1126 1127 1128 1129 1130 1131 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1126 def all_textviews?.each {|entry| entry.clear } @internal_hash[:may_we_reveal_the_answer_after_a_delay] = false end |
#button_reveal_the_answer? ⇒ Boolean
#
button_reveal_the_answer?
#
543 544 545 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 543 def @internal_hash[:button_reveal_the_answer] end |
#button_reveal_the_answer_was_clicked ⇒ Object Also known as:
#
button_reveal_the_answer_was_clicked
#
3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3113 def if all_questions_have_been_answered_in_this_topic? notify_the_user_that_all_questions_have_been_answered_in_this_topic( current_topic?, _ ) else always_reveal_the_exam_answer_via_this_method we_may_not_reveal_the_exam_answer_anymore end end |
#button_solve_the_exam_question? ⇒ Boolean
#
button_solve_the_exam_question?
#
1698 1699 1700 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1698 def @button_solve_the_exam_question end |
#button_solve_the_exam_question_was_clicked ⇒ Object Also known as: mark_the_exam_question_as_solved, do_solve_the_exam_question, the_current_exam_question_is_now_solved
#
button_solve_the_exam_question_was_clicked (solved tag, solve tag)
#
1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1705 def # the_current_exam_question_is_now_solved # update_three_important_widgets _ = Studium::Exams::Solved.new(ARGV) { :do_not_run_yet } _.set_commandline _.run consider_running_rinstall2 # ======================================================================= # # Also update the appropriate label next, whenever the solve-exam # question was clicked. # ======================================================================= # update_the_label_n_questions_were_answered end |
#button_update_n_questions_were_answered? ⇒ Boolean
#
button_update_n_questions_were_answered?
#
2417 2418 2419 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2417 def @internal_hash[:button_update_n_questions_were_answered] end |
#button_use_random_entry_from_the_ten_aliases? ⇒ Boolean
#
button_use_random_entry_from_the_ten_aliases?
#
733 734 735 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 733 def @internal_hash[:button_use_random_entry_from_the_ten_aliases] end |
#change_to_a_happy_smiley_before_reverting_to_the_prior_default_again(delay_to_use = 5_000) ⇒ Object
#
change_to_a_happy_smiley_before_reverting_to_the_prior_default_again
This method is used to turn the thinking-smiley to a happy-smiley, before reverting again to the prior default.
#
1734 1735 1736 1737 1738 1739 1740 1741 1742 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1734 def change_to_a_happy_smiley_before_reverting_to_the_prior_default_again( delay_to_use = 5_000 # This refers to 5 seconds. ) @a_thinking_smiley_emoji.toggle GLib::Timeout.add(delay_to_use) { @a_thinking_smiley_emoji.revert_to_the_initial_state # This reverts to the initial state again. false # Must end it. } end |
#clear_the_exam_answer ⇒ Object Also known as: clear_reveal_the_answer, clear_answers, clear_answers_buffer, clear_answer_buffer, clear_the_answer_buffer
#
clear_the_exam_answer (clear tag)
This method may only ever call set_exam_answer() - no other method is allowed to be called here.
#
465 466 467 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 465 def clear_the_exam_answer set_exam_answer('') # Simply set the answer to an empty String here. end |
#combobox_available_exam_topics? ⇒ Boolean Also known as: return_the_combobox, combo_box_available_exam_topics?, main_combo_box?, combo_box?, return_combo_box_showing_all_exam_questions, return_combo_box_available_exam_topics
#
combobox_available_exam_topics?
This combo box will contain all available (registered) exam topics.
#
2405 2406 2407 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2405 def combobox_available_exam_topics? @internal_hash[:combobox_available_exam_topics] end |
#connect_the_notebook_tab(window = main_window?, , padding_to_use = 2) ⇒ Object
#
connect_the_notebook_tab
This method will connect the notebook with the main Gtk::Window in use.
#
2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2510 def connect_the_notebook_tab( window = main_window?, padding_to_use = 2 ) # @notebook_tab.halign = 0.5 scrolled_window = create_scrolled_window(@notebook_tab) scrolled_window.show_all window.add(scrolled_window) # , padding_to_use) window.show_all end |
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag)
#
3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3207 def connect_the_skeleton abort_on_exception add_the_status_icon r = create_window_or_runner(nil, width?, height?, title?) properly_prepare_this_window( r, return_the_default_hash_for_properly_preparing_this_window ) do_assign_the_default_exam_topic_to_the_correct_entry let_the_scrolled_window_for_the_answer_parse_URLs deselect_the_entry_containing_the_exam_topic do_jump_into_the_entry_containing_the_current_exam_topic parse_the_commandline_arguments populate_the_main_grid(main_grid?) # Populate the main grid here next. populate_the_notebook_tab connect_the_notebook_tab(r) r.top_left (r) # Designate it as the parent widget. enable_the_main_key_combinations r. r. { |, event| if ::Gtk.right_mouse_click?(event) # right mouse click event. _..popup_based_on_this_event(event) end } # r.automatic_size_then_automatic_title r.show_all the_first_notebook_tab_is_active r.enable_quick_exit r.set_default_size(width?, height?) # resize_the_notebook_tab_towards_the_primary_width_and_height run_main end |
#consider_making_available_the_show_ten_aliases_widget ⇒ Object
#
consider_making_available_the_show_ten_aliases_widget
#
3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3184 def # ======================================================================= # # The next if-clause must come after @internal_hash has been # defined. # ======================================================================= # if Object.const_defined?(:Roebe) begin require 'roebe/gui/gtk3/show_ten_aliases/show_ten_aliases.rb' @internal_hash[:show_ten_aliases] = ::Roebe::GUI::Gtk::ShowTenAliases.new rescue LoadError; end end end |
#consider_running_rinstall2 ⇒ Object
#
consider_running_rinstall2
#
603 604 605 606 607 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 603 def consider_running_rinstall2 if is_on_roebe? and Object.const_defined?(:Roebe) rinstall2 # Run rinstall2 here, to update the local copy. end end |
#context_menu? ⇒ Boolean
#
context_menu?
#
536 537 538 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 536 def @context_menu end |
#control_panel? ⇒ Boolean
#
control_panel?
#
864 865 866 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 864 def control_panel? @control_panel end |
#create_entry_n_total_exam_questions ⇒ Object Also known as: create_the_entry_containing_n_questions
#
create_entry_n_total_exam_questions
#
1230 1231 1232 1233 1234 1235 1236 1237 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1230 def create_entry_n_total_exam_questions # ======================================================================= # # === @entry_n_total_exam_questions # ======================================================================= # @internal_hash[:entry_n_total_exam_questions] = entry('', 12) # The 12 is for jruby specifically. enhance_the_entry_containing_n_questions return @internal_hash[:entry_n_total_exam_questions] end |
#create_scrolled_window3(i = textview3? ) ⇒ Object
#
create_scrolled_window3
This method will return the textarea-widget that can be used for “free typing” by the user - in other words, where the user can simply write whatever he/she wants to.
#
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1083 def create_scrolled_window3( i = textview3? ) # ======================================================================= # # The next scrolled-window is called "textview3", as it is the third # textarea to be seen in the main widget. The rationale for this # method was briefly mentioned above. # ======================================================================= # _ = create_scrolled_window(i) { :only_top_to_bottom } _.set_name('textview3') _.width_height(900, 180) _.pad4px _. _.min_content_width = 80 _.min_content_height = 120 # ======================================================================= # # Next, enable select-all-on-click events: # ======================================================================= # _.signal_connect(:event) {|, event| case event.event_type.name.to_s when 'GDK_BUTTON_PRESS' # e 'The left mouse-button was clicked! Selecting everything next.' # @text_view_for_simply_typing_anything.signal_emit(:select_all, event) i.select_everything(event) end } @scrolled_window3 = _ return _ # And return it here as well, just in case. end |
#create_text_buffer_for_the_answer ⇒ Object
#
create_text_buffer_for_the_answer
#
550 551 552 553 554 555 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 550 def create_text_buffer_for_the_answer # ======================================================================= # # === @text_buffer_for_the_answer # ======================================================================= # @text_buffer_for_the_answer = create_text_buffer end |
#create_the_button_ask_the_exam_question ⇒ Object Also known as:
#
create_the_button_ask_the_exam_question
#
1398 1399 1400 1401 1402 1403 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1398 def # ======================================================================= # # === @internal_hash[:button_ask_the_exam_question] # ======================================================================= # @internal_hash[:button_ask_the_exam_question] = (use_emoji?) end |
#create_the_button_solve_the_question ⇒ Object
#
create_the_button_solve_the_question
#
1380 1381 1382 1383 1384 1385 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1380 def # ======================================================================= # # === @button_solve_the_question # ======================================================================= # @button_solve_the_exam_question = end |
#create_the_button_update_n_questions_were_answered ⇒ Object
#
create_the_button_update_n_questions_were_answered (update tag)
#
1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1952 def # ======================================================================= # # === The update-button is created next. It had the cat emoji in the # past, aka 🐈️, but not every computer system has access to such # an emoji, so this was replaced via an image. # # The old text was: '🐈️ Update ➡️ ' # # ======================================================================= # _ = ('Update ➡️ ') _.on_hover(:lightblue) _.hint = 'Click this button to update the entry to the right side.' _.on_clicked { update_the_label_n_questions_were_answered } # ======================================================================= # # Last but not least, assign it: # ======================================================================= # @internal_hash[:button_update_n_questions_were_answered] = _ end |
#create_the_button_use_random_entry_from_the_ten_aliases ⇒ Object
#
create_the_button_use_random_entry_from_the_ten_aliases
#
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 689 def # ======================================================================= # # === @internal_hash[:button_use_random_entry_from_the_ten_aliases] # # This is an eventbox rather than a button, but I think this is still # fine. The unicode character "🕵" (U+1F575) is the spy character. # ======================================================================= # if use_emoji? label = create_label('🕵️') else # label = image_avatar_default # This will be a gtk-image for ruby-gtk3. # In December 2023, the above was changed to an image. label = create_image( Gtk.project_base_directory?+'images/misc/investigate.png' ) end # ======================================================================= # # === @internal_hash[:button_use_random_entry_from_the_ten_aliases] # ======================================================================= # _ = create_eventbox(label) _.on_clicked { if show_ten_aliases? set_exam_topic( show_ten_aliases?.return_random_entry ) one_two_three end } _.set_size_request(40, 40) _.on_hover_lightblue # Provide some helpful message to help the user make use of this # button. _.hint = 'Click on this small widget to randomly assign one of '\ 'the 10 exam-topics currently being studied as the '\ 'new main exam-topic in use.' # This is actually an event box rather than a button. @internal_hash[:button_use_random_entry_from_the_ten_aliases] = _ # And assign it here too. return _ end |
#create_the_buttons ⇒ Object
#
create_the_buttons (buttons tag, button tag)
#
1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1490 def # ======================================================================= # # === @button_solve_the_exam_question # ======================================================================= # # ======================================================================= # # === @button_clear # ======================================================================= # @button_clear = ('_Clear all entries', self, :use_mnemonic) { :button_clear_was_clicked } # ======================================================================= # # Next style these four buttons uniformly # ======================================================================= # [ , , , @button_clear, ].each {|| .clear_background .bblack2 .on_hover(:lightgreen) } # This one should come last here. end |
#create_the_checkbox_shall_we_reveal_the_answer(entry_delay_to_use = entry_delay_to_use? ) ⇒ Object
#
create_the_checkbox_shall_we_reveal_the_answer
#
2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2801 def create_the_checkbox_shall_we_reveal_the_answer( entry_delay_to_use = entry_delay_to_use? ) _ = create_checkbox( " Automatically reveal the \n answer after a delay" ) _.set_font(smallest_font?) # ======================================================================= # # Next determine whether the checkbox is active, on startup, or whether # it is not active when the GUI starts up. # ======================================================================= # _.mark_as_checked # Should be checked as-is. _.hint = 'Deselect this if you do not want to automatically reveal the answer. '\ 'In that case you have to manually click on the Answer button.' _.on_toggled { || if _.active? entry_delay_to_use.grey_in elsif not _.active? entry_delay_to_use.grey_out end } if _.is_it_active? entry_delay_to_use.grey_in else entry_delay_to_use.grey_out end # ======================================================================= # # === @internal_hash[:checkbox_shall_we_reveal_the_answer] # ======================================================================= # @internal_hash[:checkbox_shall_we_reveal_the_answer] = _ end |
#create_the_combobox(use_these_exam_topics = :default_exam_topics) ⇒ Object
#
create_the_combobox
This method will create the combo-box that contains all exam-topics. It will be a bit truncated, largely for display-reasons rather than any other reason.
#
1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1751 def create_the_combobox( use_these_exam_topics = :default_exam_topics ) case use_these_exam_topics # ===================================================================== # # === :default_exam_topics # ===================================================================== # when :default_exam_topics use_these_exam_topics = available_exam_topics_in_short_form?. map(&:downcase).sort end # ===================================================================== # # Next truncate these exam-topics a bit: # ===================================================================== # use_this_sorted_array = use_these_exam_topics.uniq.map {|entry| if entry.size > 25 # Truncate it a bit in this case here. entry = entry[0 .. 25] end entry }.sort _ = create_combobox_text # Create the combo-box here. # use_this_sorted_array.each {|entry| # entry = entry.to_s # _.append_text(entry) if entry and !entry.empty? # } _.fill_up(use_this_sorted_array) _.first_entry_is_active _.bblack1 _.set_size_request(100, 28) # ======================================================================= # # Wrap-width determines how many entries per row are shown when the # combo-box is expanded. We stick to the default of 1 here. # ======================================================================= # _.set_wrap_width(1) # ======================================================================= # # The event where the combo-box is changed is handled next. # ======================================================================= # _.on_changed { handle_the_combo_box_available_exam_topics_on_changed_event } @internal_hash[:combobox_available_exam_topics] = _ # And assign it here. return _ end |
#create_the_context_menu ⇒ Object
#
create_the_context_menu
This is the context-menu which will appear on a right-mouse click event. It currently only works on ruby-gtk3.
#
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 638 def # ======================================================================= # # === @context_menu # ======================================================================= # @context_menu = (self) {{ numbered_actions: { 'Ask an exam question': :ask_an_exam_question, 'Reveal the answer to the exam question': :reveal_the_answer_to_the_exam_question, 'Mark the exam question as solved': :mark_the_exam_question_as_solved, 'Pick a new font (show the widget)': :popup_pick_a_new_font, 'Debug': :debug #'Change the font in use': :do_interactively_change_the_font, } }} @context_menu.make_bold @context_menu.set_font(:hack_18) end |
#create_the_editor ⇒ Object
#
create_the_editor (editor tag)
This method only makes sense for ruby-gtk3.
#
1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1526 def create_the_editor if shall_we_create_the_gtk_editor? require 'gtk_paradise/widgets/gtk3/editor/editor.rb' # ===================================================================== # # === @editor # ===================================================================== # @editor = ::Gtk::Editor.new { :do_not_use_the_colour_box_widget } else @editor = nil end end |
#create_the_emoji_toggle_widget ⇒ Object
#
create_the_emoji_toggle_widget
Note that in order to use EmojiToggleWidget, we have to pull in the right file, either ruby-gtk3 or ruby-gtk2.
#
1458 1459 1460 1461 1462 1463 1464 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1458 def require 'gtk_paradise/widgets/gtk3/emoji_toggle_widget/emoji_toggle_widget.rb' @a_thinking_smiley_emoji = ::Gtk::EmojiToggleWidget.new( :use_two_smileys ) @a_thinking_smiley_emoji.make_selectable end |
#create_the_entries(use_this_font = :default_font) ⇒ Object
#
create_the_entries (entries tag, entry tag)
#
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 871 def create_the_entries( use_this_font = :default_font ) # ======================================================================= # # The entry "n percentage" will be created first: # ======================================================================= # create_the_entry_percentage # ======================================================================= # # === The entry for n exam questions in total comes next # ======================================================================= # create_the_entry_containing_n_questions create_the_entry_for_the_current_exam_topic create_the_entry_n_unanswered_questions # ======================================================================= # # === :entry_for_sleeping_n_seconds # ======================================================================= # create_the_entry_for_sleeping_n_seconds create_the_entry_n_answered_exam_questions(use_this_font) end |
#create_the_entry_for_sleeping_n_seconds ⇒ Object
#
create_the_entry_for_sleeping_n_seconds
#
1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1174 def create_the_entry_for_sleeping_n_seconds # ======================================================================= # # === :entry_for_sleeping_n_seconds # # Next create the delay-entry that keeps track how many seconds to wait, # before revealing the answer (IF the user has decided to make use of # that functionality). # ======================================================================= # _ = entry('', 5) # entry('', 5) is primarily for jruby. _ << default_delay?.to_s.dup # Default delay. @internal_hash[:entry_for_sleeping_n_seconds] = _ enhance_the_entry_for_sleeping_n_seconds return @internal_hash[:entry_for_sleeping_n_seconds] end |
#create_the_entry_for_the_current_exam_topic ⇒ Object
#
create_the_entry_for_the_current_exam_topic
#
1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1819 def create_the_entry_for_the_current_exam_topic # ======================================================================= # # === @internal_hash[:entry_exam_topic_in_use] # # This is the entry that contains the current exam topics. The user can # modify the content of this entry at his or her own discretion. It # is the most important entry for this widget, among all entries # used in this GUI application. # # This entry is positioned rather close to the top of the main widget, # on the left hand side. The user can thus simply manipulate it by # clicking on it; most users will look at the top left (or middle) # first. # # Another entry of this widget may depend on this entry here, so it # should come early in the create-entries method - aka on top of # this method. # # We use a completionable-entry here, but only for ruby-gtk3. # ======================================================================= # _ = entry_with_this_completion( available_exam_topics_in_short_form? ) _.clear_background _.bblack1 _.very_light_yellow_background _.width_height(400, 20) _.set_font(smaller_font?) _.hint = 'This is the entry that keeps '\ 'track of the current exam topic.' # ======================================================================= # # We need this entry to be fairly wide, hence the following method call. # ======================================================================= # _.set_size_request(500, 40) _.(false) _.(false) # ======================================================================= # # Allow for scroll-events. # ======================================================================= # _.enable_scroll_events _.on_enter { find_completion_for_the_entry_for_the_current_exam_topic } _.on_scroll_event {|, event| # ===================================================================== # # For now this simply sets a new, random topic. # ===================================================================== # if scroll_up?(event) set_exam_topic( available_exam_topics?.sample.downcase ) sync_entry_holding_all_exam_topics_onto_the_combo_box # Sync towards the combo-box. elsif scroll_down?(event) set_exam_topic( available_exam_topics?.sample.downcase ) sync_entry_holding_all_exam_topics_onto_the_combo_box # Sync towards the combo-box. end } # ======================================================================= # # Respond to the enter-key pressed next. # ======================================================================= # # _.on_enter_key_pressed { |widget, event| # sync_entry_holding_all_exam_topics_onto_the_main_combo_box # } # ======================================================================= # # Assign the entry-widget finally: # ======================================================================= # @internal_hash[:entry_exam_topic_in_use] = _ # And assign it here as well. end |
#create_the_entry_n_answered_exam_questions(use_this_font = :default_font) ⇒ Object Also known as: create_the_entry_containing_n_answered_exam_questions
#
create_the_entry_n_answered_exam_questions
#
2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2231 def create_the_entry_n_answered_exam_questions( use_this_font = :default_font ) # ======================================================================= # # === The entry keeping track as to how many answers have been # given for that particular exam-topic. # ======================================================================= # @internal_hash[:entry_n_answered_exam_questions] = entry('', 12) enhance_entry_n_answered_exam_questions(use_this_font) return entry_n_answered_exam_questions? # And return it here. end |
#create_the_entry_n_unanswered_questions ⇒ Object Also known as: create_the_entry_containing_n_unanswered_questions, create_the_entry_containing_n_unanswered_exam_questions
#
create_the_entry_n_unanswered_questions
#
1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1152 def create_the_entry_n_unanswered_questions # ======================================================================= # # === @entry_n_unanswered_questions # ======================================================================= # @entry_n_unanswered_questions = create_entry enhance_entry_containing_n_unanswered_questions( :default_font, @entry_n_unanswered_questions ) end |
#create_the_entry_percentage(use_this_font = smaller_font? ) ⇒ Object
#
create_the_entry_percentage
#
832 833 834 835 836 837 838 839 840 841 842 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 832 def create_the_entry_percentage( use_this_font = smaller_font? ) # ======================================================================= # # === Next create the percentage-entry # ======================================================================= # _ = entry('', 12) @internal_hash[:entry_percentage] = _ enhance_the_entry_percentage(use_this_font) # This has to happen after the ^^^ above. return _ end |
#create_the_labels ⇒ Object
#
create_the_labels
#
2375 2376 2377 2378 2379 2380 2381 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2375 def create_the_labels # ======================================================================= # # === @label_n_questions_were_answered # ======================================================================= # @label_n_questions_were_answered = selectable_label update_the_label_n_questions_were_answered(@label_n_questions_were_answered) end |
#create_the_notebook_tab ⇒ Object
#
create_the_notebook_tab (notebook tag)
#
2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2524 def create_the_notebook_tab # ======================================================================= # # === @notebook_tab # ======================================================================= # @notebook_tab = create_notebook { :make_it_scrollable } @notebook_tab.css_class('notebook_for_the_exam_trainer') @notebook_tab.the_tabs_appear_on_top @notebook_tab.can_be_rearranged @notebook_tab.do_show_the_tabs @notebook_tab.do_show_the_border end |
#create_the_reveal_the_answer_button ⇒ Object Also known as:
#
create_the_reveal_the_answer_button
This is the so-called “reveal button”.
#
2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2893 def # ======================================================================= # # === @internal_hash[:button_reveal_the_answer] (answer tag) # # The reveal-button is created next, also known as the "answer button". # The mnemonic-key is set to "A", so that we can toggle between # "Q" and "A" for "Question" and "Answer" respectively. # ======================================================================= # _ = ('Reveal the _Answer', self, true) { # This was the old emoji: ❗ :the_button_reveal_the_answer_was_clicked } _.set_size_request(78, 30) #_.on_hover_lightblue _.hint = 'Click on this button in order to '\ 'reveal the answer to the current exam question at hand.' @internal_hash[:button_reveal_the_answer] = _ end |
#create_the_skeleton ⇒ Object Also known as: create_skeleton
#
create_the_skeleton (create tag, skeleton tag)
#
2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2488 def create_the_skeleton create_the_entries # Should come fairly early - definitely before the grid is created. create_the_checkbox_shall_we_reveal_the_answer # ← Must come after the entries were created. create_text_buffer_for_the_answer # Must come before create_the_textviews(). create_the_textviews create_the_combobox create_the_editor create_the_labels # Should come after the editor was created. # create_the_emoji_toggle_widget # This currently does not work. create_the_thumbs_up_emoji # The context-menu can come last. # instantiate_the_control_panel # This one must come before the notebook tab is populated. create_the_main_grid create_the_notebook_tab # This must come late. end |
#create_the_textview_that_will_contain_the_exam_question(text_buffer_for_the_question = :default_buffer) ⇒ Object
#
create_the_textview_that_will_contain_the_exam_question
#
1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1290 def create_the_textview_that_will_contain_the_exam_question( text_buffer_for_the_question = :default_buffer ) # ======================================================================= # # === @internal_hash[:textview1] # ======================================================================= # _ = create_textview(text_buffer_for_the_question) _.set_left_right_margin(USE_THIS_MARGIN) _.word_wrap scrolled_window_containing_the_textarea1 = create_scrolled_window( _ ) { :only_up_and_bottom } scrolled_window_containing_the_textarea1.set_name('textview1_for_the_studium_gem') # Contains the question. scrolled_window_containing_the_textarea1.set_size_request(920, 180) @internal_hash[:textview1] = _ @internal_hash[:scrolled_window_containing_the_textarea1] = scrolled_window_containing_the_textarea1 end |
#create_the_textviews ⇒ Object
#
create_the_textviews
#
1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1342 def create_the_textviews create_the_textview_that_will_contain_the_exam_question # ======================================================================= # # === @internal_hash[:textview2] # ======================================================================= # # ======================================================================= # # === @internal_hash[:textview3] # ======================================================================= # create_scrolled_window3 # And create the scrolled-window3 here as well. end |
#create_the_thumbs_up_emoji ⇒ Object
#
create_the_thumbs_up_emoji
#
1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1012 def create_the_thumbs_up_emoji # ======================================================================= # # Add the thumbs-up emoji, but only if we use emojis. # ======================================================================= # if use_emoji? event_box_for_the_thumbs_up_emoji = create_event_box(label(' 👍')) else event_box_for_the_thumbs_up_emoji = create_event_box(image_trophy_gold) end @thumbs_up_emoji = event_box_for_the_thumbs_up_emoji.on_clicked { do_ask_a_new_exam_question } end |
#create_the_widget_for_the_exam_answer(use_this_text_buffer = @text_buffer_for_the_answer) ⇒ Object Also known as: create_text_view_for_the_answer
#
create_the_widget_for_the_exam_answer (answer tag, answers tags)
#
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1358 def ( use_this_text_buffer = @text_buffer_for_the_answer ) _ = create_textview(use_this_text_buffer) _.set_left_right_margin(USE_THIS_MARGIN) _.word_wrap @internal_hash[:textview2] = _ scrolled_window = create_scrolled_window( _ ) { :only_up_and_bottom } scrolled_window.set_name('textview2_for_the_studium_gem') # Contains the answer. scrolled_window.set_size_request(1000, 150) scrolled_window.min_content_width = 100 scrolled_window.min_content_height = 200 scrolled_window. @scrolled_window_containing_the_textarea2 = scrolled_window return _ # And return it too, just in case. end |
#create_the_widget_for_the_freeform_textview ⇒ Object
#
create_the_widget_for_the_freeform_textview
#
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1051 def # ======================================================================= # # === @internal_hash[:textview3] # ======================================================================= # _ = create_textview _.bblack1 _.set_left_right_margin(USE_THIS_MARGIN) # ======================================================================= # # The next code sets up a default placeholder text. Upon a focus-in-event # that default placeholder text is removed. # ======================================================================= # _.buffer.set_placeholder_text( DEFAULT_PLACEHOLDER_TEXT ) _.buffer.sync_placeholder_text _.word_wrap _.focus_in_event { if _.buffer.text? == DEFAULT_PLACEHOLDER_TEXT _.buffer.clear # Remove that placeholder text in this case. end } @internal_hash[:textview3] = _ return _ end |
#create_then_return_the_default_grid ⇒ Object Also known as: create_the_main_grid
#
create_then_return_the_default_grid
#
2475 2476 2477 2478 2479 2480 2481 2482 2483 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2475 def create_then_return_the_default_grid grid = default_grid # main_grid? grid.pad2px grid.default_spacing(8) grid.width_height(width?, height?) grid.set_size_request(width?, height?) @internal_hash[:main_grid] = grid return grid end |
#current_exam_topic_from_the_entry? ⇒ Boolean Also known as: current_exam_topic_as_a_string?
#
current_exam_topic_from_the_entry?
#
2293 2294 2295 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2293 def current_exam_topic_from_the_entry? entry_for_the_current_exam_topic?.text?.to_s end |
#debug ⇒ Object
#
debug
#
430 431 432 433 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 430 def debug pp array_all_exam_questions? pp array_all_exam_questions?.size end |
#default_exam_topic? ⇒ Boolean
#
default_exam_topic?
#
455 456 457 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 455 def default_exam_topic? USE_THIS_AS_THE_DEFAULT_EXAM_TOPIC end |
#delay_to_use? ⇒ Boolean Also known as: default_delay?
#
default_delay?
#
1945 1946 1947 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1945 def delay_to_use? @internal_hash[:delay_to_use] end |
#deselect_the_entry_containing_the_exam_topic(i = entry_for_the_current_exam_topic? ) ⇒ Object
#
deselect_the_entry_containing_the_exam_topic
#
1325 1326 1327 1328 1329 1330 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1325 def deselect_the_entry_containing_the_exam_topic( i = entry_for_the_current_exam_topic? ) i.deselect text_view_containing_the_current_question?.set_focus(true) end |
#do_assign_a_new_exam_topic ⇒ Object
#
do_assign_a_new_exam_topic
#
950 951 952 953 954 955 956 957 958 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 950 def do_assign_a_new_exam_topic clear_reveal_the_answer this_topic = select_not_yet_completed_exam_topics( available_exam_topics? ).sample # Obtain a random exam topic here. entry_for_the_current_exam_topic?.set_text(this_topic.to_s) sync_entry_holding_all_exam_topics_onto_the_combo_box do_ask_an_exam_question end |
#do_assign_the_default_exam_topic_to_the_correct_entry ⇒ Object
#
do_assign_the_default_exam_topic_to_the_correct_entry
#
1318 1319 1320 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1318 def do_assign_the_default_exam_topic_to_the_correct_entry set_exam_topic(USE_THIS_AS_THE_DEFAULT_EXAM_TOPIC) end |
#do_clear_the_free_form_textarea ⇒ Object
#
do_clear_the_free_form_textarea
#
1483 1484 1485 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1483 def do_clear_the_free_form_textarea free_form_textarea?.set_text('') end |
#do_clear_the_question_buffer ⇒ Object Also known as: clear_question_buffer, clear_questions_buffer
#
do_clear_the_question_buffer
Clear the question-buffer via this method.
#
908 909 910 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 908 def do_clear_the_question_buffer text_buffer_for_the_question?.set_text('') end |
#do_interactively_change_the_font ⇒ Object
#
do_interactively_change_the_font
This does not work. :(
#
521 522 523 524 525 526 527 528 529 530 531 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 521 def do_interactively_change_the_font require 'gtk_paradise/widgets/gtk3/text_entry_widget/text_entry_widget.rb' require 'gtk_paradise/examples/gtk3/gtk_dialog_sample.rb' _ = ::Gtk::TextEntryWidget.run ::Gtk::DialogSample.new(_) ::Gtk.main e 'The selection was:' e pp _.selection? e end |
#do_jump_into_the_entry_containing_the_current_exam_topic ⇒ Object
#
do_jump_into_the_entry_containing_the_current_exam_topic
#
423 424 425 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 423 def do_jump_into_the_entry_containing_the_current_exam_topic entry_for_the_current_exam_topic?.do_focus_on_it end |
#do_open_the_current_exam_topic_file(use_this_as_exam_topic = current_exam_topic_from_the_entry? ) ⇒ Object
#
do_open_the_current_exam_topic_file
This method can either open the exam-file in the bluefish editor, or in the integrated ruby-gtk editor. Since as of July 2021 we will try the integrated variant. Unfortunately ruby-gtk is somehow buggy - reading a large file leads to a BadAlloc error, so this was changed to open an external editor instead.
#
2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2306 def do_open_the_current_exam_topic_file( use_this_as_exam_topic = current_exam_topic_from_the_entry? ) use_this_as_exam_topic = Studium.find_corresponding_exam_topic(use_this_as_exam_topic) if use_this_as_exam_topic.empty? do_popup_the_you_have_to_provide_an_exam_topic end # ======================================================================= # # We must obtain the correct path next, to then send into the editor: # ======================================================================= # use_this_as_exam_topic = Studium.path_to_exam_topic?+ File.basename(use_this_as_exam_topic) if use_the_internal_editor? # This here is when we use the internal editor. set_save_into_this_local_file(use_this_as_exam_topic) set_editor_buffer(File.read(use_this_as_exam_topic)) @notebook_tab.focus_on_this_tab(2) else # ======================================================================= # # Or simply use bluefish or whatever else the editor is. # ======================================================================= # _ = "#{use_this_editor?} #{use_this_as_exam_topic}" esystem(_) end end |
#do_popup_the_array_of_all_exam_questions(array = :infer) ⇒ Object
#
do_popup_the_array_of_all_exam_questions
This method will be called then whe icon-with-glasses is clicked.
#
2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2681 def do_popup_the_array_of_all_exam_questions( array = :infer ) case array # ======================================================================= # # === :infer # ======================================================================= # when :infer array = Studium.return_all_exam_questions_from_this_topic( entry_exam_topic_as_string? ) end content = array.map.with_index {|line, index| index += 1 line = line.dup line.prepend( "(#{index}) " ) line }.join("\n") text_buffer = create_text_buffer(content) text_view = create_text_view(text_buffer) scrolled_window = create_scrolled_window(text_view) scrolled_window.width_height(1200, 700) scrolled_window.pad8px # scrolled_window.add(text_view) scrolled_window.show_all ( scrolled_window, text_view, entry_for_the_exam_topic? ).popup end |
#do_popup_the_you_have_to_provide_an_exam_topic ⇒ Object
#
do_popup_the_you_have_to_provide_an_exam_topic
#
2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2717 def do_popup_the_you_have_to_provide_an_exam_topic = bold_label( "You have to provide an exam-topic, in the exam-topic entry.\n\n"\ "The arrow should indicate the proper entry." ) ( # Nudge the user here. , entry_for_the_exam_topic? ).popup end |
#do_sleep_now(i = :default, use_this_as_timeout = 0) ⇒ Object
#
do_sleep_now (sleep tag)
#
2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2957 def do_sleep_now( i = :default, use_this_as_timeout = 0 ) case i # ======================================================================= # # === :default # # This will always obtain the value from the proper entry. # ======================================================================= # when :default, :use_the_correct_entry_for_the_delay i = entry_sleep_n_seconds?.text? end i = i.to_f # Always use a float here. # ======================================================================= # # An alternative to sleep() would be this: # # GLib::Timeout.add(use_this_as_timeout) { # @text_view_for_the_answer.set_text(answer) # false # } # # ======================================================================= # if use_this_as_timeout >= 0 and checkbox_shall_we_reveal_the_answer?.is_it_active? sleep(i) end end |
#do_style_all_buttons_uniformly(i = return_all_buttons) ⇒ Object
#
do_style_all_buttons_uniformly (style tag)
#
1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1242 def ( i = ) # ======================================================================= # # Style all buttons uniformly next, via CSS. # ======================================================================= # i.each {|| # ===================================================================== # # Use the same CSS rule for each button. # ===================================================================== # .clear_background .bblack2 .set_size_request(75, 28) .set_name('button_hover_transition') } end |
#do_update_the_entries_n_answered_and_n_unanswered ⇒ Object
#
do_update_the_entries_n_answered_and_n_unanswered
#
740 741 742 743 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 740 def do_update_the_entries_n_answered_and_n_unanswered do_update_the_entry_n_unanswered_questions update_n_unanswered end |
#do_update_the_entry_n_questions(current_exam_topic = current_exam_topic? ) ⇒ Object
#
do_update_the_entry_n_questions
#
340 341 342 343 344 345 346 347 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 340 def do_update_the_entry_n_questions( current_exam_topic = current_exam_topic? ) set_n_exam_questions( return_n_questions_from_the_currently_selected_topic(current_exam_topic).to_s ) end |
#do_update_the_entry_n_unanswered_questions ⇒ Object Also known as: update_the_entry_n_unanswered_questions, update_n_unanswered
#
do_update_the_entry_n_unanswered_questions
This method depends on two entries being set correctly.
#
2759 2760 2761 2762 2763 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2759 def do_update_the_entry_n_unanswered_questions _ = entry_containing_n_questions?.text?.to_i - entry_containing_n_answers?.text?.to_i entry_containing_n_unanswered_questions?.set_text(_.to_s) end |
#enable_all_key_combinations ⇒ Object
#
enable_all_key_combinations
#
1592 1593 1594 1595 1596 1597 1598 1599 1600 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1592 def enable_all_key_combinations # ======================================================================= # # === @accel_group # ======================================================================= # @accel_group = create_and_add_gtk_accel_group enable_alt_w_key_combination enable_alt_y_key_combination enable_alt_1_key_combination end |
#enable_alt_1_key_combination ⇒ Object
#
enable_alt_1_key_combination
#
767 768 769 770 771 772 773 774 775 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 767 def enable_alt_1_key_combination # ======================================================================= # # Add alt+1 key combination: # ======================================================================= # use_this_key = Gdk::Keyval::KEY_1 @accel_group.connect(use_this_key, :mod1_mask, :visible) { # alt+1 entry_ask_questions?.set_focus(true) } end |
#enable_alt_w_key_combination(i = @accel_group) ⇒ Object
#
enable_alt_w_key_combination
This method will specifically enable the “alt+w” shortcut.
#
2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2278 def enable_alt_w_key_combination( i = @accel_group ) # ======================================================================= # # Add alt+w key combination, to open the current exam topic file: # ======================================================================= # use_this_key = ::Gdk::Keyval::KEY_W i.connect(use_this_key, :mod1_mask, :visible) { # alt+w do_open_the_current_exam_topic_file } end |
#enable_alt_y_key_combination ⇒ Object
#
enable_alt_y_key_combination
#
780 781 782 783 784 785 786 787 788 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 780 def enable_alt_y_key_combination # ======================================================================= # # Add alt+y key combination, to assign a new exam topic: # ======================================================================= # use_this_key = Gdk::Keyval::KEY_Y @accel_group.connect(use_this_key, :mod1_mask, :visible) { # alt+y do_assign_a_new_exam_topic } end |
#enable_the_main_key_combinations(use_this_hash = HASH_DESIGNATED_KEY_COMBINATIONS) ⇒ Object
#
enable_the_main_key_combinations
#
1994 1995 1996 1997 1998 1999 2000 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1994 def enable_the_main_key_combinations( use_this_hash = HASH_DESIGNATED_KEY_COMBINATIONS ) enable_these_key_combinations( use_this_hash ) end |
#enhance_entry_n_answered_exam_questions(use_this_font = :default_font, entry = entry_n_answered_exam_questions? ) ⇒ Object
#
enhance_entry_n_answered_exam_questions
This method can be used to enhance the entry “n answered exam questions”.
#
2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2206 def enhance_entry_n_answered_exam_questions( use_this_font = :default_font, entry = entry_n_answered_exam_questions? ) case use_this_font # ======================================================================= # # === :default_font # ======================================================================= # when :default_font, nil use_this_font = smaller_font? end # ======================================================================= # # === @internal_hash[:entry_n_answered_exam_questions] # ======================================================================= # entry.set_font(use_this_font) if use_this_font entry.width_height(320, 22) entry.bblack1 entry.very_light_yellow_background entry.center entry.readonly end |
#enhance_the_entry_containing_n_questions(use_this_font = smaller_font?, , entry = ) ⇒ Object
#
enhance_the_entry_containing_n_questions
#
2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2188 def enhance_the_entry_containing_n_questions( use_this_font = smaller_font?, entry = @internal_hash[:entry_n_total_exam_questions] ) entry.set_font(use_this_font) if use_this_font entry.clear_background entry.width_height(350, 22) entry.bblack1 entry.center entry.readonly entry.very_light_yellow_background end |
#enhance_the_entry_for_sleeping_n_seconds(i = entry_for_sleeping_n_seconds? ) ⇒ Object
#
enhance_the_entry_for_sleeping_n_seconds
#
2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2152 def enhance_the_entry_for_sleeping_n_seconds( i = entry_for_sleeping_n_seconds? ) i.width_height(45, 20) i.center i.bblack1 i.set_name('BG_bisque') i.hint = 'Provide the delay here, as <b>n seconds</b>. This will only work '\ 'if the checkbox to the right side <b>active</b>.' end |
#enhance_the_entry_percentage(use_this_font = nil) ⇒ Object
#
enhance_the_entry_percentage
#
2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2167 def enhance_the_entry_percentage( use_this_font = nil ) _ = entry_percentage? _.hint = "This field denotes how many questions have already\n"\ "been answered successfully, <b>in percent</b>.\n\n"\ "Note that this requires a specific exam topic to "\ "have been set, so no percentage value may be "\ "shown initially.\n\nSimply assign to an exam topic "\ "and it should work fine." _.do_center _.disable_user_input # The user can not change this entry. _.set_font(use_this_font) if use_this_font _.set_name('BG_bisque') _.bblack1 end |
#entry_delay_value? ⇒ Boolean
#
entry_delay_value?
#
2877 2878 2879 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2877 def entry_delay_value? entry_for_sleeping_n_seconds?.text?.to_f end |
#entry_exam_topic_in_use? ⇒ Boolean Also known as: entry_for_the_current_exam_topic?, entry_for_the_exam_topic?, entry_holding_all_exam_topics?, entry_current_exam_topic?
#
entry_exam_topic_in_use?
#
2464 2465 2466 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2464 def entry_exam_topic_in_use? @internal_hash[:entry_exam_topic_in_use] end |
#entry_for_sleeping_n_seconds? ⇒ Boolean Also known as: entry_delay_to_use?, entry_sleep_n_seconds?, entry_delay?, return_entry_for_sleeping_n_seconds, return_the_entry_sleep_n_seconds
#
entry_for_sleeping_n_seconds?
#
2866 2867 2868 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2866 def entry_for_sleeping_n_seconds? @internal_hash[:entry_for_sleeping_n_seconds] end |
#entry_n_answered_exam_questions? ⇒ Boolean Also known as: entry_containing_n_answers?
#
entry_n_answered_exam_questions?
#
1167 1168 1169 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1167 def entry_n_answered_exam_questions? @internal_hash[:entry_n_answered_exam_questions] end |
#entry_n_total_exam_questions? ⇒ Boolean Also known as: entry_containing_n_questions?
#
entry_n_total_exam_questions?
#
1638 1639 1640 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1638 def entry_n_total_exam_questions? @internal_hash[:entry_n_total_exam_questions] end |
#entry_n_unanswered_questions? ⇒ Boolean Also known as: entry_containing_n_unanswered_questions?, entry_containing_n_unanswered_questions
#
entry_n_unanswered_questions?
#
1690 1691 1692 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1690 def entry_n_unanswered_questions? @entry_n_unanswered_questions end |
#entry_percentage? ⇒ Boolean Also known as: return_entry_percentage
#
entry_percentage?
#
1192 1193 1194 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1192 def entry_percentage? @internal_hash[:entry_percentage] end |
#exam_answer? ⇒ Boolean
#
exam_answer?
#
2933 2934 2935 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2933 def exam_answer? @internal_hash[:exam_answer] end |
#exam_question? ⇒ Boolean Also known as: current_exam_question?
#
exam_question?
#
3106 3107 3108 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3106 def exam_question? @internal_hash[:exam_question] end |
#exam_question_object? ⇒ Boolean
#
exam_question_object?
#
2884 2885 2886 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2884 def exam_question_object? @internal_hash[:exam_question_object] end |
#exam_topic_from_the_correct_entry? ⇒ Boolean Also known as: entry_ask_questions_from_this_topic?, current_exam_topic?, main_exam_topic?, exam_topic?, current_topic?, entry_exam_topic?, entry_ask_questions?, entry_exam_topic_as_string?
#
exam_topic_from_the_correct_entry?
This method must always return a string, hence the .to_s call.
#
2733 2734 2735 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2733 def exam_topic_from_the_correct_entry? entry_exam_topic_in_use?.text?.to_s.strip # This must always be a String. end |
#find_completion_for_the_entry_for_the_current_exam_topic ⇒ Object
#
find_completion_for_the_entry_for_the_current_exam_topic
#
325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 325 def find_completion_for_the_entry_for_the_current_exam_topic _ = entry_for_the_current_exam_topic? current_text = _.text? new_text = Studium.exam_topic_completion(current_text) { :be_quiet } # Expand it here. if new_text unless new_text == current_text set_exam_topic(new_text) end one_two_three # The old call was: do_update_the_entry_n_questions end end |
#handle_CSS ⇒ Object
#
handle_CSS (CSS tag)
#
508 509 510 511 512 513 514 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 508 def handle_CSS use_gtk_paradise_project_css_file append_project_css_file( Studium.project_base_directory?+'css/project.css' ) apply_the_CSS_rules end |
#handle_the_combo_box_available_exam_topics_on_changed_event ⇒ Object Also known as: do_handle_the_combobox_available_exam_topics_on_changed_event, sync_the_current_exam_topic_onto_the_exam_topic_entry
#
handle_the_combo_box_available_exam_topics_on_changed_event
#
2787 2788 2789 2790 2791 2792 2793 2794 2795 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2787 def handle_the_combo_box_available_exam_topics_on_changed_event clear_question_buffer # ===================================================================== # # Now we need to sync from the combo-box towards the current # exam-entry. # ===================================================================== # sync_combo_box_entry_onto_the_current_exam_entry one_two_three end |
#hash_dataset_of_all_lectures? ⇒ Boolean
#
hash_dataset_of_all_lectures?
#
1311 1312 1313 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1311 def hash_dataset_of_all_lectures? @internal_hash[:hash_dataset_of_all_lectures] end |
#instantiate_the_control_panel ⇒ Object
#
instantiate_the_control_panel
This only works for ruby-gtk3.
#
661 662 663 664 665 666 667 668 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 661 def instantiate_the_control_panel require 'studium/gui/gtk3/control_panel/control_panel.rb' # ======================================================================= # # === @control_panel # ======================================================================= # @control_panel = ::Studium::GUI::Gtk::ControlPanel.new(self) @control_panel.use_this_font(main_font?) end |
#label_n_questions_were_answered? ⇒ Boolean
#
label_n_questions_were_answered?
#
2386 2387 2388 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2386 def label_n_questions_were_answered? @label_n_questions_were_answered end |
#larger_font? ⇒ Boolean
#
larger_font?
#
416 417 418 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 416 def larger_font? LARGER_FONT end |
#let_the_scrolled_window_for_the_answer_parse_URLs(scrolled_window_for_the_answer = scrolled_window_for_the_answer? ) ⇒ Object
#
let_the_scrolled_window_for_the_answer_parse_URLs
#
352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 352 def let_the_scrolled_window_for_the_answer_parse_URLs( scrolled_window_for_the_answer = scrolled_window_for_the_answer? ) # ======================================================================= # # The scrolled-window for the answer allows the user to click on # hyperlinks - or at the least this is the idea. It does not # work 100% yet because we need to get the selection first # rather than select the whole entry. # ======================================================================= # scrolled_window_for_the_answer. { parse_for_URL(text_view_for_the_answer?.text?) } if scrolled_window_for_the_answer end |
#main_font? ⇒ Boolean
#
main_font?
#
448 449 450 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 448 def main_font? USE_THIS_FONT end |
#main_grid? ⇒ Boolean
#
main_grid?
#
2457 2458 2459 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2457 def main_grid? @internal_hash[:main_grid] end |
#may_we_reveal_the_answer_after_a_delay? ⇒ Boolean Also known as: may_we_reveal_the_answer?
#
may_we_reveal_the_answer_after_a_delay?
#
2950 2951 2952 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2950 def may_we_reveal_the_answer_after_a_delay? @internal_hash[:may_we_reveal_the_answer_after_a_delay] end |
#notify_the_user_that_all_questions_have_been_answered_in_this_topic(this_topic = current_exam_topic?, , this_widget = button_reveal_the_answer? ) ⇒ Object
#
notify_the_user_that_all_questions_have_been_answered_in_this_topic
#
1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1136 def notify_the_user_that_all_questions_have_been_answered_in_this_topic( this_topic = current_exam_topic?, = ) = create_bold_label( 'All questions have been answered for '+this_topic+'. \o/' ) ( , ).popup end |
#one_two_three(use_this_topic = exam_topic_from_the_correct_entry? ) ⇒ Object Also known as: update_n_questions, update_three_important_widgets
#
one_two_three (one_two_three tag)
#
2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2990 def one_two_three( use_this_topic = exam_topic_from_the_correct_entry? ) update_array_all_exam_questions if use_this_topic.empty? # ===================================================================== # # First protect against empty exam topics, with a helpful message to # the user. # ===================================================================== # do_popup_the_you_have_to_provide_an_exam_topic end unless ::Studium.is_this_exam_topic_available?(use_this_topic) # ===================================================================== # # Here we must notify the user that this exam-topic is not registered # aka not available. # ===================================================================== # ( # Nudge the user here. text( ' <b>⚠️</b> No exam-entry called <b>'+use_this_topic.to_s+ '</b> is available. <b>⚠️</b>' ), entry_for_the_exam_topic? ).popup return end local_file = Studium.local_exam_file(use_this_topic) if File.exist?(local_file) update_hash_dataset_of_all_lectures # ===================================================================== # # (1) Pass the current exam topic into a method that will return # an Array. # ===================================================================== # # array = Studium.return_an_array_for_this_exam_topic(use_this_topic) dataset = Studium.read_in_unanswered_exam_questions_from_this_file(local_file) sample = dataset.sample n_exam_questions_in_total = Studium.n_exam_questions_in_this_topic?(File.basename(local_file)) n_unanswered_exam_questions = dataset.size n_answered_exam_questions = n_exam_questions_in_total - n_unanswered_exam_questions # ===================================================================== # # (3) Next we must update various entries: # ===================================================================== # set_n_exam_questions_exist_in_total(n_exam_questions_in_total) set_n_unanswered_questions(n_unanswered_exam_questions) set_n_exam_questions_were_already_answered(n_answered_exam_questions) set_n_percentage( n_answered_exam_questions.to_f * 100.0 / n_exam_questions_in_total ) if entry_percentage?.text?.to_f == 100.0 # =================================================================== # # Handle the case where the exam-topic at hand has been answered # completely. # =================================================================== # = label( "All questions have been answered for the topic <b>"\ "#{current_exam_topic?}</b>.\n\n <b>Please choose another exam topic</b>.\n" ) ( , ).popup else # =================================================================== # # Next keep a backup-reference # =================================================================== # ::Studium.set_last_exam_question_line(sample) # =================================================================== # # Keep a reference to the exam-question object: # =================================================================== # @internal_hash[:exam_question_object] = Studium::Exams::ExamQuestion.new(sample) @internal_hash[:may_we_reveal_the_answer_after_a_delay] = true clear_the_exam_answer last_exam_question_asked = current_exam_question? set_exam_question( @internal_hash[:exam_question_object].question?, :remove_tags ) Thread.new { if may_we_reveal_the_answer_after_a_delay? do_sleep_now(:use_the_correct_entry_for_the_delay) unless last_exam_question_asked == current_exam_question? reveal_the_exam_answer(:but_only_if_we_may) end end } end else e "No file exists at `#{local_file}`." end end |
#original_return_available_exam_topics ⇒ Object
#
original_return_available_exam_topics
This variant is probably no longer necessary, but it is retained for now.
#
628 629 630 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 628 def original_return_available_exam_topics Studium.return_available_exam_topics end |
#padding? ⇒ Boolean
#
padding?
#
310 311 312 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 310 def padding? 8 end |
#parse_for_URL(i = text_view_for_the_answer?.buffer.text) ⇒ Object
#
parse_for_URL
This method can be used to return all URLs in a given text.
#
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1031 def parse_for_URL( i = text_view_for_the_answer?.buffer.text ) array = ::Studium.return_all_URLs_from(i) if array.size > 0 first_entry = array.first # ===================================================================== # # We first have to assign it to the GUI part. Note that the "browser" # is part of the control-panel since the rewrite in January 2021. # ===================================================================== # if respond_to?(:control_panel?) and control_panel?.respond_to?(:browser?) control_panel?.browser?.assign_this_text(first_entry) end ::Studium.open_this_remote_url(first_entry) end end |
#parse_the_commandline_arguments ⇒ Object
#
parse_the_commandline_arguments
#
1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1659 def parse_the_commandline_arguments _ = commandline_arguments? unless _.empty? new_topic = _.first # ===================================================================== # # === Handle numbers given as input here: # # Example: # # ruby misc.rb 5 # # ===================================================================== # if new_topic =~ /^\d+$/ # A number - and only a number - was given to this class here. new_topic = new_topic.to_i new_topic = Studium.exam_topic_number?(new_topic).to_s end new_topic = Studium.find_corresponding_exam_topic(new_topic) entry_for_the_current_exam_topic?.set_text(new_topic) # ===================================================================== # # Next, we must also update the combo-box. # This is currently not enabled: # _.find_and_try_to_select_this_entry(new_topic) # simply_assign_this_as_the_new_exam_topic_onto_the_primary_combobox(new_topic) # ===================================================================== # one_two_three end end |
#populate_the_main_grid(grid = main_grid? ) ⇒ Object
#
populate_the_main_grid (grid tag, populate tag)
In order to populate the grid, all widgets have to be designated.
#
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2007 def populate_the_main_grid( grid = main_grid? ) reset_the_grid_counter # Just to be safe. ::Gtk::Grid.full_width = 3 # 3 entries per row. grid.left( return_frame_containing_the_label_exam_topic ) grid.middle( entry_exam_topic_in_use? ) mini_hbox = create_hbox mini_hbox.maximal(combobox_available_exam_topics?, 2) mini_hbox.minimal(return_event_box_with_face_glasses, 2) # ======================================================================= # # The event-box comes next to the box with face-glasses: # ======================================================================= # mini_hbox.minimal(return_eventbox_with_an_image_to_exit_the_application, 2) grid.right(mini_hbox) # One row has been completed here. grid.full_line(scrolled_window1?) grid.full_line(scrolled_window_containing_the_textarea2?) # ========================================================================= # # Show a little helpful text how to use the textview3: # ========================================================================= # grid.full_line(return_hbox_containing_two_icons_and_instructions_what_to_do_with_the_free_form_textarea) # ======================================================================= # # Next add the free-form widget: # ======================================================================= # grid.full_line(return_scrolled_window3) # ======================================================================= # # Next synchronize the design layout of the three scrolled windows: # ======================================================================= # [ scrolled_window1?, scrolled_window2?, scrolled_window3? ].each {|| .pad8px } # ======================================================================= # # Next comes the middle-part of the GUI (middle tag) # ======================================================================= # # ======================================================================= # # === n questions in total # # This will show the "n questions in total" text. # ======================================================================= # text = selectable_text(N_EXAM_QUESTIONS_IN_TOTAL) text.set_font(smaller_font?) text.pad6px mini_hbox = create_hbox(text, entry_n_total_exam_questions?) grid.left(mini_hbox) # ======================================================================= # # === n unanswered questions # ======================================================================= # text = selectable_text(N_UNANSWERED_EXAM_QUESTIONS) text.set_font(smaller_font?) text.pad6px mini_hbox = create_hbox(text, entry_n_unanswered_questions?) grid.middle(mini_hbox) # ======================================================================= # # === n answered exam questions # # This is the text that goes along the lines of # "n answered exam questions". # ======================================================================= # text = selectable_text(N_ANSWERED_EXAM_QUESTIONS) text.set_font(smaller_font?) text.pad6px text.royalblue text.make_bold mini_hbox = create_hbox(text, entry_n_answered_exam_questions?) grid.right(mini_hbox) # ======================================================================= # # === The entry "percentage solved" comes next # ======================================================================= # text = selectable_text(N_PERCENT_SOLVED) text.set_font(smaller_font?) text.pad6px mini_hbox = create_hbox mini_hbox.minimal(text, 1) mini_hbox.maximal(entry_percentage?, 1) grid.left(mini_hbox) # ======================================================================= # # === sleep n seconds solved # # Next we add the delay-n-seconds entry. # ======================================================================= # text = selectable_text(SLEEP_N_SECONDS) text.set_font(smaller_font?) text.pad6px mini_hbox = create_hbox mini_hbox.minimal(text, 1) mini_hbox.maximal(entry_for_sleeping_n_seconds?, 1) grid.middle(mini_hbox) grid.right(checkbox?) # ======================================================================= # # Add three buttons next: # ======================================================================= # grid.left() grid.middle() grid.right() # ======================================================================= # # And two more buttons: # ======================================================================= # grid.left() mini_hbox.(true) mini_hbox = create_hbox mini_hbox.minimal(, 2) mini_hbox.minimal(return_event_box_for_asking_a_random_exam_topic, 2) mini_hbox.minimal(, 2) mini_hbox.minimal(, 2) # ======================================================================= # # We could also add smiley-emojis next: # # mini_hbox.minimal(@a_thinking_smiley_emoji, 2) # mini_hbox.minimal(@thumbs_up_emoji, 2) # # ======================================================================= # grid.two_width(mini_hbox) grid.new_line # ======================================================================= # # Next add the label that the ^^^ button can update: # ======================================================================= # grid.left() grid.two_width(label_n_questions_were_answered?) grid.new_line mini_hbox = create_hbox return grid end |
#populate_the_notebook_tab ⇒ Object
#
populate_the_notebook_tab
#
2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2546 def populate_the_notebook_tab # ======================================================================= # # We could display a Curriculum in a notebook-tab. Unfortunately, in # 2021, this is a bit wide, and makes the whole notebook appear too # large, so it was disabled again, until we improve on it. We probably # have to decrease its size from the get go, and manage it at all # times via scrolled-widgets. # # The old code is shown next: # # label4 = modify_bold_label('Curriculum Viewer', @internal_hash[:colour_to_use_for_the_notebook_labels]) # @notebook_tab.add_tab(::Studium::GUI::Gtk::CurriculumViewer.new, label4) # # ======================================================================= # show_ten_aliases = show_ten_aliases? # ======================================================================= # # === Add the first tab, containing the "Exam Trainer" widget next # # This will be contained in @first_vbox, which in turn contains # the @horizontal_pane variable. # ======================================================================= # @notebook_tab.append_page( main_grid?, modify_bold_label('Exam trainer', @internal_hash[:colour_to_use_for_the_notebook_labels]) ) if use_the_internal_editor? # ===================================================================== # # Append the editor in this event: # ===================================================================== # @notebook_tab.append_page(@editor, bold_text('editor')) end if Object.const_defined?(:Roebe) and show_ten_aliases # ===================================================================== # # Designate the parent widget next: # ===================================================================== # show_ten_aliases.(self) # ===================================================================== # # And append the show-ten-aliases widget next: # ===================================================================== # @notebook_tab.append_page( show_ten_aliases, modify_bold_label( 'Current top-ten exams', @internal_hash[:colour_to_use_for_the_notebook_labels] ) ) end @notebook_tab.the_first_tab_is_active # ======================================================================= # # === Add the tab that includes the Control Panel # ======================================================================= # # label2 = modify_bold_label('Control Panel', @internal_hash[:colour_to_use_for_the_notebook_labels]) # @notebook_tab.append_page( # @control_panel, # label2 # ) end |
#popup_pick_a_new_font ⇒ Object
#
popup_pick_a_new_font
#
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 793 def popup_pick_a_new_font _ = create_hbox _.minimal(text(' → ')) = ('Choose font here') .set_size_request(800, 660) .bblack2 .disallow_resizing _.minimal() # Add the file-chooser widget here. .on_click { result = gtk_font_chooser_dialog set_use_this_font(::Gtk.main_file?) result.destroy } # ======================================================================= # # Next create the popup for the font-choosing. # ======================================================================= # = ( text_view_for_the_question?, '', _ ) # popup_widget.no_arrow # ← This will only work on gtk4, I think. .popup end |
#question_is? ⇒ Boolean
#
question_is?
#
1931 1932 1933 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1931 def question_is? @internal_hash[:exam_question_object].question? end |
#reset ⇒ Object
#
reset (reset tag)
#
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 202 def reset super() if respond_to?(:super) reset_the_internal_variables reset_the_base_module # This must come after reset_the_internal_variables(). reset_the_shared_module infer_the_namespace reset_the_shared_variables Studium.set_runmode :gui # Make it known that we use the gui-runmode in this case. # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, namespace?] # ======================================================================= # # === Set the title; this must come after we delegate to the # @configuration object # ======================================================================= # set_title( return_the_title_from_the_config_file(true, @configuration) ) # ======================================================================= # # === Set the title, width, height and the font in use. # ======================================================================= # title_width_height_font(title?, WIDTH, HEIGHT, USE_THIS_FONT) handle_CSS if use_gtk3? enable_all_key_combinations # This should come after CSS was handled. infer_the_size_automatically # ======================================================================= # # === @delay_to_use # ======================================================================= # set_delay_to_use(DEFAULT_DELAY) # ======================================================================= # # === @internal_hash[:may_we_reveal_the_answer] # ======================================================================= # @internal_hash[:may_we_reveal_the_answer] = true # ======================================================================= # # === :prefer_emoji_or_images # # This variable can have two different states: # # :emoji # :images # # If :emoji is active then we will use emojis to enhance the # user interface. If :images is active then we will use different # images from the main icon theme in use instead. # # The reason why this was added in May 2021 was because the host # system may not support this or that emoji. If the emoji is # not supported then the user will see only garbage, which isn't # great. Thus, the default is now for :images since as of May # 2021, but with the intended goal to retain support for emojis # as well, should a user ever want to change this. # ======================================================================= # @internal_hash[:prefer_emoji_or_images] = :images # ======================================================================= # # === :use_this_editor # # The value of this variable may be :bluefish or :internal usually. # ======================================================================= # @internal_hash[:use_this_editor] = :bluefish # :internal # ======================================================================= # # === :show_ten_aliases # # This is only in use if the roebe-gem is available. Many users of this # class won't need it though. # ======================================================================= # @internal_hash[:show_ten_aliases] = nil # ======================================================================= # # === @internal_hash[:colour_to_use_for_the_notebook_labels] # ======================================================================= # @internal_hash[:colour_to_use_for_the_notebook_labels] = 'darkblue' # ======================================================================= # # === @internal_hash[:smaller_font] # ======================================================================= # @internal_hash[:smaller_font] = SMALLER_FONT upon_delete_event_quit_the_application end |
#reset_the_shared_module ⇒ Object
#
reset_the_shared_module
#
757 758 759 760 761 762 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 757 def reset_the_shared_module # ======================================================================= # # === :array_all_exam_questions # ======================================================================= # @internal_hash[:array_all_exam_questions] = [] end |
#reset_the_shared_variables ⇒ Object
#
reset_the_shared_variables
#
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 284 def reset_the_shared_variables # ======================================================================= # # === :hash_dataset_of_all_lectures # # This is the Hash that looks like this: # # :biopolymers => {:n_total_questions=>4, :n_questions_answered=>0, :percentage_of_questions_answered=>0.0}, # :biophysik => {:n_total_questions=>28, :n_questions_answered=>0, :percentage_of_questions_answered=>0.0}, # # In other words: it will keep track of how many exam questions and # exam answers are in that Hash. # ======================================================================= # @internal_hash[:hash_dataset_of_all_lectures] = Studium::Statistics::ReportHowManyExamQuestionsWereAnswered.new { :be_quiet }.internal_dataset end |
#resize_the_notebook_tab_towards_the_primary_width_and_height ⇒ Object
#
resize_the_notebook_tab_towards_the_primary_width_and_height
#
2630 2631 2632 2633 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2630 def resize_the_notebook_tab_towards_the_primary_width_and_height _ = @notebook_tab _.set_size_request(width?, height?) end |
#return_button_ask_the_exam_question(use_emoji = false) ⇒ Object Also known as:
#
return_button_ask_the_exam_question (ask tag)
#
3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3128 def ( use_emoji = false ) # ======================================================================= # # Add the ask-exam-question button next. Note that its click-event # is handled separately via a method call. # # The question mark emoji is Unicode Character "❓" (U+2753). # ======================================================================= # if use_emoji? _ = (mnemonic: 'Ask an exam _Question ❓') else _ = (mnemonic: 'Ask an exam _Question') end _.clear_background _.width_height(780, 38) _.pad2px _.hint = 'Click on this button to ask an exam-question. '\ '(Or, use alt+q as shortcut)' _.on_clicked { # ===================================================================== # # Determine what happens next when the ask-question button is clicked. # ===================================================================== # } return _ end |
#return_button_open_exam_topic_file ⇒ Object
#
return_button_open_exam_topic_file
This button should be next to the event box that will ask a random exam topic.
#
2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2337 def # ======================================================================= # # This button will have the symbol for :open_file, an emoji - if # emojis are used. Otherwise an image will be used instead. # ======================================================================= # if use_emoji? _ = (return_emoji(:open_box)) else _ = (image_open_file) end _.no_relief _.on_hover_lightblue _.hint = 'Click on this button to <b>open the current exam-topic file</b>.' _.on_clicked { do_open_the_current_exam_topic_file } return _ end |
#return_button_solve_the_question ⇒ Object
#
return_button_solve_the_question
The old String was:
'_Solve the exam question'
#
2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2643 def _ = ('😁️ Mark the question as _solved ✓', self, :use_a_mnemonic) { :button_solve_the_exam_question_was_clicked } # ======================================================================= # # .set_size_request() is not necessary as we use a separate method # that controls the size of the widget at hand. # ======================================================================= # _.hint = 'Use this button to <span weight="bold" foreground="lightgreen">mark '\ 'the question as solved</span> - that is, it is now '\ '<b>correctly answered</b>).' # button_solve_the_question.set_size_request(78, 30) return _ end |
#return_checkbox_shall_we_reveal_the_answer ⇒ Object Also known as: checkbox?, checkbox_shall_we_reveal_the_answer?
#
return_checkbox_shall_we_reveal_the_answer
This will only return the checkbox; creation must happen before this method is called.
#
2438 2439 2440 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2438 def return_checkbox_shall_we_reveal_the_answer @internal_hash[:checkbox_shall_we_reveal_the_answer] end |
#return_event_box_for_asking_a_random_exam_topic ⇒ Object
#
return_event_box_for_asking_a_random_exam_topic
This event-box can be used for asking a question from a random exam topic.
#
985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 985 def return_event_box_for_asking_a_random_exam_topic # ======================================================================= # # Next create the actual event box: # ======================================================================= # event_box_for_image_view_refresh_symbolic_symbolic = create_event_box( image_view_refresh_symbolic_symbolic ) # ======================================================================= # # Provide useful hints how to use this event-box: # ======================================================================= # event_box_for_image_view_refresh_symbolic_symbolic.hint = 'Click on this icon to <span weight="bold" foreground="lightgreen">set a random exam topic</span>, '\ "and then ask an exam question from this topic.\n\n"\ 'Note that since as of <b>August 2022</b> this will ignore '\ 'exam topics that were already solved.' # ======================================================================= # # Let the event-box respond to an on-click event. # ======================================================================= # event_box_for_image_view_refresh_symbolic_symbolic.on_clicked { do_assign_a_new_exam_topic } return event_box_for_image_view_refresh_symbolic_symbolic end |
#return_event_box_with_face_glasses ⇒ Object
#
return_event_box_with_face_glasses
This one belongs close to the top of the widget.
#
937 938 939 940 941 942 943 944 945 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 937 def return_event_box_with_face_glasses event_box = create_event_box image = create_icon('face-glasses') event_box.add(image) event_box.on_clicked { do_popup_the_array_of_all_exam_questions } return event_box end |
#return_eventbox_with_an_image_to_exit_the_application ⇒ Object
#
return_eventbox_with_an_image_to_exit_the_application
This method bundles together a quit-the-application functionality.
#
1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1979 def return_eventbox_with_an_image_to_exit_the_application application_exit_image = return_this_image_based_on_the_default_icon_theme( 'system-log-out-symbolic.symbolic' ) # Or: :application_exit _ = create_eventbox(application_exit_image) _.hint = 'Click on this image to exit the program.' _.on_clicked { exit_application } return _ end |
#return_frame_containing_the_label_exam_topic ⇒ Object
#
return_frame_containing_the_label_exam_topic
#
1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1605 def return_frame_containing_the_label_exam_topic # ======================================================================= # # Create the exam-topic label next, showing a watermelon emoji on the # left-hand side. The watermelon emoji used to be 🍉️; but it was # replaced with the electric light bulb emoji in January 2021, which # is 💡️. Unfortunately this does not work on every system, so it # was decided to replace this with an image that is determined by # the icon theme at hand. # ======================================================================= # label_exam_topic = bold_text(' Exam topic ') label_emoji = right_arrow_emoji label_emoji.set_size_request(22, 22) label_emoji.align_right event_box_for_the_label_emoji = create_event_box(label_emoji) event_box_for_the_label_emoji.on_clicked { do_jump_into_the_entry_containing_the_current_exam_topic } tiny_hbox = create_hbox tiny_hbox.minimal(label_exam_topic) tiny_hbox.maximal(event_box_for_the_label_emoji) tiny_hbox.minimal(text(' ')) # Just a "spacer". frame_containing_the_label_exam_topic = create_frame(tiny_hbox) frame_containing_the_label_exam_topic.modify_background(:normal, :oldlace) frame_containing_the_label_exam_topic.bblack1 # frame_containing_the_label_exam_topic.set_font(smaller_font?) label_exam_topic.hint = 'Denote <b>the current exam </b> topic '\ 'to the <b>right</b> of this text.' return frame_containing_the_label_exam_topic end |
#return_hbox_containing_two_icons_and_instructions_what_to_do_with_the_free_form_textarea ⇒ Object
#
return_hbox_containing_two_icons_and_instructions_what_to_do_with_the_free_form_textarea
This widget returned by this method here, should come before the free-form widget is added.
#
1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1202 def return_hbox_containing_two_icons_and_instructions_what_to_do_with_the_free_form_textarea hbox_with_two_icons = create_hbox first_eventbox = create_event_box(image_accessories_text_editor) first_eventbox.on_clicked { do_clear_the_free_form_textarea } hbox_with_two_icons.minimal(first_eventbox, 2) text = text( 'Below this text you can input your assumed '\ 'answer to the exam question at hand.' ) text.left_align text.make_selectable text.set_font(:hack_18) hbox_with_two_icons.maximal(text, 4) event_box_for_image_accessories_text_editor = create_event_box(image_accessories_text_editor) event_box_for_image_accessories_text_editor.hint = 'Click here to empty the free-form textarea below this icon.' event_box_for_image_accessories_text_editor.on_clicked { do_clear_the_free_form_textarea } hbox_with_two_icons.minimal(event_box_for_image_accessories_text_editor, 2) return hbox_with_two_icons end |
#return_n_answers_from_the_currently_selected_topic(i = current_exam_topic_as_a_string? ) ⇒ Object
#
return_n_answers_from_the_currently_selected_topic
#
2359 2360 2361 2362 2363 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2359 def return_n_answers_from_the_currently_selected_topic( i = current_exam_topic_as_a_string? ) ::Studium.n_answers_available_in_this_topic(i) end |
#return_n_questions_from_the_currently_selected_topic(i = current_exam_topic? ) ⇒ Object
#
return_n_questions_from_the_currently_selected_topic
This method will return how many exam questions exist in the selected exam topic.
This method is no longer that important as of December 2023.
#
1474 1475 1476 1477 1478 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1474 def return_n_questions_from_the_currently_selected_topic( i = current_exam_topic? ) ::Studium.n_questions_available_in_this_topic(i) end |
#return_string_how_many_exam_questions_are_already_answered ⇒ Object
#
return_string_how_many_exam_questions_are_already_answered
#
1924 1925 1926 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1924 def return_string_how_many_exam_questions_are_already_answered ::Studium.return_string_how_many_exam_questions_are_already_answered end |
#return_wikipedia_widget ⇒ Object
#
return_wikipedia_widget (wikipedia tag)
This method will return the widget that, upon user-mouse-button-click event, will open the corresponding wikipedia entry. This defaults to the german wikipedia entry right now; if others want to change the default then this could be changed easily.
#
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 383 def begin require 'roebe/classes/wikipedia.rb' rescue LoadError; end hbox = create_hbox wikipedia_entry = entry wikipedia_entry.clear_background wikipedia_entry.bblack1 wikipedia_entry.center wikipedia_entry.pad3px wikipedia_entry.lightgreen_background wikipedia_entry.width_height(650, 30) wikipedia_entry.hint = 'Click the "<b>enter</b>" key to open the assorted keyword in the '\ 'german-wikipedia. Simply replace <b>de</b> with <b>en</b> in '\ 'the URL to have the english wikipedia.' wikipedia_entry.on_enter { if Object.const_defined?(:Roebe) and Roebe.const_defined?(:Wikipedia) Roebe::Wikipedia.new(wikipedia_entry.text?) # Instantiate a new wrapper. else e 'You need to install the '+steelblue('roebe')+ ' gem for this functionality.' end } hbox.minimal(wikipedia_entry, 2) return hbox end |
#reveal_the_exam_answer(may_we_reveal_the_exam_answer = may_we_reveal_the_answer_after_a_delay? ) ⇒ Object
#
reveal_the_exam_answer
#
3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3085 def reveal_the_exam_answer( may_we_reveal_the_exam_answer = may_we_reveal_the_answer_after_a_delay? ) case may_we_reveal_the_exam_answer # ========================================================================= # # === true # ========================================================================= # when true set_exam_answer # ========================================================================= # # === :but_only_if_we_may # ========================================================================= # when :but_only_if_we_may may_we_reveal_the_exam_answer = may_we_reveal_the_answer_after_a_delay? set_exam_answer if may_we_reveal_the_exam_answer end end |
#rinstall2 ⇒ Object Also known as: r2
#
rinstall2
#
438 439 440 441 442 443 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 438 def rinstall2 Roebe.rinstall2( use_this_directory: Studium.ruby_src_dir_at_home?+ 'studium/' ) end |
#run ⇒ Object
#
run (run tag)
#
3245 3246 3247 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3245 def run run_super end |
#sanitize_the_answer(i, apply_these_filters = []) ⇒ Object Also known as: sanitize_this_answer
#
sanitize_the_answer
This is called from within set_exam_answer().
#
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 562 def sanitize_the_answer( i, apply_these_filters = [] ) i = i.to_s if apply_these_filters.is_a? Symbol apply_these_filters = [apply_these_filters] end if apply_these_filters and !apply_these_filters.empty? apply_these_filters.each {|this_filter| case this_filter # =================================================================== # # === :remove_tags # =================================================================== # when :remove_tags, :filter_away_tags i = Studium.(i) end } end if i.include? 'URL: ' i.gsub!(/URL: /,"\nURL: ") end if i.include?('(2)') i.gsub!(/\(1\)/, "\n (1)") i.gsub!(/\(2\)/, "\n (2)") i.gsub!(/\(3\)/, "\n (3)") i.gsub!(/\(4\)/, "\n (4)") i.gsub!(/\(5\)/, "\n (5)") i.gsub!(/\(6\)/, "\n (6)") i.gsub!(/\(7\)/, "\n (7)") i.gsub!(/\(8\)/, "\n (8)") end i = Studium.remove_html(i) i = word_wrap(i, threshold: WORD_WRAP_AT_N_CHARACTERS) return i.rstrip end |
#save_the_buffer ⇒ Object
#
save_the_buffer
#
847 848 849 850 851 852 853 854 855 856 857 858 859 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 847 def save_the_buffer editor?.save_the_buffer # ======================================================================= # # Check whether we use the internal editor or not. # ======================================================================= # if use_the_internal_editor? and is_on_roebe? # ===================================================================== # # In this case jump to the first tab. # ===================================================================== # @notebook_tab.focus_on_this_tab(0) rinstall2 end end |
#scrolled_window1? ⇒ Boolean
#
scrolled_window1?
#
1335 1336 1337 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1335 def scrolled_window1? @internal_hash[:scrolled_window_containing_the_textarea1] end |
#scrolled_window2? ⇒ Boolean Also known as: return_scrolled_window_containing_the_text_view_for_the_answer, scrolled_window_for_the_answer?, scrolled_window_containing_the_textarea2?
#
scrolled_window2?
#
369 370 371 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 369 def scrolled_window2? @scrolled_window_containing_the_textarea2 end |
#scrolled_window3? ⇒ Boolean Also known as: return_widget_for_the_freeform_textview, scrolled_window_containing_the_textarea3, return_scrolled_window3, return_scrolled_window_containing_the_textarea3
#
scrolled_window3?
#
1116 1117 1118 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1116 def scrolled_window3? @scrolled_window3 end |
#select_not_yet_completed_exam_topics(i) ⇒ Object
#
select_not_yet_completed_exam_topics
#
1914 1915 1916 1917 1918 1919 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1914 def select_not_yet_completed_exam_topics(i) if i and i.is_a?(Array) return ::Studium.reject_already_completed_exam_topics(i, hash_dataset_of_all_lectures?) end return i # else return the original input unmodified. end |
#set_delay_to_use(i = DEFAULT_DELAY) ⇒ Object
#
set_delay_to_use
#
748 749 750 751 752 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 748 def set_delay_to_use( i = DEFAULT_DELAY ) @internal_hash[:delay_to_use] = i.to_f end |
#set_editor_buffer(i) ⇒ Object
#
set_editor_buffer
#
501 502 503 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 501 def set_editor_buffer(i) editor?.set_buffer(i.to_s) end |
#set_exam_answer(i = answer_is?, , apply_these_filters = [:filter_away_tags]) ⇒ Object Also known as: set_answer, reveal_the_answer_to_the_exam_question
#
set_exam_answer (answer tag)
#
2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2914 def set_exam_answer( i = answer_is?, apply_these_filters = [:filter_away_tags] ) i = sanitize_the_answer(i.to_s, apply_these_filters) i = ::Gtk.replace_all_URL_entries_in_this_string(i) i.lstrip! i.sub!(/A: /,'') if i.start_with? 'A: ' # ================================================================= # # Replace all "(2) foo" entries with "(2) foo\n" entries. # ================================================================= # i = ::Studium.add_newlines_to_numbered_exam_question(i) @internal_hash[:exam_answer] = i textview2?.set_text(i) end |
#set_exam_question(i = exam_question_object?.question?, apply_these_filters = [:remove_tags]) ⇒ Object Also known as: set_question
#
set_exam_question
The second argument can be a filter. For instance, if the Symbol :remove_tags is passed, then all HTML tags will be removed from the given input at hand. This is actually the default behaviour.
#
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1412 def set_exam_question( i = exam_question_object?.question?, apply_these_filters = [:remove_tags] ) i = i.to_s.dup i[0,2] = '' if i.start_with?('- ') # We don't ever want leading '-' here. if apply_these_filters.is_a? Symbol apply_these_filters = [apply_these_filters] end # ======================================================================= # # Replace all URL entries with <a href> entries next: # ======================================================================= # if i i = ::Gtk.replace_all_URL_entries_in_this_string(i) end # ======================================================================= # # The following line may have to be re-evaluated again in the future - # in the past, in 2021, this had a bug and things crashed, but this # may no longer be the case - let's see, eventually. # # editor?.update_the_main_buffer(dataset) # # ======================================================================= # if apply_these_filters and !apply_these_filters.empty? apply_these_filters.each {|this_filter| case this_filter # =================================================================== # # === :remove_tags # =================================================================== # when :remove_tags, :no_tags, :default i = Studium.(i) end } end @internal_hash[:exam_question] = i textview1?.set_text(i) # This is the widget for the exam-questions. end |
#set_exam_topic(i = :default) ⇒ Object Also known as: set_current_exam_topic
#
set_exam_topic
This will set towards the entry that holds the current exam topic.
#
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1800 def set_exam_topic( i = :default ) case i # ===================================================================== # # === :default # ===================================================================== # when :default i = default_exam_topic?.to_s end i = i.to_s # .downcase # Studium.expand_exam_topic(use_this_topic.to_s) if i and !i.empty? entry_for_the_current_exam_topic?.set_text(i) end end |
#set_n_exam_questions_are_unanswered(i) ⇒ Object Also known as: set_n_unanswered_questions
#
set_n_exam_questions_are_unanswered
#
1907 1908 1909 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1907 def set_n_exam_questions_are_unanswered(i) entry_containing_n_unanswered_questions?.set_text(i.to_s) end |
#set_n_exam_questions_exist_in_total(i) ⇒ Object
#
set_n_exam_questions_exist_in_total
This method exists to set the value of the proper entry, containing how many exam-questions are still unanswered.
#
2396 2397 2398 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2396 def set_n_exam_questions_exist_in_total(i) entry_n_total_exam_questions?.set_text(i.to_s) end |
#set_n_exam_questions_were_already_answered(i) ⇒ Object
#
set_n_exam_questions_were_already_answered
#
2269 2270 2271 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2269 def set_n_exam_questions_were_already_answered(i) entry_n_answered_exam_questions?.set_text(i.to_s) end |
#set_n_percentage_of_questions_answered(i) ⇒ Object Also known as: set_n_percentage, update_the_percentage_entry, do_update_this_entry_with_that_exam_topic_for_its_percentage_value
#
set_n_percentage_of_questions_answered
An alternative would be:
percentage_value = Studium.n_percent_questions_answered_of_this_topic?(
use_this_exam_topic.downcase
)
#
2776 2777 2778 2779 2780 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2776 def set_n_percentage_of_questions_answered(i) percentage_value = -1 if percentage_value == false # Weak "safeguard". i = i.to_f.round(1) entry_percentage?.set_text("#{i}%") # Sync it onto the proper entry. end |
#set_save_into_this_local_file(i) ⇒ Object
#
set_save_into_this_local_file
This method will only be in use if the internal editor is used.
#
682 683 684 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 682 def set_save_into_this_local_file(i) editor?.set_save_into_this_local_file(i.to_s) end |
#shall_we_create_the_gtk_editor? ⇒ Boolean
#
shall_we_create_the_gtk_editor?
#
2368 2369 2370 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2368 def shall_we_create_the_gtk_editor? @internal_hash[:use_this_editor] == :internal end |
#show_ten_aliases? ⇒ Boolean
#
show_ten_aliases?
#
3200 3201 3202 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3200 def show_ten_aliases? @internal_hash[:show_ten_aliases] end |
#simply_assign_this_as_the_new_exam_topic_onto_the_primary_combobox(i) ⇒ Object
#
simply_assign_this_as_the_new_exam_topic_onto_the_primary_combobox
This method does not work currently.
#
2448 2449 2450 2451 2452 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2448 def simply_assign_this_as_the_new_exam_topic_onto_the_primary_combobox( i ) combobox_available_exam_topics?.append_text(i.to_s) end |
#smallest_font? ⇒ Boolean
#
smallest_font?
#
619 620 621 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 619 def smallest_font? SMALLEST_FONT end |
#sync_combo_box_entry_onto_the_current_exam_entry(i = combo_box?.entry?) ⇒ Object
#
sync_combo_box_entry_onto_the_current_exam_entry
#
2747 2748 2749 2750 2751 2752 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2747 def sync_combo_box_entry_onto_the_current_exam_entry( i = combo_box?.entry? ) _ = ::Studium.find_corresponding_exam_title(i) set_current_exam_topic(_) end |
#sync_entry_holding_all_exam_topics_onto_the_combo_box(value = Studium.find_corresponding_exam_topic( entry_for_the_current_exam_topic?.text? )) ⇒ Object Also known as: sync_entry_holding_all_exam_topics_onto_the_main_combo_box
#
sync_entry_holding_all_exam_topics_onto_the_combo_box
#
963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 963 def sync_entry_holding_all_exam_topics_onto_the_combo_box( value = Studium.find_corresponding_exam_topic( entry_for_the_current_exam_topic?.text? ) ) # ======================================================================= # # Next find the correct index: # ======================================================================= # # index = array.find_index {|entry| entry.delete('_').include?(value) } # if index # combo_box_available_exam_topics?.set_active(index) # else # e 'The index was not found. Input was '+steelblue(value)+'.' # end end |
#textview1? ⇒ Boolean Also known as: widget_for_the_questions?, text_view_for_the_question?, return_widget_for_the_questions, return_text_view_for_the_question, return_scrolled_window_for_the_text_view_for_the_question, text_view_containing_the_current_question?, text_buffer_for_the_question?, textarea1?, question_buffer, question_buffer?
#
textview1?
#
1274 1275 1276 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 1274 def textview1? @internal_hash[:textview1] end |
#textview2? ⇒ Boolean Also known as: return_widget_for_the_answers, text_view_for_the_answer, text_view_for_the_answer?, textarea2?, answer_buffer?, answer_buffer
#
textview2?
#
894 895 896 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 894 def textview2? @internal_hash[:textview2] end |
#textview3? ⇒ Boolean Also known as: text_view_for_the_freeform_input?, text_view_for_the_freeform_input, free_form_textarea?, return_textarea_number_three
#
textview3?
#
821 822 823 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 821 def textview3? @internal_hash[:textview3] end |
#the_first_notebook_tab_is_active ⇒ Object
#
the_first_notebook_tab_is_active
#
2539 2540 2541 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2539 def the_first_notebook_tab_is_active @notebook_tab.the_first_notebook_tab_is_active end |
#top_textbuffer? ⇒ Boolean
#
top_textbuffer?
#
612 613 614 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 612 def top_textbuffer? text_view_for_the_question?.buffer end |
#update_array_all_exam_questions ⇒ Object
#
update_array_all_exam_questions
#
2672 2673 2674 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2672 def update_array_all_exam_questions @internal_hash[:array_all_exam_questions] = [] end |
#update_hash_dataset_of_all_lectures ⇒ Object
#
update_hash_dataset_of_all_lectures
#
317 318 319 320 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 317 def update_hash_dataset_of_all_lectures @internal_hash[:hash_dataset_of_all_lectures] = Studium::Statistics::ReportHowManyExamQuestionsWereAnswered.new { :be_quiet }.internal_dataset end |
#update_n_answered(i = :infer) ⇒ Object Also known as: do_update_the_entry_n_answered
#
update_n_answered
#
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 916 def update_n_answered( i = :infer ) case i # ======================================================================= # # === :infer # ======================================================================= # when :infer current_exam_topic = current_exam_topic_from_the_entry? hash = hash_dataset_of_all_lectures? # Always update it here in this case. _ = hash[current_exam_topic.tr(' ','_').to_sym] i = _[:n_questions_answered] end set_n_exam_questions_were_already_answered(i) end |
#update_the_label_n_questions_were_answered(i = @label_n_questions_were_answered) ⇒ Object Also known as: update_the_label_containing_the_last_exam_question
#
update_the_label_n_questions_were_answered
#
2424 2425 2426 2427 2428 2429 2430 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 2424 def update_the_label_n_questions_were_answered( i = @label_n_questions_were_answered ) i.set_text( return_string_how_many_exam_questions_are_already_answered ) end |
#use_emoji? ⇒ Boolean
#
use_emoji?
#
673 674 675 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 673 def use_emoji? @internal_hash[:prefer_emoji_or_images] == :emoji end |
#use_the_internal_editor? ⇒ Boolean
#
use_the_internal_editor?
#
476 477 478 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 476 def use_the_internal_editor? @internal_hash[:use_this_editor] == :internal end |
#use_this_editor? ⇒ Boolean
#
use_this_editor?
#
483 484 485 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 483 def use_this_editor? @internal_hash[:use_this_editor] end |
#we_may_not_reveal_the_exam_answer_anymore ⇒ Object
#
we_may_not_reveal_the_exam_answer_anymore
#
3174 3175 3176 3177 3178 3179 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3174 def we_may_not_reveal_the_exam_answer_anymore # ======================================================================= # # === @internal_hash[:may_we_reveal_the_answer_after_a_delay] # ======================================================================= # @internal_hash[:may_we_reveal_the_answer_after_a_delay] = false end |
#we_may_reveal_the_exam_answer ⇒ Object
#
we_may_reveal_the_exam_answer
#
3160 3161 3162 |
# File 'lib/studium/gui/universal_widgets/exam_trainer/exam_trainer.rb', line 3160 def we_may_reveal_the_exam_answer @internal_hash[:may_we_reveal_the_answer_after_a_delay] = true end |