|
1 |
# This is an example plymouth plugin script |
1 |
# This is the Univention Corporate Server 4 plymouth plugin script |
2 |
|
2 |
|
3 |
# background image |
3 |
# background image |
4 |
bg.image = Image("bg.png"); |
4 |
bg.image = Image("bg.png"); |
|
29 |
|
29 |
|
30 |
line_height = Image.Text("AfpqtM").GetHeight(); |
30 |
line_height = Image.Text("AfpqtM").GetHeight(); |
31 |
|
31 |
|
32 |
# to determine the mode of operation plymouth was started in use Plymouth.GetMode |
32 |
# to determine the mode of operation plymouth was started in use Plymouth.GetMode |
33 |
# which returns a string of one of: "boot", "shutdown", "suspend", "resume" or unknown. |
33 |
# which returns a string of one of: "boot", "shutdown", "suspend", "resume" or unknown. |
34 |
#status = Plymouth.GetMode (); |
34 |
#status = Plymouth.GetMode (); |
35 |
|
35 |
|
36 |
########## |
36 |
########## |
|
156 |
|
156 |
|
157 |
for (i=0; i < ASK_PROMPT_LINES; i++) { |
157 |
for (i=0; i < ASK_PROMPT_LINES; i++) { |
158 |
prompt[i].sprite = Sprite(); |
158 |
prompt[i].sprite = Sprite(); |
159 |
prompt[i].sprite.SetPosition(10, 50 + (20 * i), 10000); |
159 |
prompt[i].sprite.SetPosition(10, 80 + (20 * i), 10000); |
160 |
} |
160 |
} |
161 |
|
161 |
|
162 |
prompt.setText = fun (string) { |
162 |
prompt.setText = fun (string) { |
|
192 |
prompt.y + 20, |
192 |
prompt.y + 20, |
193 |
10000 |
193 |
10000 |
194 |
); |
194 |
); |
195 |
}; |
195 |
}; |
196 |
|
196 |
|
197 |
global.ask.prompt = prompt; |
197 |
global.ask.prompt = prompt; |
198 |
global.ask.text = text; |
198 |
global.ask.text = text; |
|
206 |
local.lock; |
206 |
local.lock; |
207 |
local.entry; |
207 |
local.entry; |
208 |
local.prompt; |
208 |
local.prompt; |
209 |
|
209 |
|
210 |
lock.image = Image("lock.png"); |
210 |
lock.image = Image("lock.png"); |
211 |
entry.image = Image("entry.png"); |
211 |
entry.image = Image("entry.png"); |
212 |
|
212 |
|
213 |
lock.sprite = Sprite(lock.image); |
213 |
lock.sprite = Sprite(lock.image); |
214 |
lock.x = Window.GetX() + Window.GetWidth() / 2 - lock.image.GetWidth() / 2; |
214 |
lock.x = Window.GetX() + Window.GetWidth() / 2 - lock.image.GetWidth() / 2; |
215 |
lock.y = Window.GetY() + Window.GetHeight() / 2 - global.box.image.GetHeight() / 3; |
215 |
lock.y = Window.GetY() + Window.GetHeight() / 2 - global.box.image.GetHeight() / 3; |
216 |
lock.z = 10000; |
216 |
lock.z = 10000; |
217 |
lock.sprite.SetPosition(lock.x, lock.y, lock.z); |
217 |
lock.sprite.SetPosition(lock.x, lock.y, lock.z); |
218 |
|
218 |
|
219 |
entry.sprite = Sprite(entry.image); |
219 |
entry.sprite = Sprite(entry.image); |
220 |
entry.x = Window.GetX() + Window.GetWidth() / 2 - entry.image.GetWidth() / 2; |
220 |
entry.x = Window.GetX() + Window.GetWidth() / 2 - entry.image.GetWidth() / 2; |
221 |
entry.y = Window.GetY() + Window.GetHeight() / 2 - entry.image.GetHeight() / 2; |
221 |
entry.y = Window.GetY() + Window.GetHeight() / 2 - entry.image.GetHeight() / 2; |
|
224 |
|
224 |
|
225 |
for (i=0; i < PASSWORD_PROMPT_LINES; i++) { |
225 |
for (i=0; i < PASSWORD_PROMPT_LINES; i++) { |
226 |
prompt[i] = Sprite(); |
226 |
prompt[i] = Sprite(); |
227 |
prompt[i].SetPosition(10, 50 + (20 * i), 10000); |
227 |
prompt[i].SetPosition(10, 80 + (20 * i), 10000); |
228 |
} |
228 |
} |
229 |
|
229 |
|
230 |
prompt.setText = fun (string) { |
230 |
prompt.setText = fun (string) { |
|
238 |
prompt[i].SetImage(msg); |
238 |
prompt[i].SetImage(msg); |
239 |
} |
239 |
} |
240 |
}; |
240 |
}; |
241 |
|
241 |
|
242 |
global.dialog.lock = lock; |
242 |
global.dialog.lock = lock; |
243 |
global.dialog.entry = entry; |
243 |
global.dialog.entry = entry; |
244 |
global.dialog.prompt = prompt; |
244 |
global.dialog.prompt = prompt; |
Lines 288-294
fun display_normal_callback () {
|
Link Here
|
---|
|
288 |
global.logo.sprite.SetOpacity(1.0); |
288 |
global.logo.sprite.SetOpacity(1.0); |
289 |
} |
289 |
} |
290 |
|
290 |
|
291 |
# the callback function is called when the display should return to normal |
291 |
# the callback function is called when the display should return to normal |
292 |
Plymouth.SetDisplayNormalFunction(display_normal_callback); |
292 |
Plymouth.SetDisplayNormalFunction(display_normal_callback); |
293 |
|
293 |
|
294 |
############ |
294 |
############ |
Lines 329-335
fun display_password_callback (prompt, bullets) {
|
Link Here
|
---|
|
329 |
} |
329 |
} |
330 |
} |
330 |
} |
331 |
|
331 |
|
332 |
# the callback function is called when the display should display a |
332 |
# the callback function is called when the display should display a |
333 |
# password dialogue. First arg is prompt string, the second is the number of bullets. |
333 |
# password dialogue. First arg is prompt string, the second is the number of bullets. |
334 |
Plymouth.SetDisplayPasswordFunction(display_password_callback); |
334 |
Plymouth.SetDisplayPasswordFunction(display_password_callback); |
335 |
|
335 |
|
Lines 339-345
Plymouth.SetDisplayPasswordFunction(display_password_callback);
|
Link Here
|
---|
|
339 |
|
339 |
|
340 |
statusmsg.sprite = Sprite(); |
340 |
statusmsg.sprite = Sprite(); |
341 |
statusmsg.sprite.SetX(Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth() / 2 + 5); |
341 |
statusmsg.sprite.SetX(Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth() / 2 + 5); |
342 |
statusmsg.sprite.SetY(Window.GetY() + Window.GetHeight() / 2 + box.image.GetHeight() / 2); |
342 |
statusmsg.sprite.SetY(Window.GetY() + Window.GetHeight() / 2 + box.image.GetHeight() / 2 + 40); |
343 |
|
343 |
|
344 |
fun update_status_callback (text) { |
344 |
fun update_status_callback (text) { |
345 |
local.image = Image.Text(text, 0, 0, 0); |
345 |
local.image = Image.Text(text, 0, 0, 0); |
Lines 360-371
fun update_status_callback (text) {
|
Link Here
|
---|
|
360 |
else |
360 |
else |
361 |
image = Image.Text("Checking disk " + device + " (" + progress + "% complete)", 0, 0, 0); |
361 |
image = Image.Text("Checking disk " + device + " (" + progress + "% complete)", 0, 0, 0); |
362 |
} |
362 |
} |
363 |
statusmsg.sprite.SetImage(image); |
363 |
statusmsg.sprite.SetImage(image); |
364 |
} |
364 |
} |
365 |
|
365 |
|
366 |
# the callback function is called with the new boot status string |
366 |
# the callback function is called with the new boot status string |
367 |
Plymouth.SetUpdateStatusFunction(update_status_callback); |
367 |
Plymouth.SetUpdateStatusFunction(update_status_callback); |
368 |
|
368 |
|
369 |
######## |
369 |
######## |
370 |
# quit # |
370 |
# quit # |
371 |
######## |
371 |
######## |
Lines 397-403
fun question_callback (prompt, string) {
|
Link Here
|
---|
|
397 |
global.ask.text.setText(string); |
397 |
global.ask.text.setText(string); |
398 |
} |
398 |
} |
399 |
|
399 |
|
400 |
# the callback function is called when the display should display a question |
400 |
# the callback function is called when the display should display a question |
401 |
# dialogue. First arg is prompt string, the second is the entry contents. |
401 |
# dialogue. First arg is prompt string, the second is the entry contents. |
402 |
Plymouth.SetDisplayQuestionFunction(question_callback); |
402 |
Plymouth.SetDisplayQuestionFunction(question_callback); |
403 |
|
403 |
|
Lines 405-418
Plymouth.SetDisplayQuestionFunction(question_callback);
|
Link Here
|
---|
|
405 |
# message # |
405 |
# message # |
406 |
########### |
406 |
########### |
407 |
|
407 |
|
408 |
# message |
408 |
# message |
409 |
message.sprite = Sprite(); |
409 |
message.sprite = Sprite(); |
410 |
message.sprite.SetPosition(10, 5, 10000); |
410 |
message.sprite.SetPosition(10, 40, 10000); |
411 |
message.maxLength = 100; |
411 |
message.maxLength = 100; |
412 |
|
412 |
|
413 |
# fsck action line |
413 |
# fsck action line |
414 |
message_action.sprite = Sprite(); |
414 |
message_action.sprite = Sprite(); |
415 |
message_action.sprite.SetPosition(10, 30, 10000); |
415 |
message_action.sprite.SetPosition(10, 60, 10000); |
416 |
message_action.maxLength = 100; |
416 |
message_action.maxLength = 100; |
417 |
|
417 |
|
418 |
fun message_callback (text) { |
418 |
fun message_callback (text) { |
Lines 440-446
fun message_callback (text) {
|
Link Here
|
---|
|
440 |
} |
440 |
} |
441 |
} |
441 |
} |
442 |
|
442 |
|
443 |
# he callback function is called when new message should be displayed. |
443 |
# the callback function is called when new message should be displayed. |
444 |
# First arg is message to display. |
444 |
# First arg is message to display. |
445 |
Plymouth.SetMessageFunction(message_callback); |
445 |
Plymouth.SetMessageFunction(message_callback); |
446 |
|
446 |
|
Lines 455-462
fun refresh_callback () {
|
Link Here
|
---|
|
455 |
index = Math.Int(logo.count % 48); |
455 |
index = Math.Int(logo.count % 48); |
456 |
global.logo.sprite.SetImage(logo[index].image); |
456 |
global.logo.sprite.SetImage(logo[index].image); |
457 |
} |
457 |
} |
458 |
|
458 |
|
459 |
# calling Plymouth.SetRefreshFunction with a function will set that |
459 |
# calling Plymouth.SetRefreshFunction with a function will set that |
460 |
# function to be called up to 50 times every second |
460 |
# function to be called up to 50 times every second |
461 |
Plymouth.SetRefreshFunction (refresh_callback); |
461 |
Plymouth.SetRefreshFunction (refresh_callback); |
462 |
|
|
|
463 |
- |