本文整理汇总了Python中lib.db.DB.addTask方法的典型用法代码示例。如果您正苦于以下问题:Python DB.addTask方法的具体用法?Python DB.addTask怎么用?Python DB.addTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.db.DB
的用法示例。
在下文中一共展示了DB.addTask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Workload
# 需要导入模块: from lib.db import DB [as 别名]
# 或者: from lib.db.DB import addTask [as 别名]
class Workload(QtGui.QMainWindow):
def __init__(self,app,onlyDBAccess=False):
'''main window init'''
QtGui.QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.db = DB(self)
self.settings=Settings(self)
self.onlyDBAccess=onlyDBAccess
if onlyDBAccess:
return
#GUI setting
guiSettings(self)
connectSignals(self)
changeStyle(self)
self.taskOpened = False
self.app = app
loadContexts(self)
self.currentContext = self.settings.getInitContext()
selectCurrentContext(self)
self.loadTasksList(init=True)
self.tray=Trayicon(self)
self.timer=TaskReminder(self)
self.shortcuts=ShortcutsHandler(self,self.settings['keyMainWindowToggle'])
finalizeInit(self)
self.translate()
self.adjustHeight(init=True)
def resizeEvent(self,e):
path=QtGui.QPainterPath()
rect=e.size()
path.addRoundedRect(-1,-1,rect.width()+1,rect.height()+1,7,7)
region=QtGui.QRegion(path.toFillPolygon().toPolygon())
self.setMask(region)
def taskListFocusIn(self,e):
if e.reason()==QtCore.Qt.FocusReason.TabFocusReason:
try:
item=self.ui.taskList.itemAt(0)
self.ui.taskList.setCurrentItem(self.ui.taskList.itemAt(0))
except:
pass
def toggle(self):
if self.isVisible():
self.hide()
else:
self.show()
def dropTask(self,e):
Task.dropTask(self, e)
def resizeColumns(self):
self.ui.taskList.setColumnWidth(0, 20)
self.ui.taskList.setColumnWidth(1, 20)
self.ui.taskList.hideColumn(0)
def setMarker(self,tasks):
icon=QtGui.QIcon(':res/status/clock.png')
items=self.ui.taskList.findItems("",QtCore.Qt.MatchContains|QtCore.Qt.MatchRecursive)
for i in items:
removeicon=QtGui.QIcon()
i.setIcon(2,removeicon)
for i in tasks:
for j in items:
if j.data(0,32)==i:
j.setIcon(2,icon)
def drawRow(self,painter,myopt,index):
myopt.decorationPosition=QtGui.QStyleOptionViewItem.Right
myopt.decorationAlignment=QtCore.Qt.AlignCenter
QtGui.QTreeWidget.drawRow(self.ui.taskList,painter,myopt,index)
# TASKS RELATED ACTIONS
def addTask(self):
t = self.ui.taskInput.text().strip()
if t =="":
return False
self.ui.taskInput.clear()
priority = 0
try:
if t[1] == ":":
priority = int(t[0])
if priority<6:
t = t[2:]
else:
priority = 0
elif t[-2] == ":":
priority = int(t[-1])
if priority<6:
t = t[:-2]
else:
#.........这里部分代码省略.........