Пример #1
0
    def _callyanfunction(self, index):
        print('callyanfunction:' + self.profilename)
        txtfilename = os.path.join(self._profilepath, self._DirSub(index),
                                   self.profilename + ".txt")
        smplfilename = os.path.join(self._profilepath, self._DirSub(index),
                                    self.profilename + ".jpg")
        logging.info(txtfilename)
        logging.info(smplfilename)
        if os.path.exists(txtfilename) and os.path.exists(smplfilename):
            self.lockyan.acquire()
            logging.info(datetime.now().strftime("%H:%M:%S.%f") +
                         "   *testScrews**")
            try:
                '''
                resultjon = "/tmp/ramdisk/result_%d.json" % index
                cmdline=' python3 testScrew.py -txtfilename "{0}" -jpgfilename "{1}" -testImageName {2} -result {3}'.format(
                    txtfilename, smplfilename, "/tmp/ramdisk/phoneimage_%d.jpg" % index, resultjon
                )
                logging.info(cmdline)
                #os.system(cmdline)
                subprocess.call(["python3", "testScrew.py", '-txtfilename', txtfilename, '-jpgfilename', smplfilename, '-testImageName', "/tmp/ramdisk/phoneimage_%d.jpg" % index, '-result', resultjon])
                logging.info(datetime.now().strftime("%H:%M:%S.%f")+"   -testScrews--")

                '''
                dataresult = testScrew.testScrews(
                    txtfilename, smplfilename,
                    "/tmp/ramdisk/phoneimage_%d.jpg" % index)
                self.imageresults[index] = dataresult
                '''
                if os.path.exists(resultjon):
                    with open(resultjon) as json_file:
                        dataresult = json.load(json_file)                    
                        self.imageresults[index] = dataresult
                else:
                    self.imageresults[index] = []
                '''
            except:
                self.imageresults[index] = []
                pass

            logging.info(datetime.now().strftime("%H:%M:%S.%f") +
                         "   -testScrews end--")
            self.lockyan.release()
            print(self.imageresults[index])
Пример #2
0
 def _callyanfunction(self, index):
     #self.profilename= self.leProfile.text() if self.checkBox.isChecked() else self.comboBox.currentText()
     self.logger.info('callyanfunction:' + self.profilename)
     txtfilename=os.path.join(self._profilepath, self._DirSub(index), self.profilename+".txt")
     smplfilename=os.path.join(self._profilepath, self._DirSub(index), self.profilename+".jpg")
     self.logger.info(txtfilename)
     self.logger.info(smplfilename)
     if os.path.exists(txtfilename) and os.path.exists(smplfilename):
         self.logger.info("*testScrews**")
         try:
             self.imageresults = testScrew.testScrews(
                 txtfilename, 
                 smplfilename, 
                 "/tmp/ramdisk/phoneimage_%d.jpg" % index)
         except :
             self.imageresults = []
             pass
         
         self.logger.info("-testScrews end--")
         self.logger.info(self.imageresults)
Пример #3
0
    def _callyanfunction(self, index):
        self.logger.info('callyanfunction:' + self.profilename)
        txtfilename = os.path.join(self._profilepath, self._DirSub(index),
                                   self.profilename + ".txt")
        smplfilename = os.path.join(self._profilepath, self._DirSub(index),
                                    self.profilename + ".jpg")
        self.logger.info(txtfilename)
        self.logger.info(smplfilename)
        self.imageresults[index] = []
        if os.path.exists(txtfilename) and os.path.exists(smplfilename):
            self.logger.info("*testScrews**")
            try:
                self.imageresults[index] = testScrew.testScrews(
                    txtfilename, smplfilename,
                    "/tmp/ramdisk/phoneimage_%d.jpg" % index)
            except:
                self.imageresults[index] = []
                pass

            self.logger.info("-testScrews end--" + str(index))
            self.logger.info(self.imageresults[index])