eric6/E5XML/TasksReader.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7780
41420f82c0ac
child 8011
630a173cb137
permissions
-rw-r--r--

Updated copyright for 2021.

585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2010 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a class for reading an XML tasks file.
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import time
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from E5Gui.E5Application import e5App
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Config import tasksFileFormatVersion
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from .XMLStreamReaderBase import XMLStreamReaderBase
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
17 from Tasks.Task import Task
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
18
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 import Utilities
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
21
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 class TasksReader(XMLStreamReaderBase):
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Class for reading an XML tasks file.
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
26 supportedVersions = ["4.2", "5.0", "5.1", "6.0"]
590
beb60b9b3d8d Added code to handle unsupported versions to the new XML readers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 589
diff changeset
27
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
28 def __init__(self, device, forProject=False, viewer=None):
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Constructor
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @param device reference to the I/O device to read from (QIODevice)
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @param forProject flag indicating project related mode (boolean)
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @param viewer reference to the task viewer (TaskViewer)
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 XMLStreamReaderBase.__init__(self, device)
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.viewer = viewer
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.forProject = forProject
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 if viewer:
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.viewer = viewer
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 else:
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.viewer = e5App().getObject("TaskViewer")
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.version = ""
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
47 self.tasks = []
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 def readXML(self):
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 """
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 Public method to read and parse the XML document.
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 while not self.atEnd():
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.readNext()
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
55 if self.isEndElement() and self.name() == "Tasks":
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
56 for task, expanded in self.tasks:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
57 task.setExpanded(expanded)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
58 break
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
59
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 if self.isStartElement():
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 if self.name() == "Tasks":
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
62 self.version = self.attribute(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
63 "version", tasksFileFormatVersion)
590
beb60b9b3d8d Added code to handle unsupported versions to the new XML readers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 589
diff changeset
64 if self.version not in self.supportedVersions:
beb60b9b3d8d Added code to handle unsupported versions to the new XML readers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 589
diff changeset
65 self.raiseUnsupportedFormatVersion(self.version)
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 elif self.name() == "Task":
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.__readTask()
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
68 elif self.name() == "ProjectScanFilter":
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
69 scanFilter = self.readElementText()
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
70 if self.forProject:
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
71 self.viewer.projectTasksScanFilter = scanFilter
589
a9a4620f6767 Added code to handle unexpected start tags to the new XML readers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 587
diff changeset
72 else:
a9a4620f6767 Added code to handle unexpected start tags to the new XML readers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 587
diff changeset
73 self.raiseUnexpectedStartTag(self.name())
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.showErrorMessage()
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 def __readTask(self):
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 """
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 Private method to read the task info.
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
81 task = {"summary": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
82 "priority": 1,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
83 "completed": False,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
84 "created": 0,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
85 "filename": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
86 "linenumber": 0,
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
87 "type": Task.TypeTodo,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
88 "description": "",
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
89 "uid": "",
3035
36e9f388958b Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
90 }
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 task["priority"] = int(self.attribute("priority", "1"))
592
3ad07054e658 Extended the stream reader API and adjusted the tasks reader accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 590
diff changeset
92 task["completed"] = self.toBool(self.attribute("completed", "False"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
93 if self.version in ["4.2", "5.0"]:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
94 isBugfix = self.toBool(self.attribute("bugfix", "False"))
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
95 if isBugfix:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
96 task["type"] = Task.TypeFixme
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
97 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
98 task["type"] = int(self.attribute("type", str(Task.TypeTodo)))
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
99 uid = self.attribute("uid", "")
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
100 if uid:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
101 task["uid"] = uid
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
102 else:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
103 # upgrade from pre 6.0 format
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
104 from PyQt5.QtCore import QUuid
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
105 task["uid"] = QUuid.createUuid().toString()
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
106 parentUid = self.attribute("parent_uid", "")
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
107 expanded = self.toBool(self.attribute("expanded", "True"))
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 while not self.atEnd():
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 self.readNext()
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 if self.isEndElement() and self.name() == "Task":
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
112 parentTask = self.viewer.findParentTask(parentUid)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
113 addedTask = self.viewer.addTask(
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
114 task["summary"], priority=task["priority"],
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
115 filename=task["filename"], lineno=task["linenumber"],
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
116 completed=task["completed"], _time=task["created"],
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
117 isProjectTask=self.forProject, taskType=task["type"],
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
118 description=task["description"], uid=task["uid"],
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
119 parentTask=parentTask)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
120 self.tasks.append((addedTask, expanded))
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 break
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 if self.isStartElement():
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 if self.name() == "Summary":
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 task["summary"] = self.readElementText()
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 elif self.name() == "Description":
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 task["description"] = self.readElementText()
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 elif self.name() == "Created":
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
129 task["created"] = time.mktime(time.strptime(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
130 self.readElementText(), "%Y-%m-%d, %H:%M:%S"))
589
a9a4620f6767 Added code to handle unexpected start tags to the new XML readers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 587
diff changeset
131 elif self.name() == "Resource":
a9a4620f6767 Added code to handle unexpected start tags to the new XML readers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 587
diff changeset
132 continue # handle but ignore this tag
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 elif self.name() == "Filename":
7253
50dbe65a1334 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
134 task["filename"] = Utilities.toNativeSeparators(
50dbe65a1334 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
135 self.readElementText()
50dbe65a1334 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
136 )
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 elif self.name() == "Linenumber":
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 try:
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 task["linenumber"] = int(self.readElementText())
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 except ValueError:
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 pass
589
a9a4620f6767 Added code to handle unexpected start tags to the new XML readers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 587
diff changeset
142 else:
a9a4620f6767 Added code to handle unexpected start tags to the new XML readers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 587
diff changeset
143 self.raiseUnexpectedStartTag(self.name())

eric ide

mercurial