[cfe-commits] r56854 - in /cfe/trunk/tools/scan-view: Reporter.py Resources/FileRadar.scpt

Ted Kremenek kremenek at apple.com
Tue Sep 30 09:37:57 PDT 2008


Author: kremenek
Date: Tue Sep 30 11:37:50 2008
New Revision: 56854

URL: http://llvm.org/viewvc/llvm-project?rev=56854&view=rev
Log:
Add "SelectionParameter" class to represent drop-down boxes.
Added "Classification" field to Radar filing.
Modified FileRadar.scpt to take the classification as an argument.

Modified:
    cfe/trunk/tools/scan-view/Reporter.py
    cfe/trunk/tools/scan-view/Resources/FileRadar.scpt

Modified: cfe/trunk/tools/scan-view/Reporter.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/Reporter.py?rev=56854&r1=56853&r2=56854&view=diff

==============================================================================
--- cfe/trunk/tools/scan-view/Reporter.py (original)
+++ cfe/trunk/tools/scan-view/Reporter.py Tue Sep 30 11:37:50 2008
@@ -37,24 +37,34 @@
 class ReporterParameter:
   def __init__(self, n):
     self.name = n
-    
   def getName(self):
     return self.name
-
+  def getValue(self,r,bugtype,getConfigOption):
+     return getConfigOption(r.getName(),self.getName())
   def saveConfigValue(self):
     return True
 
 class TextParameter (ReporterParameter):
-  def getValue(self,r,bugtype,getConfigOption):
-     return getConfigOption(r.getName(),self.getName())
-
   def getHTML(self,r,bugtype,getConfigOption):
     return """\
 <tr>
-  <td class="form_clabel">%s:</td>
-  <td class="form_value"><input type="text" name="%s_%s" value="%s"></td>
+<td class="form_clabel">%s:</td>
+<td class="form_value"><input type="text" name="%s_%s" value="%s"></td>
 </tr>"""%(self.getName(),r.getName(),self.getName(),self.getValue(r,bugtype,getConfigOption))
 
+class SelectionParameter (ReporterParameter):
+  def __init__(self, n, values):
+    ReporterParameter.__init__(self,n)
+    self.values = values
+    
+  def getHTML(self,r,bugtype,getConfigOption):
+    return """\
+<tr>
+<td class="form_clabel">%s:</td><td class="form_value"><select name="%s_%s">
+%s
+</select></td>"""%(self.getName(),r.getName(),self.getName(),'\n'.join(["""\
+<option value="%s">%s</option>"""%(o[0],o[1]) for o in self.values]))
+
 #===------------------------------------------------------------------------===#
 # Reporters
 #===------------------------------------------------------------------------===#
@@ -156,11 +166,16 @@
         return 'Radar'
 
     def getParameters(self):
-        return map(lambda x:TextParameter(x),['Component', 'Component Version'])
+        return [ TextParameter('Component'), TextParameter('Component Version'),
+                 SelectionParameter('Classification',
+                  [ ['1', 'Security'], ['2', 'Crash/Hang/Data Loss'],
+                    ['3', 'Performance'], ['4', 'UI/Usability'],
+                    ['6', 'Serious Bug'], ['7', 'Other'] ]) ]
 
     def fileReport(self, report, parameters):
         component = parameters.get('Component', '')
         componentVersion = parameters.get('Component Version', '')
+        classification = parameters.get('Classification', '')
         personID = ""
         diagnosis = ""
         config = ""
@@ -171,13 +186,12 @@
             componentVersion = 'X'
 
         script = os.path.join(os.path.dirname(__file__),'Resources/FileRadar.scpt')
-        args = ['osascript', script, component, componentVersion, personID, report.title,
+        args = ['osascript', script, component, componentVersion, classification, personID, report.title,
                 report.description, diagnosis, config] + map(os.path.abspath, report.files)
 #        print >>sys.stderr, args
-	try:
-       	    p = subprocess.Popen(args, 
-                                 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-       	except:
+        try:
+          p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        except:
             raise ReportFailure("Unable to file radar (AppleScript failure).")
         data, err = p.communicate()
         res = p.wait()

Modified: cfe/trunk/tools/scan-view/Resources/FileRadar.scpt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/Resources/FileRadar.scpt?rev=56854&r1=56853&r2=56854&view=diff

==============================================================================
Binary files - no diff available.





More information about the cfe-commits mailing list