Class: Roebe::GUI::UniversalWidgets::TodoViewer
- Inherits:
-
Base
- Object
- Base
- Roebe::GUI::UniversalWidgets::TodoViewer
show all
- Includes:
- UniversalWidgets::BaseModule
- Defined in:
- lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb
Overview
Constant Summary
collapse
- TITLE =
'Todo Viewer'
- WIDTH =
'95% or minimum 1200px'
- HEIGHT =
'35% or minimum 250px'
- USE_THIS_FONT =
:hack_20
- LARGER_FONT =
:hack_24
- SMALLER_FONT =
:hack_28
- TODO_DIRECTORY =
'/home/x/data/personal/todo/'
Constants inherited
from Base
Base::COLOURS, Base::HOME_DIRECTORY_OF_USER_X, Base::N, Base::NAMESPACE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#actions, #append_this_onto_that_file, #append_what_into, #be_silent, #be_verbose?, #beautiful_url, #burlywood, #call_next, #chdir, #cheerful_guy, #cliner, #complex_esystem, #convert_global_env, #copy_directory, #copy_file, #cornflowerblue, #create_directory, #crimson, #current_month?, #current_time?, #current_year?, #cyan, #darkcyan, #darkgreen, #darkkhaki, #darkslateblue, #deeppink, #delete_symlink, #do_not_use_the_base_colours, #do_use_the_base_colours, #e, #ecomment, #editor_to_use?, #efancy, #eimp, #emphasis, #ensure_main_encoding, #ensure_utf_encoding, #eparse, #erev, #esteelblue, #etomato, #ewarn, #exit_program, #firebrick, #get_current_day, #get_current_month, #get_files_and_directories, #get_files_from, #get_german_name_for_this_weekday, #gold, #green, #grey, #hh_mm_ss, #hh_mm_ss_day_month_year, #home_dir?, #home_directory_of_user_x?, #infer_the_namespace, #internal_hash?, #is_a_directory?, #is_a_file?, #is_a_jpg_file?, #is_an_image_file?, #is_archive?, #is_audio_file?, #is_in_studium_dir?, #is_multimedia_file?, #is_on_roebe?, #is_on_windows?, #is_studium_available?, #is_symlink?, #is_this_a_ruby_file?, #is_video_file?, #iso_encoding?, #le, #left_colour, #lightblue, #lightgreen, #lightseagreen, #lightsteelblue, #lime, #limegreen, #localhost_to_data, #log_directory?, #main_encoding?, #mediumorchid, #mediumpurple, #mediumseagreen, #mediumslateblue, #mediumspringgreen, #mediumturquoise, #mkdir_p, #mv, #n_days_in_this_month, #n_pages_in_this_pdf_file?, #namespace?, #no_file_exists_at, #ogrey, #olive, #olivedrab, #open_in_browser, #opne, #opnesystem, #opnn, #orange, #orchid, #orev, #palegoldenrod, #palevioletred, #pink, #powderblue, #programs_dir?, #project_base_dir?, #random_html_colour, #rds, #read_file_in_iso_encoding, #read_file_via_the_default_encoding, #read_lines_via_iso_encoding, #readlines_with_main_encoding, #red, #register_sigint, #remove, #remove_directory, #remove_file, #rename_kde_konsole_tab, #replace_localhost_with_data, #report_pwd, #require_rescue, #reset_the_internal_hash, #return_all_directories_from_this_directory, #return_all_files_from_this_directory, #return_current_directory, #return_dd_mm_yyyy, #return_file_or_directory_of, #return_files_from_pwd, #return_last_part_of_the_current_directory, #return_utc, #rev, #right_arrow?, #right_colour, #roebe_log_directory?, #rosybrown, #royalblue, #ruby_base_directory?, #run_in_background, #run_rcfiles_then_run_ata_via_qdbus, #sandybrown, #sdir, #seagreen, #set_be_verbose, #set_xorg_buffer, #sfancy, #sfile, #show_help, #silent_redirection?, #simp, #simple_esystem, #skyblue, #slateblue, #slategray, #springgreen, #steelblue, #string_italic, #swarn, #symlink, #teal, #temp_dir?, #to_camelcase, #to_counted_hash, #tomato, #touch, #try_to_require_the_beautiful_url_gem, #try_to_require_the_html_template, #try_to_require_the_open_gem, #try_to_require_the_program_information_gem, #try_to_require_the_xorg_buffer, #use_colours?, #verbose_truth, #weekday?, #word_wrap, #write_what_into, #yellow
#append_onto_the_commandline_arguments, #clear_commandline_arguments, #commandline_arguments?, #commandline_arguments_as_string?, #commandline_arguments_without_leading_hyphens?, #first_argument?, #first_argument_without_leading_hyphens?, #has_an_argument_been_passed?, #remove_hyphened_arguments_from_the_commandline_arguments, #return_commandline_arguments_with_leading_hyphens, #second_argument?, #set_commandline_arguments
Constructor Details
#initialize(commandline_arguments = nil, run_already = true) ⇒ TodoViewer
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 73
def initialize(
commandline_arguments = nil,
run_already = true
)
super(:vertical) if use_gtk3?
determine_the_GUI_to_be_used(commandline_arguments) reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
334
335
336
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 334
def self.[](i = ARGV)
new(i)
end
|
.run(i = ARGV) ⇒ Object
#
Roebe::GUI::Gtk::TodoViewer.run
#
319
320
321
322
323
324
325
326
327
328
329
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 319
def self.run(
i = ARGV
)
require 'gtk_paradise/run'
_ = ::Roebe::GUI::Gtk::TodoViewer.new(i)
r = ::Gtk.run
r << _
r.automatic_size
r.automatic_title
r.top_left_then_run
end
|
Instance Method Details
#border_size? ⇒ Boolean
305
306
307
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 305
def border_size?
2
end
|
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag)
#
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 251
def connect_the_skeleton
abort_on_exception
_ = return_top_bar
_.add(@button_open_file)
_.add(@button_save)
_.add(@button_load_data)
vbox1 = create_vbox
vbox1.minimal(_)
@text_buffer = create_text_buffer
if @text_buffer
text_viewer = create_text_view(@text_buffer)
else
text_viewer = create_text_view
end
scrolled_window = create_scrolled_window(text_viewer) { :up_and_down }
scrolled_window.bblack2
scrolled_window.pad4px
scrolled_window.yellow_background
scrolled_window.width_height(600, 600)
vbox1.minimal(scrolled_window, 8)
window = create_window_or_runner(vbox1)
window.set_title(title?)
window.set_font(font?)
window.set_size_request(width?, height?)
window.set_padding(padding?)
window.set_border_size(border_size?)
window.show_all
do_read_in_data_from_this_todo_file
run_main
end
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 209
def create_the_buttons
@button_save = button('_Save')
@button_save.clear_background
@button_save.on_clicked { save_data }
@button_save.set_size_request(80,50)
@button_save.modify_background(:normal, :ivory)
@button_save.modify_background(:prelight, :lightblue)
@button_save.modify_background(:active, :grey)
@button_save.hint = 'Click this button to save the '\
'content to a file.'
@button_load_data = button('_Reload the todo file')
@button_load_data.clear_background
@button_load_data.on_clicked { load_data }
@button_load_data.modify_background(:normal, :ivory)
@button_load_data.modify_background(:prelight, :lightblue)
@button_load_data.modify_background(:active, :grey)
@button_open_file = button('_Open file')
@button_open_file.clear_background
@button_open_file.hint = 'Open a local file'
@button_open_file.modify_background(:normal, :ivory)
@button_open_file.modify_background(:prelight, :lightblue)
@button_open_file.modify_background(:active, :grey)
@button_open_file.on_clicked {
do_open_a_local_file
}
return_all_buttons.each {|this_button|
this_button.bblack1
}
end
|
#create_the_skeleton ⇒ Object
#
create_skeleton (create tag, skeleton tag)
#
188
189
190
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 188
def create_the_skeleton
create_the_buttons
end
|
#do_open_a_local_file ⇒ Object
171
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 171
def do_open_a_local_file
_ = Gtk::BaseModuleBox.new.new_file_chooser_dialog {{
filter_for: '.md',
additional_folders: main_dir?,
start_dir: main_dir?
}}
filename = _.filename?
if File.exist? filename
load_data(filename)
else
e 'No file exists at '+filename+'.'
end
end
|
#do_read_in_data_from_this_todo_file(this_todo_file = :pc) ⇒ Object
#
do_read_in_data_from_this_todo_file
#
195
196
197
198
199
200
201
202
203
204
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 195
def do_read_in_data_from_this_todo_file(
this_todo_file = :pc )
this_todo_file = "#{TODO_DIRECTORY}#{this_todo_file}.md"
if File.exist? this_todo_file
@work_on_this_file = this_todo_file
_ = File.read(@work_on_this_file)
@text_buffer.set_text(_.to_s) if @text_buffer
end
end
|
#load_data(this_file = main_file?
) ⇒ Object
#
load_data
Used to read the content of the TODO file.
#
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 155
def load_data(
this_file = main_file?
)
if File.exist?(this_file)
this_file_content = File.read(this_file)
main_buffer?.text = this_file_content else
e 'No file exists at '+this_file
end
end
|
#main_buffer? ⇒ Boolean
122
123
124
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 122
def main_buffer?
@text_buffer
end
|
#main_dir? ⇒ Boolean
129
130
131
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 129
def main_dir?
TODO_DIRECTORY
end
|
#padding? ⇒ Boolean
298
299
300
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 298
def padding?
0
end
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 89
def reset
super() if respond_to?(:super)
reset_the_base_module
reset_the_internal_variables
infer_the_namespace
@configuration = [true, __dir__, namespace?]
title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
@work_on_this_file = nil
if use_gtk3?
append_project_css_file
use_gtk_paradise_project_css_file
end
infer_the_size_automatically
end
|
#reset_the_shared_module ⇒ Object
#
reset_the_shared_module
#
116
117
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 116
def reset_the_shared_module
end
|
312
313
314
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 312
def run
run_super
end
|
#save_data ⇒ Object
#
save_data
stores to file
#
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 138
def save_data
if @work_on_this_file
opn; e 'Saving buffer to '+@work_on_this_file.to_s+' next.'
SaveFile.write_what_into(
@text_buffer.text?,
@work_on_this_file
)
else
opn; e 'No file has been assigned yet.'
end
end
|
#work_on_this_file? ⇒ Boolean
Also known as:
main_file?
291
292
293
|
# File 'lib/roebe/gui/universal_widgets/todo_viewer/todo_viewer.rb', line 291
def work_on_this_file?
@work_on_this_file
end
|