1
# -*- coding: utf-8 -*-
2
# -----------------------------------------------------------------------------
3
# Gettings Things Gnome! - a personal organizer for the GNOME desktop
4
# Copyright (c) 2008-2009 - Lionel Dricot & Bertrand Rousseau
6
# This program is free software: you can redistribute it and/or modify it under
7
# the terms of the GNU General Public License as published by the Free Software
8
# Foundation, either version 3 of the License, or (at your option) any later
11
# This program is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16
# You should have received a copy of the GNU General Public License along with
17
# this program. If not, see <http://www.gnu.org/licenses/>.
18
# -----------------------------------------------------------------------------
21
TaskClipboard allows to cut/copy the content of a TaskView accross multiples
22
taskeditors, preserving subtasks
24
class TaskClipboard():
25
def __init__(self,req):
26
self.description = None
30
""""take two gtk.TextIter as parameter and copy the
32
def copy(self,start,stop,bullet=None):
34
#Now, we take care of the normal, cross application clipboard
35
text = start.get_text(stop)
37
#we replace the arrow by the original "-"
38
newtext = text.replace(bullet, "-")
39
self.description = newtext
41
self.description = text
43
end_line = start.copy()
44
#we take line after line in the selection
46
while end_line.get_line() <= stop.get_line() and nextline:
47
nextline = end_line.forward_line()
48
end_line.backward_char()
49
#we want to detect subtasks in the selection
50
tags = end_line.get_tags()+end_line.get_toggled_tags(False)
53
if (ta.get_data('is_subtask')):
55
tid = ta.get_data('child')
56
tas = self.req.get_task(tid)
59
self.content.append(['subtask', tid])
61
if end_line.get_line() < stop.get_line():
62
self.content.append(['text', "%s\n" %start.get_text(end_line)])
64
self.content.append(['text', start.get_text(stop)])
65
end_line.forward_char()
69
return self.description
75
self.descriptiion = None