Class: Studium::GUI::Gtk::LectureInformation
- Inherits:
-
Gtk::Box
- Object
- Gtk::Box
- Studium::GUI::Gtk::LectureInformation
- Includes:
- Gtk::BaseModule
- Defined in:
- lib/studium/gui/gtk3/lecture_information/lecture_information.rb
Overview
Studium::GUI::Gtk::LectureInformation
Constant Summary collapse
- NAMESPACE =
#
NAMESPACE
#
inspect- TITLE =
#
TITLE
#
'Lecture Information'- WIDTH =
#
WIDTH
#
'45% or minimum 500px'- HEIGHT =
#
HEIGHT
#
'15% or minimum 100px'- USE_THIS_FONT =
#
USE_THIS_FONT
#
:dejavu_condensed_20
Class Method Summary collapse
-
.run(i = ARGV) ⇒ Object
# === Studium::GUI::Gtk::LectureInformation.run ========================================================================= #.
Instance Method Summary collapse
-
#border_size? ⇒ Boolean
# === border_size? ========================================================================= #.
-
#connect_skeleton ⇒ Object
# === connect_skeleton (connect tag) ========================================================================= #.
-
#create_skeleton ⇒ Object
# === create_skeleton (create tag, skeleton tag) ========================================================================= #.
-
#create_the_tree_view ⇒ Object
# === create_the_tree_view ========================================================================= #.
-
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ LectureInformation
constructor
# === initialize ========================================================================= #.
-
#padding? ⇒ Boolean
# === padding? ========================================================================= #.
-
#populate_the_list_store ⇒ Object
# === populate_the_list_store ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#tree_view? ⇒ Boolean
# === tree_view? ========================================================================= #.
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ LectureInformation
#
initialize
#
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 53 def initialize( commandline_arguments = ARGV, run_already = true ) super(:vertical) reset set_commandline_arguments( commandline_arguments ) run if run_already end |
Class Method Details
.run(i = ARGV) ⇒ Object
#
Studium::GUI::Gtk::LectureInformation.run
#
180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 180 def self.run( i = ARGV ) require 'gtk_paradise/app/app.rb' _ = ::Studium::GUI::Gtk::LectureInformation.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?
#
92 93 94 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 92 def border_size? 2 end |
#connect_skeleton ⇒ Object
#
connect_skeleton (connect tag)
#
167 168 169 170 171 172 173 174 175 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 167 def connect_skeleton abort_on_exception scrolled_window = gtk_scrolled_window(tree_view?) scrolled_window.width_height(1820, 1020) scrolled_window.show_all scrolled_window.bblack1 scrolled_window.pad8px add(scrolled_window) end |
#create_skeleton ⇒ Object
#
create_skeleton (create tag, skeleton tag)
#
134 135 136 137 138 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 134 def create_skeleton @list_store = five_strings create_the_tree_view populate_the_list_store end |
#create_the_tree_view ⇒ Object
#
create_the_tree_view
#
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 113 def create_the_tree_view # ======================================================================= # # === @tree_view # ======================================================================= # @tree_view = gtk_tree_view(@list_store) { :clickable_headers } # gtk_tree_store(*@list_store) @tree_view.width_height(500, 200) @tree_view.enable_search = true @tree_view.make_reorderable @tree_view.the_header_can_be_resized @tree_view.the_header_are_clickable @tree_view.all_are_sortable @tree_view.append('LVA-ID', default_renderer, text: 0) @tree_view.append('Name of the lecture', bold_renderer, text: 1) @tree_view.append('n ECTS', default_renderer, text: 2) @tree_view.append('semester', default_renderer, text: 3) @tree_view.append('already solved?', default_renderer, text: 4) end |
#padding? ⇒ Boolean
#
padding?
#
85 86 87 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 85 def padding? 4 end |
#populate_the_list_store ⇒ Object
#
populate_the_list_store
#
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 143 def populate_the_list_store _ = ::Studium.dataset_from_the_file_lecture_information counter = 0 _.each_pair {|name_of_the_lecture, inner_hash| counter += 1 unless counter > 125 n_ECTS = inner_hash[:ects].to_s semester = inner_hash[:semester].to_s already_solved = inner_hash[:already_solved].to_s lva_id = name_of_the_lecture.split(' ').first.to_s short_name_of_the_lecture = name_of_the_lecture.split(' ')[1..-1].join(' ').strip iter = @list_store.append iter.set_value(0, lva_id) iter.set_value(1, short_name_of_the_lecture) iter.set_value(2, n_ECTS) iter.set_value(3, semester) iter.set_value(4, already_solved) end } end |
#reset ⇒ Object
#
reset (reset tag)
#
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 68 def reset reset_the_internal_variables # ======================================================================= # # === @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 # or use use_project_css_file infer_the_size_automatically end |
#run ⇒ Object
#
run (run tag)
#
106 107 108 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 106 def run super() end |
#tree_view? ⇒ Boolean
#
tree_view?
#
99 100 101 |
# File 'lib/studium/gui/gtk3/lecture_information/lecture_information.rb', line 99 def tree_view? @tree_view end |