eric6/E5XML/TasksReader.py

branch
maintenance
changeset 8400
b3eefd7e58d1
parent 8280
17d03699f151
child 8665
1600bcd3a378
equal deleted inserted replaced
8274:197414ba11cc 8400:b3eefd7e58d1
13 from E5Gui.E5Application import e5App 13 from E5Gui.E5Application import e5App
14 14
15 from .Config import tasksFileFormatVersion 15 from .Config import tasksFileFormatVersion
16 from .XMLStreamReaderBase import XMLStreamReaderBase 16 from .XMLStreamReaderBase import XMLStreamReaderBase
17 17
18 from Tasks.Task import Task 18 from Tasks.Task import TaskType, TaskPriority
19 19
20 import Utilities 20 import Utilities
21 21
22 22
23 class TasksReader(XMLStreamReaderBase): 23 class TasksReader(XMLStreamReaderBase):
78 def __readTask(self): 78 def __readTask(self):
79 """ 79 """
80 Private method to read the task info. 80 Private method to read the task info.
81 """ 81 """
82 task = {"summary": "", 82 task = {"summary": "",
83 "priority": 1, 83 "priority": TaskPriority.NORMAL,
84 "completed": False, 84 "completed": False,
85 "created": 0, 85 "created": 0,
86 "filename": "", 86 "filename": "",
87 "linenumber": 0, 87 "linenumber": 0,
88 "type": Task.TypeTodo, 88 "type": TaskType.TODO,
89 "description": "", 89 "description": "",
90 "uid": "", 90 "uid": "",
91 } 91 }
92 task["priority"] = int(self.attribute("priority", "1")) 92 task["priority"] = TaskPriority(
93 int(self.attribute("priority", str(TaskPriority.NORMAL.value)))
94 )
93 task["completed"] = self.toBool(self.attribute("completed", "False")) 95 task["completed"] = self.toBool(self.attribute("completed", "False"))
94 if self.version in ["4.2", "5.0"]: 96 if self.version in ["4.2", "5.0"]:
95 isBugfix = self.toBool(self.attribute("bugfix", "False")) 97 isBugfix = self.toBool(self.attribute("bugfix", "False"))
96 if isBugfix: 98 if isBugfix:
97 task["type"] = Task.TypeFixme 99 task["type"] = TaskType.FIXME
98 else: 100 else:
99 # TODO: task type enum change 101 task["type"] = TaskType(
100 # TaskType(int(self.attribute("type", str(Task.TypeTodo.value)))) 102 int(self.attribute("type", str(TaskType.TODO.value)))
101 task["type"] = int(self.attribute("type", str(Task.TypeTodo))) 103 )
102 uid = self.attribute("uid", "") 104 uid = self.attribute("uid", "")
103 if uid: 105 if uid:
104 task["uid"] = uid 106 task["uid"] = uid
105 else: 107 else:
106 # upgrade from pre 6.0 format 108 # upgrade from pre 6.0 format

eric ide

mercurial