This file is indexed.

/usr/share/pyshared/SimPy/tkprogressbar.py is in python-simpy-gui 2.3.1-1.

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
from Tkinter import *


import warnings
warnings.warn('This module be removed in SimPy 3.', DeprecationWarning)


class ProgressBar:
    def __init__(self, master = None, orientation = 'horizontal',
                 min = 0, max = 100, width = 100, height = 18,
                 doLabel = 1, appearance = 'sunken',
                 fillColor = 'blue', background = 'gray',
                 labelColor = 'yellow', labelFont = 'Verdana',
                 labelText = "', labelFormat = '%d%%",
                 value = 50, bd = 2):
        # preserve various values
        self.master = master
        self.orientation = orientation
        self.min = min
        self.max = max
        self.width = width
        self.height = height
        self.doLabel = doLabel
        self.fillColor = fillColor
        self.labelFont = labelFont
        self.labelColor = labelColor
        self.background = background
        self.labelText = labelText
        self.labelFormat = labelFormat
        self.value = value
        self.frame = Frame(master, relief = appearance, bd = bd)
        self.canvas = Canvas(self.frame, height = height, width = width, bd = 0,
                           highlightthickness = 0, background = background)
        self.scale = self.canvas.create_rectangle(0, 0, width, height,
                                                fill = fillColor)
        self.label = self.canvas.create_text(self.canvas.winfo_reqwidth()
/ 2,
                                           height / 2, text = labelText,
                                           anchor = 'c', fill = labelColor,
                                           font = self.labelFont)
        self.update()
        self.canvas.pack(side = 'top', fill = 'x', expand = 'no')

    def updateProgress(self, newValue, newMax = None):
        if newMax:
            self.max = newMax
        self.value = newValue
        self.update()

    def update(self):
        # Trim the values to be between min and max
        value = self.value
        if value > self.max:
            value = self.max
        if value < self.min:
            value = self.min
        # Adjust the rectangle
        if self.orientation == 'horizontal':
            self.canvas.coords(self.scale, 0, 0,
              float(value) / self.max * self.width, self.height)
        else:
            self.canvas.coords(self.scale, 0,
                               self.height - (float(value) /
                                              self.max * self.height),
                               self.width, self.height)
        # Now update the colors
        self.canvas.itemconfig(self.scale, fill = self.fillColor)
        self.canvas.itemconfig(self.label, fill = self.labelColor)
        # And update the label
        if self.doLabel:
            if value:
                if value >= 0:
                    pvalue = int((float(value) / float(self.max)) *
                                   100.0)
                else:
                    pvalue = 0
                self.canvas.itemconfig(self.label, text = self.labelFormat
                                         % pvalue)
            else:
                self.canvas.itemconfig(self.label, text = '')
        else:
            self.canvas.itemconfig(self.label, text = self.labelFormat %
                                   self.labelText)
        self.canvas.update_idletasks()