TimeTracker/TimeTrackEntry.py

branch
eric7
changeset 106
6deb942739dc
parent 105
44bfd9e7e65e
child 108
702f47d3f794
equal deleted inserted replaced
105:44bfd9e7e65e 106:6deb942739dc
89 self.__task = data["task"] 89 self.__task = data["task"]
90 self.__comment = data["comment"] 90 self.__comment = data["comment"]
91 91
92 self.__valid = True 92 self.__valid = True
93 return self.__id 93 return self.__id
94 94
95 ## def toString(self):
96 ## """
97 ## Public method to get a string representation of the entry.
98 ##
99 ## @return string representation of the entry (string)
100 ## """
101 ## if self.__valid:
102 ## dataLine = TimeTrackEntry.Separator.join([
103 ## str(self.__id),
104 ## self.__startDateTime.toString(Qt.DateFormat.ISODate),
105 ## str(self.__duration),
106 ## self.__task,
107 ## self.__comment,
108 ## ])
109 ## return "{0}{1}".format(TimeTrackEntry.LineMarker, dataLine)
110 ## else:
111 ## return ""
112 ##
113 ## def fromString(self, line):
114 ## """
115 ## Public method to populate the entry from the given string.
116 ##
117 ## @param line stringified entry data as generated by toString() (string)
118 ## @return ID of the tracker entry; -1 indicates an error (integer)
119 ## """
120 ## if not line.startswith(TimeTrackEntry.LineMarker):
121 ## return -1
122 ##
123 ## line = line.replace(TimeTrackEntry.LineMarker, "")
124 ## dataList = line.split(TimeTrackEntry.Separator)
125 ## if len(dataList) != self.__entryMembersCount:
126 ## return -1
127 ##
128 ## try:
129 ## self.__id = int(dataList[0])
130 ## except ValueError:
131 ## return -1
132 ##
133 ## dt = QDateTime.fromString(dataList[1], Qt.DateFormat.ISODate)
134 ## if not dt.isValid():
135 ## return -1
136 ## self.__startDateTime = dt
137 ##
138 ## try:
139 ## dt = int(dataList[2])
140 ## except ValueError:
141 ## return -1
142 ## self.__duration = dt
143 ##
144 ## self.__task = dataList[3]
145 ## self.__comment = dataList[4]
146 ##
147 ## self.__valid = True
148 ## return self.__id
149 ##
150 def isValid(self): 95 def isValid(self):
151 """ 96 """
152 Public method to check the validity of the entry. 97 Public method to check the validity of the entry.
153 98
154 @return validity of the entry 99 @return validity of the entry

eric ide

mercurial