class RBT::GUI::Gtk::TextViewWidget

Constants

NAMESPACE
#

NAMESPACE

#

Public Class Methods

new() click to toggle source
#

initialize

#
Calls superclass method
# File lib/rbt/gui/gtk/textview_widget.rb, line 38
def initialize
  super()
  reset
  run
end

Public Instance Methods

add_gui_skeleton() click to toggle source
#

add_gui_skeleton

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 160
def add_gui_skeleton
  add_textview_widget
  add_input_widget_to_the_left_and_start_compile_button_on_the_right
  add_label_for_success_or_failure
end
add_input_widget_to_the_left_and_start_compile_button_on_the_right() click to toggle source
#

add_input_widget_to_the_left_and_start_compile_button_on_the_right

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 138
def add_input_widget_to_the_left_and_start_compile_button_on_the_right
  @input_widget_on_the_left = gtk_entry # entry tag
  @input_widget_on_the_left.on_click_highlight_all
  @input_widget_on_the_left.on_enter_event_select_this
  @compile_button_on_the_right = gtk_button('_Compile')
  @compile_button_on_the_right.signal_connect(:clicked) {
    do_compile_this_program
  }
  @compile_button_on_the_right.tooltip(
    'Press this button to start compiling the program '\
    'listed to the left'
  )
  @widget_with_input_and_compile_button = ::Gtk.hbox(
    @input_widget_on_the_left,
    @compile_button_on_the_right
  )
  pack_start(@widget_with_input_and_compile_button, false, true, 2)
end
add_label_for_success_or_failure() click to toggle source
#

add_label_for_success_or_failure

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 169
def add_label_for_success_or_failure
  @label_for_success_or_failure = ::Gtk.label()
  pack_start(@label_for_success_or_failure, false, true,2)
end
add_textview_widget() click to toggle source
#

add_textview_widget

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 53
def add_textview_widget
  @textview_widget = ::Gtk.return_textview_widget
  @textview_widget.indent = 4
  pack_start(@textview_widget, true, true, 2)
end
append_this_text_to_the_textview_widget( this_text ) click to toggle source
#

append_this_text_to_the_textview_widget (append tag)

This is mostly a convenience method - whenever it is called, we will simply append to the textview widget.

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 125
def append_this_text_to_the_textview_widget(
    this_text
  )
  unless this_text.end_with? N
    this_text = this_text.dup if this_text.frozen?
    this_text << N
  end
  @textview_widget.append_this_text(this_text)
end
do_compile_this_program( this_program = return_content_of_input_widget ) click to toggle source
#

do_compile_this_program (compile tag, action tag, click tag)

The action that is used to compile a given program at hand.

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 71
def do_compile_this_program(
    this_program = return_content_of_input_widget
  )
  text = 'Now compiling the program `'+sfancy(this_program)+'`.'
  append_this_text_to_the_textview_widget(
    text
  )
  # ======================================================================= #
  # Also report it on the commandline.
  # ======================================================================= #
  opnn; e text
  append_this_text_to_the_textview_widget(
    this_program
  )
  Thread.new {
    @compile_object = RBT::Compile.new(
      this_program.strip
    )
    set_success_or_failure(
      @compile_object.has_been_successfully_compiled?
    )
  }.join
end
height?() click to toggle source
#

height?

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 177
def height?
  800
end
opnn() click to toggle source
#

opnn

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 115
def opnn
  Opn.opn(namespace: NAMESPACE)
end
reset() click to toggle source
#

reset

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 47
def reset
end
return_content_of_input_widget() click to toggle source
#

return_content_of_input_widget

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 62
def return_content_of_input_widget
  @input_widget_on_the_left.content
end
run() click to toggle source
#

run

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 191
def run
  add_gui_skeleton
  show_all
end
set_success_or_failure(i) click to toggle source
#

set_success_or_failure

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 98
def set_success_or_failure(i)
  @success_or_failure = i.to_s.strip
  if i.to_s == 'true'
    @label_for_success_or_failure.set_text(
      'The program '+return_content_of_input_widget+' has been compiled successfully!'
    )
  else
    @label_for_success_or_failure.set_text(
      'The program '+return_content_of_input_widget+' has NOT been compiled successfully.'
    )
  end
  @label_for_success_or_failure.make_bold
end
width?() click to toggle source
#

width?

#
# File lib/rbt/gui/gtk/textview_widget.rb, line 184
def width?
  900
end