TimeTracker/TimeTrackerEntryDialog.py

branch
eric7
changeset 98
693e42176007
parent 94
a3d936304e51
child 105
44bfd9e7e65e
diff -r 44ec4168b442 -r 693e42176007 TimeTracker/TimeTrackerEntryDialog.py
--- a/TimeTracker/TimeTrackerEntryDialog.py	Thu Jun 03 18:02:18 2021 +0200
+++ b/TimeTracker/TimeTrackerEntryDialog.py	Fri Jun 04 16:40:54 2021 +0200
@@ -7,8 +7,8 @@
 Module implementing the time tracker edit dialog.
 """
 
-from PyQt5.QtCore import pyqtSlot, QDateTime, QDate
-from PyQt5.QtWidgets import QDialog, QDialogButtonBox
+from PyQt6.QtCore import pyqtSlot, QDateTime, QDate
+from PyQt6.QtWidgets import QDialog, QDialogButtonBox
 
 from .Ui_TimeTrackerEntryDialog import Ui_TimeTrackerEntryDialog
 
@@ -21,18 +21,24 @@
         """
         Constructor
         
-        @param tracker reference to the time tracker (TimeTracker)
-        @param entry reference to the time tracker entry (TimeTrackEntry)
+        @param tracker reference to the time tracker
+        @type TimeTracker
+        @param entry reference to the time tracker entry
+        @type TimeTrackEntry
         @param taskItems list of task item entries for the
-            task combo box (list of strings)
+            task combo box
+        @type list of str
         @param commentItems list of comment item entries for the
-            comment combo box (list of strings)
-        @param parent reference to the parent widget (QWidget)
+            comment combo box
+        @type list of str
+        @param parent reference to the parent widget
+        @type QWidget
         """
         super().__init__(parent)
         self.setupUi(self)
         
-        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Ok).setEnabled(False)
         
         self.taskCombo.addItems(taskItems)
         self.commentCombo.addItems(commentItems)
@@ -51,6 +57,8 @@
         else:
             self.startDateTimeEdit.setDateTime(entry.getStartDateTime())
             self.durationSpinBox.setValue(entry.getDuration())
+            self.durationSpinBox.setMaximum(
+                entry.getStartDateTime().secsTo(self.__endDateTime) // 60)
             self.taskCombo.setEditText(entry.getTask())
             self.commentCombo.setEditText(entry.getComment())
         
@@ -62,7 +70,7 @@
         Private slot to set the enabled state of the OK button.
         """
         dt = self.startDateTimeEdit.dateTime()
-        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
+        self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
             dt.addSecs(self.durationSpinBox.value() * 60) <=
             self.__endDateTime)
     
@@ -71,7 +79,8 @@
         """
         Private slot handling a change of the start date and time.
         
-        @param date start date and time (QDateTime)
+        @param date start date and time
+        @type QDateTime
         """
         self.__checkOk()
     
@@ -80,7 +89,8 @@
         """
         Private slot handling a change of the duration.
         
-        @param value value of the duration spin box (integer)
+        @param value value of the duration spin box
+        @type int
         """
         self.__checkOk()
     
@@ -89,7 +99,8 @@
         Public method to get the data.
         
         @return tuple with start date and time, duration, task description
-            and comment (QDateTime, integer, string, string)
+            and comment
+        @rtype tuple of (QDateTime, int, str, str)
         """
         return (
             self.startDateTimeEdit.dateTime(),

eric ide

mercurial