Merge lp:~bertrand-rousseau/gtg/get_due_date into lp:~gtg/gtg/old-trunk
- get_due_date
- Merge into old-trunk
Status: | Merged |
---|---|
Merged at revision: | 1211 |
Proposed branch: | lp:~bertrand-rousseau/gtg/get_due_date |
Merge into: | lp:~gtg/gtg/old-trunk |
Diff against target: |
309 lines (+69/-54) 4 files modified
CHANGELOG (+1/-0) GTG/core/task.py (+44/-18) GTG/gtk/browser/taskbrowser.glade (+24/-24) GTG/gtk/editor/editor.py (+0/-12) |
To merge this branch: | bzr merge lp:~bertrand-rousseau/gtg/get_due_date |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Izidor Matušov | code, running | Approve | |
Review via email: mp+109534@code.launchpad.net |
Commit message
Description of the change
Remove the implicit interpretation of due date through get_due_date:
With this patch, GTG uses the actual value of the task object's due date
when accessing it through get_due_date.
It seems to me that it's saner than the current mechanism that relies
on an on-the-fly interpretation when accessing the due date. Indeed,
this can hide mismatches between the stored value and the returned due
date.
Typical example: a parent task with due date A and a child task
with no due date: the child has no due date set, but get_due_date
will return 'A'.
Now, you get what you really have stored, but therefore it's up to the
code to make sure you store a correct value!
Therefore, from now on all code dealing with tasks due dates and
tasks relations MUST be written so that the due dates are always set
correctly (=they respect the date constraints). This is actually not
a big deal since most of this is actually cared for by set_due_date().
set_due_date() has thus been slightly modified (pursuing previous
work by Nimit Shah), so that when you set/update the due date, all
related tasks dates are modified to respect the constraints.
However, D&D'ing tasks can still create situations where a parent task due
date and its child due date are not compatible. This cannot be fixed
now since D&D is done in liblarch and there are no hooks available
from the GTG code to handle tasks updates when reparenting them...
This patch also means that from now on, undefined due date are presented
explicitely in the list as not being set, even when constrained by a
parent. Therefore, it's up to the user to explicitely define it if needed
(which she/he can do by directly setting the due date of the task, or by
setting the due date of the parent). It's possibly more work for her/him,
but at least the outcome is clear and therefore predictable/usable: explicit
is always better than implicit.
Note: some code from the task editor that checks if the start and due
date are compatible has been removed, since it's done in set_due_date
now.
- 1198. By Bertrand Rousseau
-
After giving it (even) more thoughts, I think it's better to set the due
date to the most urgent parents due date when clearing it (instead of
setting it to undefine as I did in the previous version of this patch).Indeed, it reinforces the rule imposing that "task due date < parents
due dates" at all times. Since this the GTG policy, it's probably better
to insist on it (it requires to discover or learn the policy, but it
reduces the confusion once it is learned - a better doc would certainly
help here btw).Moreover, in order to provide a better feedback on the fact that there
is a "default value" for a task due date depending on related task due
dates, I changed a "set due date" context menu label from "clear due
date" to "reset to default", since it could let one think that this
would actually unset the due date instead of setting it to its current
most constrained value (according to the due date policy).All that being said, I think this actually corresponds to the previous
behavior, so this should not be a big deal...
Izidor Matušov (izidor) wrote : | # |
- 1199. By Bertrand Rousseau
-
Apply modification to fix remarks from Izidor's review
- 1200. By Bertrand Rousseau
-
Merge trunk, and fix the self-description in about dialog which was shortened for som reason.
- 1201. By Bertrand Rousseau
-
Some pylint fixes
- 1202. By Bertrand Rousseau
-
Update CHANGELOG
Bertrand Rousseau (bertrand-rousseau) wrote : | # |
Hi Izidor,
I updated the code to take your remarks into account. I also changed some other small things:
- Used capital letter in the menu items (it's a convention, sort of)
- Fixed the GTG self-description in the about dialog (it was shortened for some reasons)
- Fixed lint errors on the modified methods
Izidor Matušov (izidor) wrote : | # |
It looks great, merging.
Preview Diff
1 | === modified file 'CHANGELOG' | |||
2 | --- CHANGELOG 2012-07-18 12:09:41 +0000 | |||
3 | +++ CHANGELOG 2012-07-20 09:48:37 +0000 | |||
4 | @@ -31,6 +31,7 @@ | |||
5 | 31 | * It is not possible to add another instance of local file synchronization service | 31 | * It is not possible to add another instance of local file synchronization service |
6 | 32 | * Fixes for bugs #906516, #1002160 (task urgency color plugin), by Wolter Hellmund | 32 | * Fixes for bugs #906516, #1002160 (task urgency color plugin), by Wolter Hellmund |
7 | 33 | * Fix for bug #1001012: Notification area icon should change color when there are urgent tasks, by Antonio Roquentin | 33 | * Fix for bug #1001012: Notification area icon should change color when there are urgent tasks, by Antonio Roquentin |
8 | 34 | * Saner implementation of set_due_date | ||
9 | 34 | 35 | ||
10 | 35 | 2012-02-13 Getting Things GNOME! 0.2.9 | 36 | 2012-02-13 Getting Things GNOME! 0.2.9 |
11 | 36 | * Big refractorization of code, now using liblarch | 37 | * Big refractorization of code, now using liblarch |
12 | 37 | 38 | ||
13 | === modified file 'GTG/core/task.py' | |||
14 | --- GTG/core/task.py 2012-07-13 17:27:54 +0000 | |||
15 | +++ GTG/core/task.py 2012-07-20 09:48:37 +0000 | |||
16 | @@ -247,33 +247,59 @@ | |||
17 | 247 | self.last_modified = modified | 247 | self.last_modified = modified |
18 | 248 | 248 | ||
19 | 249 | def set_due_date(self, fulldate): | 249 | def set_due_date(self, fulldate): |
22 | 250 | self.due_date=Date(fulldate) | 250 | """Defines the task's due date.""" |
23 | 251 | if self.get_start_date() > Date(fulldate) and self.get_start_date() != Date.no_date(): | 251 | def get_due_date_constraint(): |
24 | 252 | """ Returns the most urgent due date constraint, following | ||
25 | 253 | parents' due dates. Return Date.no_date() if no constraint | ||
26 | 254 | is applied. """ | ||
27 | 255 | cur_date = Date.no_date() | ||
28 | 256 | for par_id in self.get_parents(): | ||
29 | 257 | par = self.req.get_task(par_id) | ||
30 | 258 | if par.get_due_date() != Date.no_date() and \ | ||
31 | 259 | par.get_due_date() < cur_date: | ||
32 | 260 | cur_date = par.get_due_date() | ||
33 | 261 | return cur_date | ||
34 | 262 | fulldate_obj = Date(fulldate) # caching the conversion | ||
35 | 263 | self.due_date = fulldate_obj | ||
36 | 264 | # if the task's start date happens later than the | ||
37 | 265 | # new due date, we update it | ||
38 | 266 | if self.get_start_date() != Date.no_date() and \ | ||
39 | 267 | self.get_start_date() > fulldate_obj: | ||
40 | 252 | self.set_start_date(fulldate) | 268 | self.set_start_date(fulldate) |
42 | 253 | if Date(fulldate)!= Date.no_date(): | 269 | if fulldate_obj != Date.no_date(): |
43 | 270 | # if the parent's due date happens before the task's new | ||
44 | 271 | # due date, we update it | ||
45 | 254 | for par_id in self.parents: | 272 | for par_id in self.parents: |
46 | 255 | par = self.req.get_task(par_id) | 273 | par = self.req.get_task(par_id) |
48 | 256 | if par.due_date != Date.no_date() and par.due_date < Date(fulldate): | 274 | if par.get_due_date() != Date.no_date() and \ |
49 | 275 | par.get_due_date() < fulldate_obj: | ||
50 | 257 | par.set_due_date(fulldate) | 276 | par.set_due_date(fulldate) |
51 | 277 | # the current task being one of its children's parents, we must | ||
52 | 278 | # apply the constraints on their due/start dates as well | ||
53 | 258 | for sub_id in self.children: | 279 | for sub_id in self.children: |
58 | 259 | sub=self.req.get_task(sub_id) | 280 | sub = self.req.get_task(sub_id) |
59 | 260 | if sub.due_date > Date(fulldate) and sub.due_date != Date.no_date(): | 281 | # child's due date is not set, we use the task's new |
60 | 261 | sub.set_due_date(fulldate) | 282 | # due date |
61 | 262 | if sub.get_start_date() != Date.no_date() and sub.get_start_date() > Date(fulldate): | 283 | if sub.get_due_date() == Date.no_date(): |
62 | 284 | sub.set_due_date(fulldate) | ||
63 | 285 | # child's due date happens later than the task's: we | ||
64 | 286 | # update it to the task's new due date | ||
65 | 287 | # (= the new most restrictive) | ||
66 | 288 | if sub.get_due_date() != Date.no_date() and \ | ||
67 | 289 | sub.get_due_date() > fulldate_obj: | ||
68 | 290 | sub.set_due_date(fulldate) | ||
69 | 291 | # if the child's start date happens later than | ||
70 | 292 | # the task's new due date, we update it | ||
71 | 293 | if sub.get_start_date() != Date.no_date() and \ | ||
72 | 294 | sub.get_start_date() > fulldate_obj: | ||
73 | 263 | sub.set_start_date(fulldate) | 295 | sub.set_start_date(fulldate) |
74 | 296 | else: | ||
75 | 297 | self.due_date = get_due_date_constraint() | ||
76 | 264 | self.sync() | 298 | self.sync() |
77 | 265 | 299 | ||
78 | 266 | def get_due_date(self): | 300 | def get_due_date(self): |
89 | 267 | """ Due date return the most urgent date of all parents """ | 301 | """ Returns the due date, which always respects all constraints """ |
90 | 268 | zedate = self.due_date | 302 | return self.due_date |
81 | 269 | |||
82 | 270 | for par in self.get_parents(): | ||
83 | 271 | # compare with the parent's due date | ||
84 | 272 | pardate = self.req.get_task(par).get_due_date() | ||
85 | 273 | if pardate and zedate > pardate: | ||
86 | 274 | zedate = pardate | ||
87 | 275 | |||
88 | 276 | return zedate | ||
91 | 277 | 303 | ||
92 | 278 | def set_start_date(self, fulldate): | 304 | def set_start_date(self, fulldate): |
93 | 279 | self.start_date = Date(fulldate) | 305 | self.start_date = Date(fulldate) |
94 | 280 | 306 | ||
95 | === modified file 'GTG/gtk/browser/taskbrowser.glade' | |||
96 | --- GTG/gtk/browser/taskbrowser.glade 2012-07-13 17:24:28 +0000 | |||
97 | +++ GTG/gtk/browser/taskbrowser.glade 2012-07-20 09:48:37 +0000 | |||
98 | @@ -4,7 +4,7 @@ | |||
99 | 4 | <!-- interface-naming-policy toplevel-contextual --> | 4 | <!-- interface-naming-policy toplevel-contextual --> |
100 | 5 | <object class="GtkWindow" id="MainWindow"> | 5 | <object class="GtkWindow" id="MainWindow"> |
101 | 6 | <property name="can_focus">False</property> | 6 | <property name="can_focus">False</property> |
103 | 7 | <property name="title" translatable="yes">Getting Things Gnome!</property> | 7 | <property name="title" translatable="yes">Getting Things GNOME!</property> |
104 | 8 | <property name="default_width">700</property> | 8 | <property name="default_width">700</property> |
105 | 9 | <property name="default_height">550</property> | 9 | <property name="default_height">550</property> |
106 | 10 | <signal name="configure-event" handler="on_move" swapped="no"/> | 10 | <signal name="configure-event" handler="on_move" swapped="no"/> |
107 | @@ -796,13 +796,13 @@ | |||
108 | 796 | <property name="type_hint">dialog</property> | 796 | <property name="type_hint">dialog</property> |
109 | 797 | <property name="program_name" translatable="yes">Getting Things GNOME!</property> | 797 | <property name="program_name" translatable="yes">Getting Things GNOME!</property> |
110 | 798 | <property name="copyright" translatable="yes">Copyright © 2008-2012 Lionel Dricot, Bertrand Rousseau</property> | 798 | <property name="copyright" translatable="yes">Copyright © 2008-2012 Lionel Dricot, Bertrand Rousseau</property> |
112 | 799 | <property name="comments" translatable="yes">GTG is a personal tasks and TODO-list items organizer for the GNOME.</property> | 799 | <property name="comments" translatable="yes">GTG is a personal tasks and TODO-list items organizer for the GNOME desktop environment.</property> |
113 | 800 | <property name="website_label" translatable="yes">GTG website</property> | 800 | <property name="website_label" translatable="yes">GTG website</property> |
119 | 801 | <property name="license" translatable="yes">Getting Things Gnome! is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. | 801 | <property name="license" translatable="yes">Getting Things GNOME! is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. |
120 | 802 | 802 | ||
121 | 803 | Getting Things Gnome! is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | 803 | Getting Things GNOME! is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
122 | 804 | 804 | ||
123 | 805 | You should have received a copy of the GNU General Public License along with Getting Things Gnome!; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</property> | 805 | You should have received a copy of the GNU General Public License along with Getting Things GNOME!; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</property> |
124 | 806 | <property name="authors">Lionel Dricot (ploum@ploum.net), | 806 | <property name="authors">Lionel Dricot (ploum@ploum.net), |
125 | 807 | Bertrand Rousseau (bertrand.rousseau@gmail.com)</property> | 807 | Bertrand Rousseau (bertrand.rousseau@gmail.com)</property> |
126 | 808 | <property name="logo_icon_name">gtg</property> | 808 | <property name="logo_icon_name">gtg</property> |
127 | @@ -1044,7 +1044,7 @@ | |||
128 | 1044 | </child> | 1044 | </child> |
129 | 1045 | <child> | 1045 | <child> |
130 | 1046 | <object class="GtkImageMenuItem" id="tcm_start_menu"> | 1046 | <object class="GtkImageMenuItem" id="tcm_start_menu"> |
132 | 1047 | <property name="label" translatable="yes">_Set start date</property> | 1047 | <property name="label" translatable="yes">_Set Start Date</property> |
133 | 1048 | <property name="visible">True</property> | 1048 | <property name="visible">True</property> |
134 | 1049 | <property name="can_focus">False</property> | 1049 | <property name="can_focus">False</property> |
135 | 1050 | <property name="use_action_appearance">False</property> | 1050 | <property name="use_action_appearance">False</property> |
136 | @@ -1056,7 +1056,7 @@ | |||
137 | 1056 | <property name="can_focus">False</property> | 1056 | <property name="can_focus">False</property> |
138 | 1057 | <child> | 1057 | <child> |
139 | 1058 | <object class="GtkImageMenuItem" id="tcm_mark_as_started"> | 1058 | <object class="GtkImageMenuItem" id="tcm_mark_as_started"> |
141 | 1059 | <property name="label" translatable="yes">t_oday</property> | 1059 | <property name="label" translatable="yes">T_oday</property> |
142 | 1060 | <property name="visible">True</property> | 1060 | <property name="visible">True</property> |
143 | 1061 | <property name="can_focus">False</property> | 1061 | <property name="can_focus">False</property> |
144 | 1062 | <property name="use_action_appearance">False</property> | 1062 | <property name="use_action_appearance">False</property> |
145 | @@ -1067,7 +1067,7 @@ | |||
146 | 1067 | </child> | 1067 | </child> |
147 | 1068 | <child> | 1068 | <child> |
148 | 1069 | <object class="GtkImageMenuItem" id="tcm_start_for_tomorrow"> | 1069 | <object class="GtkImageMenuItem" id="tcm_start_for_tomorrow"> |
150 | 1070 | <property name="label" translatable="yes">_tomorrow</property> | 1070 | <property name="label" translatable="yes">_Tomorrow</property> |
151 | 1071 | <property name="visible">True</property> | 1071 | <property name="visible">True</property> |
152 | 1072 | <property name="can_focus">False</property> | 1072 | <property name="can_focus">False</property> |
153 | 1073 | <property name="use_action_appearance">False</property> | 1073 | <property name="use_action_appearance">False</property> |
154 | @@ -1078,7 +1078,7 @@ | |||
155 | 1078 | </child> | 1078 | </child> |
156 | 1079 | <child> | 1079 | <child> |
157 | 1080 | <object class="GtkImageMenuItem" id="tcm_start_for_next_week"> | 1080 | <object class="GtkImageMenuItem" id="tcm_start_for_next_week"> |
159 | 1081 | <property name="label" translatable="yes">next _week</property> | 1081 | <property name="label" translatable="yes">Next _Week</property> |
160 | 1082 | <property name="visible">True</property> | 1082 | <property name="visible">True</property> |
161 | 1083 | <property name="can_focus">False</property> | 1083 | <property name="can_focus">False</property> |
162 | 1084 | <property name="use_action_appearance">False</property> | 1084 | <property name="use_action_appearance">False</property> |
163 | @@ -1089,7 +1089,7 @@ | |||
164 | 1089 | </child> | 1089 | </child> |
165 | 1090 | <child> | 1090 | <child> |
166 | 1091 | <object class="GtkImageMenuItem" id="tcm_start_for_next_month"> | 1091 | <object class="GtkImageMenuItem" id="tcm_start_for_next_month"> |
168 | 1092 | <property name="label" translatable="yes">next _month</property> | 1092 | <property name="label" translatable="yes">Next _Month</property> |
169 | 1093 | <property name="visible">True</property> | 1093 | <property name="visible">True</property> |
170 | 1094 | <property name="can_focus">False</property> | 1094 | <property name="can_focus">False</property> |
171 | 1095 | <property name="use_action_appearance">False</property> | 1095 | <property name="use_action_appearance">False</property> |
172 | @@ -1100,7 +1100,7 @@ | |||
173 | 1100 | </child> | 1100 | </child> |
174 | 1101 | <child> | 1101 | <child> |
175 | 1102 | <object class="GtkImageMenuItem" id="tcm_start_for_next_year"> | 1102 | <object class="GtkImageMenuItem" id="tcm_start_for_next_year"> |
177 | 1103 | <property name="label" translatable="yes">next _year</property> | 1103 | <property name="label" translatable="yes">Next _Year</property> |
178 | 1104 | <property name="visible">True</property> | 1104 | <property name="visible">True</property> |
179 | 1105 | <property name="can_focus">False</property> | 1105 | <property name="can_focus">False</property> |
180 | 1106 | <property name="use_action_appearance">False</property> | 1106 | <property name="use_action_appearance">False</property> |
181 | @@ -1117,7 +1117,7 @@ | |||
182 | 1117 | </child> | 1117 | </child> |
183 | 1118 | <child> | 1118 | <child> |
184 | 1119 | <object class="GtkImageMenuItem" id="tcm_start_clear"> | 1119 | <object class="GtkImageMenuItem" id="tcm_start_clear"> |
186 | 1120 | <property name="label" translatable="yes">_clear start date</property> | 1120 | <property name="label" translatable="yes">_Clear Start Date</property> |
187 | 1121 | <property name="visible">True</property> | 1121 | <property name="visible">True</property> |
188 | 1122 | <property name="can_focus">False</property> | 1122 | <property name="can_focus">False</property> |
189 | 1123 | <property name="use_action_appearance">False</property> | 1123 | <property name="use_action_appearance">False</property> |
190 | @@ -1132,7 +1132,7 @@ | |||
191 | 1132 | </child> | 1132 | </child> |
192 | 1133 | <child> | 1133 | <child> |
193 | 1134 | <object class="GtkImageMenuItem" id="tcm_due_menu"> | 1134 | <object class="GtkImageMenuItem" id="tcm_due_menu"> |
195 | 1135 | <property name="label" translatable="yes">Set due date</property> | 1135 | <property name="label" translatable="yes">Set Due Date</property> |
196 | 1136 | <property name="visible">True</property> | 1136 | <property name="visible">True</property> |
197 | 1137 | <property name="can_focus">False</property> | 1137 | <property name="can_focus">False</property> |
198 | 1138 | <property name="use_action_appearance">False</property> | 1138 | <property name="use_action_appearance">False</property> |
199 | @@ -1144,7 +1144,7 @@ | |||
200 | 1144 | <property name="can_focus">False</property> | 1144 | <property name="can_focus">False</property> |
201 | 1145 | <child> | 1145 | <child> |
202 | 1146 | <object class="GtkImageMenuItem" id="tcm_due_today"> | 1146 | <object class="GtkImageMenuItem" id="tcm_due_today"> |
204 | 1147 | <property name="label" translatable="yes">t_oday</property> | 1147 | <property name="label" translatable="yes">T_oday</property> |
205 | 1148 | <property name="visible">True</property> | 1148 | <property name="visible">True</property> |
206 | 1149 | <property name="can_focus">False</property> | 1149 | <property name="can_focus">False</property> |
207 | 1150 | <property name="use_action_appearance">False</property> | 1150 | <property name="use_action_appearance">False</property> |
208 | @@ -1155,7 +1155,7 @@ | |||
209 | 1155 | </child> | 1155 | </child> |
210 | 1156 | <child> | 1156 | <child> |
211 | 1157 | <object class="GtkImageMenuItem" id="tcm_due_tomorrow"> | 1157 | <object class="GtkImageMenuItem" id="tcm_due_tomorrow"> |
213 | 1158 | <property name="label" translatable="yes">_tomorrow</property> | 1158 | <property name="label" translatable="yes">_Tomorrow</property> |
214 | 1159 | <property name="visible">True</property> | 1159 | <property name="visible">True</property> |
215 | 1160 | <property name="can_focus">False</property> | 1160 | <property name="can_focus">False</property> |
216 | 1161 | <property name="use_action_appearance">False</property> | 1161 | <property name="use_action_appearance">False</property> |
217 | @@ -1166,7 +1166,7 @@ | |||
218 | 1166 | </child> | 1166 | </child> |
219 | 1167 | <child> | 1167 | <child> |
220 | 1168 | <object class="GtkImageMenuItem" id="tcm_due_next_week"> | 1168 | <object class="GtkImageMenuItem" id="tcm_due_next_week"> |
222 | 1169 | <property name="label" translatable="yes">next _week</property> | 1169 | <property name="label" translatable="yes">Next _Week</property> |
223 | 1170 | <property name="visible">True</property> | 1170 | <property name="visible">True</property> |
224 | 1171 | <property name="can_focus">False</property> | 1171 | <property name="can_focus">False</property> |
225 | 1172 | <property name="use_action_appearance">False</property> | 1172 | <property name="use_action_appearance">False</property> |
226 | @@ -1177,7 +1177,7 @@ | |||
227 | 1177 | </child> | 1177 | </child> |
228 | 1178 | <child> | 1178 | <child> |
229 | 1179 | <object class="GtkImageMenuItem" id="tcm_due_next_month"> | 1179 | <object class="GtkImageMenuItem" id="tcm_due_next_month"> |
231 | 1180 | <property name="label" translatable="yes">next _month</property> | 1180 | <property name="label" translatable="yes">Next _Month</property> |
232 | 1181 | <property name="visible">True</property> | 1181 | <property name="visible">True</property> |
233 | 1182 | <property name="can_focus">False</property> | 1182 | <property name="can_focus">False</property> |
234 | 1183 | <property name="use_action_appearance">False</property> | 1183 | <property name="use_action_appearance">False</property> |
235 | @@ -1188,7 +1188,7 @@ | |||
236 | 1188 | </child> | 1188 | </child> |
237 | 1189 | <child> | 1189 | <child> |
238 | 1190 | <object class="GtkImageMenuItem" id="tcm_due_next_year"> | 1190 | <object class="GtkImageMenuItem" id="tcm_due_next_year"> |
240 | 1191 | <property name="label" translatable="yes">next _year</property> | 1191 | <property name="label" translatable="yes">Next _Year</property> |
241 | 1192 | <property name="visible">True</property> | 1192 | <property name="visible">True</property> |
242 | 1193 | <property name="can_focus">False</property> | 1193 | <property name="can_focus">False</property> |
243 | 1194 | <property name="use_action_appearance">False</property> | 1194 | <property name="use_action_appearance">False</property> |
244 | @@ -1205,7 +1205,7 @@ | |||
245 | 1205 | </child> | 1205 | </child> |
246 | 1206 | <child> | 1206 | <child> |
247 | 1207 | <object class="GtkImageMenuItem" id="tcm_due_now"> | 1207 | <object class="GtkImageMenuItem" id="tcm_due_now"> |
249 | 1208 | <property name="label" translatable="yes">_now</property> | 1208 | <property name="label" translatable="yes">_Now</property> |
250 | 1209 | <property name="visible">True</property> | 1209 | <property name="visible">True</property> |
251 | 1210 | <property name="can_focus">False</property> | 1210 | <property name="can_focus">False</property> |
252 | 1211 | <property name="use_action_appearance">False</property> | 1211 | <property name="use_action_appearance">False</property> |
253 | @@ -1216,7 +1216,7 @@ | |||
254 | 1216 | </child> | 1216 | </child> |
255 | 1217 | <child> | 1217 | <child> |
256 | 1218 | <object class="GtkImageMenuItem" id="tcm_due_soon"> | 1218 | <object class="GtkImageMenuItem" id="tcm_due_soon"> |
258 | 1219 | <property name="label" translatable="yes">_soon</property> | 1219 | <property name="label" translatable="yes">_Soon</property> |
259 | 1220 | <property name="visible">True</property> | 1220 | <property name="visible">True</property> |
260 | 1221 | <property name="can_focus">False</property> | 1221 | <property name="can_focus">False</property> |
261 | 1222 | <property name="use_action_appearance">False</property> | 1222 | <property name="use_action_appearance">False</property> |
262 | @@ -1227,7 +1227,7 @@ | |||
263 | 1227 | </child> | 1227 | </child> |
264 | 1228 | <child> | 1228 | <child> |
265 | 1229 | <object class="GtkImageMenuItem" id="tcm_due_someday"> | 1229 | <object class="GtkImageMenuItem" id="tcm_due_someday"> |
267 | 1230 | <property name="label" translatable="yes">_someday</property> | 1230 | <property name="label" translatable="yes">_Someday</property> |
268 | 1231 | <property name="visible">True</property> | 1231 | <property name="visible">True</property> |
269 | 1232 | <property name="can_focus">False</property> | 1232 | <property name="can_focus">False</property> |
270 | 1233 | <property name="use_action_appearance">False</property> | 1233 | <property name="use_action_appearance">False</property> |
271 | @@ -1244,7 +1244,7 @@ | |||
272 | 1244 | </child> | 1244 | </child> |
273 | 1245 | <child> | 1245 | <child> |
274 | 1246 | <object class="GtkImageMenuItem" id="tcm_due_clear"> | 1246 | <object class="GtkImageMenuItem" id="tcm_due_clear"> |
276 | 1247 | <property name="label" translatable="yes">_clear due date</property> | 1247 | <property name="label" translatable="yes">_Clear Due Date</property> |
277 | 1248 | <property name="visible">True</property> | 1248 | <property name="visible">True</property> |
278 | 1249 | <property name="can_focus">False</property> | 1249 | <property name="can_focus">False</property> |
279 | 1250 | <property name="use_action_appearance">False</property> | 1250 | <property name="use_action_appearance">False</property> |
280 | 1251 | 1251 | ||
281 | === modified file 'GTG/gtk/editor/editor.py' | |||
282 | --- GTG/gtk/editor/editor.py 2012-07-13 17:24:28 +0000 | |||
283 | +++ GTG/gtk/editor/editor.py 2012-07-20 09:48:37 +0000 | |||
284 | @@ -366,13 +366,6 @@ | |||
285 | 366 | self.task.set_due_date(datetoset) | 366 | self.task.set_due_date(datetoset) |
286 | 367 | elif data == "closed": | 367 | elif data == "closed": |
287 | 368 | self.task.set_closed_date(datetoset) | 368 | self.task.set_closed_date(datetoset) |
288 | 369 | |||
289 | 370 | # Set the due date to be equal to the start date | ||
290 | 371 | # when it happens that the start date is later than the due date | ||
291 | 372 | start_date = self.task.get_start_date() | ||
292 | 373 | due_date = self.task.get_due_date() | ||
293 | 374 | if start_date and (start_date > due_date): | ||
294 | 375 | self.task.set_due_date(self.task.get_start_date()) | ||
295 | 376 | else: | 369 | else: |
296 | 377 | #We should write in red in the entry if the date is not valid | 370 | #We should write in red in the entry if the date is not valid |
297 | 378 | widget.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse("#F00")) | 371 | widget.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse("#F00")) |
298 | @@ -382,11 +375,6 @@ | |||
299 | 382 | """Called when a date-changing button is clicked.""" | 375 | """Called when a date-changing button is clicked.""" |
300 | 383 | if date_kind == GTGCalendar.DATE_KIND_DUE: | 376 | if date_kind == GTGCalendar.DATE_KIND_DUE: |
301 | 384 | date = self.task.get_due_date() | 377 | date = self.task.get_due_date() |
302 | 385 | start_date = self.task.get_start_date() | ||
303 | 386 | due_before_start = start_date and start_date > date | ||
304 | 387 | |||
305 | 388 | if not date or due_before_start: | ||
306 | 389 | date = self.task.get_start_date() | ||
307 | 390 | elif date_kind == GTGCalendar.DATE_KIND_START: | 378 | elif date_kind == GTGCalendar.DATE_KIND_START: |
308 | 391 | date = self.task.get_start_date() | 379 | date = self.task.get_start_date() |
309 | 392 | elif date_kind == GTGCalendar.DATE_KIND_CLOSED: | 380 | elif date_kind == GTGCalendar.DATE_KIND_CLOSED: |
I reviewed your changes and I like the proposed behavior better. There goes nitpicking:
get_constrained _date() should be a private method (start with '_') or even better a private function (a defined function within function) because it isn't use anywehre but set_due_date() and it is not intended to be a public method
The correct code in editor should be:
if date_kind == GTGCalendar. DATE_KIND_ DUE: get_due_ date()
date = self.task.
Otherwise it uses start date for the calendar - regression.
You've changed the description from "clear due date" into "reset to default". I am not sure if it is a good idea:
1, it is inconsistent within due_date -> the button in calendar is still "clear"
2, it is inconsistent with start_date -> why you clear start_date but reset due_date? In my opinion, it reveals too much implementation details to a user.
And as usually, the name of the program is intranslatible after using Glade :-/
It looks good, fix those small details and you have my aproval.