eric6/Tasks/Task.py

changeset 8240
93b8a353c4bf
parent 8218
7c09585bd960
child 8269
87f521f359d5
--- a/eric6/Tasks/Task.py	Wed Apr 14 19:38:19 2021 +0200
+++ b/eric6/Tasks/Task.py	Wed Apr 14 19:59:16 2021 +0200
@@ -9,6 +9,7 @@
 
 import os
 import time
+import contextlib
 
 from PyQt5.QtCore import Qt, QUuid
 from PyQt5.QtWidgets import QTreeWidgetItem
@@ -144,13 +145,10 @@
         nonBoldFont = self.font(0)
         nonBoldFont.setBold(False)
         for col in range(5):
-            try:
+            with contextlib.suppress(KeyError):
                 self.setBackground(
                     col, Preferences.getTasks(
                         Task.TaskType2ColorName[self.taskType]))
-            except KeyError:
-                # do not set background color if type is not known
-                pass
             
             if self._isProjectTask:
                 self.setFont(col, boldFont)

eric ide

mercurial