2
# -*- coding: utf-8 -*-
6
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
7
__licenses__ = ["LICENSE.LGPL"]
8
__description__ = "Frame widget"
10
from container import Container
11
from image import Image
13
class Frame(Container):
15
A frame widget provides a top level container for other widgets and should
16
be your top most widget in the hierarchical tree just below the Stage.
17
This because using the Stage as the top most is not a good idea since
18
unlike a Frame, it is attached to the window, or a GTK embed and thus
19
cannot be transformed.
24
""" Initialize frame """
26
super(Frame, self).__init__()
30
self._update_style(self.style)
32
def _init_elements(self):
33
""" Initializes graphical elements """
35
self._background_image = Image()
36
self.add(self._background_image)
38
def _update_style(self, props=None):
41
super(Frame, self)._update_style(props)
43
for key, value in props:
44
if key == 'background-image':
45
self.background_image = value
46
self._background_image.set_source(self.background_image)
47
self._background_image._update_layout()
49
def _update_layout(self):
50
""" Updates layout """
52
super(Frame, self)._update_layout()
54
for child in self.get_children():
55
child._update_layout()
58
""" Overrides clutter.Actor--add(child) method; calls layout update """
60
super(Frame, self).add(child)