def toDiaryDict(self): text, formats = self.textEditor.getRichText() tags = self.tagEditor.text() if self.tagModified: # remove duplicate tags tags = ' '.join(set(tags.split())) return dict(id=self.id, datetime=self.datetime or currentDatetime(), text=text, formats=formats, title=self.titleEditor.text(), tags=tags)
def toNikkiDict(self): text, formats = self.textEditor.getRichText() return dict(id=self.id, datetime=self.datetime or currentDatetime(), text=text, formats=formats, title=self.titleEditor.text(), tags=self.tagEditor.text())
def on_dtBtn_clicked(self): """Show datetime edit dialog""" if self.readOnly: return dtStr = currentDatetime() if self.datetime is None else self.datetime newDt = DateTimeDialog.getDateTime(datetimeToQt(dtStr), fullDatetimeFmt, self) if newDt is not None: newDtStr = newDt.toString(DB_DATETIME_FMT_QT) if newDtStr != self.datetime: self.datetime = newDtStr self.dtBtn.setText(datetimeTrans(newDtStr)) self.timeModified = True