当前位置: 首页>>代码示例>>Python>>正文


Python DB.completeTask方法代码示例

本文整理汇总了Python中lib.db.DB.completeTask方法的典型用法代码示例。如果您正苦于以下问题:Python DB.completeTask方法的具体用法?Python DB.completeTask怎么用?Python DB.completeTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.db.DB的用法示例。


在下文中一共展示了DB.completeTask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Workload

# 需要导入模块: from lib.db import DB [as 别名]
# 或者: from lib.db.DB import completeTask [as 别名]

#.........这里部分代码省略.........
        if init:
            winheight=320
            listheight=252
        else:
            winheight=self.height()
            listheight=self.ui.taskList.height()
        desiredHeight=taskheight*len(tasks)+winheight-listheight+6
        if ( desiredHeight>self.height() or downSize ) and desiredHeight<QtGui.QApplication.desktop().height():
            self.resize(self.width(),desiredHeight)

    def closeEvent(self, e=None):
        self.hide()
        if e:
            e.ignore()

###### MENU FUNCTIONS

    def importTasklist(self):
        fname=QtGui.QFileDialog.getOpenFileName(self, QtGui.QApplication.translate("ui","Open"), "", QtGui.QApplication.translate("ui","Workload Import File (*.w)"))
        if fname[0]:
            filename=fname[0]
            from lib import importexport
            importexport.importTasks(self,filename,self.settings["dateFormat"])
            
    def exportTaskList(self):
        fname=QtGui.QFileDialog.getSaveFileName(self,QtGui.QApplication.translate("ui","Save"), "", QtGui.QApplication.translate("ui","Workload Export File (*.w)"))
        if fname[0]:
            includeArchive=self.questionPopup(QtGui.QApplication.translate("ui","Exporting tasks"), QtGui.QApplication.translate("ui","Do you want to include completed tasks?"))
            tasks=self.db.exportTasks(self.currentContext, includeArchive)
            from lib import importexport
            filename=fname[0]
            importexport.export(tasks, filename,self.settings["dateFormat"])
            
    def about(self):
        f=open("about.html")
        text=f.read()
        f.close()
        QtGui.QMessageBox.information(self, QtGui.QApplication.translate("ui","About"), text, buttons=QtGui.QMessageBox.Ok )

    def exit(self,exitcode=0):
        exit_=False
        if self.settings["askOnExit"]:
            if self.questionPopup(QtGui.QApplication.translate("ui","Exit"), QtGui.QApplication.translate("ui","Are you sure?")):
                exit_=True
        else: exit_=True
        if exit_==True:
            self.settings.setCurrentContextAsLast()
            self.shortcuts.terminate()
            self.app.exit(exitcode)

    def createTask(self):
        Task(self,taskid=0)

    def completeTasks(self):
        if self.ui.taskList.hasFocus():
            tasks=self.ui.taskList.selectedItems()
            for i in tasks:
                self.db.completeTask(i.data(0,32))
                index = self.ui.taskList.indexOfTopLevelItem(i)
                self.ui.taskList.takeTopLevelItem(index)
                self.ui.statusbar.showMessage(QtGui.QApplication.translate("ui","Task completed."),3300)

    def showHistory(self):
        ArchiveWindow(self)
                
    def hoyKeyError(self):
        QtGui.QMessageBox.critical(self,QtGui.QApplication.translate("ui","Error"),QtGui.QApplication.translate("ui","Unable to register global shortcut"))

    def changeEvent(self, e):
        if e.type()==QtCore.QEvent.LanguageChange:
            self.ui.retranslateUi(self)
            self.ui.statusbar.showMessage(QtGui.QApplication.translate("ui","Hello! Ready to work ;-)"),3600)
            loadContexts(self)
            selectCurrentContext(self)
            
        QtGui.QMainWindow.changeEvent(self,e)
        
    def translate(self,lang=None):
        if lang is None:
            lang= self.settings["lang"]
        translate=True
        if lang=="auto":
            locale = QtCore.QLocale.system().name()
        
        elif lang=="en":
            translate=False
            try:
                self.app.removeTranslator(self.qtTranslator)
            except:
                pass
        else:
            locale=lang
    
        if translate:
            self.qtTranslator = QtCore.QTranslator()
            self.qtTranslator.load("i18n"+os.sep+"workload_"+locale+".qm")
            self.app.installTranslator(self.qtTranslator)
    def showMsg(self,msg):
        msgWindow=QtGui.QMessageBox()
        msgWindow.information(self, "Workload - Information", msg, buttons=QtGui.QMessageBox.Ok )
开发者ID:middleofdreams,项目名称:workload,代码行数:104,代码来源:main.py


注:本文中的lib.db.DB.completeTask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。