本文整理汇总了Python中lib.db.DB.getTasks方法的典型用法代码示例。如果您正苦于以下问题:Python DB.getTasks方法的具体用法?Python DB.getTasks怎么用?Python DB.getTasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.db.DB
的用法示例。
在下文中一共展示了DB.getTasks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Workload
# 需要导入模块: from lib.db import DB [as 别名]
# 或者: from lib.db.DB import getTasks [as 别名]
#.........这里部分代码省略.........
def defaultDueDate(self):
if self.settings["defaultDueDateOn"]:
dueValue=int(self.settings["defaultDueDateValue"])
if self.settings["defaultDueDateUnit"]=="0":
td=datetime.timedelta(hours=dueValue)
else:
td=datetime.timedelta(days=dueValue)
return timestamp(datetime.datetime.now()+td)
else:
return None
def createTaskItem(self, t, taskid=None, priority=0):
item = QtGui.QTreeWidgetItem([str(priority),"", t])
item.setData(0, 32, taskid)
item.setSizeHint(1, QtCore.QSize(0, 22))
self.ui.taskList.addTopLevelItem(item)
self.setPriorityColor(item, priority)
self.ui.taskList.sortItems(0,QtCore.Qt.AscendingOrder)
def checkIfExist(self,t):
if len(self.ui.taskList.findItems(t,QtCore.Qt.MatchFlags(QtCore.Qt.MatchExactly),2))>0:
return True
def taskAlreadyExistMsg(self,parent=None):
text=QtGui.QApplication.translate("ui","Task with same name already exist, choose another")
windowtitle=QtGui.QApplication.translate("ui","Task name already exists")
msgWindow=QtGui.QMessageBox()
if parent is not None: self=parent
msgWindow.information(self, windowtitle, text, buttons=QtGui.QMessageBox.Ok )
def loadTasksList(self, archived=False,init=False):
self.ui.taskList.clear()
for i in self.db.getTasks(self.currentContext):
self.createTaskItem(i[1], i[0],i[2])
def deleteSelectedTasks(self, force=False):
selectedItems = self.ui.taskList.selectedItems()
if len(selectedItems)>0:
tasks = []
for item in selectedItems:
tasks.append(item)
windowtitle=QtGui.QApplication.translate("ui","Delete task")
text=QtGui.QApplication.translate("ui","Do you really want to delete selected task(s) ?")
if force:
self.deleteTasks(tasks)
windowtitle=QtGui.QApplication.translate("ui","Delete task")
text=QtGui.QApplication.translate("ui","Do you really want to delete selected task(s) ?")
elif self.questionPopup(windowtitle,text):
self.deleteTasks(tasks)
self.adjustHeight(downSize=True)
def deleteTasks(self, tasks):
for item in tasks:
self.db.deleteTask(item.data(0, 32))
index = self.ui.taskList.indexOfTopLevelItem(item)
self.ui.taskList.takeTopLevelItem(index)
self.ui.statusbar.showMessage(QtGui.QApplication.translate("ui","Task removed."),3300)
def setTaskPriority(self,priority):
selectedItems = self.ui.taskList.selectedItems()
for item in selectedItems:
self.db.setTaskPriority(item.data(0, 32),priority)
self.setPriorityColor(item, priority)
item.setText(0,str(priority))