backup_paradise 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +452 -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 +390 -0
- data/doc/TODO.md +130 -0
- data/img/BackupParadise_Logo.png +0 -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 +529 -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 +165 -0
- data/lib/backup_paradise/gui/libui/backup_for_ingrid/backup_for_ingrid.rb +99 -0
- data/lib/backup_paradise/gui/shared_code/simple_backup_widget/simple_backup_widget_module.rb +0 -0
- data/lib/backup_paradise/gui/tk/backup.rb +108 -0
- data/lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb +921 -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 +1942 -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 +192 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/base/tab.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BackupParadise
|
8
|
+
|
9
|
+
class Base
|
10
|
+
|
11
|
+
require 'backup_paradise/tab/tab.rb'
|
12
|
+
require 'backup_paradise/toplevel_methods/config.rb'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === use_this_program_to_rename_tabs?
|
16
|
+
# ========================================================================= #
|
17
|
+
def use_this_program_to_rename_tabs?
|
18
|
+
BackupParadise.use_this_program_to_rename_tabs?
|
19
|
+
end
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === rename_tab
|
23
|
+
#
|
24
|
+
# This method can be used to rename the tab of e. g. mrxvt or KDE konsole.
|
25
|
+
# ========================================================================= #
|
26
|
+
def rename_tab(
|
27
|
+
use_this_terminal = use_this_program_to_rename_tabs?, # or :mrxvt
|
28
|
+
use_this_as_new_title = 'Hello world!'
|
29
|
+
)
|
30
|
+
BackupParadise::Tab.rename_tab(
|
31
|
+
use_this_terminal,
|
32
|
+
use_this_as_new_title
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
# ========================================================================= #
|
37
|
+
# === tab_title
|
38
|
+
#
|
39
|
+
# This is as above, but uses the default terminal.
|
40
|
+
# ========================================================================= #
|
41
|
+
def tab_title(
|
42
|
+
i = ''
|
43
|
+
)
|
44
|
+
rename_tab(use_this_program_to_rename_tabs?, i)
|
45
|
+
end
|
46
|
+
|
47
|
+
end; end
|
@@ -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/html_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,165 @@
|
|
1
|
+
module BackupParadise
|
2
|
+
|
3
|
+
module Gtk
|
4
|
+
|
5
|
+
class Backup < ::Gtk::Frame
|
6
|
+
|
7
|
+
# ========================================================================= #
|
8
|
+
# === scan_for_new_events
|
9
|
+
# ========================================================================= #
|
10
|
+
def scan_for_new_events(
|
11
|
+
n_seconds = 5
|
12
|
+
)
|
13
|
+
Thread.new {
|
14
|
+
e 'Scanning for new events ...'
|
15
|
+
synchronize_data
|
16
|
+
sleep n_seconds
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
# ========================================================================= #
|
21
|
+
# === create_fdisk_scrolled_window
|
22
|
+
#
|
23
|
+
# Will create the scrolled window which holds our fdisk information.
|
24
|
+
# ========================================================================= #
|
25
|
+
def create_fdisk_scrolled_window
|
26
|
+
@fdisk_result = update_fdisk
|
27
|
+
create_text_view
|
28
|
+
@scrolled_window = create_scrolled_window(@text_view) { :always_never }
|
29
|
+
end
|
30
|
+
|
31
|
+
# ========================================================================= #
|
32
|
+
# === create_text_view
|
33
|
+
# ========================================================================= #
|
34
|
+
def create_text_view
|
35
|
+
@text_buffer = create_text_buffer
|
36
|
+
@text_buffer.insert_at_cursor(@fdisk_result)
|
37
|
+
@text_view = text_view(@text_buffer)
|
38
|
+
@text_view.set_editable(true)
|
39
|
+
end
|
40
|
+
|
41
|
+
# ========================================================================= #
|
42
|
+
# === create_gtk_buttons
|
43
|
+
# ========================================================================= #
|
44
|
+
def create_gtk_buttons
|
45
|
+
# ======================================================================= #
|
46
|
+
# === The backup-button
|
47
|
+
# ======================================================================= #
|
48
|
+
@button_backup = create_button('_Backup')
|
49
|
+
|
50
|
+
@button_backup.on_clicked {
|
51
|
+
@object_rbackup.set_dir_name() # first must set proper dir name.
|
52
|
+
# First one backup to hdd.
|
53
|
+
if @combo_box.active_text == ENV['FESTPLATTE1']
|
54
|
+
eimp ' => Doing Backup to '+ENV['FESTPLATTE1']
|
55
|
+
@object_rbackup.target_device = ENV['FESTPLATTE1']
|
56
|
+
@object_rbackup.backup_system(:tohdd)
|
57
|
+
else
|
58
|
+
@object_rbackup.information_startup_tasks
|
59
|
+
@object_rbackup.get_raw_info
|
60
|
+
@object_rbackup.scan_for_usb_entries
|
61
|
+
@object_rbackup.backup_system()
|
62
|
+
end
|
63
|
+
synchronize_data
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# ========================================================================= #
|
68
|
+
# === init_hdd_image
|
69
|
+
#
|
70
|
+
# Init our hdd image. Copied from hdd_info.rb
|
71
|
+
# ========================================================================= #
|
72
|
+
def init_hdd_image
|
73
|
+
if @object_hdd_info.respond_to? :percentage_used
|
74
|
+
tmp = @object_hdd_info.percentage_used.to_i
|
75
|
+
else
|
76
|
+
tmp = 0
|
77
|
+
end
|
78
|
+
_tmp_path = ''
|
79
|
+
case tmp
|
80
|
+
when 0..1 then _tmp_path = 'HDD_EMPTY.png'
|
81
|
+
when 2..25 then _tmp_path = 'HDD_ONEFOURTH.png'
|
82
|
+
when 26..50 then _tmp_path = 'HDD_HALF.png'
|
83
|
+
when 51..75 then _tmp_path = 'HDD_THREEFOURTH.png'
|
84
|
+
when 76..89 then _tmp_path = 'HDD_THREEEIGHT.png'
|
85
|
+
else # else 90 oder mehr full
|
86
|
+
_tmp_path = 'HDD_FULL.png'
|
87
|
+
end
|
88
|
+
@hdd_image = create_image(ENV['IMG_STD']+'/'+_tmp_path)
|
89
|
+
@hdd_image.set_padding(3, 3)
|
90
|
+
@event_box = create_event_box(@hdd_image)
|
91
|
+
@event_box.signal_connect(:button_press_event) {
|
92
|
+
e 'Starting firefox in /'
|
93
|
+
open_in_browser('/')
|
94
|
+
}
|
95
|
+
return @event_box
|
96
|
+
end
|
97
|
+
|
98
|
+
# ========================================================================= #
|
99
|
+
# === synchronize_data
|
100
|
+
#
|
101
|
+
# Every button must invoke this method after doing its
|
102
|
+
# default task. Currently only updates the variable @fdisk_result
|
103
|
+
# ========================================================================= #
|
104
|
+
def synchronize_data
|
105
|
+
@fdisk_result = update_fdisk
|
106
|
+
end
|
107
|
+
|
108
|
+
def run
|
109
|
+
create_fdisk_scrolled_window
|
110
|
+
# ======================================================================= #
|
111
|
+
# Here are the different entries.
|
112
|
+
# ======================================================================= #
|
113
|
+
@combo_box = create_combo_box_entry
|
114
|
+
ARRAY_PREDEFINED_DEVICES.each { |val| @combo_box.append_text(val) }
|
115
|
+
|
116
|
+
scan_for_new_events(5)
|
117
|
+
@main_table.attach_defaults(@button_backup, 0, 1, 0, 1)
|
118
|
+
@main_table.attach_defaults(@combo_box, 1, 2, 0, 1)
|
119
|
+
@main_table.attach_defaults(@button_debug, 2, 3, 0, 1)
|
120
|
+
|
121
|
+
@main_table.attach_defaults(@button_quit, 0, 1, 1, 2)
|
122
|
+
@main_table.attach_defaults(init_hdd_image, 1, 2, 1, 2)
|
123
|
+
@main_table.attach_defaults(@scrolled_window, 2, 3, 1, 2)
|
124
|
+
|
125
|
+
@main_vbox = gtk_vbox
|
126
|
+
@main_vbox.maximal(@main_table, 0)
|
127
|
+
mini_hbox = gtk_hbox
|
128
|
+
@button_run_the_mount_command = gtk_button('Run → ')
|
129
|
+
@button_run_the_mount_command.lightgreen
|
130
|
+
@button_run_the_mount_command.fancy_tooltips = 'Clicking this '\
|
131
|
+
'button will run <b>the command on the right hand side</b>.'
|
132
|
+
mini_hbox.minimal(@button_run_the_mount_command, 2)
|
133
|
+
mini_hbox.minimal(gtk_label('mount '), 2)
|
134
|
+
@dropdown_box_holding_all_dev_entries = gtk_dropdown(
|
135
|
+
%w(
|
136
|
+
/dev/sda1
|
137
|
+
/dev/sda2
|
138
|
+
/dev/sda3
|
139
|
+
/dev/sdb1
|
140
|
+
/dev/sdb2
|
141
|
+
/dev/sdb3
|
142
|
+
/dev/sdc1
|
143
|
+
/dev/sdc2
|
144
|
+
/dev/sdc3
|
145
|
+
)
|
146
|
+
)
|
147
|
+
@dropdown_box_holding_all_dev_entries.active = 2
|
148
|
+
mini_hbox.minimal(@dropdown_box_holding_all_dev_entries, 0)
|
149
|
+
mini_hbox.minimal(gtk_label(' onto '), 2)
|
150
|
+
dropdown_box_holding_the_mount_targets = gtk_dropdown(ARRAY_PREDEFINED_DEVICES)
|
151
|
+
dropdown_box_holding_the_mount_targets.active = 0
|
152
|
+
mini_hbox.minimal(dropdown_box_holding_the_mount_targets, 2)
|
153
|
+
@button_run_the_mount_command.on_clicked {
|
154
|
+
cmd = 'mount '+
|
155
|
+
@dropdown_box_holding_all_dev_entries.active_text.to_s+
|
156
|
+
' '+
|
157
|
+
dropdown_box_holding_the_mount_targets.active_text.to_s
|
158
|
+
e
|
159
|
+
esystem cmd
|
160
|
+
e
|
161
|
+
}
|
162
|
+
@main_vbox.minimal(mini_hbox, 0)
|
163
|
+
end
|
164
|
+
|
165
|
+
end; end; end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === BackupParadise::GUI::LibUI::BackupForIngrid
|
6
|
+
# =========================================================================== #
|
7
|
+
# require 'backup_paradise/gui/libui/backup_for_ingrid/backup_for_ingrid.rb'
|
8
|
+
# BackupParadise::GUI::LibUI::BackupForIngrid.new
|
9
|
+
# =========================================================================== #
|
10
|
+
module BackupParadise
|
11
|
+
|
12
|
+
module GUI
|
13
|
+
|
14
|
+
module LibUI
|
15
|
+
|
16
|
+
class BackupForIngrid # === BackupParadise::GUI::LibUI::BackupForIngrid
|
17
|
+
|
18
|
+
require 'libui_paradise'
|
19
|
+
include LibuiParadise::Extensions
|
20
|
+
|
21
|
+
require 'backup_paradise/gui/shared_code/simple_backup_widget/simple_backup_widget_module.rb'
|
22
|
+
include BackupParadise::GUI::SimpleBackupWidgetModule
|
23
|
+
|
24
|
+
alias e puts
|
25
|
+
|
26
|
+
# ========================================================================= #
|
27
|
+
# === TITLE
|
28
|
+
# ========================================================================= #
|
29
|
+
TITLE = 'Backup Widget'
|
30
|
+
|
31
|
+
# ========================================================================= #
|
32
|
+
# === WIDTH
|
33
|
+
# ========================================================================= #
|
34
|
+
WIDTH = '25% or minimum 380px'
|
35
|
+
|
36
|
+
# ========================================================================= #
|
37
|
+
# === HEIGHT
|
38
|
+
# ========================================================================= #
|
39
|
+
HEIGHT = 100
|
40
|
+
|
41
|
+
# ========================================================================= #
|
42
|
+
# === initialize
|
43
|
+
# ========================================================================= #
|
44
|
+
def initialize(
|
45
|
+
run_already = true
|
46
|
+
)
|
47
|
+
reset
|
48
|
+
run if run_already
|
49
|
+
end
|
50
|
+
|
51
|
+
# ========================================================================= #
|
52
|
+
# === reset (reset tag)
|
53
|
+
# ========================================================================= #
|
54
|
+
def reset
|
55
|
+
set_title(TITLE)
|
56
|
+
set_width(WIDTH)
|
57
|
+
set_height(HEIGHT)
|
58
|
+
end
|
59
|
+
|
60
|
+
# ========================================================================= #
|
61
|
+
# === run
|
62
|
+
# ========================================================================= #
|
63
|
+
def run
|
64
|
+
window = ui_padded_main_window(title?, width?, height?, 0)
|
65
|
+
outer_vbox = padded_vbox
|
66
|
+
# ======================================================================= #
|
67
|
+
# First add the two buttons on top:
|
68
|
+
# ======================================================================= #
|
69
|
+
hbox_on_top = padded_hbox
|
70
|
+
button_backup_for_ingrid = button(
|
71
|
+
"Backup c:\\ingrid\\"
|
72
|
+
)
|
73
|
+
button_backup_for_ingrid.on_clicked {
|
74
|
+
backup_ingrid_directory
|
75
|
+
popup_message(window, 'Backup finished!')
|
76
|
+
}
|
77
|
+
button_quit = quit_button
|
78
|
+
# ======================================================================= #
|
79
|
+
# Add the backup-button next:
|
80
|
+
# ======================================================================= #
|
81
|
+
hbox_on_top.maximal(button_backup_for_ingrid)
|
82
|
+
outer_vbox.add_hsep
|
83
|
+
hbox_on_top.maximal(button_quit)
|
84
|
+
outer_vbox.add_hsep
|
85
|
+
outer_vbox.add(
|
86
|
+
LibuiParadise.draw_rectangle(width?, 50, :steelblue)
|
87
|
+
)
|
88
|
+
outer_vbox.add_hsep
|
89
|
+
outer_vbox.maximal(hbox_on_top)
|
90
|
+
outer_vbox.add_hsep
|
91
|
+
window.add(outer_vbox)
|
92
|
+
window.intelligent_exit
|
93
|
+
end
|
94
|
+
|
95
|
+
end; end; end; end
|
96
|
+
|
97
|
+
if __FILE__ == $PROGRAM_NAME
|
98
|
+
BackupParadise::GUI::LibUI::BackupForIngrid.new
|
99
|
+
end
|
File without changes
|