5 |
5 |
6 """ |
6 """ |
7 Module implementing the time track entry class. |
7 Module implementing the time track entry class. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import Qt, QDateTime |
10 from PyQt4.QtCore import Qt, QDateTime, QTime |
11 |
11 |
12 |
12 |
13 class TimeTrackEntry(object): |
13 class TimeTrackEntry(object): |
14 """ |
14 """ |
15 Class implementing the time track entry. |
15 Class implementing the time track entry. |
142 def continue_(self): |
142 def continue_(self): |
143 """ |
143 """ |
144 Public method to continue the entry. |
144 Public method to continue the entry. |
145 """ |
145 """ |
146 if self.__paused: |
146 if self.__paused: |
147 self.__continueDateTime = QDateTime(self.__startDateTime) |
147 self.__continueDateTime = self.__currentDateTime() |
148 self.__paused = False |
148 self.__paused = False |
149 |
149 |
150 def isPaused(self): |
150 def isPaused(self): |
151 """ |
151 """ |
152 Public method to check for a paused state. |
152 Public method to check for a paused state. |
153 |
153 |
154 @return flag indicating a paused state (boolean) |
154 @return flag indicating a paused state (boolean) |
155 """ |
155 """ |
156 return self.__paused |
156 return self.__paused |
|
157 |
|
158 def __currentDateTime(self): |
|
159 """ |
|
160 Private method to get the current date and time without milliseconds. |
|
161 |
|
162 @return current date and time (QDateTime) |
|
163 """ |
|
164 dt = QDateTime.currentDateTime() |
|
165 t = dt.time() |
|
166 t2 = QTime(t.hour(), t.minute(), t.second()) |
|
167 dt.setTime(t2) |
|
168 return dt |
157 |
169 |
158 def __calculateDuration(self, start, stop): |
170 def __calculateDuration(self, start, stop): |
159 """ |
171 """ |
160 Private method to calculate the duration in minutes. |
172 Private method to calculate the duration in minutes. |
161 |
173 |