|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the time tracker widget. |
|
8 """ |
|
9 |
|
10 from PyQt4.QtCore import pyqtSlot, QPoint |
|
11 from PyQt4.QtGui import QWidget, QMenu |
|
12 |
|
13 from .Ui_TimeTrackerWidget import Ui_TimeTrackerWidget |
|
14 |
|
15 |
|
16 class TimeTrackerWidget(QWidget, Ui_TimeTrackerWidget): |
|
17 """ |
|
18 Class implementing the time tracker widget. |
|
19 """ |
|
20 def __init__(self, tracker, parent=None): |
|
21 """ |
|
22 Constructor |
|
23 |
|
24 @param tracker reference to the time tracker (TimeTracker) |
|
25 @param parent reference to the parent widget (QWidget) |
|
26 """ |
|
27 super().__init__(parent) |
|
28 self.setupUi(self) |
|
29 |
|
30 self.__tracker = tracker |
|
31 |
|
32 @pyqtSlot(str) |
|
33 def on_taskCombo_editTextChanged(self, p0): |
|
34 """ |
|
35 Slot documentation goes here. |
|
36 """ |
|
37 # TODO: not implemented yet |
|
38 raise NotImplementedError |
|
39 |
|
40 @pyqtSlot(str) |
|
41 def on_commentCombo_editTextChanged(self, p0): |
|
42 """ |
|
43 Slot documentation goes here. |
|
44 """ |
|
45 # TODO: not implemented yet |
|
46 raise NotImplementedError |
|
47 |
|
48 @pyqtSlot(bool) |
|
49 def on_pauseButton_toggled(self, checked): |
|
50 """ |
|
51 Slot documentation goes here. |
|
52 """ |
|
53 # TODO: not implemented yet |
|
54 raise NotImplementedError |
|
55 |
|
56 @pyqtSlot() |
|
57 def on_newButton_clicked(self): |
|
58 """ |
|
59 Slot documentation goes here. |
|
60 """ |
|
61 # TODO: not implemented yet |
|
62 raise NotImplementedError |
|
63 |
|
64 @pyqtSlot(QPoint) |
|
65 def on_entriesList_customContextMenuRequested(self, pos): |
|
66 """ |
|
67 Private slot to create the context menu and show it. |
|
68 |
|
69 @param pos position the menu should be shown at (QPoint) |
|
70 """ |
|
71 menu = QMenu() |
|
72 |
|
73 menu.addAction(self.tr("Edit"), self.__editEntry).setEnabled( |
|
74 len(self.entriesList.selectedItems()) == 1) |
|
75 menu.addAction(self.tr("Delete"), self.__deleteSelectedEntries) |
|
76 menu.addSeparator() |
|
77 menu.addAction(self.tr("Save"), self.__saveEntries) |
|
78 menu.addSeparator() |
|
79 menu.addAction(self.tr("Import"), self.__importEntries) |
|
80 menu.addAction(self.tr("Export Selected"), self.__exportSelectedEntries) |
|
81 menu.addAction(self.tr("Export All"), self.__exportAllEntries) |
|
82 |
|
83 def __editEntry(self): |
|
84 """ |
|
85 Private slot to edit the selected tracker entry. |
|
86 """ |
|
87 # TODO: not implemented yet |
|
88 raise NotImplementedError |
|
89 |
|
90 def __deleteSelectedEntries(self): |
|
91 """ |
|
92 Private slot to delete the selected tracker entries. |
|
93 """ |
|
94 # TODO: not implemented yet |
|
95 raise NotImplementedError |
|
96 |
|
97 def __saveEntries(self): |
|
98 """ |
|
99 Private slot to save the tracker entries. |
|
100 """ |
|
101 # TODO: not implemented yet |
|
102 raise NotImplementedError |
|
103 |
|
104 def __importEntries(self): |
|
105 """ |
|
106 Private slot to import tracker entries. |
|
107 """ |
|
108 # TODO: not implemented yet |
|
109 raise NotImplementedError |
|
110 |
|
111 def __exportSelectedEntries(self): |
|
112 """ |
|
113 Private slot to export the selected tracker entries. |
|
114 """ |
|
115 # TODO: not implemented yet |
|
116 raise NotImplementedError |
|
117 |
|
118 def __exportAllEntries(self): |
|
119 """ |
|
120 Private slot to export all tracker entries. |
|
121 """ |
|
122 # TODO: not implemented yet |
|
123 raise NotImplementedError |