Fri, 25 Oct 2013 18:54:29 +0200
Fixed code style issues.
--- a/ChangeLog Sat Sep 28 13:37:07 2013 +0200 +++ b/ChangeLog Fri Oct 25 18:54:29 2013 +0200 @@ -1,5 +1,8 @@ ChangeLog --------- +Version 1.2.1: +- fixed code style issues + Version 1.2.0: - Python 2 compatibility for Eric 5 @@ -11,7 +14,8 @@ - first stable release Version 0.3.0: -- bug fix related to uninstalling the plug-in via the external plug-in uninstaller +- bug fix related to uninstalling the plug-in via the external plug-in + uninstaller - added Spanish translations Version 0.2.0:
--- a/PluginTimeTracker.e4p Sat Sep 28 13:37:07 2013 +0200 +++ b/PluginTimeTracker.e4p Fri Oct 25 18:54:29 2013 +0200 @@ -7,7 +7,7 @@ <ProgLanguage mixed="0">Python3</ProgLanguage> <ProjectType>E4Plugin</ProjectType> <Description>Plugin implementing a simple time tracker to keep track of the time used for a project. The time can be subdivided into tasks.</Description> - <Version>1.1.0</Version> + <Version>1.2.x</Version> <Author>Detlev Offenbach</Author> <Email>detlev@die-offenbachs.de</Email> <TranslationPattern>TimeTracker/i18n/timetracker_%language%.ts</TranslationPattern> @@ -231,4 +231,77 @@ </dict> </DocumentationParams> </Documentation> + <Checkers> + <CheckersParams> + <dict> + <key> + <string>Pep8Checker</string> + </key> + <value> + <dict> + <key> + <string>DocstringType</string> + </key> + <value> + <string>eric</string> + </value> + <key> + <string>ExcludeFiles</string> + </key> + <value> + <string></string> + </value> + <key> + <string>ExcludeMessages</string> + </key> + <value> + <string>E24, W293, N802, N803, N807, N808, N821</string> + </value> + <key> + <string>FixCodes</string> + </key> + <value> + <string></string> + </value> + <key> + <string>FixIssues</string> + </key> + <value> + <bool>False</bool> + </value> + <key> + <string>HangClosing</string> + </key> + <value> + <bool>False</bool> + </value> + <key> + <string>IncludeMessages</string> + </key> + <value> + <string></string> + </value> + <key> + <string>MaxLineLength</string> + </key> + <value> + <int>79</int> + </value> + <key> + <string>NoFixCodes</string> + </key> + <value> + <string>E501</string> + </value> + <key> + <string>RepeatMessages</string> + </key> + <value> + <bool>True</bool> + </value> + </dict> + </value> + </dict> + </CheckersParams> + </Checkers> </Project>
--- a/PluginTimeTracker.py Sat Sep 28 13:37:07 2013 +0200 +++ b/PluginTimeTracker.py Fri Oct 25 18:54:29 2013 +0200 @@ -24,12 +24,14 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "1.2.0" +version = "1.2.1" className = "TimeTrackerPlugin" packageName = "TimeTracker" shortDescription = "Time Tracker to keep track of the project time." -longDescription = """This plug-in implements a time tracker to keep track""" \ - """ of the time used for a project. The time can be subdivided into tasks.""" +longDescription = \ + """This plug-in implements a time tracker to keep track""" \ + """ of the time used for a project. The time can be subdivided""" \ + """ into tasks.""" needsRestart = False pyqtApi = 2 # End-Of-Header @@ -43,6 +45,7 @@ """ Module function to create the Time Tracker configuration page. + @param configDlg reference to the configuration dialog @return reference to the configuration page """ global timeTrackerPluginObject @@ -59,11 +62,11 @@ """ if e5App().getObject("UserInterface").versionIsNewer('5.2.99', '20121012'): return { - "timeTrackerPage": \ - [QCoreApplication.translate("TimeTrackerPlugin", "Time Tracker"), - os.path.join("TimeTracker", "icons", - "clock.png"), - createTimeTrackerPage, None, None], + "timeTrackerPage": [ + QCoreApplication.translate("TimeTrackerPlugin", + "Time Tracker"), + os.path.join("TimeTracker", "icons", "clock.png"), + createTimeTrackerPage, None, None], } else: return {} @@ -120,8 +123,8 @@ if self.__ui.versionIsNewer('5.2.99', '20121102'): error = "" else: - error = self.trUtf8("eric5 version is too old, {0}, {1} or newer needed.")\ - .format("5.3.0", "20121103") + error = self.trUtf8("eric5 version is too old, {0}, {1} or newer" + " needed.").format("5.3.0", "20121103") return False return True @@ -176,8 +179,8 @@ if self.__ui is not None: loc = self.__ui.getLocale() if loc and loc != "C": - locale_dir = \ - os.path.join(os.path.dirname(__file__), "TimeTracker", "i18n") + locale_dir = os.path.join( + os.path.dirname(__file__), "TimeTracker", "i18n") translation = "timetracker_{0}".format(loc) translator = QTranslator(None) loaded = translator.load(translation, locale_dir) @@ -185,8 +188,8 @@ self.__translator = translator e5App().installTranslator(self.__translator) else: - print("Warning: translation file '{0}' could not be loaded."\ - .format(translation)) + print("Warning: translation file '{0}' could not be" + " loaded.".format(translation)) print("Using default.") def getPreferences(self, key): @@ -197,15 +200,15 @@ @return the requested setting """ if key in ["MinimumDuration"]: - return int(Preferences.Prefs.settings.value(self.PreferencesKey + "/" + key, - self.__defaults[key])) + return int(Preferences.Prefs.settings.value( + self.PreferencesKey + "/" + key, self.__defaults[key])) elif key in ["AutoSave", "AllowDuplicates"]: return Preferences.toBool( - Preferences.Prefs.settings.value(self.PreferencesKey + "/" + key, - self.__defaults[key])) + Preferences.Prefs.settings.value( + self.PreferencesKey + "/" + key, self.__defaults[key])) else: - return Preferences.Prefs.settings.value(self.PreferencesKey + "/" + key, - self.__defaults[key]) + return Preferences.Prefs.settings.value( + self.PreferencesKey + "/" + key, self.__defaults[key]) def setPreferences(self, key, value): """ @@ -213,6 +216,6 @@ @param key the key of the setting to be set (string) @param value the value to be set - @param prefClass preferences class used as the storage area """ - Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value) + Preferences.Prefs.settings.setValue( + self.PreferencesKey + "/" + key, value)
--- a/TimeTracker/ConfigurationPage/TimeTrackerPage.py Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/ConfigurationPage/TimeTrackerPage.py Fri Oct 25 18:54:29 2013 +0200 @@ -9,7 +9,8 @@ from __future__ import unicode_literals # __IGNORE_WARNING__ -from Preferences.ConfigurationPages.ConfigurationPageBase import ConfigurationPageBase +from Preferences.ConfigurationPages.ConfigurationPageBase import \ + ConfigurationPageBase from .Ui_TimeTrackerPage import Ui_TimeTrackerPage @@ -41,9 +42,9 @@ """ Public slot to save the Pyramid configuration. """ - self.__plugin.setPreferences("MinimumDuration", - self.durationSpinBox.value()) - self.__plugin.setPreferences("AutoSave", - self.autosaveCheckBox.isChecked()) - self.__plugin.setPreferences("AllowDuplicates", - self.duplicatesCheckBox.isChecked()) + self.__plugin.setPreferences( + "MinimumDuration", self.durationSpinBox.value()) + self.__plugin.setPreferences( + "AutoSave", self.autosaveCheckBox.isChecked()) + self.__plugin.setPreferences( + "AllowDuplicates", self.duplicatesCheckBox.isChecked())
--- a/TimeTracker/Documentation/source/Plugin_Time_Tracker.PluginTimeTracker.html Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/Documentation/source/Plugin_Time_Tracker.PluginTimeTracker.html Fri Oct 25 18:54:29 2013 +0200 @@ -167,9 +167,6 @@ </dd><dt><i>value</i></dt> <dd> the value to be set -</dd><dt><i>prefClass</i></dt> -<dd> -preferences class used as the storage area </dd> </dl> <div align="right"><a href="#top">Up</a></div> @@ -180,6 +177,11 @@ <p> Module function to create the Time Tracker configuration page. </p><dl> +<dt><i>configDlg</i></dt> +<dd> +reference to the configuration dialog +</dd> +</dl><dl> <dt>Returns:</dt> <dd> reference to the configuration page
--- a/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTrackEntry.html Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTrackEntry.html Fri Oct 25 18:54:29 2013 +0200 @@ -182,6 +182,11 @@ <dd> reference to the other object (TimeTrackEntry) </dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating that self is less than other (boolean) +</dd> </dl><a NAME="TimeTrackEntry.addDuration" ID="TimeTrackEntry.addDuration"></a> <h4>TimeTrackEntry.addDuration</h4> <b>addDuration</b>(<i>duration</i>) @@ -190,8 +195,8 @@ </p><dl> <dt><i>duration</i></dt> <dd> -duration to be added in minutes (integer). Negative values - are ignored. +duration to be added in minutes (integer). Negative + values are ignored. </dd> </dl><a NAME="TimeTrackEntry.continue_" ID="TimeTrackEntry.continue_"></a> <h4>TimeTrackEntry.continue_</h4> @@ -241,9 +246,9 @@ </p><dl> <dt>Returns:</dt> <dd> -entry data as a tuple of start date (string), start time (string), - duration (integer), task (string), comment (string) and flag indicating - a paused state (boolean) +entry data as a tuple of start date (string), start time + (string), duration (integer), task (string), comment (string) + and flag indicating a paused state (boolean) </dd> </dl><a NAME="TimeTrackEntry.getID" ID="TimeTrackEntry.getID"></a> <h4>TimeTrackEntry.getID</h4>
--- a/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTracker.html Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTracker.html Fri Oct 25 18:54:29 2013 +0200 @@ -210,7 +210,12 @@ <b>getCurrentEntry</b>(<i></i>) <p> Public method to get a reference to the current tracker entry. -</p><a NAME="TimeTracker.getEntry" ID="TimeTracker.getEntry"></a> +</p><dl> +<dt>Returns:</dt> +<dd> +reference to the current entry (TimeTrackEntry) +</dd> +</dl><a NAME="TimeTracker.getEntry" ID="TimeTracker.getEntry"></a> <h4>TimeTracker.getEntry</h4> <b>getEntry</b>(<i>eid</i>) <p> @@ -256,8 +261,8 @@ <p> Public slot to merge duplicate time tracker entries. </p><p> - If entries with the identical start date and time are found, the durations - of these entries are added. + If entries with the identical start date and time are found, the + durations of these entries are added. </p><a NAME="TimeTracker.pauseTrackerEntry" ID="TimeTracker.pauseTrackerEntry"></a> <h4>TimeTracker.pauseTrackerEntry</h4> <b>pauseTrackerEntry</b>(<i></i>) @@ -289,7 +294,8 @@ </p><dl> <dt><i>filePath=</i></dt> <dd> -path and name of the file to write the entries to (string) +path and name of the file to write the entries to + (string) </dd><dt><i>ids=</i></dt> <dd> list of entry IDs to be written (list of integer)
--- a/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTrackerEntryDialog.html Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTrackerEntryDialog.html Fri Oct 25 18:54:29 2013 +0200 @@ -119,15 +119,25 @@ </dd> </dl><a NAME="TimeTrackerEntryDialog.on_durationSpinBox_valueChanged" ID="TimeTrackerEntryDialog.on_durationSpinBox_valueChanged"></a> <h4>TimeTrackerEntryDialog.on_durationSpinBox_valueChanged</h4> -<b>on_durationSpinBox_valueChanged</b>(<i>p0</i>) +<b>on_durationSpinBox_valueChanged</b>(<i>value</i>) <p> Private slot handling a change of the duration. -</p><a NAME="TimeTrackerEntryDialog.on_startDateTimeEdit_dateTimeChanged" ID="TimeTrackerEntryDialog.on_startDateTimeEdit_dateTimeChanged"></a> +</p><dl> +<dt><i>value</i></dt> +<dd> +value of the duration spin box (integer) +</dd> +</dl><a NAME="TimeTrackerEntryDialog.on_startDateTimeEdit_dateTimeChanged" ID="TimeTrackerEntryDialog.on_startDateTimeEdit_dateTimeChanged"></a> <h4>TimeTrackerEntryDialog.on_startDateTimeEdit_dateTimeChanged</h4> <b>on_startDateTimeEdit_dateTimeChanged</b>(<i>date</i>) <p> Private slot handling a change of the start date and time. -</p> +</p><dl> +<dt><i>date</i></dt> +<dd> +start date and time (QDateTime) +</dd> +</dl> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html> \ No newline at end of file
--- a/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTrackerWidget.html Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTrackerWidget.html Fri Oct 25 18:54:29 2013 +0200 @@ -239,11 +239,18 @@ <b>on_pauseButton_toggled</b>(<i>checked</i>) <p> Private slot to pause the current timing. -</p><a NAME="TimeTrackerWidget.on_taskCombo_editTextChanged" ID="TimeTrackerWidget.on_taskCombo_editTextChanged"></a> +</p><dl> +<dt><i>checked</i></dt> +<dd> +flag indicating the checked status of the button + (boolean) +</dd> +</dl><a NAME="TimeTrackerWidget.on_taskCombo_editTextChanged" ID="TimeTrackerWidget.on_taskCombo_editTextChanged"></a> <h4>TimeTrackerWidget.on_taskCombo_editTextChanged</h4> <b>on_taskCombo_editTextChanged</b>(<i>txt</i>) <p> - Private slot handling changes of the task description of the current entry. + Private slot handling changes of the task description of the current + entry. </p><dl> <dt><i>txt</i></dt> <dd>
--- a/TimeTracker/TimeTrackEntry.py Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/TimeTrackEntry.py Fri Oct 25 18:54:29 2013 +0200 @@ -43,6 +43,7 @@ Special method implementing the less than function. @param other reference to the other object (TimeTrackEntry) + @return flag indicating that self is less than other (boolean) """ return self.__startDateTime < other.getStartDateTime() @@ -218,7 +219,8 @@ if startDateTime.isValid(): self.__startDateTime = startDateTime self.__valid = self.__startDateTime.isValid() and \ - self.__duration >= self.__plugin.getPreferences("MinimumDuration") + self.__duration >= self.__plugin.getPreferences( + "MinimumDuration") def getDuration(self): """ @@ -237,14 +239,15 @@ if duration >= self.__plugin.getPreferences("MinimumDuration"): self.__duration = duration self.__valid = self.__startDateTime.isValid() and \ - self.__duration >= self.__plugin.getPreferences("MinimumDuration") + self.__duration >= self.__plugin.getPreferences( + "MinimumDuration") def addDuration(self, duration): """ Public method to add a duration. - @param duration duration to be added in minutes (integer). Negative values - are ignored. + @param duration duration to be added in minutes (integer). Negative + values are ignored. """ if duration > 0: self.__duration += duration @@ -289,9 +292,9 @@ """ Public method to get the entry data. - @return entry data as a tuple of start date (string), start time (string), - duration (integer), task (string), comment (string) and flag indicating - a paused state (boolean) + @return entry data as a tuple of start date (string), start time + (string), duration (integer), task (string), comment (string) + and flag indicating a paused state (boolean) """ return ( self.__id,
--- a/TimeTracker/TimeTracker.py Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/TimeTracker.py Fri Oct 25 18:54:29 2013 +0200 @@ -62,20 +62,24 @@ from .TimeTrackerWidget import TimeTrackerWidget self.__widget = TimeTrackerWidget(self) - self.__ui.addSideWidget(self.__ui.BottomSide, self.__widget, - UI.PixmapCache.getIcon(os.path.join("TimeTracker", "icons", "clock.png")), + self.__ui.addSideWidget( + self.__ui.BottomSide, self.__widget, + UI.PixmapCache.getIcon( + os.path.join("TimeTracker", "icons", "clock.png")), self.tr("Time Tracker")) - self.__activateAct = E5Action(self.trUtf8('Time Tracker'), - self.trUtf8('T&ime Tracker'), - QKeySequence(self.trUtf8("Alt+Shift+I")), - 0, self, - 'time_tracker_activate') + self.__activateAct = E5Action( + self.trUtf8('Time Tracker'), + self.trUtf8('T&ime Tracker'), + QKeySequence(self.trUtf8("Alt+Shift+I")), + 0, self, + 'time_tracker_activate') self.__activateAct.setStatusTip(self.trUtf8( "Switch the input focus to the Time Tracker window.")) self.__activateAct.setWhatsThis(self.trUtf8( """<b>Activate Time Tracker</b>""" - """<p>This switches the input focus to the Time Tracker window.</p>""" + """<p>This switches the input focus to the Time Tracker""" + """ window.</p>""" )) self.__activateAct.triggered[()].connect(self.__activateWidget) @@ -108,7 +112,8 @@ TimeTracker.FileName) self.__readTrackerEntries() - self.__widget.showTrackerEntries(sorted(self.__entries.values(), reverse=True)) + self.__widget.showTrackerEntries(sorted(self.__entries.values(), + reverse=True)) self.__widget.setEnabled(True) self.startTrackerEntry() @@ -132,11 +137,12 @@ data = f.read() f.close() except (IOError, OSError) as err: - E5MessageBox.critical(self.__ui, + E5MessageBox.critical( + self.__ui, self.trUtf8("Read Time Tracker File"), - self.trUtf8("""<p>The time tracker file <b>{0}</b> could not be""" - """ read.</p><p>Reason: {1}</p>""").format( - self.__trackerFilePath, str(err))) + self.trUtf8("""<p>The time tracker file <b>{0}</b> could""" + """ not be read.</p><p>Reason: {1}</p>""") + .format(self.__trackerFilePath, str(err))) return from .TimeTrackEntry import TimeTrackEntry @@ -151,23 +157,27 @@ invalidCount += 1 if invalidCount: - E5MessageBox.information(self.__ui, + E5MessageBox.information( + self.__ui, self.trUtf8("Read Time Tracker File"), - self.trUtf8("""<p>The time tracker file <b>{0}</b> contained""" - """ %n invalid entries. These have been discarded.</p>""", - "", invalidCount).format(self.__trackerFilePath)) + self.trUtf8("""<p>The time tracker file <b>{0}</b>""" + """ contained %n invalid entries. These""" + """ have been discarded.</p>""", "", + invalidCount).format(self.__trackerFilePath)) def saveTrackerEntries(self, filePath="", ids=[]): """ Public slot to save the tracker entries to a file. - @keyparam filePath path and name of the file to write the entries to (string) + @keyparam filePath path and name of the file to write the entries to + (string) @keyparam ids list of entry IDs to be written (list of integer) """ if not filePath: filePath = self.__trackerFilePath if ids: - entriesList = [self.__entries[eid] for eid in ids if eid in self.__entries] + entriesList = [self.__entries[eid] for eid in ids + if eid in self.__entries] else: entriesList = self.__entries.values() try: @@ -177,11 +187,12 @@ f.write(entry.toString() + "\n") f.close() except (IOError, OSError) as err: - E5MessageBox.critical(self.__ui, + E5MessageBox.critical( + self.__ui, self.trUtf8("Save Time Tracker File"), - self.trUtf8("""<p>The time tracker file <b>{0}</b> could not be""" - """ saved.</p><p>Reason: {1}</p>""").format( - self.__trackerFilePath, str(err))) + self.trUtf8("""<p>The time tracker file <b>{0}</b> could""" + """ not be saved.</p><p>Reason: {1}</p>""") + .format(self.__trackerFilePath, str(err))) def importTrackerEntries(self, fname): """ @@ -194,11 +205,12 @@ data = f.read() f.close() except (IOError, OSError) as err: - E5MessageBox.critical(self.__ui, + E5MessageBox.critical( + self.__ui, self.trUtf8("Import Time Tracker File"), - self.trUtf8("""<p>The time tracker file <b>{0}</b> could not be""" - """ read.</p><p>Reason: {1}</p>""").format( - fname, str(err))) + self.trUtf8("""<p>The time tracker file <b>{0}</b> could""" + """ not be read.</p><p>Reason: {1}</p>""") + .format(fname, str(err))) return from .TimeTrackEntry import TimeTrackEntry @@ -236,27 +248,34 @@ if invalidCount != 0 or duplicateCount != 0: if invalidCount != 0 and duplicateCount != 0: - msg = self.tr("""<p>The time tracker file <b>{0}</b> contained""" + msg = self.tr( + """<p>The time tracker file <b>{0}</b> contained""" """ %n invalid entries.""", "", invalidCount).format(fname) - msg += " " + self.tr(""" %n duplicate entries were detected.""", - "", duplicateCount) + msg += " " + self.tr( + """ %n duplicate entries were detected.""", "", + duplicateCount) elif duplicateCount != 0: - msg = self.tr("""<p>The time tracker file <b>{0}</b> contained""" + msg = self.tr( + """<p>The time tracker file <b>{0}</b> contained""" """ %n duplicate entries.""", "", duplicateCount).format(fname) elif invalidCount != 0: - msg = self.tr("""<p>The time tracker file <b>{0}</b> contained""" + msg = self.tr( + """<p>The time tracker file <b>{0}</b> contained""" """ %n invalid entries.""", "", invalidCount).format(fname) - msg += " " + self.tr(""" %n entries have been ignored.</p>""", + msg += " " + self.tr( + """ %n entries have been ignored.</p>""", "", invalidCount + duplicateCount) - E5MessageBox.information(self.__ui, + E5MessageBox.information( + self.__ui, self.trUtf8("Import Time Tracker File"), msg) self.__widget.clear() - self.__widget.showTrackerEntries(sorted(self.__entries.values(), reverse=True)) + self.__widget.showTrackerEntries(sorted(self.__entries.values(), + reverse=True)) self.__widget.setCurrentEntry(self.__currentEntry) def addTrackerEntry(self, startDateTime, duration, task, comment): @@ -275,7 +294,7 @@ return if duration < self.__plugin.getPreferences("MinimumDuration"): - return + return if len(self.__entries.keys()): nextID = max(self.__entries.keys()) + 1 @@ -293,7 +312,8 @@ self.__entries[nextID] = entry self.__widget.clear() - self.__widget.showTrackerEntries(sorted(self.__entries.values(), reverse=True)) + self.__widget.showTrackerEntries(sorted(self.__entries.values(), + reverse=True)) self.__widget.setCurrentEntry(self.__currentEntry) def pauseTrackerEntry(self): @@ -346,6 +366,8 @@ def getCurrentEntry(self): """ Public method to get a reference to the current tracker entry. + + @return reference to the current entry (TimeTrackEntry) """ return self.__currentEntry @@ -397,15 +419,16 @@ self.saveTrackerEntries() self.__widget.clear() - self.__widget.showTrackerEntries(sorted(self.__entries.values(), reverse=True)) + self.__widget.showTrackerEntries(sorted(self.__entries.values(), + reverse=True)) self.__widget.setCurrentEntry(self.__currentEntry) def mergeDuplicateTrackerEntries(self): """ Public slot to merge duplicate time tracker entries. - If entries with the identical start date and time are found, the durations - of these entries are added. + If entries with the identical start date and time are found, the + durations of these entries are added. """ entries = {} for entry in self.__entries.values(): @@ -426,7 +449,8 @@ self.saveTrackerEntries() self.__widget.clear() - self.__widget.showTrackerEntries(sorted(self.__entries.values(), reverse=True)) + self.__widget.showTrackerEntries(sorted(self.__entries.values(), + reverse=True)) self.__widget.setCurrentEntry(self.__currentEntry) def entryChanged(self):
--- a/TimeTracker/TimeTrackerEntryDialog.py Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/TimeTrackerEntryDialog.py Fri Oct 25 18:54:29 2013 +0200 @@ -41,9 +41,11 @@ # The allowed end time (i.e. start date and time plus duration must be # earlier or equal to the start date and time of the current entry. - self.__endDateTime = QDateTime(tracker.getCurrentEntry().getStartDateTime()) + self.__endDateTime = QDateTime( + tracker.getCurrentEntry().getStartDateTime()) - self.durationSpinBox.setMinimum(tracker.getPreferences("MinimumDuration")) + self.durationSpinBox.setMinimum( + tracker.getPreferences("MinimumDuration")) if entry is None: self.setWindowTitle(self.tr("Add Tracker Entry")) @@ -60,19 +62,24 @@ """ dt = self.startDateTimeEdit.dateTime() self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( - dt.addSecs(self.durationSpinBox.value() * 60) <= self.__endDateTime) + dt.addSecs(self.durationSpinBox.value() * 60) <= + self.__endDateTime) @pyqtSlot(QDateTime) def on_startDateTimeEdit_dateTimeChanged(self, date): """ Private slot handling a change of the start date and time. + + @param date start date and time (QDateTime) """ self.__checkOk() @pyqtSlot(int) - def on_durationSpinBox_valueChanged(self, p0): + def on_durationSpinBox_valueChanged(self, value): """ Private slot handling a change of the duration. + + @param value value of the duration spin box (integer) """ self.__checkOk()
--- a/TimeTracker/TimeTrackerWidget.py Sat Sep 28 13:37:07 2013 +0200 +++ b/TimeTracker/TimeTrackerWidget.py Fri Oct 25 18:54:29 2013 +0200 @@ -45,7 +45,8 @@ @pyqtSlot(str) def on_taskCombo_editTextChanged(self, txt): """ - Private slot handling changes of the task description of the current entry. + Private slot handling changes of the task description of the current + entry. @param txt new task description (string) """ @@ -78,6 +79,9 @@ def on_pauseButton_toggled(self, checked): """ Private slot to pause the current timing. + + @param checked flag indicating the checked status of the button + (boolean) """ if checked: self.__tracker.pauseTrackerEntry() @@ -86,7 +90,8 @@ duration = entry.getDuration() itm = self.entriesList.topLevelItem(0) - itm.setText(self.DurationColumn, self.tr("{0} min").format(duration)) + itm.setText(self.DurationColumn, + self.tr("{0} min").format(duration)) self.entriesList.resizeColumnToContents(self.DurationColumn) self.durationSpinBox.setValue(duration) @@ -102,7 +107,8 @@ eid, duration = self.__tracker.stopTrackerEntry() if eid > -1: itm = self.entriesList.topLevelItem(0) - itm.setText(self.DurationColumn, self.tr("{0} min").format(duration)) + itm.setText(self.DurationColumn, + self.tr("{0} min").format(duration)) itm.setData(0, Qt.UserRole, eid) else: itm = self.entriesList.takeTopLevelItem(0) @@ -129,7 +135,8 @@ menu.addAction(self.tr("Save"), self.__saveEntries) menu.addSeparator() menu.addAction(self.tr("Import"), self.__importEntries) - menu.addAction(self.tr("Export Selected"), self.__exportSelectedEntries)\ + menu.addAction(self.tr("Export Selected"), + self.__exportSelectedEntries)\ .setEnabled(len(self.entriesList.selectedItems()) != 0) menu.addAction(self.tr("Export All"), self.__exportEntries) menu.addSeparator() @@ -171,7 +178,8 @@ comments = [] for index in range(self.commentCombo.count()): comments.append(self.commentCombo.itemText(index)) - dlg = TimeTrackerEntryDialog(self.__tracker, entry, tasks, comments) + dlg = TimeTrackerEntryDialog(self.__tracker, entry, tasks, + comments) if dlg.exec_() == QDialog.Accepted: start, duration, task, comment = dlg.getData() @@ -181,8 +189,10 @@ entry.setComment(comment) self.__tracker.entryChanged() - date, time, duration, task, comment = entry.getEntryData()[1:-1] - itm.setText(0, self.tr("{0}, {1}", "date, time").format(date, time)) + date, time, duration, task, comment = \ + entry.getEntryData()[1:-1] + itm.setText(0, self.tr("{0}, {1}", "date, time") + .format(date, time)) itm.setText(1, self.tr("{0} min").format(duration)) itm.setText(2, task) itm.setText(3, comment) @@ -192,9 +202,11 @@ """ Private slot to delete the selected tracker entries. """ - res = E5MessageBox.yesNo(self, + res = E5MessageBox.yesNo( + self, self.trUtf8("Delete Selected Entries"), - self.trUtf8("""Do you really want to delete the selected entries?""")) + self.trUtf8("""Do you really want to delete the selected""" + """ entries?""")) if res: for item in self.entriesList.selectedItems(): eid = item.data(0, Qt.UserRole) @@ -215,7 +227,8 @@ """ Private slot to import tracker entries. """ - path = Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() + path = Preferences.getMultiProject("Workspace") or \ + Utilities.getHomeDir() fname = E5FileDialog.getOpenFileName( None, self.trUtf8("Import Tracker Entries"), @@ -224,10 +237,11 @@ if fname: fname = Utilities.toNativeSeparators(fname) if not os.path.exists(fname): - E5MessageBox.critical(self, + E5MessageBox.critical( + self, self.trUtf8("Import Tracker Entries"), - self.trUtf8("<p>The file <b>{0}</b> does not exist.</p>").format( - fname)) + self.trUtf8("<p>The file <b>{0}</b> does not exist.</p>") + .format(fname)) return self.__tracker.importTrackerEntries(fname) @@ -238,7 +252,8 @@ @keyparam ids list of IDs to export or all if empty (list of integer) """ - path = Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() + path = Preferences.getMultiProject("Workspace") or \ + Utilities.getHomeDir() fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( self, self.trUtf8("Export Tracker Entries"), @@ -253,7 +268,8 @@ if ex: fname += ex if QFileInfo(fname).exists(): - res = E5MessageBox.yesNo(self, + res = E5MessageBox.yesNo( + self, self.trUtf8("Export Tracker Entries"), self.trUtf8("<p>The file <b>{0}</b> already exists." " Overwrite it?</p>").format(fname), @@ -280,10 +296,12 @@ """ Private slot to remove duplicate entries. """ - res = E5MessageBox.yesNo(self, + res = E5MessageBox.yesNo( + self, self.trUtf8("Remove Duplicate Tracker Entries"), - self.trUtf8("""Are you sure you want to remove duplicate tracker entries?""" - """ Only the one with the longest duration will be kept.""")) + self.trUtf8("""Are you sure you want to remove duplicate""" + """ tracker entries? Only the one with the longest""" + """ duration will be kept.""")) if res: self.__tracker.removeDuplicateTrackerEntries() @@ -291,10 +309,12 @@ """ Private slot to merge duplicate entries. """ - res = E5MessageBox.yesNo(self, + res = E5MessageBox.yesNo( + self, self.trUtf8("Merge Duplicate Tracker Entries"), - self.trUtf8("""Are you sure you want to merge duplicate tracker entries?""" - """ The durations of duplicate ones will be added.""")) + self.trUtf8("""Are you sure you want to merge duplicate""" + """ tracker entries? The durations of duplicate""" + """ ones will be added.""")) if res: self.__tracker.mergeDuplicateTrackerEntries()