CrunchBang Linux Pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

CrunchBang Linux Pastebin

Difference between
modified post 975 by johnraff on Thu 10th Mar 13:09 and
original post 968 by johnraff on Wed 9th Mar 16:55
Show old version | new version | both versions

    
11
# This is a modified version of the example plymouth plugin script
33
screen_width = Window.GetWidth();
44
screen_height = Window.GetHeight();
66
Window.SetBackgroundTopColor(0, 0, 0);
7+
Window.SetBackgro# This is a modified version of the example plymouth plugin script
9+
screen_width = Window.GetWidth();
10+
screen_height = Window.GetHeight();
12+
Window.SetBackgroundTopColor(0, 0, 0);
7-
Window.SetBackgroundBottomColor(0, 0, 0);
9+
screen_width = Window.GetWidth();
10+
screen_height = Window.GetHeight();
12+
Window.SetBackgroundTopColor(0, 0, 0);
13+
Window.SetBackgroundBottomColor(0, 0, 0);
9-
# screen width logo image was made to look best on
10-
logo_image_original_screen_width = 1024;
11-
logo_scale_factor = screen_width / logo_image_original_screen_width;
12+
Window.SetBackgroundTopColor(0, 0, 0);
13+
Window.SetBackgroundBottomColor(0, 0, 0);
15+
# screen width logo image was made to look best on
16+
logo_image_original_screen_width = 1024;
17+
logo_scale_factor = screen_width / logo_image_original_screen_width;
1319
#logo.image = Image("special://logo");
1420
logo.original_image = Image ("crunchbang-logo.png");
1521
logo_width = logo.original_image.GetWidth() * logo_scale_factor;
1622
logo_height = logo.original_image.GetHeight() * logo_scale_factor;
1723
logo.image = logo.original_image.Scale(logo_width, logo_height);
1824
logo.sprite = Sprite(logo.image);
1925
logo.opacity_angle = 0;
2228
fun refresh_callback ()
2329
  {
2430
    if (status == "normal")
2531
      {
2632
        logo.opacity_angle += ((2 * 3.14) / 50) * 0.5;  # 0.5 HZ
2733
        min_opacity = 0.3;
2834
        opacity = (Math.Cos(logo.opacity_angle) + 1) / 2;
2935
        opacity *= 1 - min_opacity;
3036
        opacity += min_opacity;
3137
        logo.sprite.SetX (Window.GetX() + screen_width  / 2 - logo_width  / 2);
3238
        logo.sprite.SetY (Window.GetY() + screen_height / 2 - logo_height / 2);
3339
        logo.sprite.SetOpacity (opacity);
3440
      }
3541
    else
3642
      {
3743
        logo.sprite.SetX (0);
3844
        logo.sprite.SetY (0);
3945
        logo.sprite.SetOpacity (1);
4046
      }
4147
  }
4349
Plymouth.SetRefreshFunction (refresh_callback);
4551
status = "normal";
4753
#----------------------------------------- Progress Bar --------------------------------
4854
progress_box_height = (logo_height * 0.1);
4955
progress_box_width = (screen_width * 0.4);
5157
progress_box.original_image = Image("progress_box.png");
5258
progress_box.image = progress_box.original_image.Scale(progress_box_width, progress_box_height);
5359
progress_box.sprite = Sprite(progress_box.image);
5561
progress_box.x = Window.GetX() + screen_width / 2 - progress_box_width / 2;
5662
progress_box.y = Window.GetY() + screen_height / 2 + logo_height / 2 + progress_box_height * 5;
5763
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
5965
progress_bar.original_image = Image("progress_bar.png");
6066
progress_bar.image = progress_bar.original_image.Scale(0, progress_box_height);
6167
progress_bar.sprite = Sprite();
6369
progress_bar.x = progress_box.x;
6470
progress_bar.y = progress_box.y;
6571
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1);
6773
# "progress * 3" for bar width is a hack which should be unnecessary
6874
fun progress_callback (duration, progress)
6975
  {
7076
# I don't understand the purpose of this line, but changed it anyway
7177
#    if (progress_bar.image.GetWidth () != Math.Int (progress_bar.original_image.GetWidth () * progress))
7278
    if (progress_bar.image.GetWidth () != Math.Int (progress_box_width * progress))
7379
      {
7480
        progress_bar.image = progress_bar.original_image.Scale(progress_box_width * progress * 3, progress_box_height);
7581
        progress_bar.sprite.SetImage (progress_bar.image);
7682
      }
7783
  }
