316 |
316 |
317 @param o flag indicating the project status |
317 @param o flag indicating the project status |
318 """ |
318 """ |
319 self.projectOpen = o |
319 self.projectOpen = o |
320 |
320 |
321 def addTask(self, summary, priority=1, filename="", lineno=0, |
321 def addTask(self, summary, priority=TaskPriority.NORMAL, filename="", |
322 completed=False, _time=0, isProjectTask=False, |
322 lineno=0, completed=False, _time=0, isProjectTask=False, |
323 taskType=Task.TypeTodo, description="", uid="", |
323 taskType=TaskType.TODO, description="", uid="", |
324 parentTask=None): |
324 parentTask=None): |
325 """ |
325 """ |
326 Public slot to add a task. |
326 Public slot to add a task. |
327 |
327 |
328 @param summary summary text of the task (string) |
328 @param summary summary text of the task |
329 @param priority priority of the task (0=high, 1=normal, 2=low) |
329 @type str |
330 @param filename filename containing the task (string) |
330 @param priority priority of the task |
331 @param lineno line number containing the task (integer) |
331 @type TaskPriority |
332 @param completed flag indicating completion status (boolean) |
332 @param filename filename containing the task |
333 @param _time creation time of the task (float, if 0 use current time) |
333 @type str |
|
334 @param lineno line number containing the task |
|
335 @type int |
|
336 @param completed flag indicating completion status |
|
337 @type bool |
|
338 @param _time creation time of the task (if 0 use current time) |
|
339 @type float |
334 @param isProjectTask flag indicating a task related to the current |
340 @param isProjectTask flag indicating a task related to the current |
335 project (boolean) |
341 project |
336 @param taskType type of the task (one of Task.TypeFixme, Task.TypeTodo, |
342 @type bool |
337 Task.TypeWarning, Task.TypeNote) |
343 @param taskType type of the task |
338 @param description explanatory text of the task (string) |
344 @type TaskType |
339 @param uid unique id of the task (string) |
345 @param description explanatory text of the task |
340 @param parentTask reference to the parent task item (Task) or the |
346 @type str |
341 UID of the parent task |
347 @param uid unique id of the task |
342 @return reference to the task item (Task) |
348 @type str |
|
349 @param parentTask reference to the parent task item or the UID of the |
|
350 parent task |
|
351 @type Task or str |
|
352 @return reference to the task item |
|
353 @rtype Task |
343 """ |
354 """ |
344 if isinstance(parentTask, str): |
355 if isinstance(parentTask, str): |
345 # UID of parent task |
356 # UID of parent task |
346 if parentTask == "": |
357 if parentTask == "": |
347 parentUid = "" |
358 parentUid = "" |
375 if isProjectTask: |
386 if isProjectTask: |
376 self.__projectTasksSaveTimer.changeOccurred() |
387 self.__projectTasksSaveTimer.changeOccurred() |
377 |
388 |
378 return task |
389 return task |
379 |
390 |
380 def addFileTask(self, summary, filename, lineno, taskType=Task.TypeTodo, |
391 def addFileTask(self, summary, filename, lineno, taskType=TaskType.TODO, |
381 description=""): |
392 description=""): |
382 """ |
393 """ |
383 Public slot to add a file related task. |
394 Public slot to add a file related task. |
384 |
395 |
385 @param summary summary text of the task (string) |
396 @param summary summary text of the task |
386 @param filename filename containing the task (string) |
397 @type str |
387 @param lineno line number containing the task (integer) |
398 @param filename filename containing the task |
388 @param taskType type of the task (one of Task.TypeFixme, Task.TypeTodo, |
399 @type str |
389 Task.TypeWarning, Task.TypeNote) |
400 @param lineno line number containing the task |
390 @param description explanatory text of the task (string) |
401 @type int |
|
402 @param taskType type of the task |
|
403 @type TaskType |
|
404 @param description explanatory text of the task |
|
405 @type str |
391 """ |
406 """ |
392 self.addTask(summary, filename=filename, lineno=lineno, |
407 self.addTask(summary, filename=filename, lineno=lineno, |
393 isProjectTask=( |
408 isProjectTask=( |
394 self.project and |
409 self.project and |
395 self.project.isProjectSource(filename)), |
410 self.project.isProjectSource(filename)), |
396 taskType=taskType, description=description) |
411 taskType=TaskType(taskType), description=description) |
397 |
412 |
398 def getProjectTasks(self): |
413 def getProjectTasks(self): |
399 """ |
414 """ |
400 Public method to retrieve all project related tasks. |
415 Public method to retrieve all project related tasks. |
401 |
416 |
476 """ |
491 """ |
477 Private slot to handle the "Properties" context menu entry. |
492 Private slot to handle the "Properties" context menu entry. |
478 """ |
493 """ |
479 from .TaskPropertiesDialog import TaskPropertiesDialog |
494 from .TaskPropertiesDialog import TaskPropertiesDialog |
480 task = self.currentItem() |
495 task = self.currentItem() |
481 dlg = TaskPropertiesDialog(task, self, self.projectOpen) |
496 dlg = TaskPropertiesDialog(task, parent=self, |
482 ro = task.getFilename() != "" |
497 projectOpen=self.projectOpen) |
483 if ro: |
498 if ( |
484 dlg.setReadOnly() |
499 dlg.exec() == QDialog.DialogCode.Accepted and |
485 if dlg.exec() == QDialog.DialogCode.Accepted and not ro: |
500 dlg.isManualTaskMode() |
486 summary, priority, completed, isProjectTask, description = ( |
501 ): |
487 dlg.getData() |
502 (summary, priority, taskType, completed, isProjectTask, |
488 ) |
503 description) = dlg.getData() |
489 task.setSummary(summary) |
504 task.setSummary(summary) |
490 task.setPriority(priority) |
505 task.setPriority(priority) |
|
506 task.setTaskType(taskType) |
491 task.setCompleted(completed) |
507 task.setCompleted(completed) |
492 task.setProjectTask(isProjectTask) |
508 task.setProjectTask(isProjectTask) |
493 task.setDescription(description) |
509 task.setDescription(description) |
494 self.__projectTasksSaveTimer.changeOccurred() |
510 self.__projectTasksSaveTimer.changeOccurred() |
495 |
511 |
496 def __newTask(self): |
512 def __newTask(self): |
497 """ |
513 """ |
498 Private slot to handle the "New Task" context menu entry. |
514 Private slot to handle the "New Task" context menu entry. |
499 """ |
515 """ |
500 from .TaskPropertiesDialog import TaskPropertiesDialog |
516 from .TaskPropertiesDialog import TaskPropertiesDialog |
501 dlg = TaskPropertiesDialog(None, self, self.projectOpen) |
517 dlg = TaskPropertiesDialog(None, parent=self, |
|
518 projectOpen=self.projectOpen) |
502 if dlg.exec() == QDialog.DialogCode.Accepted: |
519 if dlg.exec() == QDialog.DialogCode.Accepted: |
503 summary, priority, completed, isProjectTask, description = ( |
520 (summary, priority, taskType, completed, isProjectTask, |
504 dlg.getData() |
521 description) = dlg.getData() |
505 ) |
|
506 self.addTask(summary, priority, completed=completed, |
522 self.addTask(summary, priority, completed=completed, |
507 isProjectTask=isProjectTask, description=description) |
523 isProjectTask=isProjectTask, taskType=taskType, |
|
524 description=description) |
508 |
525 |
509 def __newSubTask(self): |
526 def __newSubTask(self): |
510 """ |
527 """ |
511 Private slot to handle the "New Sub-Task" context menu entry. |
528 Private slot to handle the "New Sub-Task" context menu entry. |
512 """ |
529 """ |
513 parentTask = self.currentItem() |
530 parentTask = self.currentItem() |
514 projectTask = parentTask.isProjectTask() |
531 projectTask = parentTask.isProjectTask() |
515 |
532 |
516 from .TaskPropertiesDialog import TaskPropertiesDialog |
533 from .TaskPropertiesDialog import TaskPropertiesDialog |
517 dlg = TaskPropertiesDialog(None, self, self.projectOpen) |
534 dlg = TaskPropertiesDialog(None, parent=self, |
|
535 projectOpen=self.projectOpen) |
518 dlg.setSubTaskMode(projectTask) |
536 dlg.setSubTaskMode(projectTask) |
519 if dlg.exec() == QDialog.DialogCode.Accepted: |
537 if dlg.exec() == QDialog.DialogCode.Accepted: |
520 summary, priority, completed, isProjectTask, description = ( |
538 (summary, priority, taskType, completed, isProjectTask, |
521 dlg.getData() |
539 description) = dlg.getData() |
522 ) |
|
523 self.addTask(summary, priority, completed=completed, |
540 self.addTask(summary, priority, completed=completed, |
524 isProjectTask=isProjectTask, description=description, |
541 isProjectTask=isProjectTask, taskType=taskType, |
525 parentTask=parentTask) |
542 description=description, parentTask=parentTask) |
526 |
543 |
527 def __markCompleted(self): |
544 def __markCompleted(self): |
528 """ |
545 """ |
529 Private slot to handle the "Mark Completed" context menu entry. |
546 Private slot to handle the "Mark Completed" context menu entry. |
530 """ |
547 """ |
814 |
831 |
815 class ProjectTaskExtractionThread(QThread): |
832 class ProjectTaskExtractionThread(QThread): |
816 """ |
833 """ |
817 Class implementing a thread to extract tasks related to a project. |
834 Class implementing a thread to extract tasks related to a project. |
818 |
835 |
819 @signal taskFound(str, str, int, int) emitted with the task description, |
836 @signal taskFound(str, str, int, TaskType) emitted with the task |
820 the file name, the line number and task type to signal the presence of |
837 description, the file name, the line number and task type to signal |
821 a task |
838 the presence of a task |
822 """ |
839 """ |
823 taskFound = pyqtSignal(str, str, int, int) |
840 taskFound = pyqtSignal(str, str, int, TaskType) |
824 |
841 |
825 def __init__(self, parent=None): |
842 def __init__(self, parent=None): |
826 """ |
843 """ |
827 Constructor |
844 Constructor |
828 |
845 |