This file is indexed.

/usr/share/pyshared/soya/pudding/container.py is in python-soya 0.15~rc1-10.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
# -*- indent-tabs-mode: t -*-

""" containers for pudding """

from soya.pudding      import EXPAND_VERT, EXPAND_HORIZ, CENTER_HORIZ, CENTER_VERT
from soya.pudding.core import Container, TestContainer

__revision__ = "$Revision: 1.1 $"

__doc_classes__ = [ 'VerticalContainer', 
										'HorizontalContainer',
										]

__doc_functions__ = []

# we should be able to merge these two classes but i cant think how atm

class VerticalContainer(Container):
	""" class to resize all children in a column"""

	def on_resize(self):
		""" resize all children into a column """

		self.do_anchoring()
		
		unchangable = 0 
		unchangable_count = 0
	
		for y, child in enumerate(self.children):
			if not child._container_flags & EXPAND_VERT:
				unchangable += child.height
				unchangable_count += 1

		try:
			height = (self.height - unchangable) / (len(self.children) - \
																										unchangable_count)

		except ZeroDivisionError:
			# this happens if none of the children are resizable
			height = 0

		y = 0

		for child in self.children:
			child.top = y 
			child.left = 0

			if not  child._container_flags & EXPAND_HORIZ and \
							child._container_flags & CENTER_HORIZ:
				child.left = (self.width / 2) - (child.width / 2)

			elif child._container_flags & EXPAND_HORIZ:
				child.width = self.width
				
			if child._container_flags & EXPAND_VERT:
				child.height = height

			y += child.height + self._padding

			child.on_resize()

class TestVerticalContainer(TestContainer):
	klass = VerticalContainer


class HorizontalContainer(Container):
	""" class to resize all children in a row"""

	def on_resize(self):
		""" resize all children into a row """

		self.do_anchoring()

		unchangable = 0 
		unchangable_count = 0
	
		for x, child in enumerate(self.children):
			if not child._container_flags & EXPAND_HORIZ:
				unchangable += child.width
				unchangable_count += 1
			
		try:
			width = (self.width - unchangable) / (len(self.children) - \
																									unchangable_count)
		except ZeroDivisionError:
			# this happens if none of the children are resizable
			width = 0

		x = 0

		for child in self.children:
			child.top = 0 
			child.left = x

			if not  child._container_flags & EXPAND_VERT and \
							child._container_flags & CENTER_VERT:
				child.top = (self.height / 2) - (child.height / 2)
				
			elif child._container_flags & EXPAND_VERT:
				child.height = self.height
				
			if child._container_flags & EXPAND_HORIZ:
				child.width = width

			x += child.width + self._padding

			child.on_resize()

class TestHorizontalContainer(TestContainer):
	klass = HorizontalContainer