initial script

master
DSLitvinov 2 years ago
parent f0c3f5a089
commit ee02f7fe02
  1. BIN
      mos-plymputh/lock.png
  2. 8
      mos-plymputh/lock.svg
  3. 5
      mos-plymputh/mos.plymouth
  4. 143
      mos-plymputh/mos.script

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 613 B

@ -27,9 +27,9 @@
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="12.158361"
inkscape:cx="26.072592"
inkscape:cy="28.704526"
inkscape:zoom="24.316722"
inkscape:cx="22.782676"
inkscape:cy="24.222015"
inkscape:window-width="1920"
inkscape:window-height="1007"
inkscape:window-x="0"
@ -48,6 +48,6 @@
y="4.9993453"
ry="0.37841314" /><path
style="fill:none;stroke:#fefefe;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
d="m 3.1810624,4.9993455 0.010156,-1.8004906 c 0.013887,-2.46196134 5.239487,-2.46194533 5.2535092,0.00452 l 0.01021,1.7959706"
d="m 3.1810624,5.5285122 0.010156,-2.3296573 c 0.010733,-2.46197711 5.2426785,-2.46196141 5.2535092,0.00452 l 0.01021,2.3251373"
id="path412"
sodipodi:nodetypes="cssc" /></g></svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -4,5 +4,6 @@ Description=MOS Plymouth theme.
ModuleName=script
[script]
ImageDir=DESTDIR/plymouth/themes/mos-plymputh
ScriptFile=DESTDIR/plymouth/themes/mos-plymputh/mos.script
ImageDir=/usr/share/plymouth/themes/mos-plymputh
ScriptFile=/usr/share/plymouth/themes/mos-plymputh/mos.script
UseFirmwareBackground=false

@ -1 +1,142 @@
# background
fun imgscalelogo( image, scaleX, scaleY )
{
image.Scale( image.GetWidth() * scaleX, image.GetHeight() * scaleY );
}
# background
if( Window.GetWidth()/Window.GetHeight() > 1.5 )
{
logo.raw = Image("background16x9.png");
}
else
{
logo.raw = Image("background4x3.png");
}
logo.image = imgscalelogo( logo.raw, Window.GetWidth()/logo.raw.GetWidth(), Window.GetHeight()/logo.raw.GetHeight());
logo.sprite = Sprite(logo.image);
logo.sprite.SetPosition(0, 0, 0);
#----------------------------------------- Dialog --------------------------------
status = "normal";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
#----------------------------------------- Quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
}
Plymouth.SetQuitFunction(quit_callback);
#----------------------------------------- Message --------------------------------
message_sprites = [];
message_sprite_count = 0;
message_sprite_y = 10;
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprites[message_sprite_count] = Sprite(my_image);
message_sprites[message_sprite_count].SetPosition(10, message_sprite_y, 10000);
message_sprites[message_sprite_count].text = text;
message_sprite_count++;
message_sprite_y += my_image.GetHeight();
}
fun hide_message_callback (text)
{
for (i = 0; i < message_sprite_count; i++)
{
if (message_sprites[i].text == text)
message_sprites[i] = NULL;
}
}
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Loading…
Cancel
Save