Class: Roebe::GUI::LibUI::ShowTenAliases

Inherits:
Object
  • Object
show all
Defined in:
lib/roebe/gui/libui/show_ten_aliases/show_ten_aliases.rb

Overview

Roebe::GUI::LibUI::ShowTenAliases

Constant Summary collapse

N_TIMES =
#

N_TIMES

#
10

Instance Method Summary collapse

Constructor Details

#initialize(run_already = true) ⇒ ShowTenAliases

#

initialize

#


27
28
29
30
31
32
# File 'lib/roebe/gui/libui/show_ten_aliases/show_ten_aliases.rb', line 27

def initialize(
    run_already = true
  )
  reset
  run if run_already
end

Instance Method Details

#resetObject

#

reset (reset tag)

#


45
46
47
48
49
50
# File 'lib/roebe/gui/libui/show_ten_aliases/show_ten_aliases.rb', line 45

def reset
  # ======================================================================= #
  # === @array_labels
  # ======================================================================= #
  @array_labels = []
end

#return_main_datasetObject

#

return_main_dataset

#


37
38
39
40
# File 'lib/roebe/gui/libui/show_ten_aliases/show_ten_aliases.rb', line 37

def return_main_dataset
  require 'roebe/classes/return_aliases/return_ten_aliases.rb'
  Roebe::ReturnTenAliases[] # This will return a Hash.
end

#runObject

#

run

#


55
56
57
58
59
60
61
62
63
64
65
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
# File 'lib/roebe/gui/libui/show_ten_aliases/show_ten_aliases.rb', line 55

def run
  window = ui_padded_main_window('Show Ten Aliases', 600, 200, 0)

  hash_exam_topics = return_main_dataset # This hash contains the exam-topics.
 
  outer_vbox = padded_vbox
  # ======================================================================= #
  # First add the two buttons on top:
  # ======================================================================= #
  hbox_on_top = padded_hbox
  button_refresh = ui_button('Refresh')
  button_refresh.on_clicked {
    e 'TODO: Refresh this...'
  }
  button_quit = quit_button
  hbox_on_top.maximal(button_refresh)
  hbox_on_top.maximal(button_quit)
  outer_vbox.minimal(hbox_on_top)
  outer_vbox.add_hsep

  grid = ui_padded_grid
  grid.ui_grid_append(text('Position'),   0, 0, 1, 1, 0, 0.5, 1, 0)
  grid.ui_grid_append(text('Exam Topic'), 1, 0, 1, 1, 0, 0.5, 1, 0)

  N_TIMES.times.each {|index| index += 1
    entry = hash_exam_topics[index]
    # ===================================================================== #
    # left, top, xspan, yspan, hexpand, halign, vexpand, valign
    #  0,    0,    2,     1,      0,      0,       1,      0
    # ===================================================================== #
    grid.ui_grid_append(text(index.to_s),   0, 1+index, 1, 1, 1, 1, 1, 1)
    label_exam_topic = text(entry.to_s)
    @array_labels << label_exam_topic
    grid.ui_grid_append(label_exam_topic, 1, 1+index, 1, 1, 1, 1, 1, 1)
  }
  outer_vbox.maximal(grid)
  window.add(outer_vbox)
  window.intelligent_exit
end