def __incrementMonth(self, date): if date.month() < 12: incrementedDate = date(date.year(), date.month() + 1, date.day()) else: incrementedDate = date(date.year() + 1, 0, date.day()) print("DEBUG - Incremented Date : {}".format(incrementedDate)) return incrementedDate
def updateDate(self, date, starting): if starting: self.calendarEnd.cal.setMinimumDate(date) self.sd = date self.startDate.setText( str(date.month()) + '/' + str(date.day()) + '/' + str(date.year())) else: self.calendarStart.cal.setMaximumDate(date) self.ed = date self.endDate.setText( str(date.month()) + '/' + str(date.day()) + '/' + str(date.year()))
def showMovieData(self): #옵션값 type_txt = self.ui.mComboBox_type.currentText() multi_txt = self.ui.mComboBox_multi.currentText() nation_txt = self.ui.mComboBox_nation.currentText() # 날짜 불러오기 date = self.ui.dateEdit_Movie.date() strDate = '' strDate += str(date.year()) if date.month() < 10: strDate += '0' strDate += str(date.month()) if date.day() < 10: strDate += '0' strDate += str(date.day()) type = None if type_txt == '일별': type = 'dailyBoxOffice' else: type = 'weeklyBoxOffice' movieList = getMovieDataFromDate(strDate,type,type_txt,multi_txt,nation_txt) info, self.MovieInfo = getMovieInfo(movieList,type) if info==None: self.setOnButton(self.ui.movieButton) self.ui.mail_movie.setEnabled(False) self.error(0,"구분:" + type_txt + ", 날짜:"+ str(date.year()) + "년 " + str(date.month()) +"월 "+ str(date.day()) + "일") return # 영화정보 설정 y=0 for movie in self.MovieInfo: self.movieArr[y][0].setText(movie['rank']) self.movieArr[y][1].setText(movie['movieNm']) self.movieArr[y][2].setText(movie['openDt']) self.movieArr[y][3].setText(movie['audiAcc']) y+=1 # 결과창 self.setOnButton(self.ui.movieButton) self.ui.mail_movie.setEnabled(True) QMessageBox.information(self, "Success", info + "\n \t 조회가 완료되었습니다!")
def paintCell(self, painter: QtGui.QPainter, rect: QtCore.QRect, date: typing.Union[QtCore.QDate, datetime.date]) -> None: painter.save() with open(get_resource("config.json")) as file: if date.toPyDate().strftime("%Y-%m-%d") in json.loads( file.read())["favorites"]: painter.fillRect(rect, QtGui.QColor.fromRgb(255, 255, 0)) if (date.month() != self.monthShown()): painter.setPen(QtGui.QColor("#888888")) elif date.dayOfWeek() == 6 or date.dayOfWeek() == 7: painter.setPen(QtGui.QColor("red")) tags = self.get_tags_from_date_file(date.toPyDate()) rect.adjust(0, 0, -1, -1) pen = painter.pen() pen.setColor( QtGui.QColor.fromHsl(pen.color().hue(), pen.color().saturation(), pen.color().lightness(), 150)) painter.setPen(pen) painter.drawRect(rect) pen.setColor( QtGui.QColor.fromHsl(pen.color().hue(), pen.color().saturation(), pen.color().lightness(), 255)) painter.setPen(pen) painter.drawText(rect, QtCore.Qt.AlignTop, str(date.day())) text = "" try: for tag in tags[:5]: if len(tag) > 12: tag = str(tag[:12]) + "..." text += f" {tag} \n" except TypeError: text = "" font = QtGui.QFont() font.setPixelSize(10) painter.setFont(font) brush = painter.background() random.seed(date) brush.setColor(QtGui.QColor().fromHsl(randint(0, 255), randint(0, 255), randint(200, 255))) painter.setPen(QtGui.QColor("black")) painter.setBackground(brush) painter.setBackgroundMode(QtCore.Qt.OpaqueMode) painter.drawText(rect, QtCore.Qt.AlignBottom | QtCore.Qt.AlignHCenter, text) painter.restore()
def printCalendar(date): month = date.month() day = date.day() year = date.year() if month in [1, 3, 5, 7, 8, 10, 12]: dayOfMonth = 31 elif month in [4, 6, 9, 11]: dayOfMonth = 30 elif month == 2: dayOfMonth = 28 if date.isLeapYear(): dayOfMonth += 1 print() print("%12s %s" % (date.monthName(), year)) print("%2s " * 7 % ("Su", "Mo", "Tu", "We", "Th", "Fr", "Sa")) weekOfFirstDay = Date(month, 1, 2000).dayOfWeek() # print(date) # print(weekOfFirstDay) list = [" "] * 7 countDay = 1 for ndx in range(weekOfFirstDay, 7): list[ndx] = countDay countDay += 1 printList(list) print() for curDay in range(countDay, dayOfMonth, 7): for curWeek in range(0, 7): if curDay <= dayOfMonth: list[curWeek] = curDay curDay += 1 else: list[curWeek] = "" printList(list) print()
def getIsoStringFromQDate( date:QDate ) -> str: return getIsoStringFromDateParts( date.year(), date.month(), date.day() )
def end_date_chosen(self, date): self.start_date.setMaximumDate(date) date = date.addMonths(-24) date.setDate(date.year(), date.month(), 1) self.start_date.setDate(date)
def date_to_string(date): if type(date) == datetime.date: year, month, day = str(date.year), str(date.month), str(date.day) else: year, month, day = str(date.year()), str(date.month()), str(date.day()) return year + '-' + month + '-' + day
def _convert_to_google_utc_date_string(self, date: date): local_tz = pytz.timezone(self.config['USERS_TIME_ZONE']) naive_datetime = datetime(date.year(), date.month(), date.day()) local_date = local_tz.localize(naive_datetime, self.is_dst()) return local_date.astimezone(pytz.utc).isoformat() + "Z"
def set_due_date(self): self.due_date = date.month("June")
def showTourData(self): # 옵션값 불러오기 area_txt = self.ui.ComboBox_area.currentText() content_txt = self.ui.ComboBox_content.currentText() keyword_txt = self.ui.lineEdit_keyword.text() # 날짜 불러오기 date = self.ui.dateEdit_Tour.date() strDate = '' strDate += str(date.year()) if date.month() < 10: strDate += '0' strDate += str(date.month()) if date.day() < 10: strDate += '0' strDate += str(date.day()) #키워드검색 if self.ui.checkBox_keyword.isChecked() == True: self.ui.startend_label.setText("분류") FestivalList = getTourDataFromDate('searchKeyword', area_txt, strDate,content_txt, keyword_txt) self.TourInfo = getTourInfo(True,FestivalList,strDate) if self.TourInfo == None: self.setOnButton(self.ui.tourButton) self.ui.mail_tour.setEnabled(False) self.error(1, "지역:" + area_txt + ", 분류:" + content_txt +", 키워드:'" + keyword_txt + "'") return #행사검색 else: self.ui.startend_label.setText("시작일 ~ 종료일") FestivalList = getTourDataFromDate('searchFestival',area_txt,strDate) self.TourInfo = getTourInfo(False,FestivalList,strDate) if self.TourInfo == None: self.setOnButton(self.ui.tourButton) self.ui.mail_tour.setEnabled(False) self.error(1, "지역:" + area_txt + ", 날짜:"+ str(date.year()) + "년 " + str(date.month()) +"월 "+ str(date.day()) + "일") return #여행정보 설정 y=0 buffer = QPixmap() for festival in self.TourInfo: #이미지보여주기 req = Request(festival['image'], headers={'User-Agent': 'Mozilla/5.0'}) data = urlopen(req).read() buffer.loadFromData(data) self.festivalArr[y][0].setPixmap(buffer.scaled(self.festivalArr[y][0].size())) #self.festivalArr[y][0].move(0, 0) self.festivalArr[y][0].show() self.festivalArr[y][1].setText(festival['title']) self.festivalArr[y][2].setText(festival['addr']) self.festivalArr[y][3].setText(festival['eventdate']) self.festivalArr[y][4].setText(festival['location']) y += 1 if y == festivalMAX: break if y != festivalMAX: for i in range(y,festivalMAX): self.festivalArr[i][0].setText('-') self.festivalArr[i][1].setText('-') self.festivalArr[i][2].setText('-') self.festivalArr[i][3].setText('-') self.festivalArr[i][4].setText("-\n-") # 결과창 self.setOnButton(self.ui.tourButton) self.ui.mail_tour.setEnabled(True) QMessageBox.information(self, "Success", "\n 데이트정보 조회가 완료되었습니다!")