Class: BackupParadise::GUI::UniversalWidgets::SimpleBackupWidget
- Inherits:
-
Base
- Object
- Base
- BackupParadise::GUI::UniversalWidgets::SimpleBackupWidget
show all
- Includes:
- UniversalWidgets::BaseModule
- Defined in:
- lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb
Overview
Constant Summary
collapse
- ARRAY_PREDEFINED_DEVICES =
#
ARRAY_PREDEFINED_DEVICES
#
[
ENV['USB1'],
ENV['USB2'],
ENV['USB3'],
ENV['USB4'],
ENV['USB5'],
ENV['FESTPLATTE1']
]
- USE_THESE_CSS_RULES =
'
.dotted_steelblue_border {
border: 2px dotted steelblue;
}
.the_backup_button {
border: 3px dotted royalblue;
padding: 8px;
margin: 4px;
color: darkgreen;
font-weight: bold;
}
.the_backup_button:hover {
color: forestgreen;
font-weight: bold;
}
.the_backup_button_for_ingrid {
border: 2px dotted royalblue;
padding: 5px;
margin: 2px;
color: royalblue;
font-weight: bold;
}
.the_backup_button_for_ingrid_button:hover {
color: steelblue;
font-weight: bold;
}
'
- TITLE =
'💾 Simple Backup Widget 💾'
- WIDTH =
'82% or minimum 1280px'
- HEIGHT =
'30% or minimum 400px'
- USE_THIS_FONT =
:dejavu_condensed_19
- LARGER_FONT =
:dejavu_condensed_21
- SMALLER_FONT =
:dejavu_condensed_18
- USE_THIS_MONOSPACED_FONT =
#
USE_THIS_MONOSPACED_FONT
#
:hack_16
Constants inherited
from Base
Base::NAMESPACE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#all_important_directories?, #append_what_into, #are_we_on_windows?, #cd_to_the_mounted_device, #chdir, #cliner, #copy_file, #copy_recursively, #create_directory, #cyan, #data_directory?, #dd_mm_yyyy, #delete_files, #delete_symlink, #do_symlink, #e, #esystem, #exit_program, #has_superuser_abilities?, #hh_mm_ss, #home_dir_of_user_x?, #is_on_roebe?, #is_symlink?, #lightcoral, #n_files_in?, #no_file_exists_at, #no_such_directory_exists_at, #no_target_at, #opne, #opnn, #orangered, #print_rev, #rds, #register_sigint, #remove, #remove_directory, #remove_file, #rename, #rename_tab, #report_total_size_of, #return_all_symlinks_from_this_directory, #return_current_date_and_time, #rev, #rosybrown, #royalblue, #sdir, #seagreen, #set_target_mountpoint, #sfancy, #sfile, #simp, #size?, #steelblue, #tab_title, #target_hdd_does_not_have_enough_space_left?, #target_mountpoint?, #tomato, #use_colours?, #use_system_cp?, #use_this_program_to_rename_tabs?, #write_what_into
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ SimpleBackupWidget
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 140
def initialize(
commandline_arguments = ARGV,
run_already = true
)
super(:vertical) if use_gtk3?
determine_the_GUI_to_be_used(commandline_arguments) reset
set_commandline_arguments(
commandline_arguments
)
on_delete_event_quit_the_application
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
825
826
827
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 825
def self.[](i = ARGV)
new(i)
end
|
.run(i = ARGV) ⇒ Object
807
808
809
810
811
812
813
814
815
816
817
818
819
820
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 807
def self.run(
i = ARGV
)
require 'gtk_paradise/run'
_ = ::BackupParadise::GUI::Gtk::SimpleBackupWidget.new(i)
r = ::Gtk.run
r << _
_.set_parent_widget(r)
r.automatic_size_then_automatic_title
r.enable_quick_exit
r.set_background :white
r.is_resizable r.top_left_then_run
end
|
Instance Method Details
604
605
606
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 604
def backup_audio_button?
@button_backup_audio
end
|
618
619
620
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 618
def backup_button?
@button_backup
end
|
611
612
613
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 611
def backup_ingrid_button?
@button_ingrid
end
|
#backup_ingrid_directory ⇒ Object
Also known as:
do_backup_for_ingrid
#
backup_ingrid_directory
This is a method for a custom-backup. Other users won’t need to use this method.
#
#border_size? ⇒ Boolean
255
256
257
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 255
def border_size?
0
end
|
639
640
641
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 639
def choose_file_button?
@button_choose_file
end
|
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag)
#
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 832
def connect_the_skeleton
abort_on_exception
outer_vbox = create_vbox
= { :with_close_button_and_inferred_title }
.spacing = 10
.add_left(@button_choose_file)
.add_left(@button_backup_audio)
@spinner = default_spinner
@spinner.is_inactive
.add_right(@spinner)
button = icon_theme_image('daytime-sunset-symbolic.symbolic')
button.hint = 'Click this icon to show which devices are mounted and '\
'update the combo-box showing all mounted devices.'
button.on_clicked {
scan_for_mountpoints_then_update_the_appropriate_combo_box
}
.add_left(button)
outer_vbox.minimal(, 1)
outer_vbox.minimal(horizontal_separator, 1)
outer_vbox.minimal(@grid, 1)
outer_vbox.minimal(horizontal_separator, 1)
hbox = create_hbox
_ = BackupParadise.project_base_directory?+'images/right_arrow.png'
if File.exist? _
hbox.minimal(image(_), 5)
end
hbox.maximal(@button_backup)
outer_vbox.minimal(hbox)
outer_vbox.minimal(horizontal_separator)
if is_on_roebe?
outer_vbox.minimal(@button_ingrid)
outer_vbox.minimal(horizontal_separator)
end
outer_vbox.minimal(@label_showing_results)
outer_vbox.minimal(horizontal_separator)
window = create_window_or_runner
window << outer_vbox
properly_prepare_this_window(window,
{
title: title?,
font: font?,
width: width?,
height: height?,
padding: padding?,
border_size: border_size?
}
)
window.show_all
window.top_left
do_all_startup_related_actions
run_main
end
|
#copy_from_to(from = from?,
, to = onto?
) ⇒ Object
#
copy_from_to
This is the method that can be used for backing up the data.
#
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 540
def copy_from_to(
from = from?,
to = onto?
)
unless File.directory? from
e "#{sfile(from)} should be a directory."
end
if from == 'C/ingrid/'
BackupParadise::Windows.backup_ingrid_directory
elsif File.file?(from)
do_transfer_a_single_file
else
if from.is_a?(String) and from.start_with?(':')
case from.delete(':').to_sym
when :everything
if @dataset_from_the_config_file
i = @dataset_from_the_config_file['backup_these_directories']
BackupParadise::Actions.backup {{
backup_these_directories: i,
where_to: to
}}
else
e 'No file called config.yml was found. Defaulting to the'
e 'current working directory thus.'
i = File.absolute_path("#{Dir.pwd}/")
end
end
else
begin
Thread.new {
@spinner.is_active FileUtils.cp_r(from, to)
pop_up_this_text_over_that_widget(
return_backup_complete_message, @button_backup
)
@spinner.stop_spinning
}
rescue Exception => error
pp error
end
end
end
end
|
#copy_this_file(from, b) ⇒ Object
408
409
410
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 408
def copy_this_file(from, b)
::BackupParadise.copy_this_file(from, b)
end
|
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 364
def create_file_chooser_dialog_widget
@file_chooser_dialog = ::Gtk::FileChooserDialog.new(
self: self,
title: 'Choose a file or directory',
action: ::Gtk::FileChooserAction::OPEN,
buttons: [[::Gtk::Stock::OPEN, ::Gtk::ResponseType::ACCEPT],
[::Gtk::Stock::CANCEL, ::Gtk::ResponseType::CANCEL]]
)
if File.directory? '/home/Temp/'
@file_chooser_dialog.add_shortcut_folder('/home/Temp/')
end
if File.directory? '/home/x/Temp/'
@file_chooser_dialog.add_shortcut_folder('/home/x/Temp/')
end
if File.directory? HOME_DIRECTORY_OF_THE_USER_X+'data/'
@file_chooser_dialog.add_shortcut_folder(HOME_DIRECTORY_OF_THE_USER_X+'data/')
end
if @dataset_from_the_config_file and
@dataset_from_the_config_file.has_key?('local_audio_directory')
@file_chooser_dialog.add_shortcut_folder(
@dataset_from_the_config_file['local_audio_directory'].to_s
)
end
@file_chooser_dialog.add_shortcut_folder('/Ingrid')
@file_chooser_dialog.current_folder = Dir.pwd
@file_chooser_dialog.do_show_hidden_files
end
|
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 262
def create_the_backup_audio_button
@button_backup_audio = button('Backup Audio')
@button_backup_audio.hint = 'This button is ad-hoc code to quickly '\
'copy all local songs on my home layout. You can modify this '\
'by modifying the config.yml file and changing the entry called '\
'<b>local_audio_directory</b>.'
@button_backup_audio.on_clicked {
if @dataset_from_the_config_file
local_audio_directory = @dataset_from_the_config_file['local_audio_directory'].to_s
entry_left?.set_text(
local_audio_directory
)
end
do_backup_my_songs
}
end
|
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 288
def create_the_backup_button
@button_backup = button('_Backup the data', self, :use_mnemonics) {
:do_backup_the_data
}
@button_backup.clear_background
@button_backup.on_hover(:lightblue)
@button_backup.pad8px
@button_backup.css_class('the_backup_button')
@button_backup.set_size_request(16, 25)
@button_backup.set_border_width(2)
@button_backup.hint =
"Click this button to <b>backup your data</b>. This works for both "\
"directories, as well as individual files and special instructions. "\
"Special instructions are indicated via a leading : character on "\
"the top-left hand side.\n\n"\
"Make sure that the USB device(s) are properly connected before "\
"clicking any button, though."
end
|
653
654
655
656
657
658
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 653
def create_the_buttons
create_the_file_chooser_button
create_the_backup_button
create_the_backup_audio_button
create_the_ingrid_button if is_on_roebe?
end
|
#create_the_combo_boxes ⇒ Object
#
create_the_combo_boxes (combo tag)
#
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 706
def create_the_combo_boxes
@combo_box_backup_from = combo_box
@combo_box_backup_from.bblack1
@combo_box_backup_from.set_border_width(2)
_ = BackupParadise.backup_these_directories?.map {|entry| "#{entry}/".squeeze('/') }
_.prepend(':everything')
_.prepend(':ingrid') if is_on_roebe?
@combo_box_backup_from.populate(_)
@combo_box_backup_from.the_first_entry_is_active
@combo_box_backup_from.hint =
':everything means to backup the default action, as-is. If you '\
'need a more fine-tuned level of control then simply backup only '\
'some directories, or use the entry to the right side of this '\
'combo box to backup only individual directories or files.'
@combo_box_backup_onto = combo_box
@combo_box_backup_onto.bblack1
@combo_box_backup_onto.set_border_width(2)
scan_for_mountpoints_then_update_the_appropriate_combo_box
end
|
#create_the_entries ⇒ Object
#
create_the_entries (entries tag)
#
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 485
def create_the_entries
@entry1_for_the_backup_from_value = entry
@entry1_for_the_backup_from_value.pad4px
@entry1_for_the_backup_from_value.bblack1
@entry1_for_the_backup_from_value.very_light_yellow_background
@entry2_for_the_backup_onto_value = entry
@entry2_for_the_backup_onto_value.pad4px
@entry2_for_the_backup_onto_value.bblack1
@entry2_for_the_backup_onto_value.very_light_yellow_background
@entry2_for_the_backup_onto_value.width_height(250, 50)
end
|
625
626
627
628
629
630
631
632
633
634
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 625
def create_the_file_chooser_button
@button_choose_file = button('Choose file')
@button_choose_file.on_clicked {
create_file_chooser_dialog_widget
run_file_chooser_dialog
}
end
|
#create_the_grid ⇒ Object
#
create_the_grid (grid tag)
#
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 670
def create_the_grid
@grid = default_grid
@grid.pad10px
@grid.css_class('dotted_steelblue_border')
@grid.set_size_request(100, 50)
@grid.row_spacing = 5
@grid.line_spacing = 5
label_backup_from = text('Backup from:')
label_backup_from.make_bold
label_backup_from.hint = 'Input which directory '\
'you wish to back up. Use the combo-box entry '\
'below this widget, or the entry below '\
'that combo-box.'
@grid.left(label_backup_from)
label_backup_onto = text('Backup onto:')
label_backup_onto.make_bold
label_backup_onto.hint = 'Input the target device onto which we will '\
'copy the data onto.'
@grid.right(label_backup_onto)
@grid.left(@combo_box_backup_from)
@grid.right(@combo_box_backup_onto)
@grid.left(@entry1_for_the_backup_from_value)
@grid.right(@entry2_for_the_backup_onto_value)
end
|
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 900
def create_the_ingrid_button
@button_ingrid = button('Backup _ingrid', self, :use_mnemonics) {
:do_backup_for_ingrid
}
@button_ingrid.clear_background
@button_ingrid.css_class('the_backup_button_for_ingrid')
@button_backup.on_hover(:lightblue)
@button_ingrid.pad8px
@button_ingrid.set_size_request(16, 25)
@button_ingrid.set_border_width(2)
@button_ingrid.hint = 'This will backup c:\ingrid to '\
'the appropriate external USB device.'
end
|
#create_the_label_showing_results ⇒ Object
#
create_the_label_showing_results
#
646
647
648
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 646
def create_the_label_showing_results
@label_showing_results = label
end
|
#create_the_skeleton ⇒ Object
#
create_the_skeleton (create tag, skeleton tag)
#
789
790
791
792
793
794
795
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 789
def create_the_skeleton
create_the_label_showing_results
create_the_buttons
create_the_entries
create_the_combo_boxes
create_the_grid
end
|
892
893
894
895
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 892
def do_all_startup_related_actions
sync_the_combo_box_values_onto_the_entries_below
do_handle_the_proper_syncing_when_the_combo_box_entries_are_changed
end
|
#do_backup_my_songs(to = ("#{onto?}#{File.basename(entry_left?.text?)}/").squeeze('/')) ⇒ Object
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 452
def do_backup_my_songs(
to =
("#{onto?}#{File.basename(entry_left?.text?)}/").squeeze('/')
)
to.squeeze!('/')
Thread.new {
BackupParadise.simple_backup(
entry_left?.text?, to
)
pop_up_this_text_over_that_widget(
return_backup_complete_message,
@button_backup_audio
)
}
end
|
#do_backup_the_data(from = from?,
, to = to?
) ⇒ Object
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 313
def do_backup_the_data(
from = from?,
to = to?
)
@label_showing_results.set_text(
'Command that will be run: '+"\n\n"+
' <b>cp -rv '+from+' '+to+"</b>\n"
)
@label_showing_results.do_markify
Thread.new {
e 'Backing up the data next, from `'+
sfile(from)+'` to `'+sfile(to)+'`.'
copy_from_to(from, to)
}
end
|
#do_handle_the_proper_syncing_when_the_combo_box_entries_are_changed ⇒ Object
#
do_handle_the_proper_syncing_when_the_combo_box_entries_are_changed
#
766
767
768
769
770
771
772
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 766
def do_handle_the_proper_syncing_when_the_combo_box_entries_are_changed
sync_connect(@combo_box_backup_from, entry1?)
sync_connect(@combo_box_backup_onto, entry2?)
end
|
#do_transfer_a_single_file(_ = entry_left?.text?.strip, target = onto?
) ⇒ Object
#
do_transfer_a_single_file
#
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 422
def do_transfer_a_single_file(
_ = entry_left?.text?.strip,
target = onto?
)
target = target.dup if target.frozen?
target << File.basename(_)
if _.empty?
e 'Please supply a file to transfer.'
else
e "Now trying to copy #{_} to #{target}."
Thread.new {
copy_this_file(_, target)
pop_up_this_text_over_that_widget(return_backup_complete_message, @button_backup)
}
end
end
|
#entry1? ⇒ Boolean
Also known as:
entry_left?
478
479
480
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 478
def entry1?
@entry1_for_the_backup_from_value
end
|
#entry2? ⇒ Boolean
759
760
761
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 759
def entry2?
@entry2_for_the_backup_onto_value
end
|
#favicon? ⇒ Boolean
191
192
193
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 191
def favicon?
:tabble
end
|
#from?(i = @entry1_for_the_backup_from_value.text?) ⇒ Boolean
#
from?
This method has to keep in mind that Strings such as “:ingrid” are used. This indicates a symbol which has to be treated in a special manner.
Furthermore, only directories will have a ‘/’ appended; files must not have a ‘/’ appended.
#
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 513
def from?(
i = @entry1_for_the_backup_from_value.text?
)
if i.is_a?(String) and i.start_with?(':')
case i.delete(':').to_sym
when :ingrid
i = 'C/ingrid/'
end
end
if i.is_a?(String) and i.frozen?
i = i.dup
end
i.squeeze!('/')
if File.directory?(i) and !i.end_with?('/')
i << '/'
end
return i
end
|
#handle_CSS_rules ⇒ Object
#
handle_CSS_rules (CSS tag)
#
219
220
221
222
223
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 219
def handle_CSS_rules
use_gtk_paradise_project_css_file
append_project_css_file
more_CSS_then_apply_it(USE_THESE_CSS_RULES)
end
|
#larger_font? ⇒ Boolean
415
416
417
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 415
def larger_font?
LARGER_FONT
end
|
#main_target? ⇒ Boolean
#
main_target?
This method will “return” our main target.
#
445
446
447
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 445
def main_target?
@backup_to_this_target.text?
end
|
#onto? ⇒ Boolean
Also known as:
to?
663
664
665
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 663
def onto?
return "#{@entry2_for_the_backup_onto_value.text?}/".squeeze('/')
end
|
#padding? ⇒ Boolean
248
249
250
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 248
def padding?
0
end
|
#reset ⇒ Object
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 160
def reset
super() if respond_to?(:super)
reset_the_shared_module 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)
if use_gtk3?
handle_CSS_rules
end
infer_the_size_automatically
end
|
#reset_the_shared_module ⇒ Object
#
reset_the_shared_module
This method can be used for ruby-gtk3 and ruby-libui, among other toolkits.
#
231
232
233
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 231
def reset_the_shared_module
@file_chooser_dialog = nil
@dataset_from_the_config_file = nil
if File.exist? BackupParadise.file_config?
@dataset_from_the_config_file = YAML.load_file(BackupParadise.file_config?)
end
end
|
#return_backup_complete_message ⇒ Object
#
return_backup_complete_message
#
342
343
344
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 342
def return_backup_complete_message
'Backup complete! Time finish at: '+time_now?
end
|
#run ⇒ Object
800
801
802
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 800
def run
run_super
end
|
#run_file_chooser_dialog(_ = @file_chooser_dialog) ⇒ Object
#
run_file_chooser_dialog
#
349
350
351
352
353
354
355
356
357
358
359
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 349
def run_file_chooser_dialog(
_ = @file_chooser_dialog
)
if _ and (_.run == ::Gtk::ResponseType::ACCEPT)
filename = _.filename
e "filename = #{filename}"
e "uri = #{_.uri}"
entry_left?.set_text(filename)
@file_chooser_dialog.destroy
end
end
|
#scan_for_mountpoints_then_update_the_appropriate_combo_box ⇒ Object
#
scan_for_mountpoints_then_update_the_appropriate_combo_box
#
777
778
779
780
781
782
783
784
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 777
def scan_for_mountpoints_then_update_the_appropriate_combo_box
if Object.const_defined? :Mountpoints
@combo_box_backup_onto.clear_old_datapoints
@combo_box_backup_onto.populate(Mountpoints[])
@combo_box_backup_onto.the_first_entry_is_active
sync_the_second_entry
end
end
|
#smaller_font? ⇒ Boolean
198
199
200
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 198
def smaller_font?
SMALLER_FONT
end
|
#sync_the_combo_box_values_onto_the_entries_below ⇒ Object
#
sync_the_combo_box_values_onto_the_entries_below
#
741
742
743
744
745
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 741
def sync_the_combo_box_values_onto_the_entries_below
_ = @combo_box_backup_from.text?.to_s
entry1?.set_text(_)
sync_the_second_entry
end
|
#sync_the_second_entry ⇒ Object
#
sync_the_second_entry
#
750
751
752
753
754
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 750
def sync_the_second_entry
entry2?.set_text(
@combo_box_backup_onto.text?.to_s
)
end
|
#time_now? ⇒ Boolean
471
472
473
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 471
def time_now?
return ::Time.now.strftime('%d.%m.%Y, %H:%M:%S')
end
|
#update_fdisk ⇒ Object
#
update_fdisk
Use this if you wanna get new fdisk information.
Or use this:
`fdisk -l`.gsub!(%r[^(!?/dev).*\n], '')
#
212
213
214
|
# File 'lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb', line 212
def update_fdisk
return `fdisk -l`.split("\n").delete_if { |line| line !~ /^\/dev/ }.join("\n")
end
|