71 |
71 |
72 entry = self.__tracker.getCurrentEntry() |
72 entry = self.__tracker.getCurrentEntry() |
73 duration = entry.getDuration() |
73 duration = entry.getDuration() |
74 |
74 |
75 itm = self.entriesList.topLevelItem(0) |
75 itm = self.entriesList.topLevelItem(0) |
76 itm.setText(self.DurationColumn, str(duration)) |
76 itm.setText(self.DurationColumn, self.tr("{0} min").format(duration)) |
77 self.entriesList.resizeColumnToContents(self.CommentColumn) |
77 self.entriesList.resizeColumnToContents(self.CommentColumn) |
|
78 |
|
79 self.durationSpinBox.setValue(duration) |
78 else: |
80 else: |
79 self.__tracker.continueTrackerEntry() |
81 self.__tracker.continueTrackerEntry() |
80 |
82 |
81 @pyqtSlot() |
83 @pyqtSlot() |
82 def on_newButton_clicked(self): |
84 def on_newButton_clicked(self): |
83 """ |
85 """ |
84 Slot documentation goes here. |
86 Private slot to end the current timer and start a new one. |
85 """ |
87 """ |
86 # TODO: not implemented yet |
88 # stop the current tracker |
87 raise NotImplementedError |
89 eid, duration = self.__tracker.stopTrackerEntry() |
|
90 itm = self.entriesList.topLevelItem(0) |
|
91 itm.setText(self.DurationColumn, self.tr("{0} min").format(duration)) |
|
92 itm.setData(0, Qt.UserRole, eid) |
|
93 self.entriesList.resizeColumnToContents(self.CommentColumn) |
|
94 |
|
95 # start a new one |
|
96 self.__tracker.startTrackerEntry() |
88 |
97 |
89 @pyqtSlot(QPoint) |
98 @pyqtSlot(QPoint) |
90 def on_entriesList_customContextMenuRequested(self, pos): |
99 def on_entriesList_customContextMenuRequested(self, pos): |
91 """ |
100 """ |
92 Private slot to create the context menu and show it. |
101 Private slot to create the context menu and show it. |
154 |
163 |
155 @param entry reference to the tracker entry (TimeTrackEntry) |
164 @param entry reference to the tracker entry (TimeTrackEntry) |
156 @param index index the entry is to be inserted; -1 for at the end |
165 @param index index the entry is to be inserted; -1 for at the end |
157 (integer) |
166 (integer) |
158 """ |
167 """ |
159 date, time, duration, task, comment, paused = entry.getEntryData() |
168 eid, date, time, duration, task, comment, paused = entry.getEntryData() |
160 itm = QTreeWidgetItem( |
169 itm = QTreeWidgetItem( |
161 ["{0}, {1}".format(date, time), str(duration), task, comment]) |
170 [self.tr("{0}, {1}", "date, time").format(date, time), |
|
171 self.tr("{0} min").format(duration), task, comment]) |
162 itm.setTextAlignment(1, Qt.AlignRight) |
172 itm.setTextAlignment(1, Qt.AlignRight) |
|
173 itm.setData(0, Qt.UserRole, eid) |
163 if index == -1: |
174 if index == -1: |
164 self.entriesList.addTopLevelItem(itm) |
175 self.entriesList.addTopLevelItem(itm) |
165 else: |
176 else: |
166 self.entriesList.insertTopLevelItem(index, itm) |
177 self.entriesList.insertTopLevelItem(index, itm) |
167 |
178 |
189 @param entry current entry (TimeTrackEntry) |
200 @param entry current entry (TimeTrackEntry) |
190 """ |
201 """ |
191 self.__insertEntry(entry, 0) |
202 self.__insertEntry(entry, 0) |
192 self.__resizeColumns() |
203 self.__resizeColumns() |
193 |
204 |
194 date, time, duration, task, comment, paused = entry.getEntryData() |
205 eid, date, time, duration, task, comment, paused = entry.getEntryData() |
195 self.startDateTimeEdit.setDateTime(entry.getStartDateTime()) |
206 self.startDateTimeEdit.setDateTime(entry.getStartDateTime()) |
196 self.durationSpinBox.setValue(duration) |
207 self.durationSpinBox.setValue(duration) |
197 self.taskCombo.setEditText(task) |
208 self.taskCombo.setEditText(task) |
198 self.commentCombo.setEditText(comment) |
209 self.commentCombo.setEditText(comment) |
199 |
210 |