[Uludag-commits] r11939 - trunk/bocek/src

svn-uludag at uludag.org.tr svn-uludag at uludag.org.tr
11 Oca 2007 Per 19:56:14 EET


Author: gokmen.goksel
Date: Thu Jan 11 19:56:14 2007
New Revision: 11939

Modified:
   trunk/bocek/src/bocek.py
   trunk/bocek/src/consts.py
Log:
 * Now it can capture screen and attach it with report ;)
 * Already taken screenshot can attach the report
 ...


Modified: trunk/bocek/src/bocek.py
=================================================================
--- trunk/bocek/src/bocek.py	(original)
+++ trunk/bocek/src/bocek.py	Thu Jan 11 19:56:14 2007
@@ -53,6 +53,7 @@
         self.connect(self.buttonSave, SIGNAL('clicked()'), self.buildReport)
         self.connect(self.buttonSend, SIGNAL('clicked()'), self.sendReport)
         self.connect(self.buttonHelp, SIGNAL('clicked()'), self.slotHelp)
+        self.connect(self.buttonTakScr, SIGNAL('clicked()'), self.takeScreen)
         self.connect(guiApp, SIGNAL("shutDown()"), self.slotQuit)
         os.environ['LC_ALL'] = 'C'
         self.lastReportFile=''
@@ -90,15 +91,23 @@
     def sendReport(self):
         if not self.lastReportFile:
             self.buildReport()
+        files = [self.lastReportFile]
+        picPath = str(self.picturePath.lineEdit().text())
+        if not picPath=="":
+            if os.path.exists(picPath):
+                if os.stat(picPath)[6] < (consts.pictureMaxSize * 1000):
+                    files.append(picPath)
         if mail.send_mail(str(self.lineEmail.text()),
                           ["gokmen at pardus.org.tr"],
                           str(self.lineSummary.text()),
                           str(self.lineDetails.text()),
-                          [self.lastReportFile]):
+                          files):
             print "Message sent."
         else:
             print "Error on message sending"
 
+        self.lastReportFile=""
+
     def writeReport(self):
         now = time.localtime()
         filename = '/tmp/BugReport.%s-%s-%s.txt' % (now[2],now[3],now[4])
@@ -107,6 +116,13 @@
         link.close()
         return filename
 
+    def takeScreen(self):
+        now = time.localtime()
+        filename = '/tmp/BugScreenShot.%s-%s-%s.png' % (now[2],now[3],now[4])
+        if os.system("import -window root -colors 8 +dither %s" % filename) == 0:
+            print "screenshot saved."
+            self.picturePath.lineEdit().setText(filename)
+
     def getStaticOutput(self,filename):
         try:
             ret=file(filename,'r').read()

Modified: trunk/bocek/src/consts.py
=================================================================
--- trunk/bocek/src/consts.py	(original)
+++ trunk/bocek/src/consts.py	Thu Jan 11 19:56:14 2007
@@ -39,3 +39,5 @@
 packageInfo = {"/usr/bin/pisi li -i"        :2,
                "/usr/bin/pisi lr"           :2,
                "/usr/bin/pisi lu -i"        :2}
+# Kb
+pictureMaxSize = 400


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi