def setDate(self,ldate,week=None): self.date=ldate self.week=week slist=['inbox','someday','thisweek','waiting'] if not (ldate in slist): self.week=getWeekNr(day=self.date) if self.date<date.today(): self.setDisabled(True) else: self.setEnabled(True) elif self.date=="thisweek": self.week=getWeekNr()
def dropEvent(self, event): #self.setDisabled(True) olditem=event.source().currentItem() currentrow=event.source().row(olditem) item=event.source().takeItem(currentrow) if self.date!="thisweek" or self==event.source() or event.source().week!=getWeekNr(): QtGui.QListWidget.dropEvent(self,event) newItem=self.findItems(olditem.text(),QtCore.Qt.MatchExactly)[0] row=self.row(newItem) o=self.takeItem(row) del(o) if event.source()!=self: self.insertItem(row,item) self.emit(QtCore.SIGNAL("moveTask"),item,self.date,self.week) else: del(olditem) self.insertItem(row,item) event.accept() #self.setEnabled(True) #self.emit(QtCore.SIGNAL("sortTasks"),event.source()) self.emit(QtCore.SIGNAL("sortTasks"),self) if event.source().date=="outdated":self.emit(QtCore.SIGNAL("loadOutdated"),event.source())
def setDate(self,tdate,week=None): self.current=False self.past=False self.setAcceptDrops(True) self.date=tdate self.week=week slist=['inbox','someday','thisweek','waiting','outdated'] if not (tdate in slist): qpal=QtGui.QPalette() self.week=getWeekNr(day=tdate) if self.date==date.today(): self.current=True qpal.setColor(QtGui.QPalette.Base,QtGui.QColor('#F5F3C4')) self.setPalette(qpal) elif self.date<date.today(): #self.setAcceptDrops(False) self.past=True qpal.setColor(QtGui.QPalette.Base,QtGui.QColor('#C9C9C9')) self.setPalette(qpal) else: self.setPalette(qpal)