GTG

Merge lp://staging/~bryce/gtg/code-cleanup into lp://staging/~gtg/gtg/old-trunk

Proposed by Bryce Harrington
Status: Merged
Merge reported by: Luca Invernizzi
Merged at revision: not available
Proposed branch: lp://staging/~bryce/gtg/code-cleanup
Merge into: lp://staging/~gtg/gtg/old-trunk
Diff against target: 211 lines (+26/-27)
4 files modified
GTG/core/requester.py (+1/-0)
GTG/taskeditor/editor.py (+13/-14)
GTG/taskeditor/taskview.py (+9/-10)
GTG/taskeditor/taskviewserial.py (+3/-3)
To merge this branch: bzr merge lp://staging/~bryce/gtg/code-cleanup
Reviewer Review Type Date Requested Status
Luca Invernizzi (community) Approve
Review via email: mp+19068@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Spelling fixes and a couple code cleanup type things

Revision history for this message
Luca Invernizzi (invernizzi) :
review: Approve
lp://staging/~bryce/gtg/code-cleanup updated
589. By Luca Invernizzi

Bryce's code cleanup

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'GTG/core/requester.py'
--- GTG/core/requester.py 2009-12-26 20:57:17 +0000
+++ GTG/core/requester.py 2010-02-11 01:59:13 +0000
@@ -83,6 +83,7 @@
83 task will have no tags.83 task will have no tags.
84 @param newtask: C{True} if this is creating a new task that never84 @param newtask: C{True} if this is creating a new task that never
85 existed, C{False} if importing an existing task from a backend.85 existed, C{False} if importing an existing task from a backend.
86 @return: A task.
86 """87 """
87 task = self.ds.new_task(pid=pid, newtask=newtask)88 task = self.ds.new_task(pid=pid, newtask=newtask)
88 if tags:89 if tags:
8990
=== modified file 'GTG/taskeditor/editor.py'
--- GTG/taskeditor/editor.py 2010-01-21 17:34:00 +0000
+++ GTG/taskeditor/editor.py 2010-02-11 01:59:13 +0000
@@ -19,9 +19,9 @@
1919
20#This is the TaskEditor20#This is the TaskEditor
21#21#
22#It's the window you see when you double-clic on a Task22#It's the window you see when you double-click on a Task
23#The main text widget is a home-made TextView called TaskView (see taskview.py)23#The main text widget is a home-made TextView called TaskView (see taskview.py)
24#The rest are the logic of the widget : date changing widgets, buttons, ...24#The rest is the logic of the widget : date changing widgets, buttons, ...
25import sys25import sys
26import time26import time
2727
@@ -50,7 +50,7 @@
50 #delete_callback is the function called on deletion50 #delete_callback is the function called on deletion
51 #close_callback is the function called on close51 #close_callback is the function called on close
52 #opentask_callback is the function to open a new editor52 #opentask_callback is the function to open a new editor
53 #tasktitle_callbakc is called when title change53 #tasktitle_callback is called when title changes
54 #notes is experimental (bool)54 #notes is experimental (bool)
55 #taskconfig is a ConfigObj dic to save infos about tasks55 #taskconfig is a ConfigObj dic to save infos about tasks
56 #thisisnew is True when a new task is created and opened56 #thisisnew is True when a new task is created and opened
@@ -69,10 +69,10 @@
69 self.dismissbutton = self.builder.get_object("dismiss_editor")69 self.dismissbutton = self.builder.get_object("dismiss_editor")
70 self.deletebutton = self.builder.get_object("delete_editor")70 self.deletebutton = self.builder.get_object("delete_editor")
71 self.deletebutton.set_tooltip_text(GnomeConfig.DELETE_TOOLTIP)71 self.deletebutton.set_tooltip_text(GnomeConfig.DELETE_TOOLTIP)
72 self.deletebutton = self.builder.get_object("insert_subtask")72 self.subtask_button = self.builder.get_object("insert_subtask")
73 self.deletebutton.set_tooltip_text(GnomeConfig.SUBTASK_TOOLTIP)73 self.subtask_button.set_tooltip_text(GnomeConfig.SUBTASK_TOOLTIP)
74 self.deletebutton = self.builder.get_object("inserttag")74 self.inserttag_button = self.builder.get_object("inserttag")
75 self.deletebutton.set_tooltip_text(GnomeConfig.TAG_TOOLTIP)75 self.inserttag_button.set_tooltip_text(GnomeConfig.TAG_TOOLTIP)
76 #Create our dictionary and connect it76 #Create our dictionary and connect it
77 dic = {77 dic = {
78 "mark_as_done_clicked" : self.change_status,78 "mark_as_done_clicked" : self.change_status,
@@ -122,7 +122,6 @@
122 self.duedate_widget = self.builder.get_object("duedate_entry")122 self.duedate_widget = self.builder.get_object("duedate_entry")
123 self.startdate_widget = self.builder.get_object("startdate_entry")123 self.startdate_widget = self.builder.get_object("startdate_entry")
124 self.dayleft_label = self.builder.get_object("dayleft")124 self.dayleft_label = self.builder.get_object("dayleft")
125 self.inserttag_button = self.builder.get_object("inserttag")
126 self.tasksidebar = self.builder.get_object("tasksidebar")125 self.tasksidebar = self.builder.get_object("tasksidebar")
127 self.keepnote_button = self.builder.get_object("keepnote")126 self.keepnote_button = self.builder.get_object("keepnote")
128 if not notes :127 if not notes :
@@ -249,11 +248,11 @@
249 dismiss_editor.add_accelerator('clicked', agr, key, mod, gtk.ACCEL_VISIBLE)248 dismiss_editor.add_accelerator('clicked', agr, key, mod, gtk.ACCEL_VISIBLE)
250 249
251 250
252 #Can be called at any time to reflect the status of the Task251 #Can be called at any time to reflect the status of the Task.
253 #Refresh should never interfer with the TaskView252 #Refresh should never interfere with the TaskView.
254 #If a title is passed as a parameter, it will become253 #If a title is passed as a parameter, it will become
255 #The new window title. If not, we will look for the task title254 #the new window title. If not, we will look for the task title.
256 #Refreshtext is wheter or not we should refresh the TaskView255 #Refreshtext is whether or not we should refresh the TaskView
257 #(doing it all the time is dangerous if the task is empty)256 #(doing it all the time is dangerous if the task is empty)
258 def refresh_editor(self, title=None, refreshtext=False):257 def refresh_editor(self, title=None, refreshtext=False):
259 to_save = False258 to_save = False
@@ -399,7 +398,7 @@
399 self.calendar.grab_add()398 self.calendar.grab_add()
400 #We grab the pointer in the calendar399 #We grab the pointer in the calendar
401 gdk.pointer_grab(self.calendar.window, True,gdk.BUTTON1_MASK|gdk.MOD2_MASK)400 gdk.pointer_grab(self.calendar.window, True,gdk.BUTTON1_MASK|gdk.MOD2_MASK)
402 #we will close the calendar if the user clic outside401 #we will close the calendar if the user clicks outside
403 402
404 if not isinstance(toset, dates.FuzzyDate):403 if not isinstance(toset, dates.FuzzyDate):
405 if not toset:404 if not toset:
@@ -598,7 +597,7 @@
598 597
599 598
600 def __focus_out(self,w=None,e=None) : #pylint: disable-msg=W0613599 def __focus_out(self,w=None,e=None) : #pylint: disable-msg=W0613
601 #We should only close if the pointer clic is out of the calendar !600 #We should only close if the pointer click is out of the calendar !
602 p = self.calendar.window.get_pointer()601 p = self.calendar.window.get_pointer()
603 s = self.calendar.get_size()602 s = self.calendar.get_size()
604 if not(0 <= p[0] <= s[0] and 0 <= p[1] <= s[1]) :603 if not(0 <= p[0] <= s[0] and 0 <= p[1] <= s[1]) :
605604
=== modified file 'GTG/taskeditor/taskview.py'
--- GTG/taskeditor/taskview.py 2010-01-10 11:45:45 +0000
+++ GTG/taskeditor/taskview.py 2010-02-11 01:59:13 +0000
@@ -20,9 +20,9 @@
2020
21#This is a class taken originally from21#This is a class taken originally from
22#http://trac.atzm.org/index.cgi/wiki/PyGTK22#http://trac.atzm.org/index.cgi/wiki/PyGTK
23#It was in Japanese and I didn't understood anything but the code.23#It was in Japanese and I didn't understand anything but the code.
2424
25#This class implement a gtk.TextView but with many other features25#This class implements a gtk.TextView but with many other features
26#like hyperlink and others stuffs special for GTG26#like hyperlink and others stuffs special for GTG
27#27#
28#For your information, a gtkTextView always contains a gtk.TextBuffer which28#For your information, a gtkTextView always contains a gtk.TextBuffer which
@@ -538,7 +538,6 @@
538 #Detect URL in the tasks538 #Detect URL in the tasks
539 #It's ugly...539 #It's ugly...
540 def _detect_url(self,buff,start,end) :540 def _detect_url(self,buff,start,end) :
541 #firtst, we remove the old tags :
542 #subt_list = self.get_subtasks()541 #subt_list = self.get_subtasks()
543 #First, we remove the olds tags542 #First, we remove the olds tags
544 tag_list = []543 tag_list = []
@@ -587,7 +586,7 @@
587 586
588 587
589588
590 #Detect tags in buff in the regio between start iter and end iter589 #Detect tags in buff in the region between start iter and end iter
591 def _detect_tag(self,buff,start,end) :590 def _detect_tag(self,buff,start,end) :
592 # Removing already existing tag in the current selection591 # Removing already existing tag in the current selection
593 # out of the tag table592 # out of the tag table
@@ -596,7 +595,7 @@
596 old_tags = []595 old_tags = []
597 new_tags = []596 new_tags = []
598 #We must be strictly < than the end_offset. If not, we might597 #We must be strictly < than the end_offset. If not, we might
599 #found the beginning of a tag on the nextline598 #find the beginning of a tag on the nextline
600 while (it.get_offset() < end.get_offset()) and (it.get_char() != '\0'):599 while (it.get_offset() < end.get_offset()) and (it.get_char() != '\0'):
601 if it.begins_tag() :600 if it.begins_tag() :
602 tags = it.get_toggled_tags(True)601 tags = it.get_toggled_tags(True)
@@ -687,7 +686,7 @@
687 to_return = True686 to_return = True
688 return to_return687 return to_return
689 688
690 #When the user remove a selection, we remove subtasks and @tags689 #When the user removes a selection, we remove subtasks and @tags
691 #from this selection690 #from this selection
692 def _delete_range(self,buff,start,end) :691 def _delete_range(self,buff,start,end) :
693# #If we are at the beginning of a mark, put this mark at the end692# #If we are at the beginning of a mark, put this mark at the end
@@ -914,7 +913,7 @@
914 itera = buff.get_iter_at_mark(temp_mark)913 itera = buff.get_iter_at_mark(temp_mark)
915 buff.move_mark_by_name("/%s"%subtid,itera)914 buff.move_mark_by_name("/%s"%subtid,itera)
916 buff.delete_mark(temp_mark)915 buff.delete_mark(temp_mark)
917 #The mark has right gravity but because we putted it on the left916 #The mark has right gravity but because we put it on the left
918 #of the newly inserted \n, it will not move anymore.917 #of the newly inserted \n, it will not move anymore.
919 918
920 itera = buff.get_iter_at_mark(end)919 itera = buff.get_iter_at_mark(end)
@@ -1017,7 +1016,7 @@
1017 #we keep the normal pasting by not interupting the signal1016 #we keep the normal pasting by not interupting the signal
1018 self.clipboard.clear()1017 self.clipboard.clear()
1019 1018
1020 #Function called each time the user input a letter 1019 #Function called each time the user inputs a letter
1021 def _insert_at_cursor(self, tv, itera, tex, leng) :1020 def _insert_at_cursor(self, tv, itera, tex, leng) :
1022 #We don't paste the bullet1021 #We don't paste the bullet
1023 if tex.strip() != self.bullet1 :1022 if tex.strip() != self.bullet1 :
@@ -1214,7 +1213,7 @@
1214 self.buff.disconnect(self.insert_sigid)1213 self.buff.disconnect(self.insert_sigid)
1215 insert_mark = self.buff.get_insert()1214 insert_mark = self.buff.get_insert()
1216 insert_iter = self.buff.get_iter_at_mark(insert_mark)1215 insert_iter = self.buff.get_iter_at_mark(insert_mark)
1217 #All that craps to find if we are at the end of an indent tag1216 #All this crap to find if we are at the end of an indent tag
1218 if insert_iter.ends_tag() :1217 if insert_iter.ends_tag() :
1219 for t in insert_iter.get_toggled_tags(False) :1218 for t in insert_iter.get_toggled_tags(False) :
1220 if t.get_data('is_indent') :1219 if t.get_data('is_indent') :
@@ -1226,7 +1225,7 @@
1226 self.insert_sigid = self.buff.connect('insert-text', \1225 self.insert_sigid = self.buff.connect('insert-text', \
1227 self._insert_at_cursor)1226 self._insert_at_cursor)
12281227
1229 #The mouse is moving. We must change it to a hand when hovering a link1228 #The mouse is moving. We must change it to a hand when hovering over a link
1230 def _motion(self, view, ev):1229 def _motion(self, view, ev):
1231 window = ev.window1230 window = ev.window
1232 x, y, _ = window.get_pointer()1231 x, y, _ = window.get_pointer()
12331232
=== modified file 'GTG/taskeditor/taskviewserial.py'
--- GTG/taskeditor/taskviewserial.py 2010-01-07 16:30:30 +0000
+++ GTG/taskeditor/taskviewserial.py 2010-02-11 01:59:13 +0000
@@ -72,7 +72,7 @@
72 while not buffer_end:72 while not buffer_end:
73 if tag is None:73 if tag is None:
74 # We are not in a tag context74 # We are not in a tag context
75 # Get list of know tags witch begin here75 # Get list of know tags which begin here
76 # and are not already process76 # and are not already process
77 tags = []77 tags = []
78 for ta in it.get_tags():78 for ta in it.get_tags():
@@ -135,7 +135,7 @@
135 if last_val and last_val.nodeType == 3 and \135 if last_val and last_val.nodeType == 3 and \
136 last_val.nodeValue[-1] != '\n':136 last_val.nodeValue[-1] != '\n':
137 parent.appendChild(doc.createTextNode('\n'))137 parent.appendChild(doc.createTextNode('\n'))
138 #This function concatenate all the adjacent text node of the XML138 #This function concatenates all the adjacent text node of the XML
139 parent.normalize()139 parent.normalize()
140 return parent140 return parent
141141
@@ -163,7 +163,7 @@
163163
164 #Insert a list of subtasks at the end of the buffer164 #Insert a list of subtasks at the end of the buffer
165 def insert_subtasks(self, buff, st_list):165 def insert_subtasks(self, buff, st_list):
166 #It the lastline of the buffer is not empty, we add an extra \n166 #If the lastline of the buffer is not empty, we add an extra \n
167 end_end = buff.get_end_iter()167 end_end = buff.get_end_iter()
168 end_line = end_end.get_line()168 end_line = end_end.get_line()
169 start_end = buff.get_iter_at_line(end_line)169 start_end = buff.get_iter_at_line(end_line)

Subscribers

People subscribed via source and target branches

to status/vote changes: