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
64
65
66
67
68
|
# !/usr/bin/python
# -*- coding: utf-8 -*-
# Glitter Toolkit
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
__licenses__ = ["LICENSE.LGPL"]
__description__ = "Tests for the vertical box widget"
import os
import sys
# Change sys path to glitter path
glitter_path = os.path.split(sys.path[0])[0]
sys.path[0] = glitter_path
from window import Window
import gtk
import clutter
from window import Window
from box import VBox
from label import Label
from image import Image
class TestVBox(object):
""" Tests for the vertical box widget """
def __init__(self):
""" Initialize test """
self.window = Window("Glitter tests")
self.window.connect("destroy", self.destroy)
self.stage = self.window.get_stage()
self.stage.connect('notify::width', self.do_resize)
self.stage.connect('notify::height', self.do_resize)
self.vbox = VBox()
self.vbox.spacing = 0.0
self.stage.add(self.vbox)
self.vbox._update_layout()
self.image1 = Image("base.py")
self.vbox.pack(self.image1)
self.image2 = Image("base.py")
self.vbox.pack(self.image2, order='before')
self.image2.size_ratio = -1.0
self.image2.v_offset = 0.1
self.image3 = Image("base.py")
self.vbox.pack(self.image3)
self.vbox.unpack(self.image3)
self.window.show_all()
gtk.main()
def do_resize(self, stage, event):
self.vbox._update_layout()
def destroy(self, widget, data=None):
gtk.main_quit()
if __name__ == '__main__':
TestVBox()
|