13 from PyQt4.QtGui import QKeySequence |
13 from PyQt4.QtGui import QKeySequence |
14 |
14 |
15 from E5Gui.E5Application import e5App |
15 from E5Gui.E5Application import e5App |
16 from E5Gui import E5MessageBox |
16 from E5Gui import E5MessageBox |
17 from E5Gui.E5Action import E5Action |
17 from E5Gui.E5Action import E5Action |
18 |
|
19 from .TimeTrackEntry import TimeTrackEntry |
|
20 from .TimeTrackerWidget import TimeTrackerWidget |
|
21 |
18 |
22 import UI.PixmapCache |
19 import UI.PixmapCache |
23 |
20 |
24 |
21 |
25 class TimeTracker(QObject): |
22 class TimeTracker(QObject): |
58 |
55 |
59 def activate(self): |
56 def activate(self): |
60 """ |
57 """ |
61 Public method to activate the time tracker. |
58 Public method to activate the time tracker. |
62 """ |
59 """ |
|
60 from .TimeTrackerWidget import TimeTrackerWidget |
|
61 |
63 self.__widget = TimeTrackerWidget(self) |
62 self.__widget = TimeTrackerWidget(self) |
64 self.__ui.addSideWidget(self.__ui.BottomSide, self.__widget, |
63 self.__ui.addSideWidget(self.__ui.BottomSide, self.__widget, |
65 UI.PixmapCache.getIcon(os.path.join("TimeTracker", "icons", "clock.png")), |
64 UI.PixmapCache.getIcon(os.path.join("TimeTracker", "icons", "clock.png")), |
66 self.tr("Time Tracker")) |
65 self.tr("Time Tracker")) |
67 |
66 |
135 self.trUtf8("Read Time Tracker File"), |
134 self.trUtf8("Read Time Tracker File"), |
136 self.trUtf8("""<p>The time tracker file <b>{0}</b> could not be""" |
135 self.trUtf8("""<p>The time tracker file <b>{0}</b> could not be""" |
137 """ read.</p><p>Reason: {1}</p>""").format( |
136 """ read.</p><p>Reason: {1}</p>""").format( |
138 self.__trackerFilePath, str(err))) |
137 self.__trackerFilePath, str(err))) |
139 return |
138 return |
|
139 |
|
140 from .TimeTrackEntry import TimeTrackEntry |
140 |
141 |
141 invalidCount = 0 |
142 invalidCount = 0 |
142 for line in data.splitlines(): |
143 for line in data.splitlines(): |
143 entry = TimeTrackEntry(self.__plugin) |
144 entry = TimeTrackEntry(self.__plugin) |
144 eid = entry.fromString(line.strip()) |
145 eid = entry.fromString(line.strip()) |
195 self.trUtf8("Import Time Tracker File"), |
196 self.trUtf8("Import Time Tracker File"), |
196 self.trUtf8("""<p>The time tracker file <b>{0}</b> could not be""" |
197 self.trUtf8("""<p>The time tracker file <b>{0}</b> could not be""" |
197 """ read.</p><p>Reason: {1}</p>""").format( |
198 """ read.</p><p>Reason: {1}</p>""").format( |
198 fname, str(err))) |
199 fname, str(err))) |
199 return |
200 return |
|
201 |
|
202 from .TimeTrackEntry import TimeTrackEntry |
200 |
203 |
201 invalidCount = 0 |
204 invalidCount = 0 |
202 duplicateCount = 0 |
205 duplicateCount = 0 |
203 entries = [] |
206 entries = [] |
204 for line in data.splitlines(): |
207 for line in data.splitlines(): |
275 if len(self.__entries.keys()): |
278 if len(self.__entries.keys()): |
276 nextID = max(self.__entries.keys()) + 1 |
279 nextID = max(self.__entries.keys()) + 1 |
277 else: |
280 else: |
278 nextID = 0 |
281 nextID = 0 |
279 |
282 |
|
283 from .TimeTrackEntry import TimeTrackEntry |
|
284 |
280 entry = TimeTrackEntry(self.__plugin) |
285 entry = TimeTrackEntry(self.__plugin) |
281 entry.setID(nextID) |
286 entry.setID(nextID) |
282 entry.setStartDateTime(startDateTime) |
287 entry.setStartDateTime(startDateTime) |
283 entry.setDuration(duration) |
288 entry.setDuration(duration) |
284 entry.setTask(task) |
289 entry.setTask(task) |
328 |
333 |
329 def startTrackerEntry(self): |
334 def startTrackerEntry(self): |
330 """ |
335 """ |
331 Public method to start a new tracker entry. |
336 Public method to start a new tracker entry. |
332 """ |
337 """ |
|
338 from .TimeTrackEntry import TimeTrackEntry |
|
339 |
333 self.__currentEntry = TimeTrackEntry(self.__plugin) |
340 self.__currentEntry = TimeTrackEntry(self.__plugin) |
334 self.__currentEntry.start() |
341 self.__currentEntry.start() |
335 self.__widget.setCurrentEntry(self.__currentEntry) |
342 self.__widget.setCurrentEntry(self.__currentEntry) |
336 |
343 |
337 def getCurrentEntry(self): |
344 def getCurrentEntry(self): |