This file is indexed.

/usr/lib/python2.7/dist-packages/uniconvertor/app/Graphics/maskgroup.py is in python-uniconvertor 1.1.5-2.

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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Sketch - A Python-based interactive drawing program
# Copyright (C) 1998, 1999, 2000 by Bernhard Herzog
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#
#	Class MaskGroup
#
#	A special group where one object defines a clip mask for the
#	entire group
#

from app.events.warn import warn_tb, INTERNAL

#from app.UI.command import AddCmd

from app import _, IntersectRects, RegisterCommands
from compound import EditableCompound
from properties import EmptyFillStyle, EmptyLineStyle

class MaskGroup(EditableCompound):

	is_Group = 1
	is_MaskGroup = 1

	_lazy_attrs = EditableCompound._lazy_attrs.copy()
	_lazy_attrs['mask_fill'] = 'update_mask_attrs'
	_lazy_attrs['mask_line'] = 'update_mask_attrs'

	commands = EditableCompound.commands[:]

	def __init__(self, objects = None, duplicate = None):
		EditableCompound.__init__(self, objects,
									duplicate = duplicate)

	def update_mask_attrs(self):
		if self.objects:
			mask = self.objects[0]
			if mask.has_properties:
				self.mask_fill = mask.Properties().Duplicate()
				self.mask_fill.AddStyle(EmptyLineStyle)
				if mask.has_line and mask.Properties().HasLine():
					self.mask_line = mask.Properties().Duplicate()
					self.mask_line.AddStyle(EmptyFillStyle)
				else:
					self.mask_line = None
			else:
				self.mask_line = self.mask_fill = None

	def update_rects(self):
		if self.objects:
			self.bounding_rect = self.objects[0].bounding_rect
			self.coord_rect = self.objects[0].coord_rect

	def ChildChanged(self, child):
		if child is self.objects[0]:
			if self.document is not None:
				self.document.AddClearRect(child.bounding_rect)
		EditableCompound.ChildChanged(self, child)

	def Info(self):
		return _("MaskGroup with %d objects") % len(self.objects)

	def Hit(self, p, rect, device):
		if self.objects[0].Hit(p, rect, device, clip = 1):
			return EditableCompound.Hit(self, p, rect, device)

	def Blend(self, other, frac1, frac2):
		try:
			objs = self.objects
			oobjs = other.objects
			blended = []
			for i in range(min(len(objs), len(oobjs))):
				blended.append(Blend(objs[i], oobjs[i], frac1, frac2))
			return MaskGroup(blended)
		except:
			warn_tb(INTERNAL)
			raise MismatchError

	def Ungroup(self):
		objects = EditableCompound.GetObjects(self)
		# Move the mask, which is in objects[0] to the end of the
		# objects list, because it was on top of all other objects
		# before the group was created.
		#
		# Use a copy of the objects list or we're modifying the list
		# used by the mask group itself with unpredictable consequences
		# for undo.
		# XXX perhaps it would be better to have GetObjects return a
		# copy of the list.
		objects = objects[:]
		objects.append(objects[0])
		del objects[0]
		return objects

	def SaveToFile(self, file):
		file.BeginMaskGroup()
		for obj in self.objects:
			obj.SaveToFile(file)
		file.EndMaskGroup()

	def DrawShape(self, device, rect = None):
		if not self.objects:
			return
		mask = self.objects[0]
		if mask.has_properties:
			attr = mask.properties
			mask.properties = self.mask_fill
		device.PushClip()
		clipped = 1
		try:
			mask.DrawShape(device, rect, clip = 1)
			if rect:
				rect = IntersectRects(rect, mask.bounding_rect)
				test = rect.overlaps
				for o in self.objects[1:]:
					if test(o.bounding_rect):
						o.DrawShape(device, rect)
			else:
				for obj in self.objects[1:]:
					obj.DrawShape(device)
			if self.mask_line is not None:
				device.PopClip()
				clipped = 0
				mask.properties = self.mask_line
				mask.DrawShape(device, rect)
		finally:
			if clipped:
				device.PopClip()
			if mask.has_properties:
				mask.properties = attr

	def permute_objects(self, permutation):
		# make sure the mask stays at index 0
		if permutation[0] != 0:
			permutation = list(permutation)
			permutation.remove(0)
			permutation.insert(0, 0)
		return EditableCompound.permute_objects(self, permutation)

	def Mask(self):
		return self.objects[0]

	def MaskedObjects(self):
		return self.objects[1:]

	def SelectMask(self):
		if self.document is not None:
			self.document.SelectObject(self.objects[0])
	#AddCmd(commands, SelectMask, _("Select Mask"), key_stroke = 'm')

	context_commands = ('SelectMask',)

RegisterCommands(MaskGroup)