This file is indexed.

/usr/share/pyshared/VisionEgg/PyroApps/DropinGUI.py is in python-visionegg 1.2.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
 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
# The Vision Egg: DropinGUI
#
# Copyright (C) 2004 Imran S. Ali, Lachlan Dowd, Andrew Straw
# Copyright (C) 2004 California Institute of Technology
#
# Authors: Imran S. Ali, Lachlan Dowd, Andrew Straw
# URL: <http://www.visionegg.org/>
#
# Distributed under the terms of the GNU Lesser General Public License
# (LGPL). See LICENSE.TXT that came with this file.
#
# $Id$

import VisionEgg, string
import sys, os
import Tkinter
import tkMessageBox
import VisionEgg.PyroApps.VarTypes as VarTypes
import VisionEgg.PyroApps.EPhysGUIUtils as client_utils

def get_control_list():
   return [("dropin_server",DropinControlFrame,DropinControlFrame.title)]

class DropinMetaParameters:
   def __init__(self):
      self.vars_list = []

class DropinControlFrame(client_utils.StimulusControlFrame):
   title = "Vision Egg Script"

   def __init__(self, master=None, suppress_go_buttons=0,**kw):
      client_utils.StimulusControlFrame.__init__(self,
                                                 master,
                                                 suppress_go_buttons,
                                                 DropinControlFrame.title,
                                                 DropinMetaParameters,
                                                 **kw)

      param_frame = self.param_frame # shorthand for self.param_frame created in base class
      param_frame.columnconfigure(0,weight=1)
      param_frame.columnconfigure(1,weight=1)
      self.vars_list = []
      self.error_names = []

   def get_shortname(self):
      return "dropin"

   def update_tk_vars(self):
      pass


   def send_values(self,dummy_arg=None):

      self.meta_params.vars_list = []
      self.error_names = []

      if self.vars_list is None:
         return 0

      for var in self.vars_list:
         if len(var) == 3:
            var_type = var[0]
            var_name = var[1]
            var_val_holder = var[2]
            var_val = var_val_holder.get()
            try:
               if var_val == "compound":
                  pass
               else:
                  if VarTypes.getType(var_type) == "float":
                     var_typed_val = float(var_val)
                  elif VarTypes.getType(var_type) == "integer":
                     var_typed_val = int(float(var_val))
                  elif VarTypes.getType(var_type) == "string":
                     var_typed_val = var_val
                  else:
                     raise ValueError()
                  self.meta_params.vars_list.append([var_name, var_typed_val])
            except ValueError:
               self.error_names.append(var_name)



      if len(self.error_names) == 0:
         self.meta_controller.set_parameters( self.meta_params )
         return 1
      else:
         all_error_names = "Invalid value(s) for the following variable(s):\n"
         for error_name in self.error_names:
            all_error_names = all_error_names + error_name + "\n"
         tkMessageBox.showerror("Invalid value(s)", all_error_names)
         return 0

   def get_duration_sec(self):
      # XXX not implemented yet
      return -1

   # Creates the variable Entry and Label widgets:
   def gen_var_widgets(self, demoscript_filename, vars_list):
      self.vars_list = vars_list
      param_frame = self.param_frame # shorthand for self.param_frame created in base class
      if demoscript_filename is None:
         label = "No demo file loaded"
      else:
         label = demoscript_filename
      Tkinter.Label(param_frame,
                    text=label,
                    font=("Helvetica",8,"bold")).grid(row=0,columnspan=2)
      row_num = 1

      if self.vars_list is None:
         return
      for var in self.vars_list:
         var_label = Tkinter.Label(param_frame,text=var[1]).grid(row=row_num,column=0)
         # Create a Tkinter string variable holder:
         var_val_holder = Tkinter.StringVar()
         # Set to its value:
         var_val_holder.set(var[2])
         # Create (indirectly) Entry widgets:
         # Render variables which were "not found" as non-modifiable for user:
         if var[2] == "not found":
            self.make_callback_entry(textvariable=var_val_holder, state="disabled").grid(row=row_num,column=1)
            del var[2]
         else:
            self.make_callback_entry(textvariable=var_val_holder).grid(row=row_num,column=1)
            var[2] = var_val_holder
         row_num = row_num + 1

if __name__=='__main__':
   frame = DropinControlFrame()
   frame.pack(expand=1,fill=Tkinter.BOTH)
   frame.winfo_toplevel().title("%s"%(os.path.basename(os.path.splitext(sys.argv[0])[0]),))
   frame.mainloop()