TimeTracker/TimeTrackerEntryDialog.py

changeset 42
37049a04b8fa
parent 36
d3312087bb1d
child 44
fe7ddb709c6a
equal deleted inserted replaced
41:21b31f1308ab 42:37049a04b8fa
39 self.taskCombo.addItems(taskItems) 39 self.taskCombo.addItems(taskItems)
40 self.commentCombo.addItems(commentItems) 40 self.commentCombo.addItems(commentItems)
41 41
42 # The allowed end time (i.e. start date and time plus duration must be 42 # The allowed end time (i.e. start date and time plus duration must be
43 # earlier or equal to the start date and time of the current entry. 43 # earlier or equal to the start date and time of the current entry.
44 self.__endDateTime = QDateTime(tracker.getCurrentEntry().getStartDateTime()) 44 self.__endDateTime = QDateTime(
45 tracker.getCurrentEntry().getStartDateTime())
45 46
46 self.durationSpinBox.setMinimum(tracker.getPreferences("MinimumDuration")) 47 self.durationSpinBox.setMinimum(
48 tracker.getPreferences("MinimumDuration"))
47 49
48 if entry is None: 50 if entry is None:
49 self.setWindowTitle(self.tr("Add Tracker Entry")) 51 self.setWindowTitle(self.tr("Add Tracker Entry"))
50 self.startDateTimeEdit.setDate(QDate.currentDate()) 52 self.startDateTimeEdit.setDate(QDate.currentDate())
51 else: 53 else:
58 """ 60 """
59 Private slot to set the enabled state of the OK button. 61 Private slot to set the enabled state of the OK button.
60 """ 62 """
61 dt = self.startDateTimeEdit.dateTime() 63 dt = self.startDateTimeEdit.dateTime()
62 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( 64 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
63 dt.addSecs(self.durationSpinBox.value() * 60) <= self.__endDateTime) 65 dt.addSecs(self.durationSpinBox.value() * 60) <=
66 self.__endDateTime)
64 67
65 @pyqtSlot(QDateTime) 68 @pyqtSlot(QDateTime)
66 def on_startDateTimeEdit_dateTimeChanged(self, date): 69 def on_startDateTimeEdit_dateTimeChanged(self, date):
67 """ 70 """
68 Private slot handling a change of the start date and time. 71 Private slot handling a change of the start date and time.
72
73 @param date start date and time (QDateTime)
69 """ 74 """
70 self.__checkOk() 75 self.__checkOk()
71 76
72 @pyqtSlot(int) 77 @pyqtSlot(int)
73 def on_durationSpinBox_valueChanged(self, p0): 78 def on_durationSpinBox_valueChanged(self, value):
74 """ 79 """
75 Private slot handling a change of the duration. 80 Private slot handling a change of the duration.
81
82 @param value value of the duration spin box (integer)
76 """ 83 """
77 self.__checkOk() 84 self.__checkOk()
78 85
79 def getData(self): 86 def getData(self):
80 """ 87 """

eric ide

mercurial