TimeTracker/TimeTrackEntry.py

changeset 42
37049a04b8fa
parent 36
d3312087bb1d
child 44
fe7ddb709c6a
equal deleted inserted replaced
41:21b31f1308ab 42:37049a04b8fa
41 def __lt__(self, other): 41 def __lt__(self, other):
42 """ 42 """
43 Special method implementing the less than function. 43 Special method implementing the less than function.
44 44
45 @param other reference to the other object (TimeTrackEntry) 45 @param other reference to the other object (TimeTrackEntry)
46 @return flag indicating that self is less than other (boolean)
46 """ 47 """
47 return self.__startDateTime < other.getStartDateTime() 48 return self.__startDateTime < other.getStartDateTime()
48 49
49 def toString(self): 50 def toString(self):
50 """ 51 """
216 @param startDateTime start date and time (QDateTime) 217 @param startDateTime start date and time (QDateTime)
217 """ 218 """
218 if startDateTime.isValid(): 219 if startDateTime.isValid():
219 self.__startDateTime = startDateTime 220 self.__startDateTime = startDateTime
220 self.__valid = self.__startDateTime.isValid() and \ 221 self.__valid = self.__startDateTime.isValid() and \
221 self.__duration >= self.__plugin.getPreferences("MinimumDuration") 222 self.__duration >= self.__plugin.getPreferences(
223 "MinimumDuration")
222 224
223 def getDuration(self): 225 def getDuration(self):
224 """ 226 """
225 Public slot to get the duration. 227 Public slot to get the duration.
226 228
235 @param duration duration in minutes (integer) 237 @param duration duration in minutes (integer)
236 """ 238 """
237 if duration >= self.__plugin.getPreferences("MinimumDuration"): 239 if duration >= self.__plugin.getPreferences("MinimumDuration"):
238 self.__duration = duration 240 self.__duration = duration
239 self.__valid = self.__startDateTime.isValid() and \ 241 self.__valid = self.__startDateTime.isValid() and \
240 self.__duration >= self.__plugin.getPreferences("MinimumDuration") 242 self.__duration >= self.__plugin.getPreferences(
243 "MinimumDuration")
241 244
242 def addDuration(self, duration): 245 def addDuration(self, duration):
243 """ 246 """
244 Public method to add a duration. 247 Public method to add a duration.
245 248
246 @param duration duration to be added in minutes (integer). Negative values 249 @param duration duration to be added in minutes (integer). Negative
247 are ignored. 250 values are ignored.
248 """ 251 """
249 if duration > 0: 252 if duration > 0:
250 self.__duration += duration 253 self.__duration += duration
251 254
252 def getTask(self): 255 def getTask(self):
287 290
288 def getEntryData(self): 291 def getEntryData(self):
289 """ 292 """
290 Public method to get the entry data. 293 Public method to get the entry data.
291 294
292 @return entry data as a tuple of start date (string), start time (string), 295 @return entry data as a tuple of start date (string), start time
293 duration (integer), task (string), comment (string) and flag indicating 296 (string), duration (integer), task (string), comment (string)
294 a paused state (boolean) 297 and flag indicating a paused state (boolean)
295 """ 298 """
296 return ( 299 return (
297 self.__id, 300 self.__id,
298 self.__startDateTime.toString("yyyy-MM-dd"), 301 self.__startDateTime.toString("yyyy-MM-dd"),
299 self.__startDateTime.toString("hh:mm"), 302 self.__startDateTime.toString("hh:mm"),

eric ide

mercurial