Module: Studium::GUI::Gtk::ShowUpcomingExamsModule
- Includes:
- Gtk::BaseModule
- Included in:
- ShowUpcomingExams
- Defined in:
- lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb
Overview
Studium::GUI::Gtk::ShowUpcomingExamsModule
Constant Summary
collapse
- NAMESPACE =
inspect
- TITLE =
'Studium::GUI::Gtk::ShowUpcomingExamsModule'
- WIDTH =
1400
- HEIGHT =
500
- USE_THIS_FONT_FOR_THE_TREE_VIEW =
#
USE_THIS_FONT_FOR_THE_TREE_VIEW
#
:noto_mono_18
Class Method Summary
collapse
-
.run ⇒ Object
# === GtkParadise::GUI::Gtk::ShowUpcomingExamsModule.run ========================================================================= #.
Instance Method Summary
collapse
Class Method Details
.run ⇒ Object
#
GtkParadise::GUI::Gtk::ShowUpcomingExamsModule.run
#
195
196
197
198
199
200
201
202
203
204
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 195
def self.run
require 'gtk_paradise/run'
_ = ::Studium::GUI::Gtk::ShowUpcomingExams.new
r = ::Gtk.run
r << _
r.automatic_title
r.automatic_size
r.enable_quick_exit
r.top_left_then_run
end
|
Instance Method Details
#border_size? ⇒ Boolean
97
98
99
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 97
def border_size?
2
end
|
#connect_skeleton ⇒ Object
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 172
def connect_skeleton
Thread.abort_on_exception = true
populate_liststore
= h1('Upcoming exams') .align_to_the_left
.make_bold
hbox = gtk_hbox
hbox.minimal(image_starred, 10)
hbox.maximal(, 0)
minimal(hbox)
maximal(@scrolled_window, 2)
end
|
#create_liststore ⇒ Object
131
132
133
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 131
def create_liststore
@list_store = gtk_liststore(*([String] * 3))
end
|
114
115
116
117
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 114
def create_scrolled_window
@scrolled_window = gtk_scrolled_window(@tree_view) { :automatic_scrolling }
@scrolled_window.set_size_request(400, 200)
end
|
#create_skeleton ⇒ Object
104
105
106
107
108
109
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 104
def create_skeleton
@renderer = gtk_cell_renderer_text
create_liststore
create_treeview
create_scrolled_window
end
|
#create_treeview(i = @list_store) ⇒ Object
122
123
124
125
126
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 122
def create_treeview(i = @list_store)
@tree_view = gtk_treeview(i)
@tree_view.
@tree_view.set_font(USE_THIS_FONT_FOR_THE_TREE_VIEW)
end
|
#initialize(optional_file = nil, run_already = true) ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 51
def initialize(
optional_file = nil,
run_already = true
)
super(:vertical)
reset
run if run_already
end
|
#padding? ⇒ Boolean
90
91
92
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 90
def padding?
2
end
|
#populate_liststore ⇒ Object
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 138
def populate_liststore
@tree_view.(
'#', 'Name of the course', 'Exam Date'
)
index = 0
@dataset.each {|the_name_of_the_course, inner_hash| index += 1
name_of_the_course = the_name_of_the_course
exam_date = inner_hash['exams']
if exam_date.is_a? Array
exam_date = exam_date.first
end
iter = @list_store.append
iter[0] = index.to_s
iter[1] = name_of_the_course
if exam_date
iter[2] = exam_date.squeeze(' ')
else
e '(Upcoming exams in a gtk-tree-view) '\
'Problem with '+the_name_of_the_course.to_s
end
}
end
|
#reset ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 63
def reset
reset_the_internal_variables
@configuration = [true, __dir__, NAMESPACE]
@title = TITLE
set_width(WIDTH)
set_height(HEIGHT)
set_use_this_font(:dejavu_condensed_25)
@dataset = ::Studium.return_all_registered_upcoming_exams
append_project_css_file
increase_font_size
end
|
#run ⇒ Object
188
189
190
|
# File 'lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb', line 188
def run
create_skeleton_then_connect_skeleton
end
|