TimeTracker/TimeTrackerWidget.py

branch
eric7
changeset 115
859d59103f9f
parent 114
f58b64382e67
child 118
d3f658f306d4
equal deleted inserted replaced
114:f58b64382e67 115:859d59103f9f
128 128
129 # start a new one 129 # start a new one
130 self.__tracker.startTrackerEntry() 130 self.__tracker.startTrackerEntry()
131 131
132 @pyqtSlot(QPoint) 132 @pyqtSlot(QPoint)
133 def on_entriesList_customContextMenuRequested(self, pos): 133 def on_entriesList_customContextMenuRequested(self, pos): # noqa: U100
134 """ 134 """
135 Private slot to create the context menu and show it. 135 Private slot to create the context menu and show it.
136 136
137 @param pos position the menu should be shown at 137 @param pos position the menu should be shown at
138 @type QPoint 138 @type QPoint
188 188
189 def __editEntry(self): 189 def __editEntry(self):
190 """ 190 """
191 Private slot to edit the selected tracker entry. 191 Private slot to edit the selected tracker entry.
192 """ 192 """
193 from .TimeTrackerEntryDialog import TimeTrackerEntryDialog
194
193 itm = self.entriesList.selectedItems()[0] 195 itm = self.entriesList.selectedItems()[0]
194 eid = itm.data(0, Qt.ItemDataRole.UserRole) 196 eid = itm.data(0, Qt.ItemDataRole.UserRole)
195 if eid > -1: 197 if eid > -1:
196 # the current entry is edited via the elements of this widget 198 # the current entry is edited via the elements of this widget
197 entry = self.__tracker.getEntry(eid) 199 entry = self.__tracker.getEntry(eid)
198 if entry is not None: 200 if entry is not None:
199 from .TimeTrackerEntryDialog import TimeTrackerEntryDialog
200
201 tasks = [ 201 tasks = [
202 self.taskCombo.itemText(index) 202 self.taskCombo.itemText(index)
203 for index in range(self.taskCombo.count()) 203 for index in range(self.taskCombo.count())
204 ] 204 ]
205 comments = [ 205 comments = [
233 Private slot to delete the selected tracker entries. 233 Private slot to delete the selected tracker entries.
234 """ 234 """
235 res = EricMessageBox.yesNo( 235 res = EricMessageBox.yesNo(
236 self, 236 self,
237 self.tr("Delete Selected Entries"), 237 self.tr("Delete Selected Entries"),
238 self.tr("""Do you really want to delete the selected""" """ entries?"""), 238 self.tr("""Do you really want to delete the selected entries?"""),
239 ) 239 )
240 if res: 240 if res:
241 for item in self.entriesList.selectedItems(): 241 for item in self.entriesList.selectedItems():
242 eid = item.data(0, Qt.ItemDataRole.UserRole) 242 eid = item.data(0, Qt.ItemDataRole.UserRole)
243 if eid > -1: 243 if eid > -1:
302 if QFileInfo(fname).exists(): 302 if QFileInfo(fname).exists():
303 res = EricMessageBox.yesNo( 303 res = EricMessageBox.yesNo(
304 self, 304 self,
305 self.tr("Export Time Tracker Entries"), 305 self.tr("Export Time Tracker Entries"),
306 self.tr( 306 self.tr(
307 "<p>The file <b>{0}</b> already exists." " Overwrite it?</p>" 307 "<p>The file <b>{0}</b> already exists. Overwrite it?</p>"
308 ).format(fname), 308 ).format(fname),
309 icon=EricMessageBox.Warning, 309 icon=EricMessageBox.Warning,
310 ) 310 )
311 if not res: 311 if not res:
312 return 312 return

eric ide

mercurial