backup_paradise 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of backup_paradise might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +408 -0
- data/backup_paradise.gemspec +50 -0
- data/bin/backup_for_ingrid +10 -0
- data/bin/backup_paradise +7 -0
- data/bin/windows_backup_paradise +9 -0
- data/doc/README.gen +368 -0
- data/doc/TODO.md +130 -0
- data/lib/backup_paradise/actions/README.md +2 -0
- data/lib/backup_paradise/actions/backup.rb +62 -0
- data/lib/backup_paradise/base/base.rb +502 -0
- data/lib/backup_paradise/base/colours.rb +137 -0
- data/lib/backup_paradise/base/namespace.rb +16 -0
- data/lib/backup_paradise/base/tab.rb +47 -0
- data/lib/backup_paradise/colours/colours.rb +88 -0
- data/lib/backup_paradise/constants/constants.rb +162 -0
- data/lib/backup_paradise/gui/glimmer/libui/backup_for_ingrid/backup_for_ingrid.rb +87 -0
- data/lib/backup_paradise/gui/gtk2/OLD_backup.rb +220 -0
- data/lib/backup_paradise/gui/gtk3/simple_backup_widget/create.rb +70 -0
- data/lib/backup_paradise/gui/gtk3/simple_backup_widget/misc.rb +33 -0
- data/lib/backup_paradise/gui/gtk3/simple_backup_widget/simple_backup_widget.rb +160 -0
- data/lib/backup_paradise/gui/libui/backup_for_ingrid/backup_for_ingrid.rb +99 -0
- data/lib/backup_paradise/gui/libui/simple_backup_widget/simple_backup_widget.rb +119 -0
- data/lib/backup_paradise/gui/shared_code/simple_backup_widget/simple_backup_widget_module.rb +587 -0
- data/lib/backup_paradise/gui/tk/backup.rb +108 -0
- data/lib/backup_paradise/images/BACKUP_IMAGE.png +0 -0
- data/lib/backup_paradise/images/right_arrow.png +0 -0
- data/lib/backup_paradise/project/project.rb +40 -0
- data/lib/backup_paradise/requires/require_the_backup_paradise_project.rb +18 -0
- data/lib/backup_paradise/requires/require_yaml.rb +7 -0
- data/lib/backup_paradise/tab/tab.rb +87 -0
- data/lib/backup_paradise/toplevel_methods/cliner.rb +16 -0
- data/lib/backup_paradise/toplevel_methods/config.rb +86 -0
- data/lib/backup_paradise/toplevel_methods/create_and_remove.rb +63 -0
- data/lib/backup_paradise/toplevel_methods/e.rb +16 -0
- data/lib/backup_paradise/toplevel_methods/esystem.rb +19 -0
- data/lib/backup_paradise/toplevel_methods/files_and_directories.rb +181 -0
- data/lib/backup_paradise/toplevel_methods/help.rb +93 -0
- data/lib/backup_paradise/toplevel_methods/misc.rb +153 -0
- data/lib/backup_paradise/toplevel_methods/mountpoint.rb +188 -0
- data/lib/backup_paradise/toplevel_methods/opnn.rb +27 -0
- data/lib/backup_paradise/utility_scripts/backup/backup.rb +1901 -0
- data/lib/backup_paradise/version/version.rb +19 -0
- data/lib/backup_paradise/windows/README.md +1 -0
- data/lib/backup_paradise/windows/windows.rb +101 -0
- data/lib/backup_paradise/www/backup.cgi +63 -0
- data/lib/backup_paradise/yaml/config.yml +82 -0
- data/lib/backup_paradise.rb +5 -0
- data/test/testing_toplevel_functionality.rb +11 -0
- metadata +194 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/colours/colours.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BackupParadise
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'colours'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === use_colours
|
15
|
+
# ========================================================================= #
|
16
|
+
@use_colours = true
|
17
|
+
|
18
|
+
# ========================================================================= #
|
19
|
+
# === BackupParadise.use_colours?
|
20
|
+
# ========================================================================= #
|
21
|
+
def self.use_colours?
|
22
|
+
@use_colours
|
23
|
+
end
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === BackupParadise.use_colours=
|
27
|
+
# ========================================================================= #
|
28
|
+
def self.use_colours=(i)
|
29
|
+
@use_colours = i
|
30
|
+
end
|
31
|
+
|
32
|
+
# ========================================================================= #
|
33
|
+
# === BackupParadise.sfancy
|
34
|
+
# ========================================================================= #
|
35
|
+
def self.sfancy(i = '')
|
36
|
+
return Colours.sfancy(i) if @use_colours
|
37
|
+
return i
|
38
|
+
end
|
39
|
+
|
40
|
+
# ========================================================================= #
|
41
|
+
# === BackupParadise.sdir
|
42
|
+
# ========================================================================= #
|
43
|
+
def self.sdir(i = '')
|
44
|
+
return Colours.sdir(i) if @use_colours
|
45
|
+
return i
|
46
|
+
end
|
47
|
+
|
48
|
+
# ========================================================================= #
|
49
|
+
# === BackupParadise.sfile
|
50
|
+
# ========================================================================= #
|
51
|
+
def self.sfile(i = '')
|
52
|
+
return Colours.sfile(i) if @use_colours
|
53
|
+
return i
|
54
|
+
end
|
55
|
+
|
56
|
+
# ========================================================================= #
|
57
|
+
# === BackupParadise.simp
|
58
|
+
# ========================================================================= #
|
59
|
+
def self.simp(i = '')
|
60
|
+
return Colours.simp(i) if @use_colours
|
61
|
+
return i
|
62
|
+
end
|
63
|
+
|
64
|
+
# ========================================================================= #
|
65
|
+
# === BackupParadise.royalblue
|
66
|
+
# ========================================================================= #
|
67
|
+
def self.royalblue(i = '')
|
68
|
+
return Colours.royalblue(i) if @use_colours
|
69
|
+
return i
|
70
|
+
end
|
71
|
+
|
72
|
+
# ========================================================================= #
|
73
|
+
# === BackupParadise.tomato
|
74
|
+
# ========================================================================= #
|
75
|
+
def self.tomato(i = '')
|
76
|
+
return Colours.tomato(i) if @use_colours
|
77
|
+
return i
|
78
|
+
end
|
79
|
+
|
80
|
+
# ========================================================================= #
|
81
|
+
# === BackupParadise.steelblue
|
82
|
+
# ========================================================================= #
|
83
|
+
def self.steelblue(i = '')
|
84
|
+
return Colours.steelblue(i) if @use_colours
|
85
|
+
return i
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/constants/constants.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BackupParadise
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === NAMESPACE
|
11
|
+
# ========================================================================= #
|
12
|
+
NAMESPACE = inspect
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === N
|
16
|
+
# ========================================================================= #
|
17
|
+
N = "\n"
|
18
|
+
|
19
|
+
# ========================================================================= #
|
20
|
+
# === AUTOGENERATED_DIRECTORY
|
21
|
+
# ========================================================================= #
|
22
|
+
AUTOGENERATED_DIRECTORY = '/AUTOGENERATED/'
|
23
|
+
|
24
|
+
# ========================================================================= #
|
25
|
+
# === USB1
|
26
|
+
# ========================================================================= #
|
27
|
+
USB1 = '/dev/sda1'
|
28
|
+
|
29
|
+
# ========================================================================= #
|
30
|
+
# === USB2
|
31
|
+
# ========================================================================= #
|
32
|
+
USB2 = '/dev/sdb1'
|
33
|
+
|
34
|
+
# ========================================================================= #
|
35
|
+
# === USB3
|
36
|
+
# ========================================================================= #
|
37
|
+
USB3 = '/dev/sdc1'
|
38
|
+
|
39
|
+
# ========================================================================= #
|
40
|
+
# === USB4
|
41
|
+
# ========================================================================= #
|
42
|
+
USB4 = '/dev/sdd1'
|
43
|
+
|
44
|
+
# ========================================================================= #
|
45
|
+
# === USB5
|
46
|
+
# ========================================================================= #
|
47
|
+
USB5 = '/dev/sde1'
|
48
|
+
|
49
|
+
# ========================================================================= #
|
50
|
+
# === USB6
|
51
|
+
# ========================================================================= #
|
52
|
+
USB6 = '/dev/sdf1'
|
53
|
+
|
54
|
+
# ========================================================================= #
|
55
|
+
# === USB7
|
56
|
+
# ========================================================================= #
|
57
|
+
USB7 = '/dev/sdg1'
|
58
|
+
|
59
|
+
# ========================================================================= #
|
60
|
+
# === USB8
|
61
|
+
# ========================================================================= #
|
62
|
+
USB8 = '/dev/sdh1'
|
63
|
+
|
64
|
+
# ========================================================================= #
|
65
|
+
# === DEFAULT_MODE
|
66
|
+
#
|
67
|
+
# Which mode we will use for newly-created directories and files.
|
68
|
+
# ========================================================================= #
|
69
|
+
DEFAULT_MODE = 0755
|
70
|
+
|
71
|
+
# ========================================================================= #
|
72
|
+
# === HOME_DIRECTORY_OF_THE_USER_X
|
73
|
+
# ========================================================================= #
|
74
|
+
HOME_DIRECTORY_OF_THE_USER_X = '/home/x/'
|
75
|
+
|
76
|
+
# ========================================================================= #
|
77
|
+
# === STUDIUM_DIRECTORY
|
78
|
+
# ========================================================================= #
|
79
|
+
if ENV['STUDIUM_DIRECTORY']
|
80
|
+
STUDIUM_DIRECTORY = "#{ENV['STUDIUM_DIRECTORY']}/"
|
81
|
+
else # else hardcode it.
|
82
|
+
STUDIUM_DIRECTORY = "#{HOME_DIRECTORY_OF_THE_USER_X}studium/"
|
83
|
+
end; STUDIUM_DIR = STUDIUM_DIRECTORY # === STUDIUM_DIR
|
84
|
+
|
85
|
+
# ========================================================================= #
|
86
|
+
# === DATA_DIR
|
87
|
+
#
|
88
|
+
# Determine DATA_DIR constant here.
|
89
|
+
# ========================================================================= #
|
90
|
+
if ENV['MY_DATA']
|
91
|
+
DATA_DIR = "#{ENV['MY_DATA']}/"
|
92
|
+
else
|
93
|
+
DATA_DIR = "#{HOME_DIRECTORY_OF_THE_USER_X}DATA/"
|
94
|
+
end; DATA_DIRECTORY = DATA_DIR # === DATA_DIRECTORY
|
95
|
+
|
96
|
+
# ========================================================================= #
|
97
|
+
# === AUDIO_DIR
|
98
|
+
#
|
99
|
+
# Either we will simply use an environment variable; or we will use a
|
100
|
+
# hardcoded path.
|
101
|
+
# ========================================================================= #
|
102
|
+
if ENV['AUDIO_DIRECTORY'] and File.directory?(ENV['AUDIO_DIRECTORY'])
|
103
|
+
AUDIO_DIR = "#{ENV['AUDIO_DIRECTORY']}/"
|
104
|
+
else
|
105
|
+
AUDIO_DIR = "#{HOME_DIRECTORY_OF_THE_USER_X}songs/"
|
106
|
+
end; AUDIO_DIRECTORY = AUDIO_DIR # === AUDIO_DIRECTORY
|
107
|
+
|
108
|
+
# ========================================================================= #
|
109
|
+
# === DIRECTORY_CONTAINING_ALL_SONGS
|
110
|
+
# ========================================================================= #
|
111
|
+
DIRECTORY_CONTAINING_ALL_SONGS = "#{HOME_DIRECTORY_OF_THE_USER_X}songs/"
|
112
|
+
|
113
|
+
# ========================================================================= #
|
114
|
+
# === VIDEO_DIRECTORY
|
115
|
+
# ========================================================================= #
|
116
|
+
VIDEO_DIRECTORY = "#{HOME_DIRECTORY_OF_THE_USER_X}video/"
|
117
|
+
|
118
|
+
# ========================================================================= #
|
119
|
+
# === SOURCE_DIRECTORY
|
120
|
+
# ========================================================================= #
|
121
|
+
if ENV.has_key? 'MY_SRC_DIR'
|
122
|
+
SOURCE_DIRECTORY = "#{ENV['MY_SRC_DIR']}/"
|
123
|
+
else
|
124
|
+
SOURCE_DIRECTORY = "#{HOME_DIRECTORY_OF_THE_USER_X}src/"
|
125
|
+
end; SRC_DIR = SOURCE_DIRECTORY # === SRC_DIR
|
126
|
+
|
127
|
+
# ========================================================================= #
|
128
|
+
# === PROGRAMS_DIRECTORY
|
129
|
+
# ========================================================================= #
|
130
|
+
if ENV.has_key? 'MY_PROGRAMS_DIR'
|
131
|
+
PROGRAMS_DIRECTORY = "#{ENV['MY_PROGRAMS_DIR']}/"
|
132
|
+
else
|
133
|
+
PROGRAMS_DIRECTORY = '/home/Programs/'
|
134
|
+
end; PROGRAMS_DIR = PROGRAMS_DIRECTORY # === PROGRAMS_DIR
|
135
|
+
|
136
|
+
# ========================================================================= #
|
137
|
+
# === SYSTEM_SETTINGS_DIRECTORY
|
138
|
+
# ========================================================================= #
|
139
|
+
SYSTEM_SETTINGS_DIRECTORY = ENV['SYS_SETTINGS'].to_s.dup
|
140
|
+
SYS_SETTINGS = SYSTEM_SETTINGS_DIRECTORY # === SYS_SETTINGS
|
141
|
+
|
142
|
+
# ========================================================================= #
|
143
|
+
# === DEPOT_DIRECTORY
|
144
|
+
#
|
145
|
+
# The Depot directory is determined here.
|
146
|
+
# ========================================================================= #
|
147
|
+
if ENV['DEPOT']
|
148
|
+
DEPOT_DIRECTORY = "#{ENV['DEPOT']}/"
|
149
|
+
else
|
150
|
+
DEPOT_DIRECTORY = '/Depot/Temp/'
|
151
|
+
end
|
152
|
+
|
153
|
+
# ========================================================================= #
|
154
|
+
# === BOOKS_DIRECTORY
|
155
|
+
# ========================================================================= #
|
156
|
+
if ENV['MY_BOOKS']
|
157
|
+
BOOKS_DIRECTORY = "#{ENV['MY_BOOKS'].dup}/"
|
158
|
+
else
|
159
|
+
BOOKS_DIRECTORY = "#{HOME_DIRECTORY_OF_THE_USER_X}books/"
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/gui/glimmer/libui/backup_for_ingrid/backup_for_ingrid.rb'
|
6
|
+
# BackupParadise::GUI::LibUI::BackupForIngrid.new
|
7
|
+
# =========================================================================== #
|
8
|
+
require 'glimmer-dsl-libui'
|
9
|
+
|
10
|
+
alias e puts
|
11
|
+
|
12
|
+
require 'backup_paradise/gui/shared_code/simple_backup_widget/simple_backup_widget_module.rb'
|
13
|
+
include BackupParadise::GUI::SimpleBackupWidgetModule
|
14
|
+
|
15
|
+
include Glimmer
|
16
|
+
|
17
|
+
# =========================================================================== #
|
18
|
+
# === TITLE
|
19
|
+
# =========================================================================== #
|
20
|
+
TITLE = 'Backup Widget'
|
21
|
+
|
22
|
+
# =========================================================================== #
|
23
|
+
# === WIDTH
|
24
|
+
# =========================================================================== #
|
25
|
+
WIDTH = 600
|
26
|
+
|
27
|
+
# =========================================================================== #
|
28
|
+
# === HEIGHT
|
29
|
+
# =========================================================================== #
|
30
|
+
HEIGHT = 280
|
31
|
+
|
32
|
+
# =========================================================================== #
|
33
|
+
# === do_backup_the_main_directory
|
34
|
+
# =========================================================================== #
|
35
|
+
def do_backup_the_main_directory
|
36
|
+
msg_box(
|
37
|
+
'Notification',
|
38
|
+
"Backup finished!"
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
this_image = BackupParadise.project_base_directory?+'images/BACKUP_IMAGE.png'
|
43
|
+
|
44
|
+
window('Simple backup', WIDTH, HEIGHT) {
|
45
|
+
margined true
|
46
|
+
|
47
|
+
vertical_box {
|
48
|
+
horizontal_separator { stretchy false }
|
49
|
+
form {
|
50
|
+
@first_name_entry = entry {
|
51
|
+
label 'First Name' # label property is available when control is nested under form
|
52
|
+
}
|
53
|
+
}
|
54
|
+
horizontal_separator { stretchy false }
|
55
|
+
area {
|
56
|
+
on_draw { |area_draw_params|
|
57
|
+
image(this_image, 32, 32)
|
58
|
+
}
|
59
|
+
}
|
60
|
+
horizontal_separator { stretchy false }
|
61
|
+
button('Backup') {
|
62
|
+
stretchy false
|
63
|
+
on_clicked {
|
64
|
+
do_backup_the_main_directory
|
65
|
+
}
|
66
|
+
}
|
67
|
+
horizontal_separator { stretchy false }
|
68
|
+
# The quit button comes next
|
69
|
+
button('Quit') {
|
70
|
+
stretchy false
|
71
|
+
on_clicked {
|
72
|
+
do_backup_the_main_directory
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
# Add the backup-button
|
77
|
+
button_backup_for_ingrid = button(
|
78
|
+
"Backup c:\\ingrid\\"
|
79
|
+
) {
|
80
|
+
on_clicked {
|
81
|
+
backup_ingrid_directory
|
82
|
+
popup_message(window, 'Backup finished!')
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
}
|
87
|
+
}.show
|
@@ -0,0 +1,220 @@
|
|
1
|
+
module BackupParadise
|
2
|
+
|
3
|
+
module Gtk
|
4
|
+
|
5
|
+
class Backup < ::Gtk::Frame # === BackupParadise::Gtk::Backup
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'gtk_paradise/classes/gtk2/information_about_the_harddisc.rb'
|
9
|
+
rescue LoadError; end
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === ARRAY_PREDEFINED_DEVICES
|
13
|
+
# ========================================================================= #
|
14
|
+
ARRAY_PREDEFINED_DEVICES = [
|
15
|
+
ENV['USB1'],
|
16
|
+
ENV['USB2'],
|
17
|
+
ENV['USB3'],
|
18
|
+
ENV['USB4'],
|
19
|
+
ENV['USB5'],
|
20
|
+
ENV['FESTPLATTE1']
|
21
|
+
]
|
22
|
+
|
23
|
+
# ========================================================================= #
|
24
|
+
# === initialize
|
25
|
+
# ========================================================================= #
|
26
|
+
def initialize
|
27
|
+
self.label_widget.set_markup %Q(
|
28
|
+
<span size="larger" weight="bold">💾 Backup Script</span>
|
29
|
+
)
|
30
|
+
set_width_request(REQUEST_THIS_WIDTH)
|
31
|
+
end
|
32
|
+
|
33
|
+
# ========================================================================= #
|
34
|
+
# === reset
|
35
|
+
# ========================================================================= #
|
36
|
+
def reset
|
37
|
+
# ======================================================================= #
|
38
|
+
# === @object_rbackup
|
39
|
+
# ======================================================================= #
|
40
|
+
@object_rbackup = BackupParadise::Backup.new(nil, :do_not_run_yet)
|
41
|
+
# ======================================================================= #
|
42
|
+
# === @object_hdd_info
|
43
|
+
# ======================================================================= #
|
44
|
+
@object_hdd_info = ::Gtk::InformationAboutTheHarddisc.new
|
45
|
+
end
|
46
|
+
|
47
|
+
# ========================================================================= #
|
48
|
+
# === scan_for_new_events
|
49
|
+
# ========================================================================= #
|
50
|
+
def scan_for_new_events(
|
51
|
+
n_seconds = 5
|
52
|
+
)
|
53
|
+
Thread.new {
|
54
|
+
e 'Scanning for new events ...'
|
55
|
+
synchronize_data
|
56
|
+
sleep n_seconds
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# ========================================================================= #
|
61
|
+
# === create_fdisk_scrolled_window
|
62
|
+
#
|
63
|
+
# Will create the scrolled window which holds our fdisk information.
|
64
|
+
# ========================================================================= #
|
65
|
+
def create_fdisk_scrolled_window
|
66
|
+
@fdisk_result = update_fdisk
|
67
|
+
create_text_view
|
68
|
+
@scrolled_window = create_scrolled_window(@text_view) { :always_never }
|
69
|
+
end
|
70
|
+
|
71
|
+
# ========================================================================= #
|
72
|
+
# === create_text_view
|
73
|
+
# ========================================================================= #
|
74
|
+
def create_text_view
|
75
|
+
@text_buffer = gtk_text_buffer
|
76
|
+
@text_buffer.insert_at_cursor(@fdisk_result)
|
77
|
+
@text_view = text_view(@text_buffer)
|
78
|
+
@text_view.set_editable(true)
|
79
|
+
end
|
80
|
+
|
81
|
+
# ========================================================================= #
|
82
|
+
# === update_fdisk
|
83
|
+
#
|
84
|
+
# Use this if you wanna get new fdisk information.
|
85
|
+
#
|
86
|
+
# Or use this:
|
87
|
+
#
|
88
|
+
# `fdisk -l`.gsub!(%r[^(!?/dev).*\n], '')
|
89
|
+
#
|
90
|
+
# ========================================================================= #
|
91
|
+
def update_fdisk
|
92
|
+
return `fdisk -l`.split("\n").delete_if { |line| line !~ /^\/dev/ }.join("\n")
|
93
|
+
end
|
94
|
+
|
95
|
+
# ========================================================================= #
|
96
|
+
# === create_gtk_buttons
|
97
|
+
# ========================================================================= #
|
98
|
+
def create_gtk_buttons
|
99
|
+
# ======================================================================= #
|
100
|
+
# === The backup-button
|
101
|
+
# ======================================================================= #
|
102
|
+
@button_backup = create_button('_Backup')
|
103
|
+
|
104
|
+
@button_backup.on_clicked {
|
105
|
+
@object_rbackup.set_dir_name() # first must set proper dir name.
|
106
|
+
# First one backup to hdd.
|
107
|
+
if @combo_box.active_text == ENV['FESTPLATTE1']
|
108
|
+
eimp ' => Doing Backup to '+ENV['FESTPLATTE1']
|
109
|
+
@object_rbackup.target_device = ENV['FESTPLATTE1']
|
110
|
+
@object_rbackup.backup_system(:tohdd)
|
111
|
+
else
|
112
|
+
@object_rbackup.information_startup_tasks
|
113
|
+
@object_rbackup.get_raw_info
|
114
|
+
@object_rbackup.scan_for_usb_entries
|
115
|
+
@object_rbackup.backup_system()
|
116
|
+
end
|
117
|
+
synchronize_data
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
# ========================================================================= #
|
122
|
+
# === init_hdd_image
|
123
|
+
#
|
124
|
+
# Init our hdd image. Copied from hdd_info.rb
|
125
|
+
# ========================================================================= #
|
126
|
+
def init_hdd_image
|
127
|
+
if @object_hdd_info.respond_to? :percentage_used
|
128
|
+
tmp = @object_hdd_info.percentage_used.to_i
|
129
|
+
else
|
130
|
+
tmp = 0
|
131
|
+
end
|
132
|
+
_tmp_path = ''
|
133
|
+
case tmp
|
134
|
+
when 0..1 then _tmp_path = 'HDD_EMPTY.png'
|
135
|
+
when 2..25 then _tmp_path = 'HDD_ONEFOURTH.png'
|
136
|
+
when 26..50 then _tmp_path = 'HDD_HALF.png'
|
137
|
+
when 51..75 then _tmp_path = 'HDD_THREEFOURTH.png'
|
138
|
+
when 76..89 then _tmp_path = 'HDD_THREEEIGHT.png'
|
139
|
+
else # else 90 oder mehr full
|
140
|
+
_tmp_path = 'HDD_FULL.png'
|
141
|
+
end
|
142
|
+
@hdd_image = create_image(ENV['IMG_STD']+'/'+_tmp_path)
|
143
|
+
@hdd_image.set_padding(3, 3)
|
144
|
+
@event_box = gtk_event_box(@hdd_image)
|
145
|
+
@event_box.signal_connect(:button_press_event) {
|
146
|
+
e 'Starting firefox in /'
|
147
|
+
open_in_browser('/')
|
148
|
+
}
|
149
|
+
return @event_box
|
150
|
+
end
|
151
|
+
|
152
|
+
# ========================================================================= #
|
153
|
+
# === synchronize_data
|
154
|
+
#
|
155
|
+
# Every button must invoke this method after doing its
|
156
|
+
# default task. Currently only updates the variable @fdisk_result
|
157
|
+
# ========================================================================= #
|
158
|
+
def synchronize_data
|
159
|
+
@fdisk_result = update_fdisk
|
160
|
+
end
|
161
|
+
|
162
|
+
def run
|
163
|
+
create_fdisk_scrolled_window
|
164
|
+
# ======================================================================= #
|
165
|
+
# Here are the different entries.
|
166
|
+
# ======================================================================= #
|
167
|
+
@combo_box = gtk_combo_box_entry
|
168
|
+
ARRAY_PREDEFINED_DEVICES.each { |val| @combo_box.append_text(val) }
|
169
|
+
|
170
|
+
create_gtk_buttons
|
171
|
+
scan_for_new_events(5)
|
172
|
+
@main_table.attach_defaults(@button_backup, 0, 1, 0, 1)
|
173
|
+
@main_table.attach_defaults(@combo_box, 1, 2, 0, 1)
|
174
|
+
@main_table.attach_defaults(@button_debug, 2, 3, 0, 1)
|
175
|
+
|
176
|
+
@main_table.attach_defaults(@button_quit, 0, 1, 1, 2)
|
177
|
+
@main_table.attach_defaults(init_hdd_image, 1, 2, 1, 2)
|
178
|
+
@main_table.attach_defaults(@scrolled_window, 2, 3, 1, 2)
|
179
|
+
|
180
|
+
@main_vbox = gtk_vbox
|
181
|
+
@main_vbox.maximal(@main_table, 0)
|
182
|
+
mini_hbox = gtk_hbox
|
183
|
+
@button_run_the_mount_command = gtk_button('Run → ')
|
184
|
+
@button_run_the_mount_command.lightgreen
|
185
|
+
@button_run_the_mount_command.fancy_tooltips = 'Clicking this '\
|
186
|
+
'button will run <b>the command on the right hand side</b>.'
|
187
|
+
mini_hbox.minimal(@button_run_the_mount_command, 2)
|
188
|
+
mini_hbox.minimal(gtk_label('mount '), 2)
|
189
|
+
@dropdown_box_holding_all_dev_entries = gtk_dropdown(
|
190
|
+
%w(
|
191
|
+
/dev/sda1
|
192
|
+
/dev/sda2
|
193
|
+
/dev/sda3
|
194
|
+
/dev/sdb1
|
195
|
+
/dev/sdb2
|
196
|
+
/dev/sdb3
|
197
|
+
/dev/sdc1
|
198
|
+
/dev/sdc2
|
199
|
+
/dev/sdc3
|
200
|
+
)
|
201
|
+
)
|
202
|
+
@dropdown_box_holding_all_dev_entries.active = 2
|
203
|
+
mini_hbox.minimal(@dropdown_box_holding_all_dev_entries, 0)
|
204
|
+
mini_hbox.minimal(gtk_label(' onto '), 2)
|
205
|
+
dropdown_box_holding_the_mount_targets = gtk_dropdown(ARRAY_PREDEFINED_DEVICES)
|
206
|
+
dropdown_box_holding_the_mount_targets.active = 0
|
207
|
+
mini_hbox.minimal(dropdown_box_holding_the_mount_targets, 2)
|
208
|
+
@button_run_the_mount_command.on_clicked {
|
209
|
+
cmd = 'mount '+
|
210
|
+
@dropdown_box_holding_all_dev_entries.active_text.to_s+
|
211
|
+
' '+
|
212
|
+
dropdown_box_holding_the_mount_targets.active_text.to_s
|
213
|
+
e
|
214
|
+
esystem cmd
|
215
|
+
e
|
216
|
+
}
|
217
|
+
@main_vbox.minimal(mini_hbox, 0)
|
218
|
+
end
|
219
|
+
|
220
|
+
end; end; end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/gui/gtk3/simple_backup_widget/create.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BackupParadise
|
8
|
+
|
9
|
+
module GUI
|
10
|
+
|
11
|
+
module Gtk
|
12
|
+
|
13
|
+
class SimpleBackupWidget < ::Gtk::Box # === BackupParadise::GUI::Gtk::SimpleBackupWidget
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === create_file_chooser_dialog_widget
|
17
|
+
# ========================================================================= #
|
18
|
+
def create_file_chooser_dialog_widget
|
19
|
+
@file_chooser_dialog = ::Gtk::FileChooserDialog.new(
|
20
|
+
self: self,
|
21
|
+
title: 'Choose a file or directory',
|
22
|
+
action: ::Gtk::FileChooserAction::OPEN,
|
23
|
+
buttons: [[::Gtk::Stock::OPEN, ::Gtk::ResponseType::ACCEPT],
|
24
|
+
[::Gtk::Stock::CANCEL, ::Gtk::ResponseType::CANCEL]]
|
25
|
+
)
|
26
|
+
# ======================================================================= #
|
27
|
+
# === /home/Temp
|
28
|
+
# ======================================================================= #
|
29
|
+
if File.directory? '/home/Temp/'
|
30
|
+
@file_chooser_dialog.add_shortcut_folder('/home/Temp/')
|
31
|
+
end
|
32
|
+
# ======================================================================= #
|
33
|
+
# === /home/x/Temp
|
34
|
+
# ======================================================================= #
|
35
|
+
if File.directory? '/home/x/Temp/'
|
36
|
+
@file_chooser_dialog.add_shortcut_folder('/home/x/Temp/')
|
37
|
+
end
|
38
|
+
# ======================================================================= #
|
39
|
+
# === /home/x/data/
|
40
|
+
# ======================================================================= #
|
41
|
+
if File.directory? HOME_DIRECTORY_OF_THE_USER_X+'data/'
|
42
|
+
@file_chooser_dialog.add_shortcut_folder(HOME_DIRECTORY_OF_THE_USER_X+'data/')
|
43
|
+
end
|
44
|
+
# ======================================================================= #
|
45
|
+
# Add the audio-directory shortcut, defined in the yaml file.
|
46
|
+
# ======================================================================= #
|
47
|
+
if @dataset_from_the_config_file and
|
48
|
+
@dataset_from_the_config_file.has_key?('local_audio_directory')
|
49
|
+
@file_chooser_dialog.add_shortcut_folder(
|
50
|
+
@dataset_from_the_config_file['local_audio_directory'].to_s
|
51
|
+
)
|
52
|
+
end
|
53
|
+
@file_chooser_dialog.add_shortcut_folder('/Ingrid')
|
54
|
+
@file_chooser_dialog.current_folder = Dir.pwd
|
55
|
+
@file_chooser_dialog.do_show_hidden_files
|
56
|
+
# @file_chooser_dialog.destroy
|
57
|
+
end
|
58
|
+
|
59
|
+
# ========================================================================= #
|
60
|
+
# === create_skeleton (create tag)
|
61
|
+
# ========================================================================= #
|
62
|
+
def create_skeleton
|
63
|
+
create_the_label_showing_results
|
64
|
+
create_the_buttons
|
65
|
+
create_the_entries
|
66
|
+
create_the_combo_boxes
|
67
|
+
create_the_grid
|
68
|
+
end
|
69
|
+
|
70
|
+
end; end; end; end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/gui/gtk3/simple_backup_widget/misc.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'gtk_paradise/require_gtk3'
|
8
|
+
|
9
|
+
module BackupParadise
|
10
|
+
|
11
|
+
module GUI
|
12
|
+
|
13
|
+
module Gtk
|
14
|
+
|
15
|
+
class SimpleBackupWidget < ::Gtk::Box # === BackupParadise::GUI::Gtk::SimpleBackupWidget
|
16
|
+
|
17
|
+
# ========================================================================= #
|
18
|
+
# === BackupParadise::GUI::Gtk::SimpleBackupWidget.run
|
19
|
+
# ========================================================================= #
|
20
|
+
def self.run(
|
21
|
+
i = ARGV
|
22
|
+
)
|
23
|
+
require 'gtk_paradise/run'
|
24
|
+
_ = ::BackupParadise::GUI::Gtk::SimpleBackupWidget.new(i)
|
25
|
+
_.set_border_width(2)
|
26
|
+
r = ::Gtk.run
|
27
|
+
r << _
|
28
|
+
r.automatic
|
29
|
+
r.set_title(_.title?)
|
30
|
+
r.top_left_then_run
|
31
|
+
end
|
32
|
+
|
33
|
+
end; end; end; end
|