Sat, 20 Oct 2012 22:01:38 +0200
Made some behavior dependent of configuration parameters.
TimeTracker/TimeTrackEntry.py | file | annotate | diff | comparison | revisions | |
TimeTracker/TimeTracker.py | file | annotate | diff | comparison | revisions |
--- a/TimeTracker/TimeTrackEntry.py Sat Oct 20 21:52:00 2012 +0200 +++ b/TimeTracker/TimeTrackEntry.py Sat Oct 20 22:01:38 2012 +0200 @@ -17,10 +17,14 @@ LineMarker = "Entry: " Separator = "@@" - def __init__(self): + def __init__(self, plugin): """ Constructor + + @param plugin reference to the plugin object (TimeTrackerPlugin) """ + self.__plugin = plugin + self.__entryMembersCount = 5 self.__id = -1 self.__startDateTime = QDateTime() # start date and time @@ -119,7 +123,7 @@ self.__continueDateTime, QDateTime.currentDateTime()) self.__duration += minutes - if self.__duration >= 2: + if self.__duration >= self.__plugin.getPreferences("MinimumDuration"): self.__valid = True else: self.__duration = 0
--- a/TimeTracker/TimeTracker.py Sat Oct 20 21:52:00 2012 +0200 +++ b/TimeTracker/TimeTracker.py Sat Oct 20 22:01:38 2012 +0200 @@ -30,7 +30,7 @@ """ Constructor - @param plugin reference to the plugin object + @param plugin reference to the plugin object (TimeTrackerPlugin) @param parent parent (QObject) """ QObject.__init__(self, parent) @@ -105,7 +105,7 @@ invalidCount = 0 for line in data.splitlines(): - entry = TimeTrackEntry() + entry = TimeTrackEntry(self.__plugin) eid = entry.fromString(line.strip()) if eid > -1: self.__entries[eid] = entry @@ -175,6 +175,8 @@ nextID = 0 self.__currentEntry.setID(nextID) self.__entries[nextID] = self.__currentEntry + if self.__plugin.getPreferences("AutoSave"): + self.saveTrackerEntries() duration = self.__currentEntry.getDuration() self.__currentEntry = None @@ -184,7 +186,7 @@ """ Public method to start a new tracker entry. """ - self.__currentEntry = TimeTrackEntry() + self.__currentEntry = TimeTrackEntry(self.__plugin) self.__currentEntry.start() self.__widget.setCurrentEntry(self.__currentEntry)