~glitter-team/glitter/trunk

« back to all changes in this revision

Viewing changes to glitter/toolbar.py

  • Committer: Jan Jokela
  • Date: 2008-12-10 22:18:59 UTC
  • Revision ID: janjokela@gmail.com-20081210221859-zxr2ut255a7xu15x
Hi, Glitter here

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# !/usr/bin/python
 
2
# -*- coding: utf-8 -*-
 
3
 
 
4
# Glitter Toolkit
 
5
 
 
6
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
 
7
__licenses__ = ["LICENSE.LGPL"]
 
8
__description__ = "Toolbar widget"
 
9
 
 
10
import gobject
 
11
 
 
12
from widget import *
 
13
from container import Container
 
14
from image import Image
 
15
 
 
16
class Toolbar(Container):
 
17
    """ 
 
18
    A toolbar widget offers an overlay container for displaying tools and 
 
19
    should be placed over the actual content the tools refer to.
 
20
    
 
21
    An example for this are overlay controls in a playing video.
 
22
    
 
23
    """
 
24
    
 
25
    def __init__(self):
 
26
        """ Initialize toolbar widget """
 
27
        
 
28
        super(Toolbar, self).__init__()
 
29
        
 
30
        self._init_elements()
 
31
        
 
32
        self._update_style(self.style)
 
33
 
 
34
    def _init_elements(self):
 
35
        """ Initializes graphical elements """
 
36
        
 
37
        self._background_image = Image()
 
38
        self.add(self._background_image)
 
39
        
 
40
    def _update_style(self, props=None):
 
41
        """ Updates style """
 
42
        
 
43
        super(Toolbar, self)._update_style(props)
 
44
        
 
45
        for key, value in props:
 
46
            if key == 'background-image':
 
47
                self.background_image = value
 
48
                self._background_image.set_source(self.background_image)
 
49
                self._background_image._update_layout()    
 
50
        
 
51
    def _update_layout(self):
 
52
        """ Updates layout """
 
53
        
 
54
        super(Toolbar, self)._update_layout()
 
55
        
 
56
        for child in self.get_children():
 
57
            child._update_layout()
 
58
        
 
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
    
 
66