Merge lp:~parthpanchl/gtg/fix-calendar into lp:~gtg/gtg/old-trunk

Proposed by Parth Panchal on 2014-03-16
Status: Merged
Merged at revision: 1372
Proposed branch: lp:~parthpanchl/gtg/fix-calendar
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 467 lines (+181/-119)
8 files modified
CHANGELOG (+2/-0)
GTG/gtk/browser/browser.py (+49/-6)
GTG/gtk/browser/taskbrowser.ui (+20/-10)
GTG/gtk/editor/__init__.py (+1/-0)
GTG/gtk/editor/calendar.py (+10/-7)
GTG/gtk/editor/calendar.ui (+96/-0)
GTG/gtk/editor/editor.py (+3/-1)
GTG/gtk/editor/taskeditor.ui (+0/-95)
To merge this branch: bzr merge lp:~parthpanchl/gtg/fix-calendar
Reviewer Review Type Date Requested Status
Nimit Shah 2014-03-16 Pending
Review via email: mp+211215@code.launchpad.net

Commit message

Description of the change

Fixes Bug #931904 & Bug #1289284
- Adds "Pick a date" option to set start/due date in task browser's context menu to set date from calendar window
- Removes 'Now' option from 'Set due date' context menu in task browser
- Detaches calendar ui from taskeditor.ui
- Updates calendar ui to be consistent with parent window

To post a comment you must log in.
Nimit Shah (nimit-svnit) wrote :

Hi Parth,
The branch fixes the problems but I want you to modify the UI a bit. There should be a quicker way to set dates to popular choices like today,tomorrow,next week or next month.
For this, you can create sub menu where you can give option for this and for a specific one say "Pick a date..."

lp:~parthpanchl/gtg/fix-calendar updated on 2014-03-23
1366. By Parth Panchal on 2014-03-23

Updated UI of task browser's context menu

1367. By Parth Panchal on 2014-03-23

Resolves conflicts

Parth Panchal (parthpanchl) wrote :

Nimit,
I imagined the same UI that you're suggesting but then thought that the popular choices like today, tomorrow, next week or next month could be easily understood by the users from calendar. So to reduce the average clicks to change the start/due date, I chose that UI.

Now, I've pushed the desired changes.

lp:~parthpanchl/gtg/fix-calendar updated on 2014-03-23
1368. By Parth Panchal on 2014-03-23

Fixes calendar pop up bug

1369. By Parth Panchal on 2014-03-23

