Class: Roebe::GUI::UniversalWidgets::Md5Comparer
- Inherits:
-
Base
- Object
- Base
- Roebe::GUI::UniversalWidgets::Md5Comparer
show all
- Includes:
- UniversalWidgets::BaseModule
- Defined in:
- lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb
Overview
Constant Summary
collapse
- TITLE =
'MD5sum comparer'
- WIDTH =
'55% or minimum 500px'
- HEIGHT =
'35% or minimum 250px'
- USE_THIS_FONT =
:dejavu_condensed_18
- LARGER_FONT =
:dejavu_condensed_22
- SMALLER_FONT =
:dejavu_condensed_16
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) ⇒ Md5Comparer
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 60
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
377
378
379
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 377
def self.[](i = ARGV)
new(i)
end
|
.run(i = ARGV) ⇒ Object
#
Roebe::GUI::Gtk::Md5Comparer.run
#
362
363
364
365
366
367
368
369
370
371
372
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 362
def self.run(
i = ARGV
)
require 'gtk_paradise/run'
_ = ::Roebe::GUI::UniversalWidgets::Md5Compare.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
348
349
350
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 348
def border_size?
4
end
|
273
274
275
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 273
def button1
e 'This is button1.'
end
|
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag)
#
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 298
def connect_the_skeleton
abort_on_exception
outer_vbox = create_vbox
outer_vbox.add(@header_text)
outer_vbox.show_all
@grid.left(text2?)
@grid.right(entry1?)
@grid.new_row
if use_gtk3?
file_chooser_button = ::Gtk::BaseModuleBox.new.create_file_chooser_button {{
connect_to_this_widget: @entry2, is_an_accelerator: true
}}
file_chooser_button.clear_background
file_chooser_button.bblack1
file_chooser_button.on_hover(:lightblue)
end
@grid.left(text3?)
@grid.middle(entry2?)
@grid.right(file_chooser_button)
@grid.new_row
@grid.left(text4?)
@grid.middle(entry3?)
@grid.right(@button_evaluate_the_md5sum)
outer_vbox.maximal(@grid, 25)
window = create_window_or_runner(outer_vbox)
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
run_main
end
|
#create_entry1 ⇒ Object
137
138
139
140
141
142
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 137
def create_entry1
@entry1 = entry
end
|
#create_entry2(optional_hash = {}) ⇒ Object
123
124
125
126
127
128
129
130
131
132
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 123
def create_entry2(optional_hash = {})
if optional_hash.is_a?(Hash) and optional_hash.has_key?(:id)
@entry2 = entry(optional_hash)
else
@entry2 = entry
end
end
|
#create_entry3 ⇒ Object
113
114
115
116
117
118
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 113
def create_entry3
@entry3 = entry
end
|
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 192
def create_the_buttons
@button_evaluate_the_md5sum = button('_Evaluate the md5sum', self) {
:the_button_evaluate_the_md5sum_was_clicked
}
@button_evaluate_the_md5sum.hint =
"Click this button to evaluate the md5sum of the .iso file "\
"stored ^^^ above.\n\nThis may take a while, so the application "\
"may freeze.\n"
@button_evaluate_the_md5sum.clear_background
@button_evaluate_the_md5sum.bblack1
@button_evaluate_the_md5sum.on_hover(:lightblue)
end
|
#create_the_entries ⇒ Object
158
159
160
161
162
163
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 158
def create_the_entries
create_entry1
create_entry2
create_entry3
do_style_the_entries_in_a_uniform_manner
end
|
#create_the_grid ⇒ Object
266
267
268
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 266
def create_the_grid
@grid = default_grid
end
|
168
169
170
171
172
173
174
175
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 168
def
@header_text = left_aligned_label('Compare the MD5 sum of .iso files')
@header_text.make_selectable if use_gtk3?
@header_text.font = LARGER_FONT
end
|
#create_the_skeleton ⇒ Object
#
create_skeleton (create tag, skeleton tag)
#
102
103
104
105
106
107
108
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 102
def create_the_skeleton
create_the_entries
create_the_grid
create_the_buttons
@hbox = create_hbox
end
|
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 280
def do_style_the_entries_in_a_uniform_manner
[
@entry1,
@entry2,
@entry3
].each {|this_entry|
this_entry.bblack1
this_entry.very_light_yellow_background
this_entry.pad8px
this_entry.center
this_entry.font = SMALLER_FONT
this_entry.width_height(500, 30)
}
end
|
#entry1? ⇒ Boolean
250
251
252
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 250
def entry1?
@entry1
end
|
#entry2? ⇒ Boolean
236
237
238
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 236
def entry2?
@entry2
end
|
#entry3? ⇒ Boolean
243
244
245
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 243
def entry3?
@entry3
end
|
#padding? ⇒ Boolean
341
342
343
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 341
def padding?
6
end
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 76
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)
use_gtk_paradise_project_css_file
infer_the_size_automatically
end
|
#reset_the_shared_module ⇒ Object
#
reset_the_shared_module
#
96
97
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 96
def reset_the_shared_module
end
|
#return_the_result_of_calculating_the_md5sum(i) ⇒ Object
#
return_the_result_of_calculating_the_md5sum
#
180
181
182
183
184
185
186
187
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 180
def return_the_result_of_calculating_the_md5sum(i)
if is_on_windows?
md5sum_value = `certutil -hashfile #{i} MD5`.strip
else
md5sum_value = `md5sum #{i}`.strip
end
return md5sum_value
end
|
355
356
357
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 355
def run
run_super
end
|
#text2? ⇒ Boolean
147
148
149
150
151
152
153
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 147
def text2?
text = left_aligned_text('Here you can enter the MD5 sum which '\
'the .iso file <b>should</b> have: ')
text.font = SMALLER_FONT
text.do_markify
return text
end
|
#text3? ⇒ Boolean
227
228
229
230
231
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 227
def text3?
text = left_aligned_text('Here you select the file to check its md5sum: ')
text.font = SMALLER_FONT
return text
end
|
#text4? ⇒ Boolean
257
258
259
260
261
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 257
def text4?
text = left_aligned_text('The md5sum of the .iso file is: ')
text.font = SMALLER_FONT
return text
end
|
211
212
213
214
215
216
217
218
219
220
221
222
|
# File 'lib/roebe/gui/universal_widgets/md5_comparer/md5_comparer.rb', line 211
def the_button_evaluate_the_md5sum_was_clicked
_ = @entry2.text?
if _ and File.exist?(_) and !_.empty? Thread.new {
md5sum_value = return_the_result_of_calculating_the_md5sum(_)
if md5sum_value.include? ' '
md5sum_value = md5sum_value.split(' ').first.strip
end
@entry3.set_text(md5sum_value)
}.join
end
end
|