~glitter-team/glitter/trunk

« back to all changes in this revision

Viewing changes to glitter/toolbar.py

bliss

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
from widget import *
13
13
from container import Container
14
14
from image import Image
 
15
from box import HBox
15
16
 
16
 
class Toolbar(Container):
 
17
class Toolbar(HBox):
17
18
    """ 
18
19
    A toolbar widget offers an overlay container for displaying tools and 
19
20
    should be placed over the actual content the tools refer to.
25
26
    def __init__(self):
26
27
        """ Initialize toolbar widget """
27
28
        
 
29
        self._background_image = None
 
30
        
28
31
        super(Toolbar, self).__init__()
29
 
        
30
 
        self._init_elements()
31
 
        
32
 
        self._update_style(self.style)
33
32
 
34
33
    def _init_elements(self):
35
34
        """ Initializes graphical elements """
44
43
        
45
44
        for key, value in props:
46
45
            if key == 'background-image':
 
46
                if not self._background_image:
 
47
                    self._background_image = Image()
 
48
                    self.add(self._background_image)  
47
49
                self.background_image = value
48
50
                self._background_image.set_source(self.background_image)
49
51
                self._background_image._update_layout()    
53
55
        
54
56
        super(Toolbar, self)._update_layout()
55
57
        
56
 
        for child in self.get_children():
57
 
            child._update_layout()
 
58
        self._background_image._update_layout() 
 
59
            
58
60
        
59
 
#    def add(self, child):
60
 
#        """ Overrides clutter.Actor--add(child) method; calls layout update """
61
 
#        
62
 
#        super(Toolbar, self).add(child)
63
 
#        
64
 
#        self._update_layout()
65
61
    
66
62