Class: Studium::GUI::Gtk::AskExamQuestion
- Inherits:
-
Gtk::Box
- Object
- Gtk::Box
- Studium::GUI::Gtk::AskExamQuestion
- Includes:
- AskExamQuestionModule
- Defined in:
- lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb
Overview
Studium::GUI::Gtk::AskExamQuestion
Constant Summary collapse
- HASH_DESIGNATED_KEY_COMBINATIONS =
#
HASH_DESIGNATED_KEY_COMBINATIONS
#
{ 'strg+s': 'save_the_buffer', 'alt+y': 'activate_the_third_textview' }
Class Method Summary collapse
-
.[](i = '') ⇒ Object
# === Studium::GUI::Gtk::AskExamQuestion[] ========================================================================= #.
-
.run(i = ARGV) ⇒ Object
# === Studium::GUI::Gtk::AskExamQuestion.run ========================================================================= #.
Instance Method Summary collapse
-
#allow_external_applications? ⇒ Boolean
# === allow_external_applications?.
-
#ask_an_exam_question ⇒ Object
# === ask_an_exam_question ========================================================================= #.
-
#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.
-
#connect_skeleton ⇒ Object
# === connect_skeleton (connect tag) ========================================================================= #.
-
#connect_the_notebook_tab ⇒ Object
# === connect_the_notebook_tab ========================================================================= #.
-
#control_panel? ⇒ Boolean
# === control_panel? ========================================================================= #.
-
#create_skeleton ⇒ Object
# === create_skeleton (create tag) ========================================================================= #.
-
#create_the_button_update_n_questions_were_answered ⇒ Object
# === create_the_button_update_n_questions_were_answered ========================================================================= #.
-
#create_the_buttons ⇒ Object
# === create_the_buttons (buttons tag, button tag) ========================================================================= #.
-
#create_the_editor ⇒ Object
# === create_the_editor (editor tag) ========================================================================= #.
-
#create_the_emoji_toggle_widget ⇒ Object
# === create_the_emoji_toggle_widget.
-
#create_the_main_grid ⇒ Object
# === create_the_main_grid ========================================================================= #.
-
#create_the_notebook_tab ⇒ Object
# === create_the_notebook_tab ========================================================================= #.
-
#create_the_text_views_and_text_buffers ⇒ Object
(also: #create_text_buffer_and_associated_text_views)
# === create_the_text_views_and_text_buffers ========================================================================= #.
-
#do_ask_a_new_exam_question ⇒ Object
# === do_ask_a_new_exam_question ========================================================================= #.
-
#do_interactively_change_the_font ⇒ Object
# === do_interactively_change_the_font.
-
#do_solve_the_exam_question ⇒ Object
(also: #mark_the_exam_question_as_solved)
# === do_solve_the_exam_question (solved tag) ========================================================================= #.
-
#enable_the_main_key_combinations(use_this_hash = HASH_DESIGNATED_KEY_COMBINATIONS) ⇒ Object
# === enable_the_main_key_combinations ========================================================================= #.
-
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ AskExamQuestion
constructor
# === initialize.
-
#instantiate_the_control_panel ⇒ Object
# === instantiate_the_control_panel ========================================================================= #.
-
#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 ========================================================================= #.
-
#populate_the_notebook_tab ⇒ Object
# === populate_the_notebook_tab (populate tag) ========================================================================= #.
-
#popup_pick_a_new_font ⇒ Object
# === popup_pick_a_new_font ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#return_the_widget_for_the_first_notebook_tab ⇒ Object
# === return_the_widget_for_the_first_notebook_tab (first tag) ========================================================================= #.
-
#reveal_the_answer_to_the_exam_question ⇒ Object
# === reveal_the_answer_to_the_exam_question ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#save_the_buffer ⇒ Object
# === save_the_buffer ========================================================================= #.
-
#scrolled_window_for_the_answer? ⇒ Boolean
# === scrolled_window_for_the_answer? ========================================================================= #.
-
#set_editor_buffer(i) ⇒ Object
# === set_editor_buffer ========================================================================= #.
-
#set_save_into_this_local_file(i) ⇒ Object
# === set_save_into_this_local_file ========================================================================= #.
-
#text_view_for_the_question? ⇒ Boolean
# === text_view_for_the_question? ========================================================================= #.
-
#update_the_label_containing_the_last_exam_question ⇒ Object
# === update_the_label_containing_the_last_exam_question ========================================================================= #.
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ AskExamQuestion
#
initialize
The first argument that is passed into this class may be a file that exists locally.
#
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 51 def initialize( commandline_arguments = ARGV, run_already = true ) super(:vertical) reset set_commandline_arguments( commandline_arguments ) run if run_already end |
Class Method Details
.[](i = '') ⇒ Object
#
Studium::GUI::Gtk::AskExamQuestion[]
#
752 753 754 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 752 def self.[](i = '') new(i) end |
.run(i = ARGV) ⇒ Object
#
Studium::GUI::Gtk::AskExamQuestion.run
#
642 643 644 645 646 647 648 649 650 651 652 653 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 642 def self.run( i = ARGV ) require 'gtk_paradise/run' _ = ::Studium::GUI::Gtk::AskExamQuestion.new(i) r = ::Gtk.run r << _ _.enable_the_main_key_combinations _.(r) r.automatic_size_then_automatic_title r.top_left_then_run end |
Instance Method Details
#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.
#
140 141 142 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 140 def allow_external_applications? true end |
#ask_an_exam_question ⇒ Object
#
ask_an_exam_question
#
614 615 616 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 614 def ask_an_exam_question .signal_emit(:clicked) 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.
#
168 169 170 171 172 173 174 175 176 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 168 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 |
#connect_skeleton ⇒ Object
#
connect_skeleton (connect tag)
#
352 353 354 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 352 def connect_skeleton connect_the_notebook_tab end |
#connect_the_notebook_tab ⇒ Object
#
connect_the_notebook_tab
#
285 286 287 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 285 def connect_the_notebook_tab maximal(@notebook_tab, 0) end |
#control_panel? ⇒ Boolean
#
control_panel?
#
147 148 149 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 147 def control_panel? @control_panel end |
#create_skeleton ⇒ Object
#
create_skeleton (create tag)
#
220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 220 def create_skeleton create_the_editor create_the_notebook_tab create_the_entries create_the_checkbox # This must come after the entries were created. create_the_combobox create_the_labels create_the_text_views_and_text_buffers create_the_main_grid # This should come fairly late. instantiate_the_control_panel populate_the_notebook_tab # Must come after create_the_notebook_tab(). end |
#create_the_button_update_n_questions_were_answered ⇒ Object
#
create_the_button_update_n_questions_were_answered
#
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 238 def # ======================================================================= # # === The update-button is created next. It had the cat emoji, aka # 🐈️, displayed in the past, but not every computer system has # access to such an emoji, so this was replaced via an image. # The old text was: '🐈️ Update ➡️ ' # ======================================================================= # @button_update_n_questions_were_answered = ('Update ➡️ ') @button_update_n_questions_were_answered.lightblue @button_update_n_questions_were_answered.hint = 'Click this '\ 'button to update the entry to the right side.' @button_update_n_questions_were_answered.on_clicked { update_the_label_n_questions_were_answered } end |
#create_the_buttons ⇒ Object
#
create_the_buttons (buttons tag, button tag)
#
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 257 def # ======================================================================= # # === @button_solve_the_question # # Add the solved-question button. It has a small Unicode "checkmark" # on the right side. # ======================================================================= # @button_solve_the_question = @button_solve_the_question.on_clicked { do_solve_the_exam_question # ===================================================================== # # And flip the smiley state of the label close to the top. # ===================================================================== # change_to_a_happy_smiley_before_reverting_to_the_prior_default_again update_the_label_n_questions_were_answered do_update_this_gtk_entry_with_that_exam_topic_for_its_percentage_value( @entry_percentage, current_exam_topic? ) } end |
#create_the_editor ⇒ Object
#
create_the_editor (editor tag)
#
126 127 128 129 130 131 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 126 def create_the_editor # ======================================================================= # # === @gtk_editor # ======================================================================= # @gtk_editor = ::Gtk::Editor.new { :do_not_use_the_colour_box_widget } 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.
#
184 185 186 187 188 189 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 184 def @a_thinking_smiley_emoji = ::Gtk::EmojiToggleWidget.new( :use_two_smileys ) @a_thinking_smiley_emoji.make_selectable end |
#create_the_main_grid ⇒ Object
#
create_the_main_grid
#
566 567 568 569 570 571 572 573 574 575 576 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 566 def create_the_main_grid # ======================================================================= # # === @grid # ======================================================================= # @grid = gtk_grid # grid tag @grid.set_column_spacing(5) @grid.set_row_spacing(5) @grid.set_size_request( width?+20, height? / 1.3 ) end |
#create_the_notebook_tab ⇒ Object
#
create_the_notebook_tab
#
628 629 630 631 632 633 634 635 636 637 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 628 def create_the_notebook_tab # ======================================================================= # # === @notebook_tab # ======================================================================= # @notebook_tab = gtk_notebook { :make_it_scrollable } @notebook_tab.css_class('notebook_for_ask_exam_question') @notebook_tab.the_tabs_appear_on_top @notebook_tab.do_show_the_tabs @notebook_tab.do_show_the_border end |
#create_the_text_views_and_text_buffers ⇒ Object Also known as: create_text_buffer_and_associated_text_views
#
create_the_text_views_and_text_buffers
#
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 658 def create_the_text_views_and_text_buffers # ======================================================================= # # === The text buffer for the question comes first # ======================================================================= # @text_buffer_for_the_question = gtk_text_buffer @text_view_for_the_question = return_text_view_for_the_question(@text_buffer_for_the_question) @scrolled_window_containing_the_textarea1 = return_scrolled_window_for_the_text_view_for_the_question(@text_view_for_the_question) # ======================================================================= # # === The text buffer, text view, and scrolled window for the # answer comes first. # ======================================================================= # @text_buffer_for_the_answer = gtk_text_buffer # ======================================================================= # # === @text_view_for_the_answer # ======================================================================= # @text_view_for_the_answer = return_text_view_for_the_answer(@text_buffer_for_the_answer) @scrolled_window_containing_the_textarea2 = return_scrolled_window_containing_the_text_view_for_the_answer( @text_view_for_the_answer ) # ======================================================================= # # Next comes the textarea for "free typing", where the user can # simply write whatever he wants to. # ======================================================================= # @textarea3 = return_textarea_number_three # ======================================================================= # # === @scrolled_window_containing_the_textarea3 # # This is the scrolled-window containing the free-form text the user # can type. # ======================================================================= # @scrolled_window_containing_the_textarea3 = return_scrolled_window_containing_the_textarea3(@textarea3) # ======================================================================= # # 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.buffer.text) } end |
#do_ask_a_new_exam_question ⇒ Object
#
do_ask_a_new_exam_question
#
621 622 623 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 621 def do_ask_a_new_exam_question .signal_emit(:clicked) end |
#do_interactively_change_the_font ⇒ Object
#
do_interactively_change_the_font
This does not work. :(
#
583 584 585 586 587 588 589 590 591 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 583 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:' pp _.selection? end |
#do_solve_the_exam_question ⇒ Object Also known as: mark_the_exam_question_as_solved
#
do_solve_the_exam_question (solved tag)
#
703 704 705 706 707 708 709 710 711 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 703 def do_solve_the_exam_question _ = Studium::Exams::Solved.new { :do_not_run_yet } _.set_commandline _.run if is_on_roebe? and Object.const_defined?(:Roebe) rinstall2 end update_the_label_containing_the_last_exam_question end |
#enable_the_main_key_combinations(use_this_hash = HASH_DESIGNATED_KEY_COMBINATIONS) ⇒ Object
#
enable_the_main_key_combinations
#
596 597 598 599 600 601 602 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 596 def enable_the_main_key_combinations( use_this_hash = HASH_DESIGNATED_KEY_COMBINATIONS ) enable_these_key_combinations( use_this_hash ) end |
#instantiate_the_control_panel ⇒ Object
#
instantiate_the_control_panel
#
154 155 156 157 158 159 160 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 154 def instantiate_the_control_panel # ======================================================================= # # === @control_panel # ======================================================================= # @control_panel = ::Studium::GUI::Gtk::ControlPanel.new(self) @control_panel.use_this_font(main_font?) 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
#
204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 204 def notify_the_user_that_all_questions_have_been_answered_in_this_topic( this_topic = current_exam_topic?, = @button_reveal_the_answer ) = gtk_bold_label( 'All questions have been answered for '+this_topic+'. \o/' ) ( , ).popup end |
#populate_the_notebook_tab ⇒ Object
#
populate_the_notebook_tab (populate tag)
#
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 292 def populate_the_notebook_tab # ======================================================================= # # We could display a Curriculum. 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. # # label4 = modify_bold_label('Curriculum Viewer',@colour_to_use_for_the_notebook_labels) # @notebook_tab.add_tab(::Studium::GUI::Gtk::CurriculumViewer.new, label4) # # ======================================================================= # # ======================================================================= # # === Add the first tab, containing the "Ask Exam Question" widget next # # This will be contained in @first_vbox, which in turn contains # the @horizontal_pane variable. # ======================================================================= # label1 = modify_bold_label('Ask Exam Question', @colour_to_use_for_the_notebook_labels) @notebook_tab.add_tab( , label1 ) # ======================================================================= # # === Add the second tab next, including the top-ten exam-topics as # well as the Control Panel # ======================================================================= # label2 = modify_bold_label('Control Panel', @colour_to_use_for_the_notebook_labels) vbox_containing_the_control_panel = gtk_vbox if Object.const_defined? :Roebe @show_ten_aliases.(self) vbox_containing_the_control_panel.minimal(@show_ten_aliases, 10) end vbox_containing_the_control_panel.maximal( @control_panel ) @notebook_tab.add_tab( gtk_scrolled_window( vbox_containing_the_control_panel ), label2 ) # ======================================================================= # # === Add a modified variant of the editor-widget, so that we # can easily manipulate the content of the exam-questions. # ======================================================================= # label3 = modify_bold_label('File-Editor', @colour_to_use_for_the_notebook_labels) # ======================================================================= # # Keep a reference to the editor in use as well. # ======================================================================= # vbox_containing_the_editor = @gtk_editor @notebook_tab.add_tab( vbox_containing_the_editor, label3 ) @notebook_tab.set_tab_reorderable(vbox_containing_the_editor, true) @notebook_tab.focus_on_the_first_tab @notebook_tab.set_focus(0) end |
#popup_pick_a_new_font ⇒ Object
#
popup_pick_a_new_font
#
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 716 def popup_pick_a_new_font _ = gtk_hbox _.minimal(text(' → ')) = ('Choose font here') .set_size_request(1200, 960) .css_class('bblack2') .set_size_request(500, 300) .disallow_resizing _.minimal() .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 |
#reset ⇒ Object
#
reset (reset tag)
#
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 66 def reset # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, NAMESPACE] reset_the_internal_variables :do_not_reset_the_configuration_variable # ======================================================================= # # === @answer_is # ======================================================================= # @answer_is = nil # ======================================================================= # # === @show_ten_aliases # ======================================================================= # @show_ten_aliases = nil if Object.const_defined?(:Roebe) begin require 'roebe/gui/gtk3/show_ten_aliases/show_ten_aliases.rb' @show_ten_aliases = ::Roebe::GUI::Gtk::ShowTenAliases.new rescue LoadError; end end # ======================================================================= # # === @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. # ======================================================================= # @prefer_emoji_or_images = :images # ======================================================================= # # === @colour_to_use_for_the_notebook_labels # ======================================================================= # @colour_to_use_for_the_notebook_labels = 'darkblue' # ======================================================================= # # === @title # ======================================================================= # @title = return_the_title_from_the_config_file # ======================================================================= # # === @use_this_editor # # This may be :bluefish or :internal usually. # ======================================================================= # @use_this_editor = :internal infer_the_size_automatically end |
#return_the_widget_for_the_first_notebook_tab ⇒ Object
#
return_the_widget_for_the_first_notebook_tab (first tag)
#
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 408 def # ======================================================================= # # === @first_vbox # ======================================================================= # @first_vbox = gtk_vbox frame_containing_the_label_exam_topic = return_frame_containing_the_label_exam_topic event_box_containing_the_frame_containing_the_label_exam_topic = gtk_eventbox( frame_containing_the_label_exam_topic ) event_box_containing_the_frame_containing_the_label_exam_topic.on_clicked { do_jump_into_the_entry_containing_the_current_exam_topic } @grid.attach(event_box_containing_the_frame_containing_the_label_exam_topic, 0, 0, 1, 1) @grid.attach(@entry_holding_all_exam_topics, 1, 0, 1, 1) @grid.attach(@combo_box_available_exam_topics, 3, 0, 1, 1) @grid.attach(@entry_percentage, 4, 0, 2, 1) # ======================================================================= # # The following vbox, contains the thumbs-up emoji as well as entries # for n questions and n answers. # ======================================================================= # @hbox_containing_three_labels_and_three_entries = return_hbox_containing_three_labels_and_three_entries # ======================================================================= # # Add the thumbs-up emoji, but only if we use emojis. # ======================================================================= # if use_emoji? event_box_for_the_thumbs_up_emoji = gtk_event_box(gtk_label(' 👍')) else event_box_for_the_thumbs_up_emoji = gtk_event_box(image_trophy_gold) end event_box_for_the_thumbs_up_emoji.on_clicked { do_ask_a_new_exam_question } @hbox_containing_three_labels_and_three_entries.minimal( event_box_for_the_thumbs_up_emoji, 5 # The thumbs-up emoji is actually an event-box. ) event_box_for_image_view_refresh_symbolic_symbolic = return_event_box_for_asking_a_random_exam_topic @hbox_containing_three_labels_and_three_entries.minimal( event_box_for_image_view_refresh_symbolic_symbolic, 5 ) @grid.attach(@checkbox_shall_we_reveal_the_answer, 0, 1, 1, 1) @grid.attach(@hbox_containing_three_labels_and_three_entries, 1, 1, 1, 1) hbox_containing_the_smiling_emoji_and_the_entry_delay_to_use = gtk_hbox hbox_containing_the_smiling_emoji_and_the_entry_delay_to_use.minimal( gtk_label(:vertical_line) ) hbox_containing_the_smiling_emoji_and_the_entry_delay_to_use.minimal( @a_thinking_smiley_emoji ) hbox_containing_the_smiling_emoji_and_the_entry_delay_to_use.minimal( gtk_label(:vertical_line) ) hbox_containing_the_smiling_emoji_and_the_entry_delay_to_use.minimal( @entry_delay_to_use ) hbox_containing_the_smiling_emoji_and_the_entry_delay_to_use.minimal( @button_use_random_entry_from_the_ten_aliases, 4 ) @grid.attach( hbox_containing_the_smiling_emoji_and_the_entry_delay_to_use, 3, 1, 1, 1 ) # ======================================================================= # # Add the exam-question button next # ======================================================================= # if use_emoji? @grid.attach(@button_ask_the_exam_question, 0, 2, 1, 1) else = gtk_hbox .maximal( @button_ask_the_exam_question ) event_box_for_image_dialog_question = gtk_eventbox( image_dialog_question ) event_box_for_image_dialog_question.on_clicked { do_ask_an_exam_question } .minimal( event_box_for_image_dialog_question ) @grid.attach(, 0, 2, 1, 1) end @grid.attach(@scrolled_window_containing_the_textarea1, 1, 2, 6, 1) # .attach(widget, left_pos, top_pos, width, height) @grid.attach(@button_reveal_the_answer, 0, 3, 1, 1) @grid.attach(@scrolled_window_containing_the_textarea2, 1, 3, 6, 1) hbox_with_two_icons = return_hbox_containing_two_icons_and_instructions_what_to_do_with_the_free_form_textarea @grid.attach(hbox_with_two_icons, 0, 4, 4, 1) # .attach(child_widget, left_pos, top_pos, width, height) @grid.attach(@scrolled_window_containing_the_textarea3, 0, 5, 6, 1) # ======================================================================= # # Add the widget that contains the solve-the-question-button and the # open-file button. # ======================================================================= # = gtk_hbox .minimal( @button_solve_the_question, 2 ) .minimal( , 2 ) .minimal( return_wikipedia_entry, 2 ) # ======================================================================= # # Next comes the hbox that contains, among other elements, the # "n exam questions are already answered" string. # ======================================================================= # hbox_containing_the_label = gtk_hbox mini_hbox = gtk_hbox event_box = gtk_event_box(image_applications_system_symbolic_symbolic) event_box.on_clicked { update_the_label_n_questions_were_answered } mini_hbox.minimal(event_box) mini_hbox.minimal(@button_update_n_questions_were_answered) hbox_containing_the_label.maximal(mini_hbox, 2) hbox_containing_the_label.maximal(@label_n_questions_were_answered, 25) gtk_hbox_containing_the_application_exit_image = gtk_hbox gtk_hbox_containing_the_application_exit_image.minimal( hbox_containing_the_label, 0 ) # ======================================================================= # # Add an "exit" functionality next. # ======================================================================= # eventbox_for_application_exit_image = return_eventbox_with_an_image_to_exit_the_application gtk_hbox_containing_the_application_exit_image.minimal(gtk_hseparator) gtk_hbox_containing_the_application_exit_image.rpack( eventbox_for_application_exit_image, 2 ) = gtk_vbox .minimal( , 1 ) .minimal(gtk_separator, 0) @horizontal_pane = horizontal_pane( , gtk_hbox_containing_the_application_exit_image ) @first_vbox.minimal(@grid, 2) @first_vbox.maximal(@horizontal_pane, 5) return gtk_scrolled_window(@first_vbox) # We use a scrolled-window for convenience. end |
#reveal_the_answer_to_the_exam_question ⇒ Object
#
reveal_the_answer_to_the_exam_question
#
607 608 609 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 607 def reveal_the_answer_to_the_exam_question do_reveal_the_answer_after_timeout(@answer_is,0) end |
#run ⇒ Object
#
run (run tag)
#
359 360 361 362 363 364 365 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 359 def run abort_on_exception create_skeleton_then_connect_skeleton show_all end |
#save_the_buffer ⇒ Object
#
save_the_buffer
#
384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 384 def save_the_buffer @gtk_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_window_for_the_answer? ⇒ Boolean
#
scrolled_window_for_the_answer?
#
377 378 379 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 377 def scrolled_window_for_the_answer? @scrolled_window_containing_the_textarea2 end |
#set_editor_buffer(i) ⇒ Object
#
set_editor_buffer
#
401 402 403 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 401 def set_editor_buffer(i) @gtk_editor.set_buffer(i.to_s) end |
#set_save_into_this_local_file(i) ⇒ Object
#
set_save_into_this_local_file
#
370 371 372 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 370 def set_save_into_this_local_file(i) @gtk_editor.set_save_into_this_local_file(i.to_s) end |
#text_view_for_the_question? ⇒ Boolean
#
text_view_for_the_question?
#
745 746 747 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 745 def text_view_for_the_question? @text_view_for_the_question end |
#update_the_label_containing_the_last_exam_question ⇒ Object
#
update_the_label_containing_the_last_exam_question
#
195 196 197 198 199 |
# File 'lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb', line 195 def update_the_label_containing_the_last_exam_question control_panel?.label_containing_the_last_exam_question?.set_text( ::Studium.return_last_exam_question ) end |