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