|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2005 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the task properties dialog. |
|
8 """ |
|
9 |
|
10 import time |
|
11 |
|
12 from PyQt4.QtCore import * |
|
13 from PyQt4.QtGui import * |
|
14 |
|
15 from E4Gui.E4Completers import E4FileCompleter |
|
16 |
|
17 from Ui_TaskPropertiesDialog import Ui_TaskPropertiesDialog |
|
18 |
|
19 |
|
20 class TaskPropertiesDialog(QDialog, Ui_TaskPropertiesDialog): |
|
21 """ |
|
22 Class implementing the task properties dialog. |
|
23 """ |
|
24 def __init__(self, task = None, parent = None, projectOpen = False): |
|
25 """ |
|
26 Constructor |
|
27 |
|
28 @param task the task object to be shown |
|
29 @param parent the parent widget (QWidget) |
|
30 @param projectOpen flag indicating status of the project (boolean) |
|
31 """ |
|
32 QDialog.__init__(self, parent) |
|
33 self.setupUi(self) |
|
34 |
|
35 self.filenameCompleter = E4FileCompleter(self.filenameEdit) |
|
36 |
|
37 if not projectOpen: |
|
38 self.projectCheckBox.setEnabled(False) |
|
39 if task is not None: |
|
40 self.descriptionEdit.setText(task.description) |
|
41 self.longtextEdit.setText(task.longtext) |
|
42 self.creationLabel.setText(time.strftime("%Y-%m-%d, %H:%M:%S", |
|
43 time.localtime(task.created))) |
|
44 self.priorityCombo.setCurrentIndex(task.priority) |
|
45 self.projectCheckBox.setChecked(task._isProjectTask) |
|
46 self.completedCheckBox.setChecked(task.completed) |
|
47 self.filenameEdit.setText(task.filename) |
|
48 if task.lineno: |
|
49 self.linenoEdit.setText(str(task.lineno)) |
|
50 else: |
|
51 self.projectCheckBox.setChecked(projectOpen) |
|
52 |
|
53 def setReadOnly(self): |
|
54 """ |
|
55 Public slot to set the dialog to read only mode. |
|
56 """ |
|
57 self.descriptionEdit.setReadOnly(True) |
|
58 self.completedCheckBox.setEnabled(False) |
|
59 self.priorityCombo.setEnabled(False) |
|
60 |
|
61 def getData(self): |
|
62 """ |
|
63 Public method to retrieve the dialogs data. |
|
64 |
|
65 @return tuple of description, priority, completion flag, |
|
66 project flag and long text (string, string, boolean, boolean, string) |
|
67 """ |
|
68 return (self.descriptionEdit.text(), self.priorityCombo.currentIndex(), |
|
69 self.completedCheckBox.isChecked(), self.projectCheckBox.isChecked(), |
|
70 self.longtextEdit.toPlainText()) |