コード例 #1
0
 def on_toolButtonNewEvent_clicked(self):
     dialog = eventEditDialog.EventEditDlg(sDate =self.selected_date)
     dialog.dateEditStart.setDate(self.selected_date)
     if dialog.exec_():
         newData = eventEditDialog.EventEditDlg.eventData
         sqliteUtils.insertEvent(newData)
     self.update()
コード例 #2
0
def readIcs():
    file = open('*****@*****.**', 'rb')
    cal = Calendar.from_ical(file.read())
    for event in cal.walk():
        evData = {}
        if event.name == "VEVENT":
            # if event.name == "VJOURNAL":
            evTitle = event.get('SUMMARY')
            if len(evTitle) > 0:
                evRrule = event.get('RRULE')
                evData["Period"] = 1
                evData["PeriodValue"] = 1
                evData["NoOfTimes"] = 1
                if evRrule:
                    for key in evRrule:
                        if key == 'FREQ':
                            evData["Period"] = periodNum[evRrule[key][0]]
                        if key == 'INTERVAL':
                            evData["PeriodValue"] = evRrule[key][0]
                            # print(evRrule[key][0])
                        if key == 'COUNT':
                            evData["NoOfTimes"] = evRrule[key]

                evStartDate = parse(event['DTSTART'].to_ical()).date()
                evCreatedDate = parse(event['CREATED'].to_ical()).date()
                evData["Title"] = evTitle
                evData["StartDate"] = evStartDate
                evData["CreationDate"] = evCreatedDate
                evData["Notes"] = event.get('DESCRIPTION')
                evData["Category"] = "None"
                evData["ReminderDays"] = None
                evData["DOB"] = None
                evData["MonthDay"] = 0
            # print(evData)
            insertEvent(evData)
    file.close()