Removes 'Now' from 'Set due date' context menu in Task Browser

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGELOG'
2--- CHANGELOG 2014-03-20 18:38:10 +0000
3+++ CHANGELOG 2014-03-23 12:58:31 +0000
4@@ -28,6 +28,8 @@
5 * Moving to Sphinx for documentation and improving the scripts, by Izidor MatuĊĦov
6 * Fixing the error getting thrown on drag-drop of text in taskeditor, by Sagar Ghuge
7 * Fixes #1 : Searching for something and then clicking on any place in the tag sidebar doesn't clear the quick-add bar text, by Parth Panchal
8+ * Fix for bug #931904 : Scheduling many task, by Parth Panchal
9+ * Fix for bug #1289284 : Date gets dragged from calendar widget when its date is already set, by Parth Panchal
10
11 2013-11-24 Getting Things GNOME! 0.3.1
12 * Fix for bug #1024473: Have 'Show Main Window' in notification area, by Antonio Roquentin
13
14=== modified file 'GTG/gtk/browser/browser.py'
15--- GTG/gtk/browser/browser.py 2014-03-20 18:38:10 +0000
16+++ GTG/gtk/browser/browser.py 2014-03-23 12:58:31 +0000
17@@ -39,6 +39,7 @@
18 from GTG.gtk.browser.modifytags_dialog import ModifyTagsDialog
19 from GTG.gtk.browser.tag_context_menu import TagContextMenu
20 from GTG.gtk.browser.treeview_factory import TreeviewFactory
21+from GTG.gtk.editor.calendar import GTGCalendar
22 from GTG.tools.dates import Date
23 from GTG.tools.logger import Log
24
25@@ -180,12 +181,15 @@
26
27 def _init_ui_widget(self):
28 """ Sets the main pane with the tree with active tasks and
29- create ModifyTagsDialog """
30+ create ModifyTagsDialog & Calendar """
31 # The Active tasks treeview
32 self.main_pane.add(self.vtree_panes['active'])
33
34 tag_completion = TagCompletion(self.req.get_tag_tree())
35 self.modifytags_dialog = ModifyTagsDialog(tag_completion, self.req)
36+ self.calendar = GTGCalendar()
37+ self.calendar.set_transient_for(self.window)
38+ self.calendar.connect("date-changed", self.on_date_changed)
39
40 def init_tags_sidebar(self):
41 """
42@@ -276,6 +280,8 @@
43 self.on_start_for_next_month,
44 "on_start_for_next_year":
45 self.on_start_for_next_year,
46+ "on_start_for_specific_date":
47+ self.on_start_for_specific_date,
48 "on_start_clear":
49 self.on_start_clear,
50 "on_set_due_today":
51@@ -288,12 +294,12 @@
52 self.on_set_due_next_month,
53 "on_set_due_next_year":
54 self.on_set_due_next_year,
55- "on_set_due_now":
56- self.on_set_due_now,
57 "on_set_due_soon":
58 self.on_set_due_soon,
59 "on_set_due_someday":
60 self.on_set_due_someday,
61+ "on_set_due_for_specific_date":
62+ self.on_set_due_for_specific_date,
63 "on_set_due_clear":
64 self.on_set_due_clear,
65 "on_dismiss_task":
66@@ -1095,9 +1101,6 @@
67 def on_set_due_next_year(self, widget):
68 self.update_due_date(widget, "next year")
69
70- def on_set_due_now(self, widget):
71- self.update_due_date(widget, "now")
72-
73 def on_set_due_soon(self, widget):
74 self.update_due_date(widget, "soon")
75
76@@ -1107,6 +1110,46 @@
77 def on_set_due_clear(self, widget):
78 self.update_due_date(widget, None)
79
80+ def on_start_for_specific_date(self, widget):
81+ """ Display Calendar to set start date of selected tasks """
82+ self.calendar.set_title("Set Start Date")
83+ # Get task from task name
84+ task = self.req.get_task(self.get_selected_tasks()[0])
85+ date = task.get_start_date()
86+ self.calendar.set_date(date, GTGCalendar.DATE_KIND_START)
87+ # Shows the calendar just above the mouse on widget's line of symmetry
88+ rect = widget.get_allocation()
89+ result, x, y = widget.get_window().get_origin()
90+ self.calendar.show_at_position(x + rect.x + rect.width,
91+ y + rect.y)
92+
93+ def on_set_due_for_specific_date(self, widget):
94+ """ Display Calendar to set due date of selected tasks """
95+ self.calendar.set_title("Set Due Date")
96+ # Get task from task name
97+ task = self.req.get_task(self.get_selected_tasks()[0])
98+ if not task.get_due_date():
99+ date = task.get_start_date()
100+ else:
101+ date = task.get_due_date()
102+ self.calendar.set_date(date, GTGCalendar.DATE_KIND_DUE)
103+ # Shows the calendar just above the mouse on widget's line of symmetry
104+ rect = widget.get_allocation()
105+ result, x, y = widget.get_window().get_origin()
106+ self.calendar.show_at_position(x + rect.x + rect.width,
107+ y + rect.y)
108+
109+ def on_date_changed(self, calendar):
110+ # Get tasks' list from task names' list
111+ tasks = [self.req.get_task(task) for task in self.get_selected_tasks()]
112+ date, date_kind = calendar.get_selected_date()
113+ if date_kind == GTGCalendar.DATE_KIND_DUE:
114+ for task in tasks:
115+ task.set_due_date(date)
116+ elif date_kind == GTGCalendar.DATE_KIND_START:
117+ for task in tasks:
118+ task.set_start_date(date)
119+
120 def on_modify_tags(self, widget):
121 """ Run Modify Tags dialog on selected tasks """
122 tasks = self.get_selected_tasks()
123
124=== modified file 'GTG/gtk/browser/taskbrowser.ui'
125--- GTG/gtk/browser/taskbrowser.ui 2013-11-25 02:37:46 +0000
126+++ GTG/gtk/browser/taskbrowser.ui 2014-03-23 12:58:31 +0000
127@@ -1059,6 +1059,16 @@
128 </object>
129 </child>
130 <child>
131+ <object class="GtkImageMenuItem" id="tcm_start_for_specific_date">
132+ <property name="label" translatable="yes">Pick a date...</property>
133+ <property name="visible">True</property>
134+ <property name="can_focus">False</property>
135+ <property name="use_underline">True</property>
136+ <property name="use_stock">False</property>
137+ <signal name="activate" handler="on_start_for_specific_date" swapped="no"/>
138+ </object>
139+ </child>
140+ <child>
141 <object class="GtkSeparatorMenuItem" id="menuitem1">
142 <property name="visible">True</property>
143 <property name="can_focus">False</property>
144@@ -1140,22 +1150,22 @@
145 </object>
146 </child>
147 <child>
148+ <object class="GtkImageMenuItem" id="tcm_due_specific_date">
149+ <property name="label" translatable="yes">Pick a date...</property>
150+ <property name="visible">True</property>
151+ <property name="can_focus">False</property>
152+ <property name="use_underline">True</property>
153+ <property name="use_stock">False</property>
154+ <signal name="activate" handler="on_set_due_for_specific_date" swapped="no"/>
155+ </object>
156+ </child>
157+ <child>
158 <object class="GtkSeparatorMenuItem" id="menuitem2">
159 <property name="visible">True</property>
160 <property name="can_focus">False</property>
161 </object>
162 </child>
163 <child>
164- <object class="GtkImageMenuItem" id="tcm_due_now">
165- <property name="label" translatable="yes">_Now</property>
166- <property name="visible">True</property>
167- <property name="can_focus">False</property>
168- <property name="use_underline">True</property>
169- <property name="use_stock">False</property>
170- <signal name="activate" handler="on_set_due_now" swapped="no"/>
171- </object>
172- </child>
173- <child>
174 <object class="GtkImageMenuItem" id="tcm_due_soon">
175 <property name="label" translatable="yes">_Soon</property>
176 <property name="visible">True</property>
177
178=== modified file 'GTG/gtk/editor/__init__.py'
179--- GTG/gtk/editor/__init__.py 2013-11-25 02:37:46 +0000
180+++ GTG/gtk/editor/__init__.py 2014-03-23 12:58:31 +0000
181@@ -27,6 +27,7 @@
182 class GnomeConfig:
183 current_rep = os.path.dirname(os.path.abspath(__file__))
184 EDITOR_UI_FILE = os.path.join(current_rep, "taskeditor.ui")
185+ CALENDAR_UI_FILE = os.path.join(current_rep, "calendar.ui")
186
187 MARK_DONE = _("Mark as Done")
188 MARK_UNDONE = _("Mark as not Done")
189
190=== modified file 'GTG/gtk/editor/calendar.py'
191--- GTG/gtk/editor/calendar.py 2014-03-09 12:59:59 +0000
192+++ GTG/gtk/editor/calendar.py 2014-03-23 12:58:31 +0000
193@@ -19,8 +19,9 @@
194
195 import datetime
196
197-from gi.repository import GObject, Gdk
198+from gi.repository import GObject, Gdk, Gtk
199
200+from GTG.gtk.editor import GnomeConfig
201 from GTG.tools.dates import Date
202
203
204@@ -39,9 +40,10 @@
205
206 __gsignals__ = {'date-changed': __signal_type__, }
207
208- def __init__(self, Gtk_builder):
209+ def __init__(self):
210 super(GTGCalendar, self).__init__()
211- self.__builder = Gtk_builder
212+ self.__builder = Gtk.Builder()
213+ self.__builder.add_from_file(GnomeConfig.CALENDAR_UI_FILE)
214 self.__date_kind = None
215 self.__date = Date.no_date()
216 self.__init_gtk__()
217@@ -117,9 +119,6 @@
218 width, height = self.__window.get_size()
219 self.move_calendar_inside(width, height, x, y)
220 self.__window.show()
221- # some window managers ignore move before you show a window. (which
222- # ones? question by invernizzi)
223- self.move_calendar_inside(width, height, x, y)
224 self.__window.grab_add()
225
226 #We grab the pointer in the calendar
227@@ -140,7 +139,10 @@
228 0,
229 )
230
231- self.__window.connect('button-press-event', self.__focus_out)
232+ if self.get_decorated():
233+ self.__window.connect("delete-event", self.close_calendar)
234+ else:
235+ self.__window.connect('button-press-event', self.__focus_out)
236 self.__sigid = self.__calendar.connect("day-selected",
237 self.__day_selected,
238 "RealDate",)
239@@ -172,6 +174,7 @@
240 if self.__sigid_month is not None:
241 self.__calendar.disconnect(self.__sigid_month)
242 self.__sigid_month = None
243+ return True
244
245 def __day_selected(self, widget, date_type):
246 if date_type == "RealDate":
247
248=== added file 'GTG/gtk/editor/calendar.ui'
249--- GTG/gtk/editor/calendar.ui 1970-01-01 00:00:00 +0000
250+++ GTG/gtk/editor/calendar.ui 2014-03-23 12:58:31 +0000
251@@ -0,0 +1,96 @@
252+<?xml version="1.0" encoding="UTF-8"?>
253+<interface>
254+ <!-- interface-requires gtk+ 3.0 -->
255+ <object class="GtkWindow" id="calendar">
256+ <property name="can_focus">False</property>
257+ <property name="events">GDK_STRUCTURE_MASK | GDK_PROXIMITY_OUT_MASK</property>
258+ <property name="resizable">False</property>
259+ <property name="modal">True</property>
260+ <property name="destroy_with_parent">True</property>
261+ <property name="skip_taskbar_hint">True</property>
262+ <property name="skip_pager_hint">True</property>
263+ <child>
264+ <object class="GtkBox" id="vbox5">
265+ <property name="visible">True</property>
266+ <property name="can_focus">False</property>
267+ <property name="orientation">vertical</property>
268+ <child>
269+ <object class="GtkCalendar" id="calendar1">
270+ <property name="visible">True</property>
271+ <property name="can_focus">True</property>
272+ </object>
273+ <packing>
274+ <property name="expand">False</property>
275+ <property name="fill">True</property>
276+ <property name="position">0</property>
277+ </packing>
278+ </child>
279+ <child>
280+ <object class="GtkBox" id="fuzzydate_btns">
281+ <property name="visible">True</property>
282+ <property name="can_focus">False</property>
283+ <property name="homogeneous">True</property>
284+ <child>
285+ <object class="GtkButton" id="button_now">
286+ <property name="label" translatable="yes">Now</property>
287+ <property name="visible">True</property>
288+ <property name="can_focus">True</property>
289+ <property name="receives_default">True</property>
290+ </object>
291+ <packing>
292+ <property name="expand">False</property>
293+ <property name="fill">True</property>
294+ <property name="position">0</property>
295+ </packing>
296+ </child>
297+ <child>
298+ <object class="GtkButton" id="button_soon">
299+ <property name="label" translatable="yes">Soon</property>
300+ <property name="visible">True</property>
301+ <property name="can_focus">True</property>
302+ <property name="receives_default">True</property>
303+ </object>
304+ <packing>
305+ <property name="expand">False</property>
306+ <property name="fill">True</property>
307+ <property name="position">1</property>
308+ </packing>
309+ </child>
310+ <child>
311+ <object class="GtkButton" id="button_someday">
312+ <property name="label" translatable="yes">Someday</property>
313+ <property name="visible">True</property>
314+ <property name="can_focus">True</property>
315+ <property name="receives_default">True</property>
316+ </object>
317+ <packing>
318+ <property name="expand">False</property>
319+ <property name="fill">True</property>
320+ <property name="position">2</property>
321+ </packing>
322+ </child>
323+ </object>
324+ <packing>
325+ <property name="expand">False</property>
326+ <property name="fill">True</property>
327+ <property name="position">1</property>
328+ </packing>
329+ </child>
330+ <child>
331+ <object class="GtkButton" id="button_clear">
332+ <property name="label">gtk-clear</property>
333+ <property name="visible">True</property>
334+ <property name="can_focus">True</property>
335+ <property name="receives_default">True</property>
336+ <property name="use_stock">True</property>
337+ </object>
338+ <packing>
339+ <property name="expand">False</property>
340+ <property name="fill">False</property>
341+ <property name="position">2</property>
342+ </packing>
343+ </child>
344+ </object>
345+ </child>
346+ </object>
347+</interface>
348\ No newline at end of file
349
350=== modified file 'GTG/gtk/editor/editor.py'
351--- GTG/gtk/editor/editor.py 2014-03-11 01:37:13 +0000
352+++ GTG/gtk/editor/editor.py 2014-03-23 12:58:31 +0000
353@@ -119,7 +119,9 @@
354 if conf_font_value != "":
355 self.textview.override_font(Pango.FontDescription(conf_font_value))
356 # Voila! it's done
357- self.calendar = GTGCalendar(self.builder)
358+ self.calendar = GTGCalendar()
359+ self.calendar.set_transient_for(self.window)
360+ self.calendar.set_decorated(False)
361 self.duedate_widget = self.builder.get_object("duedate_entry")
362 self.startdate_widget = self.builder.get_object("startdate_entry")
363 self.closeddate_widget = self.builder.get_object("closeddate_entry")
364
365=== modified file 'GTG/gtk/editor/taskeditor.ui'
366--- GTG/gtk/editor/taskeditor.ui 2014-03-05 19:25:18 +0000
367+++ GTG/gtk/editor/taskeditor.ui 2014-03-23 12:58:31 +0000
368@@ -403,99 +403,4 @@
369 </object>
370 </child>
371 </object>
372- <object class="GtkWindow" id="calendar">
373- <property name="can_focus">False</property>
374- <property name="events">GDK_STRUCTURE_MASK | GDK_PROXIMITY_OUT_MASK</property>
375- <property name="type">popup</property>
376- <property name="resizable">False</property>
377- <property name="modal">True</property>
378- <property name="destroy_with_parent">True</property>
379- <property name="type_hint">dropdown-menu</property>
380- <property name="skip_taskbar_hint">True</property>
381- <property name="skip_pager_hint">True</property>
382- <property name="transient_for">TaskEditor</property>
383- <child>
384- <object class="GtkBox" id="vbox5">
385- <property name="visible">True</property>
386- <property name="can_focus">False</property>
387- <property name="orientation">vertical</property>
388- <child>
389- <object class="GtkCalendar" id="calendar1">
390- <property name="visible">True</property>
391- <property name="can_focus">True</property>
392- </object>
393- <packing>
394- <property name="expand">False</property>
395- <property name="fill">True</property>
396- <property name="position">0</property>
397- </packing>
398- </child>
399- <child>
400- <object class="GtkBox" id="fuzzydate_btns">
401- <property name="visible">True</property>
402- <property name="can_focus">False</property>
403- <property name="homogeneous">True</property>
404- <child>
405- <object class="GtkButton" id="button_now">
406- <property name="label" translatable="yes">Now</property>
407- <property name="visible">True</property>
408- <property name="can_focus">True</property>
409- <property name="receives_default">True</property>
410- </object>
411- <packing>
412- <property name="expand">False</property>
413- <property name="fill">True</property>
414- <property name="position">0</property>
415- </packing>
416- </child>
417- <child>
418- <object class="GtkButton" id="button_soon">
419- <property name="label" translatable="yes">Soon</property>
420- <property name="visible">True</property>
421- <property name="can_focus">True</property>
422- <property name="receives_default">True</property>
423- </object>
424- <packing>
425- <property name="expand">False</property>
426- <property name="fill">True</property>
427- <property name="position">1</property>
428- </packing>
429- </child>
430- <child>
431- <object class="GtkButton" id="button_someday">
432- <property name="label" translatable="yes">Someday</property>
433- <property name="visible">True</property>
434- <property name="can_focus">True</property>
435- <property name="receives_default">True</property>
436- </object>
437- <packing>
438- <property name="expand">False</property>
439- <property name="fill">True</property>
440- <property name="position">2</property>
441- </packing>
442- </child>
443- </object>
444- <packing>
445- <property name="expand">False</property>
446- <property name="fill">True</property>
447- <property name="position">1</property>
448- </packing>
449- </child>
450- <child>
451- <object class="GtkButton" id="button_clear">
452- <property name="label">gtk-clear</property>
453- <property name="visible">True</property>
454- <property name="can_focus">True</property>
455- <property name="receives_default">True</property>
456- <property name="use_stock">True</property>
457- </object>
458- <packing>
459- <property name="expand">False</property>
460- <property name="fill">False</property>
461- <property name="position">2</property>
462- </packing>
463- </child>
464- </object>
465- </child>
466- </object>
467 </interface>

Subscribers

People subscribed via source and target branches

to status/vote changes: