15 import os |
15 import os |
16 import fnmatch |
16 import fnmatch |
17 import threading |
17 import threading |
18 |
18 |
19 from PyQt5.QtCore import pyqtSignal, Qt, QThread |
19 from PyQt5.QtCore import pyqtSignal, Qt, QThread |
20 from PyQt5.QtWidgets import QHeaderView, QLineEdit, QTreeWidget, QDialog, \ |
20 from PyQt5.QtWidgets import ( |
21 QInputDialog, QApplication, QMenu, QAbstractItemView, QTreeWidgetItem |
21 QHeaderView, QLineEdit, QTreeWidget, QDialog, QInputDialog, QApplication, |
|
22 QMenu, QAbstractItemView, QTreeWidgetItem |
|
23 ) |
22 |
24 |
23 from E5Gui.E5Application import e5App |
25 from E5Gui.E5Application import e5App |
24 from E5Gui import E5MessageBox |
26 from E5Gui import E5MessageBox |
25 from E5Gui.E5ProgressDialog import E5ProgressDialog |
27 from E5Gui.E5ProgressDialog import E5ProgressDialog |
26 |
28 |
244 Private slot to handle the activation of an item. |
246 Private slot to handle the activation of an item. |
245 |
247 |
246 @param itm reference to the activated item (QTreeWidgetItem) |
248 @param itm reference to the activated item (QTreeWidgetItem) |
247 @param col column the item was activated in (integer) |
249 @param col column the item was activated in (integer) |
248 """ |
250 """ |
249 if not self.__activating and \ |
251 if ( |
250 itm is not self.__extractedItem and \ |
252 not self.__activating and |
251 itm is not self.__manualItem: |
253 itm is not self.__extractedItem and |
|
254 itm is not self.__manualItem |
|
255 ): |
252 self.__activating = True |
256 self.__activating = True |
253 fn = itm.getFilename() |
257 fn = itm.getFilename() |
254 if fn: |
258 if fn: |
255 if os.path.exists(fn): |
259 if os.path.exists(fn): |
256 self.displayFile.emit(fn, itm.getLineno()) |
260 self.displayFile.emit(fn, itm.getLineno()) |
267 |
271 |
268 @param coord the position of the mouse pointer (QPoint) |
272 @param coord the position of the mouse pointer (QPoint) |
269 """ |
273 """ |
270 itm = self.itemAt(coord) |
274 itm = self.itemAt(coord) |
271 coord = self.mapToGlobal(coord) |
275 coord = self.mapToGlobal(coord) |
272 if itm is None or \ |
276 if ( |
273 itm is self.__extractedItem or \ |
277 itm is None or |
274 itm is self.__manualItem: |
278 itm is self.__extractedItem or |
|
279 itm is self.__manualItem |
|
280 ): |
275 self.backProjectTasksMenuItem.setEnabled(self.projectOpen) |
281 self.backProjectTasksMenuItem.setEnabled(self.projectOpen) |
276 if self.copyTask: |
282 if self.copyTask: |
277 self.backPasteItem.setEnabled(True) |
283 self.backPasteItem.setEnabled(True) |
278 self.backPasteMainItem.setEnabled(True) |
284 self.backPasteMainItem.setEnabled(True) |
279 else: |
285 else: |
411 |
417 |
412 @keyparam fileOnly flag indicating to clear only file related |
418 @keyparam fileOnly flag indicating to clear only file related |
413 project tasks (boolean) |
419 project tasks (boolean) |
414 """ |
420 """ |
415 for task in reversed(self.tasks[:]): |
421 for task in reversed(self.tasks[:]): |
416 if (fileOnly and task.isProjectFileTask()) or \ |
422 if ( |
417 (not fileOnly and task.isProjectTask()): |
423 (fileOnly and task.isProjectFileTask()) or |
|
424 (not fileOnly and task.isProjectTask()) |
|
425 ): |
418 if self.copyTask == task: |
426 if self.copyTask == task: |
419 self.copyTask = None |
427 self.copyTask = None |
420 parent = task.parent() |
428 parent = task.parent() |
421 parent.removeChild(task) |
429 parent.removeChild(task) |
422 self.tasks.remove(task) |
430 self.tasks.remove(task) |
463 dlg = TaskPropertiesDialog(task, self, self.projectOpen) |
471 dlg = TaskPropertiesDialog(task, self, self.projectOpen) |
464 ro = task.getFilename() != "" |
472 ro = task.getFilename() != "" |
465 if ro: |
473 if ro: |
466 dlg.setReadOnly() |
474 dlg.setReadOnly() |
467 if dlg.exec_() == QDialog.Accepted and not ro: |
475 if dlg.exec_() == QDialog.Accepted and not ro: |
468 summary, priority, completed, isProjectTask, description = \ |
476 summary, priority, completed, isProjectTask, description = ( |
469 dlg.getData() |
477 dlg.getData() |
|
478 ) |
470 task.setSummary(summary) |
479 task.setSummary(summary) |
471 task.setPriority(priority) |
480 task.setPriority(priority) |
472 task.setCompleted(completed) |
481 task.setCompleted(completed) |
473 task.setProjectTask(isProjectTask) |
482 task.setProjectTask(isProjectTask) |
474 task.setDescription(description) |
483 task.setDescription(description) |
479 Private slot to handle the "New Task" context menu entry. |
488 Private slot to handle the "New Task" context menu entry. |
480 """ |
489 """ |
481 from .TaskPropertiesDialog import TaskPropertiesDialog |
490 from .TaskPropertiesDialog import TaskPropertiesDialog |
482 dlg = TaskPropertiesDialog(None, self, self.projectOpen) |
491 dlg = TaskPropertiesDialog(None, self, self.projectOpen) |
483 if dlg.exec_() == QDialog.Accepted: |
492 if dlg.exec_() == QDialog.Accepted: |
484 summary, priority, completed, isProjectTask, description = \ |
493 summary, priority, completed, isProjectTask, description = ( |
485 dlg.getData() |
494 dlg.getData() |
|
495 ) |
486 self.addTask(summary, priority, completed=completed, |
496 self.addTask(summary, priority, completed=completed, |
487 isProjectTask=isProjectTask, description=description) |
497 isProjectTask=isProjectTask, description=description) |
488 |
498 |
489 def __newSubTask(self): |
499 def __newSubTask(self): |
490 """ |
500 """ |
495 |
505 |
496 from .TaskPropertiesDialog import TaskPropertiesDialog |
506 from .TaskPropertiesDialog import TaskPropertiesDialog |
497 dlg = TaskPropertiesDialog(None, self, self.projectOpen) |
507 dlg = TaskPropertiesDialog(None, self, self.projectOpen) |
498 dlg.setSubTaskMode(projectTask) |
508 dlg.setSubTaskMode(projectTask) |
499 if dlg.exec_() == QDialog.Accepted: |
509 if dlg.exec_() == QDialog.Accepted: |
500 summary, priority, completed, isProjectTask, description = \ |
510 summary, priority, completed, isProjectTask, description = ( |
501 dlg.getData() |
511 dlg.getData() |
|
512 ) |
502 self.addTask(summary, priority, completed=completed, |
513 self.addTask(summary, priority, completed=completed, |
503 isProjectTask=isProjectTask, description=description, |
514 isProjectTask=isProjectTask, description=description, |
504 parentTask=parentTask) |
515 parentTask=parentTask) |
505 |
516 |
506 def __markCompleted(self): |
517 def __markCompleted(self): |