TimeTracker/TimeTrackerWidget.py

changeset 42
37049a04b8fa
parent 39
82593471100f
child 44
fe7ddb709c6a
--- 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()
     

eric ide

mercurial