def getRankData(self): self.bookrank = [] val = 0 self.progBar.setValue(val) self.statusleiste.showMessage('Amazon Rank-Abfrage läuft ...') self.timestamp = time.strftime("%Y-%m-%d %H:%M:%S") infotext = u'Letzte Abfrage: ' + self.timestamp self.infoLine.setText(infotext) bookdata = RetrieveData() val_incr = 100 / len(self.booklist) self.btn_update.setEnabled(False) for i in range(len(self.booklist)): rankdata = bookdata.get_rank(self.booklist[i][3]) # Abfrage mit Link if rankdata[0] == "-": # bei Error return fail = QtWidgets.QTableWidgetItem(str(rankdata[0])) self.tabelle.setItem(i, 3, fail) rank = QtWidgets.QTableWidgetItem(str(rankdata[1])) self.tabelle.setItem(i, 3, rank) rank_belletristik = QtWidgets.QTableWidgetItem(str(rankdata[2])) self.tabelle.setItem(i, 4, rank_belletristik) if self.booklist[i][2] == "E-Book": availability = QtWidgets.QTableWidgetItem("n/a") else: availability = QtWidgets.QTableWidgetItem(str(rankdata[0])) self.tabelle.setItem(i, 5, availability) self.bookrank.append([self.timestamp, str(rankdata[1]), str(rankdata[2]), rankdata[0]]) val += val_incr self.progBar.setValue(val) self.btn_update.setEnabled(True) self.btn_saveData.setEnabled(True) self.statusleiste.showMessage('Abfrage beendet')
def checkInternetConnection(self): msg = RetrieveData.checkInetConn()[0] # return values : inet conn ok or non existent fail = RetrieveData.checkInetConn()[1] if fail: qmessagebox.warning(self, msg) else: self.statusleiste.showMessage(msg) self.connected_to_net = True