Ejemplo n.º 1
0
 def takeSnapshot(self, path):
     '''
     screen capture in png format
     :param path: saved file path
     :return: None
     '''
     p1 = self.cmd.popen(['screencap', '-p'], stdout=PIPE)
     p = Popen(['perl', '-pe', 's/\x0D\x0D\x0A/\x0A/g'], stdin=p1.stdout, stdout=PIPE)
     out, error = p.communicate()
     ba = QByteArray.fromRawData(out)
     img = QImage.fromData(ba, 'PNG')
     orient = self.getCurrDisplay()['orientation']
     if orient == 1:
         img = img.transformed(QMatrix().rotate(-90))
     elif orient == 2:
         img = img.transformed(QMatrix().rotate(-180))
     elif orient == 3:
         img = img.transformed(QMatrix().rotate(-270))
     img.save(path, 'PNG')
Ejemplo n.º 2
0
 def takeSnapshot(self, path):
     '''
     screen capture in png format
     :param path: saved file path
     :return: None
     '''
     p1 = self.cmd.popen(['screencap', '-p'], stdout=PIPE)
     p = Popen(['perl', '-pe', 's/\x0D\x0D\x0A/\x0A/g'],
               stdin=p1.stdout,
               stdout=PIPE)
     out, error = p.communicate()
     ba = QByteArray.fromRawData(out)
     img = QImage.fromData(ba, 'PNG')
     orient = self.getCurrDisplay()['orientation']
     if orient == 1:
         img = img.transformed(QMatrix().rotate(-90))
     elif orient == 2:
         img = img.transformed(QMatrix().rotate(-180))
     elif orient == 3:
         img = img.transformed(QMatrix().rotate(-270))
     img.save(path, 'PNG')
Ejemplo n.º 3
0
 def testIt(self):
     data = py3k.b("foobar")
     a = QByteArray.fromRawData(data)
     self.assertEqual(type(a), QByteArray)
     self.assertEqual(a.data(), data)
Ejemplo n.º 4
0
 def testIt(self):
     data = py3k.b("foobar")
     a = QByteArray.fromRawData(data)
     self.assertEqual(type(a), QByteArray)
     self.assertEqual(a.data(), data)