GTG

Merge lp:~gtg-user/gtg/bugfix-830971 into lp:~gtg/gtg/old-trunk

Proposed by Alan Gomes Alvino
Status: Rejected
Rejected by: Izidor Matušov
Proposed branch: lp:~gtg-user/gtg/bugfix-830971
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 32 lines (+21/-1)
1 file modified
GTG/gtk/editor/taskview.py (+21/-1)
To merge this branch: bzr merge lp:~gtg-user/gtg/bugfix-830971
Reviewer Review Type Date Requested Status
Izidor Matušov Disapprove
Bertrand Rousseau (community) code, running Needs Fixing
Review via email: mp+113497@code.launchpad.net

Description of the change

What i do was before the paste on paste_clipboard method i see if the lines of the external paste has one dash at beginning(even if the beginning of line has spaces). If he was a dash at beginning of line i create a subtask.

To post a comment you must log in.
Revision history for this message
Nimit Shah (nimit-svnit) wrote :

    Is it necessary? We are already reworking the task editor, right?
Nimit Shah,
B Tech 4th year,
Computer Engineering Department,
SVNIT Surat
www.dude-says.blogspot.com

On Thu, Jul 5, 2012 at 12:39 PM, Alan Gomes Alvino <email address hidden>wrote:

> Alan Gomes Alvino has proposed merging lp:~gtg-user/gtg/bugfix-830971 into
> lp:gtg.
>
> Requested reviews:
> Gtg developers (gtg)
> Related bugs:
> Bug #830971 in Getting Things GNOME!: "Importing dashed lines should
> create subtasks immediately"
> https://bugs.launchpad.net/gtg/+bug/830971
>
> For more details, see:
> https://code.launchpad.net/~gtg-user/gtg/bugfix-830971/+merge/113497
>
> What i do was before the paste on paste_clipboard method i see if the
> lines of the external paste has one dash at beginning(even if the beginning
> of line has spaces). If he was a dash at beginning of line i create a
> subtask.
> --
> https://code.launchpad.net/~gtg-user/gtg/bugfix-830971/+merge/113497
> Your team Gtg users is subscribed to branch lp:~gtg-user/gtg/bugfix-830971.
>
> === modified file 'GTG/gtk/editor/taskview.py'
> --- GTG/gtk/editor/taskview.py 2012-05-20 19:05:20 +0000
> +++ GTG/gtk/editor/taskview.py 2012-07-05 07:08:28 +0000
> @@ -1089,7 +1089,27 @@
> self.stop_emission("paste_clipboard")
>
> else:
> - #we keep the normal pasting by not interupting the signal
> + #Get the text of the external clipboard
> + clipboard_text = clip.wait_for_text()
> +
> + #Separate the text in lines
> + for line_strip in clipboard_text.split('\n'):
> + #Remove whitespaces at begining of line
> + line = line_strip.lstrip(' ')
> + #If line contain a task
> + if len(line) > 0 and line[0] == '-':
> + #we handle ourselves the pasting
> + self.stop_emission("paste_clipboard")
> + #Removing dash
> + line_without_dash = line[1:]
> + anchor = self.new_subtask_callback(line_without_dash)
> + mark = self.buff.get_insert()
> + line_nbr = self.buff.get_iter_at_mark(mark).get_line()
> + #we must paste the \n before inserting the subtask
> + #else, we will start another subtask
> + self.buff.insert_at_cursor("\n")
> + self.write_subtask(self.buff, line_nbr, anchor)
> +
> self.clipboard.clear()
>
> #Function called each time the user inputs a letter
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~gtg-user
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~gtg-user
> More help : https://help.launchpad.net/ListHelp
>
>

Revision history for this message
Bertrand Rousseau (bertrand-rousseau) wrote :

Your patch introduces a regression: if you paste a text containing both lines with no dashes and lines with dashes, the text without dashes is not pasted.

Example, try to paste this:
---------------------------

I am a text thaat mixes both lines with dashes and no dashes.

 - apple
   - fruits
 - bicycle

Now, another without dashes

 - a dash!
 - another dash

What you get is:
----------------

- apple
- fruits
- bicycle
- a dash!
- another dash

review: Needs Fixing (code, running)
Revision history for this message
Izidor Matušov (izidor) wrote :

Closing because of inactivity.

review: Disapprove

Unmerged revisions

1200. By Alan Gomes <email address hidden>

Solved bug

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/gtk/editor/taskview.py'
2--- GTG/gtk/editor/taskview.py 2012-05-20 19:05:20 +0000
3+++ GTG/gtk/editor/taskview.py 2012-07-05 07:08:28 +0000
4@@ -1089,7 +1089,27 @@
5 self.stop_emission("paste_clipboard")
6
7 else:
8- #we keep the normal pasting by not interupting the signal
9+ #Get the text of the external clipboard
10+ clipboard_text = clip.wait_for_text()
11+
12+ #Separate the text in lines
13+ for line_strip in clipboard_text.split('\n'):
14+ #Remove whitespaces at begining of line
15+ line = line_strip.lstrip(' ')
16+ #If line contain a task
17+ if len(line) > 0 and line[0] == '-':
18+ #we handle ourselves the pasting
19+ self.stop_emission("paste_clipboard")
20+ #Removing dash
21+ line_without_dash = line[1:]
22+ anchor = self.new_subtask_callback(line_without_dash)
23+ mark = self.buff.get_insert()
24+ line_nbr = self.buff.get_iter_at_mark(mark).get_line()
25+ #we must paste the \n before inserting the subtask
26+ #else, we will start another subtask
27+ self.buff.insert_at_cursor("\n")
28+ self.write_subtask(self.buff, line_nbr, anchor)
29+
30 self.clipboard.clear()
31
32 #Function called each time the user inputs a letter

Subscribers

People subscribed via source and target branches

to status/vote changes: