Hi guys!

I was able to put background image behind the interface. This is very crude but 
it works. With zero knowledge in Python or Pigment, I'm pretty happy with it. 

To be able to achieve this, you have to remember that visual objects in Elisa 
float in 3D space. Coming from Flash/ActionScript, it took me a while to 
realize this. I thought I can layer objects using depth or z-index. 

------------------------------------------------------------
Steps:

1: Define background image (back_image) in resources.conf. Place image inside 
theme folder.

defaults {
  basedir: 'theme';
}

elisa.plugins.poblesec {
  enter_button: 'enter_button.png';
  back_button: 'back_button.png';
  waiting_icon: 'waiting.png';
  scanning_icon: 'scanning.png';
  key_icon: 'key.png';
  back_image: 'wallpaper_02.png'; 
}


2: Edit main.py. 

#insert these statements at the top
from elisa.plugins.pigment.graph.image import Image
from elisa.plugins.pigment.widgets.theme import Theme

#insert this code inside def set_frontend()
new_size = 1.6
new_coord = (new_size - 1)/2 * -1

theme = Theme.get_default()
wallpaper_resource = theme.get_resource('elisa.plugins.poblesec.back_image')    
    

self.wallpaper = Image()
self.wallpaper.bg_a = 0
self.wallpaper.size = (new_size, new_size)
self.wallpaper.position = (new_coord, new_coord, -400.0)
self.wallpaper.set_from_file(wallpaper_resource)
self.wallpaper.visible = True
self.widget.add(self.wallpaper)
------------------------------------------------------------

Thats it!! Screenshot here - http://danao.org/elisa/elisa_with_background.jpg

I have a question though. This is easily done in Windows build. But this does 
not work in Ubuntu. It still shows a black background. I discovered the Linux 
build is not able to read my back_image reference in resources.conf. Why is 
that? I thought I could just copy the entire poblesec folder from Windows and 
place it in Ubuntu. 
 
Cheers! 
 Jon Danao
danao.org


      

Reply via email to