eric6/Tasks/TaskViewer.py

branch
maintenance
changeset 8176
31965986ecd1
parent 8142
43248bafe9b2
parent 8143
2c730d5fd177
child 8273
698ae46f40a4
equal deleted inserted replaced
8153:e01ae92db699 8176:31965986ecd1
62 0, UI.PixmapCache.getIcon("taskCompleted")) 62 0, UI.PixmapCache.getIcon("taskCompleted"))
63 self.__headerItem.setIcon( 63 self.__headerItem.setIcon(
64 1, UI.PixmapCache.getIcon("taskPriority")) 64 1, UI.PixmapCache.getIcon("taskPriority"))
65 self.setHeaderItem(self.__headerItem) 65 self.setHeaderItem(self.__headerItem)
66 66
67 self.header().setSortIndicator(2, Qt.AscendingOrder) 67 self.header().setSortIndicator(2, Qt.SortOrder.AscendingOrder)
68 self.__resizeColumns() 68 self.__resizeColumns()
69 69
70 self.tasks = [] 70 self.tasks = []
71 self.copyTask = None 71 self.copyTask = None
72 self.projectOpen = False 72 self.projectOpen = False
161 self.__backMenu.addAction( 161 self.__backMenu.addAction(
162 self.tr("Configure..."), self.__configure) 162 self.tr("Configure..."), self.__configure)
163 163
164 self.__activating = False 164 self.__activating = False
165 165
166 self.setContextMenuPolicy(Qt.CustomContextMenu) 166 self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
167 self.customContextMenuRequested.connect(self.__showContextMenu) 167 self.customContextMenuRequested.connect(self.__showContextMenu)
168 self.itemActivated.connect(self.__taskItemActivated) 168 self.itemActivated.connect(self.__taskItemActivated)
169 169
170 self.setWindowIcon(UI.PixmapCache.getIcon("eric")) 170 self.setWindowIcon(UI.PixmapCache.getIcon("eric"))
171 171
206 206
207 def __resizeColumns(self): 207 def __resizeColumns(self):
208 """ 208 """
209 Private method to resize the list columns. 209 Private method to resize the list columns.
210 """ 210 """
211 self.header().resizeSections(QHeaderView.ResizeToContents) 211 self.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents)
212 self.header().setStretchLastSection(True) 212 self.header().setStretchLastSection(True)
213 213
214 def findParentTask(self, parentUid): 214 def findParentTask(self, parentUid):
215 """ 215 """
216 Public method to find a parent task by its ID. 216 Public method to find a parent task by its ID.
480 task = self.currentItem() 480 task = self.currentItem()
481 dlg = TaskPropertiesDialog(task, self, self.projectOpen) 481 dlg = TaskPropertiesDialog(task, self, self.projectOpen)
482 ro = task.getFilename() != "" 482 ro = task.getFilename() != ""
483 if ro: 483 if ro:
484 dlg.setReadOnly() 484 dlg.setReadOnly()
485 if dlg.exec() == QDialog.Accepted and not ro: 485 if dlg.exec() == QDialog.DialogCode.Accepted and not ro:
486 summary, priority, completed, isProjectTask, description = ( 486 summary, priority, completed, isProjectTask, description = (
487 dlg.getData() 487 dlg.getData()
488 ) 488 )
489 task.setSummary(summary) 489 task.setSummary(summary)
490 task.setPriority(priority) 490 task.setPriority(priority)
497 """ 497 """
498 Private slot to handle the "New Task" context menu entry. 498 Private slot to handle the "New Task" context menu entry.
499 """ 499 """
500 from .TaskPropertiesDialog import TaskPropertiesDialog 500 from .TaskPropertiesDialog import TaskPropertiesDialog
501 dlg = TaskPropertiesDialog(None, self, self.projectOpen) 501 dlg = TaskPropertiesDialog(None, self, self.projectOpen)
502 if dlg.exec() == QDialog.Accepted: 502 if dlg.exec() == QDialog.DialogCode.Accepted:
503 summary, priority, completed, isProjectTask, description = ( 503 summary, priority, completed, isProjectTask, description = (
504 dlg.getData() 504 dlg.getData()
505 ) 505 )
506 self.addTask(summary, priority, completed=completed, 506 self.addTask(summary, priority, completed=completed,
507 isProjectTask=isProjectTask, description=description) 507 isProjectTask=isProjectTask, description=description)
514 projectTask = parentTask.isProjectTask() 514 projectTask = parentTask.isProjectTask()
515 515
516 from .TaskPropertiesDialog import TaskPropertiesDialog 516 from .TaskPropertiesDialog import TaskPropertiesDialog
517 dlg = TaskPropertiesDialog(None, self, self.projectOpen) 517 dlg = TaskPropertiesDialog(None, self, self.projectOpen)
518 dlg.setSubTaskMode(projectTask) 518 dlg.setSubTaskMode(projectTask)
519 if dlg.exec() == QDialog.Accepted: 519 if dlg.exec() == QDialog.DialogCode.Accepted:
520 summary, priority, completed, isProjectTask, description = ( 520 summary, priority, completed, isProjectTask, description = (
521 dlg.getData() 521 dlg.getData()
522 ) 522 )
523 self.addTask(summary, priority, completed=completed, 523 self.addTask(summary, priority, completed=completed,
524 isProjectTask=isProjectTask, description=description, 524 isProjectTask=isProjectTask, description=description,
551 self.__resizeColumns() 551 self.__resizeColumns()
552 552
553 ci = self.currentItem() 553 ci = self.currentItem()
554 if ci: 554 if ci:
555 ind = self.indexFromItem(ci, self.currentColumn()) 555 ind = self.indexFromItem(ci, self.currentColumn())
556 self.scrollTo(ind, QAbstractItemView.PositionAtCenter) 556 self.scrollTo(ind, QAbstractItemView.ScrollHint.PositionAtCenter)
557 557
558 def __copyTask(self): 558 def __copyTask(self):
559 """ 559 """
560 Private slot to handle the "Copy" context menu entry. 560 Private slot to handle the "Copy" context menu entry.
561 """ 561 """
629 self.__resizeColumns() 629 self.__resizeColumns()
630 630
631 ci = self.currentItem() 631 ci = self.currentItem()
632 if ci: 632 if ci:
633 ind = self.indexFromItem(ci, self.currentColumn()) 633 ind = self.indexFromItem(ci, self.currentColumn())
634 self.scrollTo(ind, QAbstractItemView.PositionAtCenter) 634 self.scrollTo(ind, QAbstractItemView.ScrollHint.PositionAtCenter)
635 635
636 def __goToTask(self): 636 def __goToTask(self):
637 """ 637 """
638 Private slot to handle the "Go To" context menu entry. 638 Private slot to handle the "Go To" context menu entry.
639 """ 639 """
676 """ 676 """
677 Private slot to handle the "Configure filter" context menu entry. 677 Private slot to handle the "Configure filter" context menu entry.
678 """ 678 """
679 from .TaskFilterConfigDialog import TaskFilterConfigDialog 679 from .TaskFilterConfigDialog import TaskFilterConfigDialog
680 dlg = TaskFilterConfigDialog(self.taskFilter) 680 dlg = TaskFilterConfigDialog(self.taskFilter)
681 if dlg.exec() == QDialog.Accepted: 681 if dlg.exec() == QDialog.DialogCode.Accepted:
682 dlg.configureTaskFilter(self.taskFilter) 682 dlg.configureTaskFilter(self.taskFilter)
683 self.__refreshDisplay() 683 self.__refreshDisplay()
684 684
685 def __configureProjectTasksScanOptions(self): 685 def __configureProjectTasksScanOptions(self):
686 """ 686 """
689 scanFilter, ok = QInputDialog.getText( 689 scanFilter, ok = QInputDialog.getText(
690 self, 690 self,
691 self.tr("Scan Filter Patterns"), 691 self.tr("Scan Filter Patterns"),
692 self.tr("Enter filename patterns of files" 692 self.tr("Enter filename patterns of files"
693 " to be excluded separated by a comma:"), 693 " to be excluded separated by a comma:"),
694 QLineEdit.Normal, 694 QLineEdit.EchoMode.Normal,
695 self.__projectTasksScanFilter) 695 self.__projectTasksScanFilter)
696 if ok: 696 if ok:
697 self.__projectTasksScanFilter = scanFilter 697 self.__projectTasksScanFilter = scanFilter
698 698
699 def regenerateProjectTasks(self, quiet=False): 699 def regenerateProjectTasks(self, quiet=False):
860 self.__markers = {} 860 self.__markers = {}
861 for markerType in markers: 861 for markerType in markers:
862 self.__markers[markerType] = markers[markerType][:] 862 self.__markers[markerType] = markers[markerType][:]
863 863
864 if not self.isRunning(): 864 if not self.isRunning():
865 self.start(QThread.LowPriority) 865 self.start(QThread.Priority.LowPriority)
866 866
867 def run(self): 867 def run(self):
868 """ 868 """
869 Public thread method to scan the given files. 869 Public thread method to scan the given files.
870 """ 870 """

eric ide

mercurial