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 __init__(self, year=date.year()): self.year = year self.holidays = { 'New Years': date(year, 1, 1), 'Martin Luther King': (rd.lastdayofmonth(0) - timedelta(days=7)), 'Memorial': rd.lastdayofmonth(0), 'Independence': date(year, 7, 4), 'Labor': rd.firstdayofmonth(0), 'Veterans': (rd.firstdayofmonth(0) + timedelta(days=7)), 'Thankgiving': rd.lastdayofmonth(3), 'Christmas': date(year, 12, 25) }
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 _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 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 데이트정보 조회가 완료되었습니다!")
def show_holiday(): year = str(date.year()) response = request.get