4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing the time track entry class. |
7 Module implementing the time track entry class. |
8 """ |
8 """ |
9 |
|
10 from __future__ import unicode_literals |
|
11 try: |
|
12 str = unicode # __IGNORE_EXCEPTION__ |
|
13 except NameError: |
|
14 pass |
|
15 |
9 |
16 from PyQt5.QtCore import Qt, QDateTime, QTime |
10 from PyQt5.QtCore import Qt, QDateTime, QTime |
17 |
11 |
18 |
12 |
19 class TimeTrackEntry(object): |
13 class TimeTrackEntry(object): |
220 |
214 |
221 @param startDateTime start date and time (QDateTime) |
215 @param startDateTime start date and time (QDateTime) |
222 """ |
216 """ |
223 if startDateTime.isValid(): |
217 if startDateTime.isValid(): |
224 self.__startDateTime = startDateTime |
218 self.__startDateTime = startDateTime |
225 self.__valid = self.__startDateTime.isValid() and \ |
219 self.__valid = ( |
|
220 self.__startDateTime.isValid() and |
226 self.__duration >= self.__plugin.getPreferences( |
221 self.__duration >= self.__plugin.getPreferences( |
227 "MinimumDuration") |
222 "MinimumDuration") |
|
223 ) |
228 |
224 |
229 def getDuration(self): |
225 def getDuration(self): |
230 """ |
226 """ |
231 Public slot to get the duration. |
227 Public slot to get the duration. |
232 |
228 |
240 |
236 |
241 @param duration duration in minutes (integer) |
237 @param duration duration in minutes (integer) |
242 """ |
238 """ |
243 if duration >= self.__plugin.getPreferences("MinimumDuration"): |
239 if duration >= self.__plugin.getPreferences("MinimumDuration"): |
244 self.__duration = duration |
240 self.__duration = duration |
245 self.__valid = self.__startDateTime.isValid() and \ |
241 self.__valid = ( |
|
242 self.__startDateTime.isValid() and |
246 self.__duration >= self.__plugin.getPreferences( |
243 self.__duration >= self.__plugin.getPreferences( |
247 "MinimumDuration") |
244 "MinimumDuration") |
|
245 ) |
248 |
246 |
249 def addDuration(self, duration): |
247 def addDuration(self, duration): |
250 """ |
248 """ |
251 Public method to add a duration. |
249 Public method to add a duration. |
252 |
250 |
268 """ |
266 """ |
269 Public method to set the task description. |
267 Public method to set the task description. |
270 |
268 |
271 @param description task description (string) |
269 @param description task description (string) |
272 """ |
270 """ |
273 self.__task = description.replace("\r\n", " ")\ |
271 self.__task = ( |
274 .replace("\n", " ")\ |
272 description.replace("\r\n", " ").replace("\n", " ") |
275 .replace("\r", " ") |
273 .replace("\r", " ") |
|
274 ) |
276 |
275 |
277 def getComment(self): |
276 def getComment(self): |
278 """ |
277 """ |
279 Public method to get the comment. |
278 Public method to get the comment. |
280 |
279 |
286 """ |
285 """ |
287 Public method to set a comment. |
286 Public method to set a comment. |
288 |
287 |
289 @param comment comment to set (string) |
288 @param comment comment to set (string) |
290 """ |
289 """ |
291 self.__comment = comment.replace("\r\n", " ")\ |
290 self.__comment = ( |
292 .replace("\n", " ")\ |
291 comment.replace("\r\n", " ").replace("\n", " ").replace("\r", " ") |
293 .replace("\r", " ") |
292 ) |
294 |
293 |
295 def getEntryData(self): |
294 def getEntryData(self): |
296 """ |
295 """ |
297 Public method to get the entry data. |
296 Public method to get the entry data. |
298 |
297 |