7985
Plymouth.SetBootProgressFunction(progress_callback);
8187
#----------------------------------------- Status Update --------------------------------
8389
NUM_SCROLL_LINES = 5;
8490
LINE_WIDTH = 55;
8591
# width of one character
8692
CHAR_WIDTH = 7;
8793
# height of one character
8894
CHAR_HEIGHT = 10;
9096
fun StringLength(string) {
9197
  index = 0;
9298
  str = String(string);
9399
  while(str.CharAt(index)) index++;
94100
  return index;
95101
}
97103
// Initialising text images and their positions
98-
// 20 is the height (including line spacing) of each line
104+
// CHAR_HEIGHT * 2 is the height (including line spacing) of each line
99105
for (i=0; i < NUM_SCROLL_LINES; i++) {
100106
  lines[i]= Image.Text("");
101107
  message_sprite[i] = Sprite();
102108
  message_sprite[i].SetX (Window.GetX() + (screen_width / 2 ) - (LINE_WIDTH * CHAR_WIDTH / 2));
103109
  message_sprite[i].SetY (Window.GetY() + (screen_height / 2) + (logo_height /2) +(logo_height * 1.2)+ (i * CHAR_HEIGHT * 2) );
104110
  message_sprite[i].SetZ (10000);
105111
}
108114
fun scroll_message_callback(text) {
110116
   // Truncate the message if too long
111117
   if (StringLength(text) > LINE_WIDTH) {
112118
     text = text.SubString(0, LINE_WIDTH - 3);
113119
     text += "...";
114120
   }
116122
   // Shift messages one up
117123
   for (i = 0; i < NUM_SCROLL_LINES - 1; i++) {
118124
     lines[i] = lines[i+1];
119125
   }
121127
   // Create the image for the latest message
122-
#  original script had "lines[i]"
128+
#  i is a global variable here? It needs to be equal to NUM_SCROLL_LINES - 1
123-
   lines[4] = Image.Text( text, 0.5, 0.5, 0.5);
129+
   lines[i] = Image.Text( text, 0.5, 0.5, 0.5);
125131
   // Re-allocate the text images to sprites
126132
   for (i = 0; i < NUM_SCROLL_LINES; i++) {
127133
     message_sprite[i].SetImage(lines[i]);
128134
   }
129135
}
131137
Plymouth.SetUpdateStatusFunction(scroll_message_callback);
133139
# messages get added to updates
134140
Plymouth.SetMessageFunction(scroll_message_callback);
136142
#----------------------------------------- Quit --------------------------------
138144
fun quit_callback ()
139145
{
140146
  logo.sprite.SetOpacity (1);
141147
  progress_bar.image = progress_bar.original_image.Scale(progress_box_width, progress_box_height);
142148
  progress_bar.sprite.SetImage(progress_bar.image);
143149
}
145151
Plymouth.SetQuitFunction(quit_callback);
153+
undBottomColor(0, 0, 0);
155+
# screen width logo image was made to look best on
156+
logo_image_original_screen_width = 1024;
157+
logo_scale_factor = screen_width / logo_image_original_screen_width;
159+
#logo.image = Image("special://logo");
160+
logo.original_image = Image ("crunchbang-logo.png");
161+
logo_width = logo.original_image.GetWidth() * logo_scale_factor;
162+
logo_height = logo.original_image.GetHeight() * logo_scale_factor;
163+
logo.image = logo.original_image.Scale(logo_width, logo_height);
164+
logo.sprite = Sprite(logo.image);
165+
logo.opacity_angle = 0;
168+
fun refresh_callback ()
169+
  {
170+
    if (status == "normal")
171+
      {
172+
        logo.opacity_angle += ((2 * 3.14) / 50) * 0.5;  # 0.5 HZ
173+
        min_opacity = 0.3;
174+
        opacity = (Math.Cos(logo.opacity_angle) + 1) / 2;
175+
        opacity *= 1 - min_opacity;
176+
        opacity += min_opacity;
177+
        logo.sprite.SetX (Window.GetX() + screen_width  / 2 - logo_width  / 2);
178+
        logo.sprite.SetY (Window.GetY() + screen_height / 2 - logo_height / 2);
179+
        logo.sprite.SetOpacity (opacity);
180+
      }
181+
    else
182+
      {
183+
        logo.sprite.SetX (0);
184+
        logo.sprite.SetY (0);
185+
        logo.sprite.SetOpacity (1);
186+
      }
187+
  }
189+
Plymouth.SetRefreshFunction (refresh_callback);
191+
status = "normal";
193+
#----------------------------------------- Progress Bar --------------------------------
194+
progress_box_height = (logo_height * 0.1);
195+
progress_box_width = (screen_width * 0.4);
197+
progress_box.original_image = Image("progress_box.png");
198+
progress_box.image = progress_box.original_image.Scale(progress_box_width, progress_box_height);
199+
progress_box.sprite = Sprite(progress_box.image);
201+
progress_box.x = Window.GetX() + screen_width / 2 - progress_box_width / 2;
202+
progress_box.y = Window.GetY() + screen_height / 2 + logo_height / 2 + progress_box_height * 5;
203+
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
205+
progress_bar.original_image = Image("progress_bar.png");
206+
progress_bar.image = progress_bar.original_image.Scale(0, progress_box_height);
207+
progress_bar.sprite = Sprite();
209+
progress_bar.x = progress_box.x;
210+
progress_bar.y = progress_box.y;
211+
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1);
213+
# "progress * 3" for bar width is a hack which should be unnecessary
214+
fun progress_callback (duration, progress)
215+
  {
216+
# I don't understand the purpose of this line, but changed it anyway
217+
#    if (progress_bar.image.GetWidth () != Math.Int (progress_bar.original_image.GetWidth () * progress))
218+
    if (progress_bar.image.GetWidth () != Math.Int (progress_box_width * progress))
219+
      {
220+
        progress_bar.image = progress_bar.original_image.Scale(progress_box_width * progress * 3, progress_box_height);
221+
        progress_bar.sprite.SetImage (progress_bar.image);
222+
      }
223+
  }
225+
Plymouth.SetBootProgressFunction(progress_callback);
227+
#----------------------------------------- Status Update --------------------------------
229+
NUM_SCROLL_LINES = 5;
230+
LINE_WIDTH = 55;
231+
# width of one character
232+
CHAR_WIDTH = 7;
233+
# height of one character
234+
CHAR_HEIGHT = 10;
236+
fun StringLength(string) {
237+
  index = 0;
238+
  str = String(string);
239+
  while(str.CharAt(index)) index++;
240+
  return index;
241+
}
243+
// Initialising text images and their positions
244+
// 20 is the height (including line spacing) of each line
245+
for (i=0; i < NUM_SCROLL_LINES; i++) {
246+
  lines[i]= Image.Text("");
247+
  message_sprite[i] = Sprite();
248+
  message_sprite[i].SetX (Window.GetX() + (screen_width / 2 ) - (LINE_WIDTH * CHAR_WIDTH / 2));
249+
  message_sprite[i].SetY (Window.GetY() + (screen_height / 2) + (logo_height /2) +(logo_height * 1.2)+ (i * CHAR_HEIGHT * 2) );
250+
  message_sprite[i].SetZ (10000);
251+
}
254+
fun scroll_message_callback(text) {
256+
   // Truncate the message if too long
257+
   if (StringLength(text) > LINE_WIDTH) {
258+
     text = text.SubString(0, LINE_WIDTH - 3);
259+
     text += "...";
260+
   }
262+
   // Shift messages one up
263+
   for (i = 0; i < NUM_SCROLL_LINES - 1; i++) {
264+
     lines[i] = lines[i+1];
265+
   }
267+
   // Create the image for the latest message
268+
#  original script had "lines[i]"
269+
   lines[4] = Image.Text( text, 0.5, 0.5, 0.5);
271+
   // Re-allocate the text images to sprites
272+
   for (i = 0; i < NUM_SCROLL_LINES; i++) {
273+
     message_sprite[i].SetImage(lines[i]);
274+
   }
275+
}
277+
Plymouth.SetUpdateStatusFunction(scroll_message_callback);
279+
# messages get added to updates
280+
Plymouth.SetMessageFunction(scroll_message_callback);
282+
#----------------------------------------- Quit --------------------------------
284+
fun quit_callback ()
285+
{
286+
  logo.sprite.SetOpacity (1);
287+
  progress_bar.image = progress_bar.original_image.Scale(progress_box_width, progress_box_height);
288+
  progress_bar.sprite.SetImage(progress_bar.image);
289+
}
291+
Plymouth.SetQuitFunction(quit_callback);

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me