Class: GamesAndRpgParadise::BaldursGate::GUI::ModInstaller
Overview
GamesAndRpgParadise::BaldursGate::GUI::ModInstaller
Constant Summary
collapse
- TITLE =
'Mod Installer'
- WIDTH =
1580
- HEIGHT =
460
- FONT =
java.awt.Font.new(java.awt.Font::SERIF, java.awt.Font::PLAIN, 26)
- LARGER_FONT =
java.awt.Font.new(java.awt.Font::SERIF, java.awt.Font::PLAIN, 34)
- NAMESPACE =
inspect
- BASE_DIR_ON_LINUX =
'/Depot/Games/Baldurs_Gate_1_and_2/Baldurs_Gate2_Enhanced_Edition/mods_and_NPCs/'
GamesAndRpgParadise::Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS
CommonExtensions::CONTROL_C_CODE, CommonExtensions::N
Class Method Summary
collapse
-
.[](i = ARGV) ⇒ Object
# === GamesAndRpgParadise::BaldursGate::GUI::ModInstaller[] ========================================================================= #.
Instance Method Summary
collapse
ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow
#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments
#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into
Constructor Details
#initialize(commandline_arguments = nil, run_already = true) ⇒ ModInstaller
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 69
def initialize(
commandline_arguments = nil,
run_already = true
)
reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
#
GamesAndRpgParadise::BaldursGate::GUI::ModInstaller[]
#
237
238
239
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 237
def self.[](i = ARGV)
new(i)
end
|
Instance Method Details
#array_mods ⇒ Object
157
158
159
160
161
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 157
def array_mods
_ = project_base_dir?+
'yaml/games/baldurs_gate_2/mod_installation_order.yml'
YAML.load_file(_)
end
|
#create_the_entries ⇒ Object
166
167
168
169
170
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 166
def create_the_entries
@entry1 = create_entry(return_pwd)
@entry1.set_size_request(280, 20)
@entry1.set_font(LARGER_FONT)
end
|
#do_change_the_directory(i = @entry1.text?) ⇒ Object
#
do_change_the_directory
#
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 96
def do_change_the_directory(
i = @entry1.text?
)
i = i.to_s
if File.directory? i
e 'Changing directory towards: '+i
cd(i) report_the_current_working_directory
end
end
|
#do_install_this_mod(this_mod) ⇒ Object
#
do_install_this_mod (action tag, install tag)
#
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 124
def do_install_this_mod(this_mod)
this_mod = this_mod.to_s
e rev+
'Installing this mod next: '+
steelblue(this_mod.to_s)+
rev+', from the directory '+
sdir(return_pwd)
old_dir = return_pwd glob = Dir['*'+this_mod+'*'].first.to_s
e rev+steelblue(glob)+rev+' will be targeted next:'
cpr(glob+'/.', File.dirname(old_dir)+'/')
target = '*'+this_mod+'*.exe'
the_exe_file = File.basename(Dir[glob+'/*.exe'].first)
cd(File.dirname(return_pwd))
e rev+'The .exe file is assumed to be called '+
steelblue(the_exe_file)+rev+', residing at '+
sdir(return_pwd)
if the_exe_file and File.exist?(the_exe_file)
e rev+'Running the .exe file next:'
e
esystem('./'+the_exe_file)
e
e 'Done!'
end
end
|
#report_the_current_working_directory ⇒ Object
#
report_the_current_working_directory
#
110
111
112
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 110
def report_the_current_working_directory
e 'The current working directory is: '+return_pwd
end
|
#reset ⇒ Object
83
84
85
86
87
88
89
90
91
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 83
def reset
super() if respond_to?(:super)
@namespace = NAMESPACE
title_width_height_font(TITLE, WIDTH, HEIGHT, FONT)
end
|
#run ⇒ Object
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 175
def run
create_the_entries
hbox1 = create_hbox
button1 = bold_button('Change directory', self) {
:do_change_the_directory
}
button1.tooltip = 'Press this button to enter the directory '\
'specified on the left hand side.'
button1.clear_background
button1.bblack2
button1.hover(:lightblue)
button1.set_font(LARGER_FONT)
hbox1 << @entry1
hbox1 << button1
vbox1 = create_vbox
vbox1.minimal(hbox1)
hbox2 = create_hbox
text1 = text('Install these mods:')
text1.set_font(LARGER_FONT)
hbox2.add(text1)
vbox1 << hbox2
scrolled_vbox = create_vbox
array_mods.each_with_index {|this_mod, index| index += 1
_ = button(this_mod)
_.on_clicked {
do_install_this_mod(this_mod)
}
_.set_font(LARGER_FONT)
small_hbox = create_hbox
the_text = text(' '+index.to_s+' ')
the_text.set_font(LARGER_FONT)
small_hbox.add(the_text)
small_hbox.add(_)
small_hbox.setFont(Font.new('Verdana', Font::PLAIN, 38))
scrolled_vbox.add(small_hbox)
scrolled_vbox.set_font(LARGER_FONT)
}
scroll_pane = default_scroll_pane(scrolled_vbox)
vbox1.add(scroll_pane)
use_this_font = Font.new(Font::SERIF, Font::BOLD, 38)
vbox1.setFont(use_this_font)
window = create_window_or_runner(vbox1)
window.set_size_request(width?, height?)
if File.directory? BASE_DIR_ON_LINUX
cd(BASE_DIR_ON_LINUX)
update_the_entry_showing_the_current_working_directory
end
run_main(window)
end
|
#update_the_entry_showing_the_current_working_directory ⇒ Object
#
update_the_entry_showing_the_current_working_directory
#
117
118
119
|
# File 'lib/games_and_rpg_paradise/gui/jruby/mod_installer/mod_installer.rb', line 117
def update_the_entry_showing_the_current_working_directory
@entry1.set_text(return_pwd)
end
|