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
63
|
# !/usr/bin/python
# -*- coding: utf-8 -*-
# Glitter Toolkit
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
__licenses__ = ["LICENSE.LGPL"]
__description__ = "NavigationBar widget"
import gobject
from widget import *
from container import Container
from image import Image
from box import HBox
class NavigationBar(HBox):
"""
A navigation bar widget offers a container attached to the top of the
parent widget for displaying app-wide navigation buttons and info.
An example for this is hierarchical navigation in a file browser for
example.
"""
def __init__(self):
""" Initialize navigation bar widget """
self._background_image = None
super(NavigationBar, 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(NavigationBar, 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(NavigationBar, self)._update_layout()
self._background_image._update_layout()
|