def sms_ahoy_reply(): resp = MessagingResponse() resp.message(getNews()) return str(resp)
def getDate(): return DAYS[datetime.datetime.now().weekday()] + datetime.datetime.today().strftime(" %d ") + MONTHS[int(datetime.datetime.today().strftime("%m"))] LARGE_FONT = ("arial", 30) TIME_FONT = ("arial", 50) SECONDS_FONT = ("arial", 20) WEATHER_FONT = ("arial", 20) NEWS_FONT = ("arial", 16) DAYS = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"] MONTHS = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"] NWTEXT = getDate() NETEXT = getMyHoro() SWTEXT = getWeather() SETEXT = newsAPI.getNews() def getHM(): HM = time.strftime("%H : %M") return HM def getS(): S = time.strftime(" : %S") return S class Main(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=1)
def update_news(self): news = newsAPI.getNews() self.SE.configure(text=news)
def retranslateUi(self, Dialog): _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "Dialog")) self.NewsText.setText(_translate("Dialog", "News")) self.groupBox.setTitle(_translate("Dialog", "News")) item = self.tableWidget_2.verticalHeaderItem(0) item.setText(_translate("Dialog", "Title")) item = self.tableWidget_2.verticalHeaderItem(1) item.setText(_translate("Dialog", "Information")) item = self.tableWidget_2.verticalHeaderItem(2) item.setText(_translate("Dialog", "Source")) item = self.tableWidget_2.verticalHeaderItem(3) item.setText(_translate("Dialog", "Date")) item = self.tableWidget_5.verticalHeaderItem(0) item.setText(_translate("Dialog", "Title")) item = self.tableWidget_5.verticalHeaderItem(1) item.setText(_translate("Dialog", "Information")) item = self.tableWidget_5.verticalHeaderItem(2) item.setText(_translate("Dialog", "Source")) item = self.tableWidget_5.verticalHeaderItem(3) item.setText(_translate("Dialog", "Date")) item = self.tableWidget_3.verticalHeaderItem(0) item.setText(_translate("Dialog", "Title")) item = self.tableWidget_3.verticalHeaderItem(1) item.setText(_translate("Dialog", "Information")) item = self.tableWidget_3.verticalHeaderItem(2) item.setText(_translate("Dialog", "Source")) item = self.tableWidget_3.verticalHeaderItem(3) item.setText(_translate("Dialog", "Date")) item = self.tableWidget.verticalHeaderItem(0) item.setText(_translate("Dialog", "Title")) item = self.tableWidget.verticalHeaderItem(1) item.setText(_translate("Dialog", "Information")) item = self.tableWidget.verticalHeaderItem(2) item.setText(_translate("Dialog", "Source")) item = self.tableWidget.verticalHeaderItem(3) item.setText(_translate("Dialog", "Date")) __sortingEnabled = self.tableWidget.isSortingEnabled() self.tableWidget.setSortingEnabled(False) self.tableWidget.setSortingEnabled(__sortingEnabled) item = self.tableWidget_4.verticalHeaderItem(0) item.setText(_translate("Dialog", "Title")) item = self.tableWidget_4.verticalHeaderItem(1) item.setText(_translate("Dialog", "Information")) item = self.tableWidget_4.verticalHeaderItem(2) item.setText(_translate("Dialog", "Source")) item = self.tableWidget_4.verticalHeaderItem(3) item.setText(_translate("Dialog", "Date")) #intégration de la fonction qui va récupérer les news #récupération des variables articles = getNews() #création des items dans les cellules #article 1 for i in range(0, 4): item = QtWidgets.QTableWidgetItem() self.tableWidget.setItem(i, 0, item) #article 2 for i in range(0, 4): item = QtWidgets.QTableWidgetItem() self.tableWidget_2.setItem(i, 0, item) #article 3 for i in range(0, 4): item = QtWidgets.QTableWidgetItem() self.tableWidget_3.setItem(i, 0, item) #article 4 for i in range(0, 4): item = QtWidgets.QTableWidgetItem() self.tableWidget_4.setItem(i, 0, item) #article 5 for i in range(0, 4): item = QtWidgets.QTableWidgetItem() self.tableWidget_5.setItem(i, 0, item) #article 1 __sortingEnabled = self.tableWidget.isSortingEnabled() self.tableWidget.setSortingEnabled(False) self.tableWidget.setSortingEnabled(__sortingEnabled) for i in range(0, 4): self.tableWidget.setColumnWidth(i, 1150) item = self.tableWidget.item(i, 0) item.setText(_translate("Dialog", articles[0][i])) self.tableWidget.resizeRowsToContents() self.tableWidget.horizontalHeader().setVisible(False) #article 2 __sortingEnabled = self.tableWidget_2.isSortingEnabled() self.tableWidget_2.setSortingEnabled(False) self.tableWidget_2.setSortingEnabled(__sortingEnabled) for i in range(0, 4): self.tableWidget_2.setColumnWidth(i, 1150) self.tableWidget_2.setItem(i, 0, item) item = self.tableWidget_2.item(i, 0) item.setText(_translate("Dialog", articles[1][i])) self.tableWidget_2.resizeRowsToContents() self.tableWidget_2.horizontalHeader().setVisible(False) #article 3 __sortingEnabled = self.tableWidget_3.isSortingEnabled() self.tableWidget_3.setSortingEnabled(False) self.tableWidget_3.setSortingEnabled(__sortingEnabled) for i in range(0, 4): self.tableWidget_3.setColumnWidth(i, 1150) self.tableWidget_3.setItem(i, 0, item) item = self.tableWidget_3.item(i, 0) item.setText(_translate("Dialog", articles[2][i])) self.tableWidget_3.resizeRowsToContents() self.tableWidget_3.horizontalHeader().setVisible(False) #article 4 __sortingEnabled = self.tableWidget_4.isSortingEnabled() self.tableWidget_4.setSortingEnabled(False) self.tableWidget_4.setSortingEnabled(__sortingEnabled) for i in range(0, 4): self.tableWidget_4.setColumnWidth(i, 1150) self.tableWidget_4.setItem(i, 0, item) item = self.tableWidget_4.item(i, 0) item.setText(_translate("Dialog", articles[3][i])) self.tableWidget_4.resizeRowsToContents() self.tableWidget_4.horizontalHeader().setVisible(False) #article 5 __sortingEnabled = self.tableWidget_5.isSortingEnabled() self.tableWidget_5.setSortingEnabled(False) self.tableWidget_5.setSortingEnabled(__sortingEnabled) for i in range(0, 4): self.tableWidget_5.setColumnWidth(i, 1150) self.tableWidget_5.setItem(i, 0, item) item = self.tableWidget_5.item(i, 0) item.setText(_translate("Dialog", articles[4][i])) self.tableWidget_5.resizeRowsToContents() self.tableWidget_5.horizontalHeader().setVisible(False) self.commandLinkButton.setText( _translate("Dialog", "https://messari.io/news"))