Class: Roebe::GUI::Gtk::GuessTheWorldCapitals

Inherits:
Gtk::BaseModuleFrame
  • Object
show all
Defined in:
lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb

Overview

Roebe::GUI::Gtk::GuessTheWorldCapitals

Constant Summary collapse

TITLE =
#

TITLE

#
'Guess the world capitals'
WIDTH =
#

WIDTH

#
'55% or minimum 1200px'
HEIGHT =
#

HEIGHT

#
'55% or minimum 800px'
USE_THIS_FONT =
#

USE_THIS_FONT

#
:dejavu_condensed_20

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commandline_arguments = ARGV, run_already = true) ⇒ GuessTheWorldCapitals

#

initialize

#


46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 46

def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  super()
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  set_label(TITLE)
  run if run_already
end

Class Method Details

.run(i = ARGV) ⇒ Object

#

Roebe::GUI::Gtk::GuessTheWorldCapitals.run

#


162
163
164
165
166
167
168
169
170
171
172
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 162

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::Roebe::GUI::Gtk::GuessTheWorldCapitals.new(i)
  r = ::Gtk.run
  r << _
  r.automatic_size_then_automatic_title
  r.enable_quick_exit
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


91
92
93
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 91

def border_size?
  0
end

#connect_skeletonObject

#

connect_skeleton (connect tag)

#


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 115

def connect_skeleton
  abort_on_exception
  # ======================================================================= #
  # bl $ROEBE_SRC/yaml/world_capitals/world_capitals.yml
  # ======================================================================= #
  _ = Roebe.project_base_directory?+'yaml/world_capitals/world_capitals.yml'
  if File.exist? _
    dataset = YAML.load_file(_)
    dataset.each_pair {|name_of_the_country, name_of_the_capital|
      @grid.left(text(name_of_the_country))
      right_text = name_of_the_capital
      capital = Roebe::GUI::Gtk::Capital.new(right_text)
      @grid.right(capital)
      @array_capital_buttons << capital
      # if name_of_the_capital.end_with? '[]'
      #   # right_text.hide
      #   capital.set_visible(false)
      # end
    }
  end
  scrolled_window = create_scrolled_window(@grid) 
  add(scrolled_window)
end

#create_skeletonObject

#

create_skeleton (create tag, skeleton tag)

#


98
99
100
101
102
103
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 98

def create_skeleton
  # ======================================================================= #
  # === @grid
  # ======================================================================= #
  @grid = create_grid
end

#do_post_create_actionsObject

#

do_post_create_actions

#


150
151
152
153
154
155
156
157
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 150

def do_post_create_actions
  @array_capital_buttons.each {|this_capital_button|
    this_capital_button.hide_me
    if this_capital_button.is_answered?
      this_capital_button.reveal_me
    end
  }
end

#favicon?Boolean

#

favicon?

#

Returns:

  • (Boolean)


108
109
110
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 108

def favicon?
  :tabble
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


84
85
86
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 84

def padding?
  15
end

#resetObject

#

reset (reset tag)

#


62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 62

def reset
  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)
  use_gtk_paradise_project_css_file
  infer_the_size_automatically
  # ======================================================================= #
  # === @array_capital_buttons
  # ======================================================================= #
  @array_capital_buttons = []
end

#runObject

#

run (run tag)

#


142
143
144
145
# File 'lib/roebe/gui/gtk3/guess_the_world_capitals/guess_the_world_capitals.rb', line 142

def run
  super()
  do_post_create_actions
end