def simpleTestBtnClicked(self): orderingPath = "/usr/palm/customization/launchpoints" stubPath = "/mnt/otncabi/usr/palm/applications" currentExcelVer = self.excelVerCombo.currentText().strip() ip = self.ipEdit.text().strip() testList = [] notIncludedCountries = [] failList = [] # 국가 변경이나 capture 실패한 것들 재실행을 위한 List ngList = [] # check 후 NG인 애들 report용 currentChip = self.divChipCombo.currentText().strip() platform = self.platformSelectCombo.currentText().strip() excelVer = self.excelVerCombo.currentText().strip() excelPath = self.excelDir.text().strip() resourcePath = self.resourceDir.text().strip() currentPlatVer = self.platformCombo2ordering.currentText().strip() platform_version = self.platformCombo2ordering.currentText() result = self.countryWorker.inquery(ip, platform_version, DISPLAY_TYPE_NAME, False) if result.resultType != RESULT_SUCCESS: self.resultText.setText(result.message) else: self.countryWorker.devDVBorATSC() countryModel = self.countryWorker.countryModel countiresFromCountryModel = [] if currentChip == DIV_CHIP_VALUES[0]: #DVB countiresFromCountryModel = self.countryWorker.countryModel.DVBcountryList elif currentChip == DIV_CHIP_VALUES[1]: #ATSC countiresFromCountryModel = self.countryWorker.countryModel.ATSCcountryList else: countiresFromCountryModel = self.countryWorker.countryModel.ARIBcountryList for c in countiresFromCountryModel: curCountry = c.split("(")[1].split(",")[0].strip() if curCountry in self.matchingWorker.countries: testList.append(c) else: notIncludedCountries.append(c) for idx, country in enumerate(testList): if not Utils.isEmpty(self, ip, str(country)): countryCode = str(country).split(",")[0].split("(")[-1].strip() excelOrdering = self.matchingWorker.parsingOrderingExcel( excelPath, platform, countryCode, excelVer) code3 = str(country).split(",")[1].strip() applistPath = orderingPath + '/' + code3 + '/applist.json' result = self.appWorker.getAppListFromTV(ip, applistPath) if not result or str( result).strip() == '' or type(result) != type("str"): failList.append((country, "cannot open applist.")) else: applist = json.loads(str(result)) ordering = applist["applications_dosci"] if len(ordering) != len(excelOrdering.keys()): print("ordering list length is different!!!") failList.append( (country, "not matching! tv ordering = " + str(ordering) + " / excel ordering = " + str(excelOrdering))) continue for idx, tv_order in enumerate(ordering): if excelOrdering[idx + 1].strip() != tv_order.strip(): failList.append( (country, "not matching! tv ordering = " + str(ordering) + " / excel ordering = " + str(excelOrdering))) break print("failList========\n", failList) resultText = "" for item in failList: for line in item: if '/' in line: line = line.split('/') line = '\n'.join(line) resultText += str(line) + '\n' resultText += '\n' self.setResultTextSignal.emit("** failList : \n" + resultText)
def orderingCheckLoop(self, countryModel, testList): try: excelVer = self.excelVerCombo.currentText().strip() excelPath = self.excelDir.text().strip() resourcePath = self.resourceDir.text().strip() platform = self.platformSelectCombo.currentText().strip() currentPlatVer = self.platformCombo2ordering.currentText().strip() ip = self.ipEdit.text().strip() failList = [] # 국가 변경이나 capture 실패한 것들 재실행을 위한 List ngList = [] # check 후 NG인 애들 report용 for count, i in enumerate(testList): if self.getStopSignal or self.appClosed: print( "########################################### get Stop Signal!!! or appClosed!!" ) return self.needToCheckList if len( self.needToCheckList ) > 0 else testList[count:] + failList self.setResultTextSignal.emit( "** The number of country to test : " + str(count + 1) + "/" + str(len(testList))) if not Utils.isEmpty(self, ip, str(i)): # i번째 국가로 변경 요청 resultCountry = self.countryWorker.changeCountry( ip, str(i)) if resultCountry.resultType == RESULT_SUCCESS: ## TBD : sleep 구문 적절한걸로 변경 ## TV Controller connect 다 동시에 사용하도록 변경해야할듯. ## #time.sleep(1) self.appendResultTextSignal.emit( "** Current country : " + countryModel.currentCountry) self.powerWorker.reboot(ip, excelVer) time.sleep(30) # key block # self.powerWorker.keyBlock(ip) # 약관 동의 해제 self.powerWorker.setEULA(ip) time.sleep(0.5) # 현재 국가 이름이 요청 국가 이름과 같을 경우 if countryModel.currentCountry == str(i): # EXIT Key 4회 누르기. (Popup 등을 죽이기 위함) # 4회인 이유는 혹시 연달아서 뜨는 것들이 있을까봐 self.appWorker.inputKey(ip, KEY_EXIT, 4) if currentPlatVer == PLATFROMS[2]: # 4.5 self.appWorker.inputKey(ip, KEY_HOME, 1) time.sleep(0.5) isHome = self.appWorker.checkForegroundAppIsHome( ip) while not isHome: self.appWorker.inputKey(ip, KEY_OK, 1) time.sleep(0.5) self.appWorker.inputKey(ip, KEY_HOME, 1) isHome = self.appWorker.checkForegroundAppIsHome( ip) # 현재 Home이 떠 있는 상황인지 Check else: # webOS 4.5에서는 currunt state가 HOME으로 안옴.. self.appWorker.inputKey(ip, KEY_HOME, 1) time.sleep(0.5) isHome, value = self.appWorker.checkHomeShowing( ip) while not isHome: if value == STATE_ALERT or value == 'None': self.appWorker.inputKey(ip, KEY_OK, 1) if value != STATE_HOME: self.appWorker.inputKey( ip, KEY_HOME, 1) isHome, value = self.appWorker.checkHomeShowing( ip) # 10칸 오른쪽 옆으로 감 (모든 CP Apps Capture를 위해) self.appWorker.inputKey(ip, KEY_RIGHT, 10) resultCapture = self.captureWorker.doScreenCapture( ip, str(i)) # resultCapture = self.captureWorker.doScreenCapture_OSD(ip, str(i)) time.sleep(1.5) if resultCapture.resultType == RESULT_SUCCESS: print("Capture Success!!") result = self.matchingWorker.doMatching( excelPath, platform, resourcePath, str(i), excelVer, self.logFileContents, int(self.matchingValEdit.text().strip())) if result == None: failList.append(str(i)) continue self.needToCheckList = testList[ count:] + failList self.needToCheckList = list( set(self.needToCheckList)) self.appendListViewSignal.emit(result) time.sleep(1) else: print("Capture Fail!!!!!!") for i in range(3): resultCapture = self.captureWorker.doScreenCapture( ip, str(i)) time.sleep(1.5) if resultCapture: break if resultCapture: print("Capture Success!!") result = self.matchingWorker.doMatching( excelPath, platform, resourcePath, str(i), excelVer, self.logFileContents, int(self.matchingValEdit.text().strip( ))) if result == None: failList.append(str(i)) continue self.appendListViewSignal.emit(result) time.sleep(1) else: failList.append(str(i)) print("Fail List : ", failList) continue # 열려 있는 Launcher를 닫는 용도 self.appWorker.inputKey(ip, KEY_EXIT, 1) else: # 현재 국가랑 str i 국가가 다를 경우 # 국가 기록하고 continue.. print("Not Same country!!!!!!!!!!!!!") failList.append(str(i)) print("Fail List : ", failList) continue else: # 국가 변경 실패 #self.resultText.setText(result.message) print("FAIL CHANGE COUNTRY!!!!!!!!!!!!!!!!!") failList.append(str(i)) print("Fail List : ", failList) continue else: self.resultText.setText(MESSAGE_NO_INPUT_CHANGE_COUNTRY) if self.getStopSignal or self.appClosed: print( "########################################### get Stop Signal!!! or appClosed!!" ) return failList + testList[count:] print("END!!!! Fail List :", failList) # key release # self.powerWorker.keyBlock(ip, False) return failList except Exception as e: print('*** orderingCheckLoop, Caught exception: %s: %s' % (e.__class__, e)) traceback.print_exc()