def gotoEntry(self):
     a = self.tableViewEvents.currentIndex().row()
     i = self.eventsViewModel.listdata[a]
     ev = sqliteUtils.fetchEvent(int(i[7]))
     self.selected_date = parse(str(ev[1]), dayfirst='false')
     self.update()
     self.stackedWidget.setCurrentIndex(0)
 def update(self):
     global daysDirty, daysEntries
     ind = 0
     c = 0
     # print(self.selected_date)
     if True:#daysDirty == True:
         allEnts = sqliteUtils.fetchAllEntries()
         if allEnts:
             self.daysEntries.clear()
             for ent in allEnts:
                 self.daysEntries.append((parse(str(ent[0])).strftime("%d/%m/%Y"),
                                          ent[1]))
                 if (datetime.date(parse(str(ent[0])))
                         <= datetime.date(parse(str((self.selected_date))))):
                     ind = c
                 c += 1
         self.daysViewModel.setAllData(self.daysEntries)
         if ind > 0:
             index = self.daysViewModel.createIndex(ind, 0)
             self.daysTableView.setCurrentIndex(index)
         # daysDirty = False
     self.events_list = {}
     self.evData.clear()
     self.calendarSelectDate.setSelectedDate(self.selected_date)
     self.dateEdit.setDate(self.selected_date)
     self.textBrowserNotes.setText('')
     self.textBrowserReminder.setText('')
     self.textBrowserCategory.setText('')
     d = sqliteUtils.fetchEntry(self.selected_date)
     if d is not None:
         self.textBrowserJournalEntry.setText(d[0])
         if len(d['event_list']) > 0:
             l = eval(d['event_list'])
             m = list(l)
             for n in m:
                 e = sqliteUtils.fetchEvent(n)
                 if e is not None:
                     if e['Category'] in G.categorySet:
                         self.events_list[n] = e['title']
     else:
         self.textBrowserJournalEntry.setText('')
     if self.stackedWidget.currentIndex() == 1:
         self.updateWeekView()
     if self.stackedWidget.currentIndex() == 2:
         self.updateMonthView()
     self.populateList()
     self.labelSelectedDate.setText((self.selected_date).strftime(
                     "%A  %B  %d,  %Y"))
     self.updateMonthView()
     self.setWindowTitle('Dayfacto file:   ' + G.lastFile)
 def on_tableViewEvents_dblClicked(self):
     a = self.tableViewEvents.currentIndex().row()
     i = self.eventsViewModel.listdata[a]
     ev = sqliteUtils.fetchEvent(int(i[7]))
     self.evData["Title"] = ev[5]
     self.evData["Notes"] = ev[6]
     self.evData["Category"] = ev[7]
     self.evData["ReminderDays"] = ev[11]
     self.evData["StartDate"] = ev[1]
     self.evData["Period"] = ev[9]
     self.evData["PeriodValue"] = ev[12]
     self.evData["NoOfTimes"] = ev[10]
     self.evData["DOB"] = ev[3]
     self.evData["EventNumber"] = ev[0]
     evNo = ev[0]
     # print(self.evData)
     dialog = eventEditDialog.EventEditDlg(eData=self.evData, sDate=self.selected_date)
     dialog.dateEditStart.setDate(self.selected_date)
     if dialog.exec_():
         newData = eventEditDialog.EventEditDlg.eventData
         sqliteUtils.updateEvent(evNo, newData)
     self.update()
 def on_item_changed(self, curr, prev):
     self.evData.clear()
     self.evData["EventNumber"] = 0
     if curr is not None:
         for k in self.events_list.keys():
             if curr.text() == self.events_list[k]:
                 e = sqliteUtils.fetchEvent(k)
                 if e is not None:
                     self.textBrowserCategory.setText(e[7])
                     self.textBrowserNotes.setText(e[6])
                     self.textBrowserReminder.setText(str(e[11]))
                     self.evData = {"EventNumber": int(e[0]),
                                    "Title": e[5],
                                    "Notes": e[6],
                                    "Category": e[7],
                                    "ReminderDays": e[11],
                                    "StartDate": e[1],
                                    "NoOfTimes": e[10],
                                    "PeriodValue": e[12],
                                    "MonthDay": e[8],
                                    "Period": e[9],
                                    "DOB": e[3],
                                    }