Module: Studium::GUI::Gtk::InformationAboutALectureModule

Includes:
Gtk::BaseModule
Included in:
InformationAboutALecture
Defined in:
lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
TITLE =
#

TITLE

#
'Information about a lecture module'
WIDTH =
#

WIDTH

#
1200
HEIGHT =
#

HEIGHT

#
500
USE_THIS_FONT =
#

USE_THIS_FONT

#
:dejavu_condensed_25

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.runObject

#

Studium::GUI::Gtk::InformationAboutALectureModule.run

#


170
171
172
173
174
175
176
177
178
# File 'lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb', line 170

def self.run
  require 'gtk_paradise/run'
  r = ::Gtk.run
  _ = ::Studium::GUI::Gtk::InformationAboutALecture.new
  r << _
  r.automatic_size
  r.automatic_title
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


99
100
101
# File 'lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb', line 99

def border_size?
  2
end

#connect_skeletonObject

#

connect_skeleton (connect tag)

#


149
150
151
152
153
154
155
156
157
158
# File 'lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb', line 149

def connect_skeleton
  abort_on_exception
  minimal(
    h3('<b>'+@dataset.size.to_s+'</b> courses are registered'), 5
  )
  minimal(@combo_box_on_top, 2)
  minimal(@button_update, 2)
  minimal(@entry1, 2)
  minimal(@entry2, 2)
end

#create_skeletonObject

#

create_skeleton

#


106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb', line 106

def create_skeleton
  _ = @dataset.keys.sort
  _.map! {|entry|
    if entry.include?(' ') and (entry.size > 80)
      entry = entry[0 .. 80]
    end
    entry
  }
  @entry1 = gtk_entry
  @entry2 = gtk_entry
  @combo_box_on_top = gtk_combo_box_text(_)
  @combo_box_on_top.first_entry_is_active
  @combo_box_on_top.set_size_request(600, 50)
  @button_update = gtk_button('_Update')
  @button_update.hint = 'Click this button to <b>update '\
    'the entry</b> below.'
  @button_update.on_clicked {
    do_sync_text_in_the_entry_onto_the_list_store
  }
end

#do_sync_text_in_the_entry_onto_the_list_storeObject

#

do_sync_text_in_the_entry_onto_the_list_store

#


130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb', line 130

def do_sync_text_in_the_entry_onto_the_list_store
  # ======================================================================= #
  # First, obtain the current selection.
  # ======================================================================= #
  _ = @combo_box_on_top.active_text
  if @dataset.has_key? _
    this_lecture_dataset = @dataset[_]
    university = this_lecture_dataset[:university].to_s
    n_ects     = this_lecture_dataset[:ects].to_s
  else
    e 'Entry '+_.to_s+' was not found.'
  end
  @entry1.set_text('University: '+university)
  @entry2.set_text('n ECTS: '+n_ects)
end

#initialize(optional_file = nil, run_already = true) ⇒ Object

#

initialize

#


51
52
53
54
55
56
57
58
# File 'lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb', line 51

def initialize(
    optional_file = nil,
    run_already   = true
  )
  super(:vertical)
  reset
  run if run_already
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


92
93
94
# File 'lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb', line 92

def padding?
  2
end

#resetObject

#

reset

#


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
# File 'lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb', line 63

def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  set_use_this_font(USE_THIS_FONT)
  # ======================================================================= #
  # === @dataset
  # ======================================================================= #
  @dataset = Studium.return_dataset_from_the_file_lecture_information
  # ======================================================================= #
  # === @title
  # ======================================================================= #
  @title  = TITLE
  # ======================================================================= #
  # === @width
  # ======================================================================= #
  set_width(WIDTH)
  # ======================================================================= #
  # === @height
  # ======================================================================= #
  set_height(HEIGHT)
  append_project_css_file
end

#runObject

#

run

#


163
164
165
# File 'lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb', line 163

def run
  create_skeleton_then_connect_skeleton
end