class RBT::GUI::UniversalWidgets::UrlAction

Constants

HEIGHT
#

HEIGHT

#
LARGER_FONT
#

LARGER_FONT

#
SMALLER_FONT
#

SMALLER_FONT

#
TITLE
#

TITLE

#
USE_THESE_CSS_RULES
#

USE_THESE_CSS_RULES

#
USE_THIS_FONT
#

USE_THIS_FONT

#
WIDTH
#

WIDTH

#

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT::GUI::UniversalWidgets::UrlAction[]

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 306
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = ARGV, run_already = true ) click to toggle source
#

initialize

#
Calls superclass method RBT::LeanPrototype::new
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 68
def initialize(
    commandline_arguments       = ARGV,
    run_already                 = true
  )
  super(:vertical) if use_gtk3?
  determine_the_GUI_to_be_used(commandline_arguments) # This must come first, even before reset().
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  on_delete_event_quit_the_application
  run if run_already
end
run( i = ARGV ) click to toggle source
#

RBT::GUI::Gtk::UrlAction.run

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 287
def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::RBT::GUI::Gtk::UrlAction.new(i)
  r = ::Gtk.run
  _.set_parent_widget(r) # Must come before we enable the key-combinations.
  r << _
  r.add_shortcut(1,  'focus_on_entry', :alt)
  r.add_shortcut(:a, 'focus_on_entry', :alt)
  r.automatic_size_then_automatic_title
  r.enable_quick_exit
  r.set_background :white
  r.top_left_then_run
end

Public Instance Methods

border_size?() click to toggle source
#

border_size?

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 222
def border_size?
  2
end
connect_the_skeleton() click to toggle source
#

connect_the_skeleton (connect tag)

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 245
def connect_the_skeleton
  abort_on_exception

  outer_vbox = create_vbox # A new vbox.

  outer_vbox.maximal(@entry,  4)
  mini_hbox = create_hbox
  mini_hbox.minimal(@button)
  outer_vbox.minimal(mini_hbox, 4)
  outer_vbox.add(@source_view)

  window = create_window_or_runner
  window << outer_vbox

  properly_prepare_this_window(window,
    {
      title:       title?,
      font:        font?,
      width:       width?,
      height:      height?,
      padding:     padding?,
      border_size: border_size?
    }
  )
  window.show_all
  window.top_left
  do_all_startup_related_actions
  run_main
end
create_scrolled_windows() click to toggle source
#

create_scrolled_windows

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 177
def create_scrolled_windows
  @source_buffer = create_text_buffer
  @source_view   = create_text_view(@source_buffer) 
end
create_the_buttons() click to toggle source
#

create_the_buttons (buttons tag)

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 192
def create_the_buttons
  # ======================================================================= #
  # === @button
  # ======================================================================= #
  @button = button('_Send Message', self, :use_mnemonics) {
    :send_message_to_url_action_from_the_main_entry
  }
  @button.clear_background
  @button.on_hover(:lightgreen)
  @button.pad8px
  @button.bblack2  
end
create_the_entries() click to toggle source
#

create_the_entries

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 155
def create_the_entries
  # ========================================================================== #
  # === @entry
  # ========================================================================== #
  @entry = create_entry
  @entry.set_max_length 50
  # @entry.set_activates_default(true)
  @entry.signal_connect(:key_press_event) { |widget, event|
    key_pressed = Gdk::Keyval.to_name(event.keyval)
    case key_pressed
    when 'Return','KP_Enter'
      @entry.set_focus true
      @button.signal_emit :clicked
    else # debug info
      # pp key_pressed
    end
  }
end
create_the_skeleton() click to toggle source
#

create_the_skeleton (create tag, skeleton tag)

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 229
def create_the_skeleton
  create_scrolled_windows
  create_the_buttons
  create_the_entries
end
favicon?() click to toggle source
#

favicon?

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 112
def favicon?
  :tabble
end
handle_CSS_rules() click to toggle source
#

handle_CSS_rules (CSS tag)

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 126
def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  more_CSS_then_apply_it(USE_THESE_CSS_RULES)
end
padding?() click to toggle source
#

padding?

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 215
def padding?
  4
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 85
def reset
  super() if respond_to?(:super)
  reset_the_shared_module # This can come early.
  reset_the_base_module
  reset_the_internal_variables
  infer_the_namespace
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, namespace?]
  # ======================================================================= #
  # === Set the title, width, height and the font in use.
  # ======================================================================= #
  title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
  if use_gtk3?
    handle_CSS_rules
  end
  infer_the_size_automatically
  # ======================================================================= #
  # === @url_action
  # ======================================================================= #
  @url_action = ::RBT::UrlAction.new('', :do_not_run_yet)
end
reset_the_shared_module() click to toggle source
#

reset_the_shared_module

This method can be used for ruby-gtk3 and ruby-libui, among other toolkits.

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 138
def reset_the_shared_module
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 238
def run
  run_super
end
Also aliased as: start_gui_application
send_message_to_url_action( this_action = 'query/wget' ) click to toggle source
#

send_message_to_url_action

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 144
def send_message_to_url_action(
    this_action = 'query/wget'
  )
  @url_action.set_action(this_action)
  @url_action.run
  set_buffer_text(@url_action.result)
end
send_message_to_url_action_from_the_main_entry() click to toggle source
#

send_message_to_url_action_from_the_main_entry

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 185
def send_message_to_url_action_from_the_main_entry
  send_message_to_url_action(@entry.text)
end
set_buffer_text(i) click to toggle source
#

set_buffer_text

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 208
def set_buffer_text(i)
  @source_buffer.text = i
end
smaller_font?() click to toggle source
#

smaller_font?

#
# File lib/rbt/gui/universal_widgets/url_action/url_action.rb, line 119
def smaller_font?
  SMALLER_FONT
end
start_gui_application()
Alias for: run