Merge lp:~nimit-svnit/gtg/cleanup into lp:~gtg/gtg/old-trunk
- cleanup
- Merge into old-trunk
Status: | Rejected |
---|---|
Rejected by: | Izidor Matušov |
Proposed branch: | lp:~nimit-svnit/gtg/cleanup |
Merge into: | lp:~gtg/gtg/old-trunk |
Diff against target: |
3494 lines (+606/-553) 42 files modified
CHANGELOG (+1/-0) GTG/__init__.py (+2/-1) GTG/gtk/backends_dialog/__init__.py (+19/-21) GTG/gtk/backends_dialog/addpanel.py (+2/-6) GTG/gtk/backends_dialog/backendscombo.py (+2/-3) GTG/gtk/backends_dialog/backendstree.py (+7/-9) GTG/gtk/backends_dialog/configurepanel.py (+8/-10) GTG/gtk/backends_dialog/parameters_ui/__init__.py (+19/-27) GTG/gtk/backends_dialog/parameters_ui/checkboxui.py (+5/-6) GTG/gtk/backends_dialog/parameters_ui/importtagsui.py (+0/-3) GTG/gtk/backends_dialog/parameters_ui/passwordui.py (+3/-5) GTG/gtk/backends_dialog/parameters_ui/pathui.py (+6/-8) GTG/gtk/backends_dialog/parameters_ui/periodui.py (+1/-3) GTG/gtk/backends_dialog/parameters_ui/textui.py (+1/-3) GTG/gtk/browser/CellRendererTags.py (+14/-14) GTG/gtk/browser/__init__.py (+19/-18) GTG/gtk/browser/browser.py (+1/-3) GTG/gtk/browser/custominfobar.py (+9/-9) GTG/gtk/browser/simple_color_selector.py (+9/-10) GTG/gtk/browser/tag_context_menu.py (+2/-3) GTG/gtk/browser/treeview_factory.py (+105/-101) GTG/gtk/colors.py (+11/-8) GTG/gtk/crashhandler.py (+1/-1) GTG/gtk/delete_dialog.py (+12/-10) GTG/gtk/editor/__init__.py (+1/-1) GTG/gtk/editor/editor.py (+64/-47) GTG/gtk/editor/taskview.py (+131/-94) GTG/gtk/editor/taskviewserial.py (+3/-3) GTG/gtk/manager.py (+32/-36) GTG/tools/borg.py (+1/-2) GTG/tools/cleanxml.py (+43/-34) GTG/tools/clipboard.py (+13/-8) GTG/tools/import_liblarch.py (+1/-0) GTG/tools/keyring.py (+7/-3) GTG/tools/logger.py (+2/-1) GTG/tools/networkmanager.py (+3/-2) GTG/tools/taskxml.py (+28/-21) GTG/tools/twokeydict.py (+4/-7) GTG/tools/urlregex.py (+4/-3) GTG/tools/watchdog.py (+1/-0) gtg (+1/-1) setup.py (+8/-8) |
To merge this branch: | bzr merge lp:~nimit-svnit/gtg/cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Izidor Matušov | code | Needs Fixing | |
Review via email: mp+111709@code.launchpad.net |
Commit message
Description of the change
Following files have been made to comply with lint and pep8 standards
setup.py
GTG/gtk/colors.py
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
gtg
init.py
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/manager.py
GTG/gtk/
GTG/__init__.py
GTG/tools/
GTG/tools/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/gtk/
GTG/tools/
GTG/tools/
GTG/tools/
GTG/tools/
GTG/tools/
Nimit Shah (nimit-svnit) wrote : | # |
Izidor Matušov (izidor) wrote : | # |
156 + _("Do you really want to remove the '%s' \
157 + synchronization service?") % \
You can't break the line inside a string like that. It will add white space inside the string. The better way to solve it would be:
message_format = _(
"Do you really want to remove the '%s' synchronization service?"
) % backend.
(You can shift the string more to left so you don't have too long line).
anoter possibility is to split string like
_("Do you really want to remove the '%s' "
"synchronization service?") % \
*******
- tasks_number)
+ tasks_number)
Delimiters \ are not needed after a comma in parameters. You can ommit them :)
*******
+ textbox_
+ self.chooser.
+ self.chooser.
You are missing spaces around '=' (It should be an error from pylint or PEP8)
The same thing in
+ GLADE_FILE = os.path.
+ MODIFYTAGS_
+ TAGEDITOR_
*******
tasks = self.req.
- for event in 'node-added-
+ l =['node-
+ for event in l:
handle = tasks.register_
It is better to split the list rather than put it into an artificial variable:
for event in ['node-
*******
- while (it.get_offset() < end.get_offset()) and (it.get_char() != '\0'):
+ while(it.
Parenthesis could be ommitted for better readability:
while it.get_offset() < end.get_offset()) and (it.get_char() != '\0':
(it is there about 3 times or so)
*******
- topoint = "http://
+ topoint = "http://
+ id=%s" %nbr
- topoint = "https:/
+ topoint = "https:/
+ %nbr
- topoint = "http://
Nimit Shah (nimit-svnit) wrote : | # |
Thanks izidor for the review!
I have installed pyflakes now. I'll make the required ammendments to the
code.
Nimit Shah,
B Tech 3rd year,
Computer Engineering Department,
SVNIT Surat
Secretary ACM-NIT Surat
www.dude-
On Sat, Jun 23, 2012 at 6:23 PM, Izidor Matušov <email address hidden>wrote:
> Review: Needs Fixing code
>
> 156 + _("Do you really want to remove the '%s' \
> 157 + synchronization service?") % \
>
> You can't break the line inside a string like that. It will add white
> space inside the string. The better way to solve it would be:
>
> message_format = _(
> "Do you really want to remove the '%s' synchronization service?"
> ) % backend.
>
> (You can shift the string more to left so you don't have too long line).
>
> anoter possibility is to split string like
>
> _("Do you really want to remove the '%s' "
> "synchronization service?") % \
>
>
> *******
>
> markup = ngettext("Syncing a task tagged %s" % tags_txt, \
> "Syncing %d tasks tagged %s" % (tasks_number,
> tags_txt), \
> - tasks_number)
> + tasks_number)
>
> Delimiters \ are not needed after a comma in parameters. You can ommit
> them :)
>
>
> *******
>
> + textbox_
> + self.chooser.
> + self.chooser.
>
> You are missing spaces around '=' (It should be an error from pylint or
> PEP8)
>
> The same thing in
> + GLADE_FILE = os.path.
> + MODIFYTAGS_
> "modifytags_
> + TAGEDITOR_
>
>
> *******
>
> tasks = self.req.
> - for event in 'node-added-
> 'node-deleted-
> + l =['node-
> 'node-deleted-
> + for event in l:
> handle = tasks.register_
> self.tag_
>
>
> It is better to split the list rather than put it into an artificial
> variable:
>
> for event in ['node-
> 'node-deleted-
>
> *******
>
> - while (it.get_offset() < end.get_offset()) and (it.get_char() !=
> '\0'):
> + while(it.
> '\0'):
>
> Parenthesis could be ommitted for better readability:
> while it.get_offset() < end.get_offset()) and (it.get_char() != '\0':
>
> (it is there about 3 times or so)
>
> *******
>
> if url.startswith("bug #") or url.startswith("lp #"):
> topoint = "https:/
> elif url.startswith("bgo #"):
> - topoint = "
> http://
> + ...
Nimit Shah (nimit-svnit) wrote : | # |
Hi!
I made some changes and in the case:
+ textbox_
+ self.chooser.
+ self.chooser.
You are missing spaces around '=' (It should be an error from pylint or
PEP8)
The same thing in
+ GLADE_FILE = os.path.
+ MODIFYTAGS_
"modifytags_
+ TAGEDITOR_
I checked and lint and pep8 didnot give any error when I removed spaces
between operator and the operands
and also,
in case of unused variables. I have simply commented them.
Nimit Shah,
B Tech 3rd year,
Computer Engineering Department,
SVNIT Surat
Secretary ACM-NIT Surat
www.dude-
On Sat, Jun 23, 2012 at 6:23 PM, Izidor Matušov <email address hidden>wrote:
> Review: Needs Fixing code
>
> 156 + _("Do you really want to remove the '%s' \
> 157 + synchronization service?") % \
>
> You can't break the line inside a string like that. It will add white
> space inside the string. The better way to solve it would be:
>
> message_format = _(
> "Do you really want to remove the '%s' synchronization service?"
> ) % backend.
>
> (You can shift the string more to left so you don't have too long line).
>
> anoter possibility is to split string like
>
> _("Do you really want to remove the '%s' "
> "synchronization service?") % \
>
>
> *******
>
> markup = ngettext("Syncing a task tagged %s" % tags_txt, \
> "Syncing %d tasks tagged %s" % (tasks_number,
> tags_txt), \
> - tasks_number)
> + tasks_number)
>
> Delimiters \ are not needed after a comma in parameters. You can ommit
> them :)
>
>
> *******
>
> + textbox_
> + self.chooser.
> + self.chooser.
>
> You are missing spaces around '=' (It should be an error from pylint or
> PEP8)
>
> The same thing in
> + GLADE_FILE = os.path.
> + MODIFYTAGS_
> "modifytags_
> + TAGEDITOR_
>
>
> *******
>
> tasks = self.req.
> - for event in 'node-added-
> 'node-deleted-
> + l =['node-
> 'node-deleted-
> + for event in l:
> handle = tasks.register_
> self.tag_
>
>
> It is better to split the list rather than put it into an artificial
> variable:
>
> for event in ['node-
> 'node-deleted-
>
> *******
>
> - while (it.get_offset() < end.get_offset()) and (it.get_char()...
Izidor Matušov (izidor) wrote : | # |
Hi Nimit,
Could you please correct my remarks? I would like to merge your changes into trunk ;)
Could you also pull the newest changes from the trunk? I solved few remarks just by removing unused code ;)
Thank you
Izidor Matušov (izidor) wrote : | # |
Hi Nimit, are you planning to finish this patch? I'd know if it makes it into GTG 0.3 or not.
Nimit Shah (nimit-svnit) wrote : | # |
Hi Izidor!
Sorry to keep you hanging like this. I was having branches diverged
error while I was trying to pull the latest changes of the trunk into the
branch. So I had to create a new branch.
Here: https:/
Nimit Shah,
B Tech 4th year,
Computer Engineering Department,
SVNIT Surat
www.dude-
On Tue, Aug 14, 2012 at 12:02 PM, Izidor Matušov
<email address hidden>wrote:
> Hi Nimit, are you planning to finish this patch? I'd know if it makes it
> into GTG 0.3 or not.
> --
> https:/
> You are the owner of lp:~nimit-svnit/gtg/cleanup.
>
Nimit Shah (nimit-svnit) wrote : | # |
I started the work fresh on this branch. I have so far taken care of
GTG/gtk/editor/* and GTG/gtk/browser/* in the branch.
Nimit Shah,
B Tech 4th year,
Computer Engineering Department,
SVNIT Surat
www.dude-
On Tue, Aug 14, 2012 at 12:56 PM, Nimit Shah <email address hidden> wrote:
> Hi Izidor!
> Sorry to keep you hanging like this. I was having branches diverged
> error while I was trying to pull the latest changes of the trunk into the
> branch. So I had to create a new branch.
> Here: https:/
> Nimit Shah,
> B Tech 4th year,
>
> Computer Engineering Department,
> SVNIT Surat
> www.dude-
>
>
>
> On Tue, Aug 14, 2012 at 12:02 PM, Izidor Matušov <<email address hidden>
> > wrote:
>
>> Hi Nimit, are you planning to finish this patch? I'd know if it makes it
>> into GTG 0.3 or not.
>> --
>> https:/
>> You are the owner of lp:~nimit-svnit/gtg/cleanup.
>>
>
>
Izidor Matušov (izidor) wrote : | # |
Okay, then I close this merge request (you have another branch) and please ask for merge with the new branch when you are ready.
Unmerged revisions
- 1201. By Nimit Shah
-
Made files comply with lint and pep8 standards
- 1200. By Nimit Shah
-
Files made to comply with pylint and pep8 standards
- 1199. By Nimit Shah
-
Code made to comply with pylint and pep8 standards
- 1198. By Nimit Shah
-
making setup.py colors.py simple_
color_selector. py cellRendererTags.py custominfobar.py treeview_factor.py tag_context_menu.py gtg pass lint
Preview Diff
1 | === modified file 'CHANGELOG' |
2 | --- CHANGELOG 2012-06-09 12:25:03 +0000 |
3 | +++ CHANGELOG 2012-06-23 11:09:19 +0000 |
4 | @@ -26,6 +26,7 @@ |
5 | * Improved Export plugin, export to PDF works now, by Izidor Matušov |
6 | * Added -t option to distinguish between multiple instances of GTG |
7 | * Fix for bug #826916 by Nimit Shah |
8 | + * making setup.py colors.py simple_color_selector.py cellRendererTags.py custominfobar.py treeview_factor.py tag_context_menu.py gtg pass lint by Nimit Shah |
9 | |
10 | 2012-02-13 Getting Things GNOME! 0.2.9 |
11 | * Big refractorization of code, now using liblarch |
12 | |
13 | === modified file 'GTG/__init__.py' |
14 | --- GTG/__init__.py 2012-03-22 12:24:50 +0000 |
15 | +++ GTG/__init__.py 2012-06-23 11:09:19 +0000 |
16 | @@ -72,7 +72,8 @@ |
17 | if os.path.isdir(user_plugins): |
18 | PLUGIN_DIR.append(user_plugins) |
19 | |
20 | -# FIXME Register GTG URI (temporary, it should be created by a schema upon installing) |
21 | +# FIXME Register GTG URI (temporary, it should be created by a schema |
22 | +# upon installing) |
23 | # FIXME Uncomment it or even better - install it properly - it breaks build |
24 | """ |
25 | try: |
26 | |
27 | === modified file 'GTG/gtk/backends_dialog/__init__.py' |
28 | --- GTG/gtk/backends_dialog/__init__.py 2012-06-07 15:25:05 +0000 |
29 | +++ GTG/gtk/backends_dialog/__init__.py 2012-06-23 11:09:19 +0000 |
30 | @@ -42,7 +42,8 @@ |
31 | |
32 | class BackendsDialog(object): |
33 | ''' |
34 | - BackendsDialog manages a window that lets you manage and configure synchronization service. |
35 | + BackendsDialog manages a window that lets you manage and |
36 | + configure synchronization service. |
37 | It can display two "views", or "panels": |
38 | - the backend configuration view |
39 | - the backend adding view |
40 | @@ -55,7 +56,7 @@ |
41 | ''' |
42 | self.req = req |
43 | self._configure_icon_theme() |
44 | - builder = gtk.Builder() |
45 | + builder = gtk.Builder() |
46 | self._load_widgets_from_glade(builder) |
47 | self.dialog.set_title(_("Synchronization Services - %s" % info.NAME)) |
48 | self._create_widgets_for_add_panel() |
49 | @@ -66,7 +67,6 @@ |
50 | ######################################## |
51 | ### INTERFACE WITH THE VIEWMANAGER ##### |
52 | ######################################## |
53 | - |
54 | def activate(self): |
55 | '''Shows this window, refreshing the current view''' |
56 | self.dialog.show_all() |
57 | @@ -77,7 +77,7 @@ |
58 | def on_close(self, widget, data = None): |
59 | ''' |
60 | Hides this window, saving the backends configuration. |
61 | - |
62 | + |
63 | @param widget: not used, here only for using this as signal callback |
64 | @param data: same as widget, disregard the content |
65 | ''' |
66 | @@ -88,7 +88,6 @@ |
67 | ######################################## |
68 | ### HELPER FUNCTIONS ################### |
69 | ######################################## |
70 | - |
71 | def get_requester(self): |
72 | ''' |
73 | Helper function: returns the requester. |
74 | @@ -109,20 +108,20 @@ |
75 | @returns gtk.gdk.Pixbuf: a pixbuf containing the wanted icon, or None |
76 | (if the icon is not present) |
77 | ''' |
78 | - #NOTE: loading icons directly from the theme and scaling them results in |
79 | - # blurry icons. So, instead of doing that, I'm loading them |
80 | - # directly from file. |
81 | + #NOTE: loading icons directly from the theme and scaling them results |
82 | + # in blurry icons. So, instead of doing that, I'm loading them |
83 | + # directly from file. |
84 | icon_info = self.icon_theme.lookup_icon(name, gtk.ICON_SIZE_MENU, 0) |
85 | if icon_info == None: |
86 | return None |
87 | - pixbuf = gtk.gdk.pixbuf_new_from_file(icon_info.get_filename()) |
88 | + pixbuf = gtk.gdk.pixbuf_new_from_file(icon_info.get_filename()) |
89 | return pixbuf.scale_simple(width, height, gtk.gdk.INTERP_BILINEAR) |
90 | |
91 | def _show_panel(self, panel_name): |
92 | ''' |
93 | Helper function to switch between panels. |
94 | |
95 | - @param panel_name: the name of the wanted panel. Choose between |
96 | + @param panel_name: the name of the wanted panel. Choose between |
97 | "configuration" or "add" |
98 | ''' |
99 | if panel_name == "configuration": |
100 | @@ -157,7 +156,6 @@ |
101 | ######################################## |
102 | ### WIDGETS AND SIGNALS ################ |
103 | ######################################## |
104 | - |
105 | def _load_widgets_from_glade(self, builder): |
106 | ''' |
107 | Loads widgets from the glade file |
108 | @@ -166,11 +164,11 @@ |
109 | ''' |
110 | builder.add_from_file(ViewConfig.BACKENDS_GLADE_FILE) |
111 | widgets = { |
112 | - 'dialog' : 'backends_dialog', |
113 | - 'treeview_window' : 'treeview_window', |
114 | - 'central_pane' : 'central_pane', |
115 | - 'add_button' : 'add_button', |
116 | - 'remove_button' : 'remove_button', |
117 | + 'dialog': 'backends_dialog', |
118 | + 'treeview_window': 'treeview_window', |
119 | + 'central_pane': 'central_pane', |
120 | + 'add_button': 'add_button', |
121 | + 'remove_button': 'remove_button', |
122 | } |
123 | for attr, widget in widgets.iteritems(): |
124 | setattr(self, attr, builder.get_object(widget)) |
125 | @@ -200,7 +198,7 @@ |
126 | |
127 | def _create_widgets_for_backends_tree(self): |
128 | ''' |
129 | - Creates the widgets for the lateral treeview displaying the |
130 | + Creates the widgets for the lateral treeview displaying the |
131 | backends the user has added |
132 | ''' |
133 | self.backends_tv = BackendsTree(self) |
134 | @@ -217,7 +215,6 @@ |
135 | ######################################## |
136 | ### EVENT HANDLING ##################### |
137 | ######################################## |
138 | - |
139 | def on_backend_selected(self, backend_id): |
140 | ''' |
141 | When a backend in the treeview gets selected, show |
142 | @@ -269,7 +266,7 @@ |
143 | |
144 | def on_remove_button(self, widget = None, data = None): |
145 | ''' |
146 | - When the remove button is pressed, a confirmation dialog is shown, |
147 | + When the remove button is pressed, a confirmation dialog is shown, |
148 | and if the answer is positive, the backend is deleted. |
149 | ''' |
150 | backend_id = self.backends_tv.get_selected_backend_id() |
151 | @@ -283,9 +280,10 @@ |
152 | type = gtk.MESSAGE_QUESTION, |
153 | buttons = gtk.BUTTONS_YES_NO, |
154 | message_format = \ |
155 | - _("Do you really want to remove the '%s' synchronization service?") % \ |
156 | + _("Do you really want to remove the '%s' \ |
157 | + synchronization service?") % \ |
158 | backend.get_human_name()) |
159 | - response = dialog.run() |
160 | + response = dialog.run() |
161 | dialog.destroy() |
162 | if response == gtk.RESPONSE_YES: |
163 | #delete the backend and remove it from the lateral treeview |
164 | |
165 | === modified file 'GTG/gtk/backends_dialog/addpanel.py' |
166 | --- GTG/gtk/backends_dialog/addpanel.py 2012-04-02 15:39:34 +0000 |
167 | +++ GTG/gtk/backends_dialog/addpanel.py 2012-06-23 11:09:19 +0000 |
168 | @@ -28,14 +28,11 @@ |
169 | # leaving this here in case we change that decision (invernizzi). |
170 | #from GTG.tools.moduletopackage import ModuleToPackage |
171 | |
172 | - |
173 | - |
174 | class AddPanel(gtk.VBox): |
175 | - ''' |
176 | + ''' |
177 | A VBox filled with gtk widgets to let the user choose a new backend. |
178 | ''' |
179 | |
180 | - |
181 | def __init__(self, backends_dialog): |
182 | ''' |
183 | Constructor, just initializes the gtk widgets |
184 | @@ -117,7 +114,7 @@ |
185 | |
186 | def _fill_bottom_hbox(self, hbox): |
187 | ''' |
188 | - Helper function to fill and hbox with a buttonbox, featuring |
189 | + Helper function to fill and hbox with a buttonbox, featuring |
190 | and ok and cancel buttons. |
191 | |
192 | @param hbox: the gtk.HBox to fill |
193 | @@ -213,4 +210,3 @@ |
194 | # text += reduce(lambda a, b: a + "\n - " + b, missing_modules) |
195 | # self.label_modules.set_markup(text) |
196 | # self.ok_button.set_sensitive(missing_modules == []) |
197 | - |
198 | |
199 | === modified file 'GTG/gtk/backends_dialog/backendscombo.py' |
200 | --- GTG/gtk/backends_dialog/backendscombo.py 2012-03-05 15:23:05 +0000 |
201 | +++ GTG/gtk/backends_dialog/backendscombo.py 2012-06-23 11:09:19 +0000 |
202 | @@ -22,18 +22,17 @@ |
203 | from GTG.backends import BackendFactory |
204 | |
205 | |
206 | - |
207 | class BackendsCombo(gtk.ComboBoxEntry): |
208 | ''' |
209 | A combobox listing all the available backends types |
210 | ''' |
211 | - |
212 | + |
213 | |
214 | COLUMN_NAME = 0 #unique name for the backend type. It's never |
215 | # displayed, it's used to find which backend has |
216 | # been selected |
217 | COLUMN_HUMAN_NAME = 1 #human friendly name (which is localized). |
218 | - COLUMN_ICON = 2 |
219 | + COLUMN_ICON = 2 |
220 | |
221 | def __init__(self, backends_dialog): |
222 | ''' |
223 | |
224 | === modified file 'GTG/gtk/backends_dialog/backendstree.py' |
225 | --- GTG/gtk/backends_dialog/backendstree.py 2012-05-01 11:04:39 +0000 |
226 | +++ GTG/gtk/backends_dialog/backendstree.py 2012-06-23 11:09:19 +0000 |
227 | @@ -24,7 +24,6 @@ |
228 | from GTG.backends.backendsignals import BackendSignals |
229 | |
230 | |
231 | - |
232 | class BackendsTree(gtk.TreeView): |
233 | ''' |
234 | gtk.TreeView that shows the currently loaded backends. |
235 | @@ -43,7 +42,7 @@ |
236 | @param backends_dialog: a reference to the dialog in which this is |
237 | loaded |
238 | ''' |
239 | - super(BackendsTree,self).__init__() |
240 | + super(BackendsTree, self).__init__() |
241 | self.dialog = backendsdialog |
242 | self.req = backendsdialog.get_requester() |
243 | self._init_liststore() |
244 | @@ -60,7 +59,8 @@ |
245 | # 1, put default backend on top |
246 | # 2, sort backends by human name |
247 | backends = list(self.req.get_all_backends(disabled = True)) |
248 | - backends = sorted(backends, key=lambda backend:(not backend.is_default(), backend.get_human_name())) |
249 | + backends = sorted(backends, key=lambda backend: ( |
250 | + not backend.is_default(), backend.get_human_name())) |
251 | |
252 | for backend in backends: |
253 | self.add_backend(backend) |
254 | @@ -101,7 +101,6 @@ |
255 | ]) |
256 | self.backendid_to_iter[backend.get_id()] = backend_iter |
257 | |
258 | - |
259 | def on_backend_state_changed(self, sender, backend_id): |
260 | ''' |
261 | Signal callback executed when a backend is enabled/disabled. |
262 | @@ -129,8 +128,8 @@ |
263 | self.liststore[b_path][self.COLUMN_TAGS] = new_tags |
264 | |
265 | def _get_markup_for_tags(self, tag_names): |
266 | - '''Given a list of tags names, generates the pango markup to render that |
267 | - list with the tag colors used in GTG |
268 | + '''Given a list of tags names, generates the pango markup to render |
269 | + that list with the tag colors used in GTG |
270 | |
271 | @param tag_names: the list of the tags (strings) |
272 | @return str: the pango markup string |
273 | @@ -141,7 +140,6 @@ |
274 | tags_txt = get_colored_tags_markup(self.req, tag_names) |
275 | return "<small>" + tags_txt + "</small>" |
276 | |
277 | - |
278 | def remove_backend(self, backend_id): |
279 | ''' Removes a backend from the treeview, and selects the first (to show |
280 | something in the configuration panel |
281 | @@ -220,8 +218,8 @@ |
282 | ''' |
283 | Helper function to get the selected path |
284 | |
285 | - @return gtk.TreePath : returns exactly one path for the selected object or |
286 | - None |
287 | + @return gtk.TreePath : returns exactly one path for the selected |
288 | + object or None |
289 | ''' |
290 | selection = self.get_selection() |
291 | if selection: |
292 | |
293 | === modified file 'GTG/gtk/backends_dialog/configurepanel.py' |
294 | --- GTG/gtk/backends_dialog/configurepanel.py 2012-04-02 18:06:56 +0000 |
295 | +++ GTG/gtk/backends_dialog/configurepanel.py 2012-06-23 11:09:19 +0000 |
296 | @@ -27,11 +27,10 @@ |
297 | |
298 | |
299 | class ConfigurePanel(gtk.VBox): |
300 | - ''' |
301 | + ''' |
302 | A VBox that lets you configure a backend |
303 | ''' |
304 | |
305 | - |
306 | def __init__(self, backends_dialog): |
307 | ''' |
308 | Constructor, creating all the gtk widgets |
309 | @@ -56,7 +55,7 @@ |
310 | self.refresh_sync_status) |
311 | _signals.connect(_signals.BACKEND_SYNC_STARTED, self.on_sync_started) |
312 | _signals.connect(_signals.BACKEND_SYNC_ENDED, self.on_sync_ended) |
313 | - |
314 | + |
315 | def _create_widgets(self): |
316 | ''' |
317 | This function fills this Vbox with widgets |
318 | @@ -77,7 +76,7 @@ |
319 | |
320 | def _fill_top_hbox(self, hbox): |
321 | ''' |
322 | - Helper function to fill an hbox with an image, a spinner and |
323 | + Helper function to fill an hbox with an image, a spinner and |
324 | three labels |
325 | |
326 | @param hbox: the gtk.HBox to fill |
327 | @@ -126,7 +125,7 @@ |
328 | |
329 | def set_backend(self, backend_id): |
330 | '''Changes the backend to configure, refreshing this view. |
331 | - |
332 | + |
333 | @param backend_id: the id of the backend to configure |
334 | ''' |
335 | self.backend = self.dialog.get_requester().get_backend(backend_id) |
336 | @@ -147,7 +146,7 @@ |
337 | markup = "<big><big><big><b>%s</b></big></big></big>" % \ |
338 | self.backend.get_human_name() |
339 | self.human_name_label.set_markup(markup) |
340 | - |
341 | + |
342 | def refresh_number_of_tasks(self): |
343 | '''refreshes the number of synced tasks by this backend''' |
344 | #FIXME: disabled for now. I'm not sure that this is nice because the |
345 | @@ -170,7 +169,7 @@ |
346 | else: |
347 | markup = ngettext("Syncing a task tagged %s" % tags_txt, \ |
348 | "Syncing %d tasks tagged %s" % (tasks_number, tags_txt), \ |
349 | - tasks_number) |
350 | + tasks_number) |
351 | self.sync_desc_label.set_markup(markup) |
352 | |
353 | def refresh_sync_button(self): |
354 | @@ -207,7 +206,7 @@ |
355 | self.refresh_number_of_tasks() |
356 | self.refresh_sync_button() |
357 | self.refresh_sync_status_label() |
358 | - |
359 | + |
360 | def on_sync_button_clicked(self, sender): |
361 | ''' |
362 | Signal callback when a backend is enabled/disabled via the UI button |
363 | @@ -256,7 +255,7 @@ |
364 | ''' |
365 | Enables/disables the gtk.Spinner, while showing/hiding it at the same |
366 | time |
367 | - |
368 | + |
369 | @param active: True if the spinner should spin |
370 | ''' |
371 | self.should_spinner_be_shown = active |
372 | @@ -268,4 +267,3 @@ |
373 | self.spinner.hide() |
374 | if isinstance(self.spinner, gtk.Spinner): |
375 | self.spinner.stop() |
376 | - |
377 | |
378 | === modified file 'GTG/gtk/backends_dialog/parameters_ui/__init__.py' |
379 | --- GTG/gtk/backends_dialog/parameters_ui/__init__.py 2012-03-05 15:23:05 +0000 |
380 | +++ GTG/gtk/backends_dialog/parameters_ui/__init__.py 2012-06-23 11:09:19 +0000 |
381 | @@ -37,7 +37,6 @@ |
382 | from GTG.gtk.backends_dialog.parameters_ui.pathui import PathUI |
383 | |
384 | |
385 | - |
386 | class ParametersUI(gtk.VBox): |
387 | ''' |
388 | Given a bakcend, this gtk.VBox populates itself with all the necessary |
389 | @@ -63,59 +62,51 @@ |
390 | {"title": _("Import tags"), \ |
391 | "anybox_text": _("All tags"), \ |
392 | "somebox_text": _("Just these tags:"), \ |
393 | - "parameter_name": "import-tags"}) \ |
394 | - ),\ |
395 | + "parameter_name": "import-tags"})),\ |
396 | ("attached-tags", self.UI_generator(ImportTagsUI, \ |
397 | {"title": _("Tags to sync"), \ |
398 | "anybox_text": _("All tasks"), \ |
399 | "somebox_text": _("Tasks with these tags:"), \ |
400 | - "parameter_name": "attached-tags"}) \ |
401 | - ),\ |
402 | + "parameter_name": "attached-tags"})), \ |
403 | ("path", self.UI_generator(PathUI)), \ |
404 | ("username", self.UI_generator(TextUI, \ |
405 | {"description": _("Username"), |
406 | - "parameter_name": "username"}) |
407 | - ), \ |
408 | - ("password" , self.UI_generator(PasswordUI)), \ |
409 | - ("period" , self.UI_generator(PeriodUI)), \ |
410 | + "parameter_name": "username"})), \ |
411 | + ("password", self.UI_generator(PasswordUI)), \ |
412 | + ("period", self.UI_generator(PeriodUI)), \ |
413 | ("service-url", self.UI_generator(TextUI, \ |
414 | {"description": _("Service URL"), \ |
415 | - "parameter_name": "service-url"}) \ |
416 | - ),\ |
417 | + "parameter_name": "service-url"})),\ |
418 | ("import-from-replies", self.UI_generator(CheckBoxUI, \ |
419 | {"text": _("Import tasks from @ replies " + \ |
420 | "directed to you"), \ |
421 | - "parameter": "import-from-replies"}) \ |
422 | - ),\ |
423 | + "parameter": "import-from-replies"})),\ |
424 | ("import-from-direct-messages", self.UI_generator(CheckBoxUI, \ |
425 | {"text": _("Import tasks from direct messages"), \ |
426 | - "parameter": "import-from-direct-messages"}) \ |
427 | - ),\ |
428 | + "parameter": "import-from-direct-messages"})),\ |
429 | ("import-from-my-tweets", self.UI_generator(CheckBoxUI, \ |
430 | {"text": _("Import tasks from your tweets"), \ |
431 | - "parameter": "import-from-my-tweets"}) \ |
432 | - ),\ |
433 | + "parameter": "import-from-my-tweets"})),\ |
434 | ("import-bug-tags", self.UI_generator(CheckBoxUI, \ |
435 | - {"text": _("Tag your GTG tasks with the bug tags"), \ |
436 | - "parameter": "import-bug-tags"}) \ |
437 | - ),\ |
438 | + {"text": _("Tag your GTG tasks with the bug tags"), \ |
439 | + "parameter": "import-bug-tags"})),\ |
440 | ("tag-with-project-name", self.UI_generator(CheckBoxUI, \ |
441 | {"text": _("Tag your GTG tasks with the project " |
442 | "targeted by the bug"), \ |
443 | - "parameter": "tag-with-project-name"}) \ |
444 | - ),\ |
445 | - ) |
446 | + "parameter": "tag-with-project-name"})),\ |
447 | + ) |
448 | + |
449 | def UI_generator(self, param_type, special_arguments = {}): |
450 | '''A helper function to build a widget type from a template. |
451 | - It passes to the created widget generator a series of common parameters, |
452 | - plus the ones needed to specialize the given template |
453 | + It passes to the created widget generator a series of common |
454 | + parameters, plus the ones needed to specialize the given template |
455 | |
456 | @param param_type: the template to specialize |
457 | @param special_arguments: the arguments used for this particular widget |
458 | generator. |
459 | |
460 | - @return function: return a widget generator, not a widget. the widget can |
461 | - be obtained by calling widget_generator(backend) |
462 | + @return function: return a widget generator, not a widget. the widget |
463 | + can be obtained by calling widget_generator(backend) |
464 | ''' |
465 | return lambda backend: param_type(req = self.req, \ |
466 | backend = backend, \ |
467 | @@ -147,6 +138,7 @@ |
468 | Saves all the parameters at their current state (the user may have |
469 | modified them) |
470 | ''' |
471 | + |
472 | def _commit_changes(child): |
473 | child.commit_changes() |
474 | self.foreach(_commit_changes) |
475 | |
476 | === modified file 'GTG/gtk/backends_dialog/parameters_ui/checkboxui.py' |
477 | --- GTG/gtk/backends_dialog/parameters_ui/checkboxui.py 2012-03-05 15:23:05 +0000 |
478 | +++ GTG/gtk/backends_dialog/parameters_ui/checkboxui.py 2012-06-23 11:09:19 +0000 |
479 | @@ -20,13 +20,11 @@ |
480 | import gtk |
481 | |
482 | |
483 | - |
484 | class CheckBoxUI(gtk.HBox): |
485 | ''' |
486 | It's a widget displaying a simple checkbox, with some text to explain its |
487 | meaning |
488 | ''' |
489 | - |
490 | |
491 | def __init__(self, req, backend, width, text, parameter): |
492 | ''' |
493 | @@ -35,8 +33,8 @@ |
494 | @param req: a Requester |
495 | @param backend: a backend object |
496 | @param width: the width of the gtk.Label object |
497 | - @param parameter: the backend parameter this checkbox should display and |
498 | - modify |
499 | + @param parameter: the backend parameter this checkbox should display |
500 | + and modify |
501 | ''' |
502 | super(CheckBoxUI, self).__init__() |
503 | self.backend = backend |
504 | @@ -47,11 +45,12 @@ |
505 | |
506 | def _populate_gtk(self, width): |
507 | '''Creates the checkbox and the related label |
508 | - |
509 | + |
510 | @param width: the width of the gtk.Label object |
511 | ''' |
512 | self.checkbutton =gtk.CheckButton(label = self.text) |
513 | - self.checkbutton.set_active(self.backend.get_parameters()[self.parameter]) |
514 | + self.checkbutton.set_active( |
515 | + self.backend.get_parameters()[self.parameter]) |
516 | self.checkbutton.connect("toggled", self.on_modified) |
517 | self.pack_start(self.checkbutton, False) |
518 | |
519 | |
520 | === modified file 'GTG/gtk/backends_dialog/parameters_ui/importtagsui.py' |
521 | --- GTG/gtk/backends_dialog/parameters_ui/importtagsui.py 2012-03-05 15:23:05 +0000 |
522 | +++ GTG/gtk/backends_dialog/parameters_ui/importtagsui.py 2012-06-23 11:09:19 +0000 |
523 | @@ -22,13 +22,11 @@ |
524 | from GTG.backends.genericbackend import GenericBackend |
525 | |
526 | |
527 | - |
528 | class ImportTagsUI(gtk.VBox): |
529 | ''' |
530 | It's a widget displaying a couple of radio buttons, a label and a textbox |
531 | to let the user change the attached tags (or imported) |
532 | ''' |
533 | - |
534 | |
535 | def __init__(self, req, backend, width, title, anybox_text, somebox_text, \ |
536 | parameter_name): |
537 | @@ -132,4 +130,3 @@ |
538 | self.some_tags_radio.connect("toggled", self.on_changed) |
539 | self.all_tags_radio.connect("toggled", self.on_changed) |
540 | self.tags_entry.connect("changed", self.on_changed) |
541 | - |
542 | |
543 | === modified file 'GTG/gtk/backends_dialog/parameters_ui/passwordui.py' |
544 | --- GTG/gtk/backends_dialog/parameters_ui/passwordui.py 2012-03-05 15:23:05 +0000 |
545 | +++ GTG/gtk/backends_dialog/parameters_ui/passwordui.py 2012-06-23 11:09:19 +0000 |
546 | @@ -22,10 +22,8 @@ |
547 | from GTG import _ |
548 | |
549 | |
550 | - |
551 | class PasswordUI(gtk.HBox): |
552 | '''Widget displaying a gtk.Label and a textbox to input a password''' |
553 | - |
554 | |
555 | def __init__(self, req, backend, width): |
556 | '''Creates the gtk widgets and loads the current password in the text |
557 | @@ -44,7 +42,7 @@ |
558 | |
559 | def _populate_gtk(self, width): |
560 | '''Creates the text box and the related label |
561 | - |
562 | + |
563 | @param width: the width of the gtk.Label object |
564 | ''' |
565 | password_label = gtk.Label(_("Password:")) |
566 | @@ -70,7 +68,8 @@ |
567 | |
568 | def commit_changes(self): |
569 | '''Saves the changes to the backend parameter ('password')''' |
570 | - self.backend.set_parameter('password', self.password_textbox.get_text()) |
571 | + self.backend.set_parameter('password', |
572 | + self.password_textbox.get_text()) |
573 | |
574 | def on_password_modified(self, sender): |
575 | ''' Signal callback, executed when the user edits the password. |
576 | @@ -81,4 +80,3 @@ |
577 | ''' |
578 | if self.backend.is_enabled() and not self.backend.is_default(): |
579 | self.req.set_backend_enabled(self.backend.get_id(), False) |
580 | - |
581 | |
582 | === modified file 'GTG/gtk/backends_dialog/parameters_ui/pathui.py' |
583 | --- GTG/gtk/backends_dialog/parameters_ui/pathui.py 2012-03-05 15:23:05 +0000 |
584 | +++ GTG/gtk/backends_dialog/parameters_ui/pathui.py 2012-06-23 11:09:19 +0000 |
585 | @@ -23,13 +23,10 @@ |
586 | from GTG import _ |
587 | |
588 | |
589 | - |
590 | - |
591 | class PathUI(gtk.HBox): |
592 | '''Gtk widgets to show a path in a textbox, and a button to bring up a |
593 | filesystem explorer to modify that path (also, a label to describe those) |
594 | ''' |
595 | - |
596 | |
597 | def __init__(self, req, backend, width): |
598 | ''' |
599 | @@ -46,7 +43,7 @@ |
600 | |
601 | def _populate_gtk(self, width): |
602 | '''Creates the gtk.Label, the textbox and the button |
603 | - |
604 | + |
605 | @param width: the width of the gtk.Label object |
606 | ''' |
607 | label = gtk.Label(_("Filename:")) |
608 | @@ -78,7 +75,7 @@ |
609 | ''' |
610 | if self.backend.is_enabled() and not self.backend.is_default(): |
611 | self.req.set_backend_enabled(self.backend.get_id(), False) |
612 | - |
613 | + |
614 | def on_button_clicked(self, sender): |
615 | '''Shows the filesystem explorer to choose a new file |
616 | |
617 | @@ -93,9 +90,10 @@ |
618 | gtk.RESPONSE_OK)) |
619 | self.chooser.set_default_response(gtk.RESPONSE_OK) |
620 | #set default file as the current self.path |
621 | - self.chooser.set_current_name(os.path.basename(self.textbox.get_text())) |
622 | - self.chooser.set_current_folder(os.path.dirname(self.textbox.get_text())) |
623 | - |
624 | + textbox_text=self.textbox.get_text() |
625 | + self.chooser.set_current_name(os.path.basename(textbox_text)) |
626 | + self.chooser.set_current_folder(os.path.dirname(textbox_text)) |
627 | + |
628 | #filter files |
629 | afilter = gtk.FileFilter() |
630 | afilter.set_name("All files") |
631 | |
632 | === modified file 'GTG/gtk/backends_dialog/parameters_ui/periodui.py' |
633 | --- GTG/gtk/backends_dialog/parameters_ui/periodui.py 2012-03-05 15:23:05 +0000 |
634 | +++ GTG/gtk/backends_dialog/parameters_ui/periodui.py 2012-06-23 11:09:19 +0000 |
635 | @@ -22,11 +22,9 @@ |
636 | from GTG import _, ngettext |
637 | |
638 | |
639 | - |
640 | class PeriodUI(gtk.HBox): |
641 | '''A widget to change the frequency of a backend synchronization |
642 | ''' |
643 | - |
644 | |
645 | def __init__(self, req, backend, width): |
646 | ''' |
647 | @@ -45,7 +43,7 @@ |
648 | |
649 | def _populate_gtk(self, width): |
650 | '''Creates the gtk widgets |
651 | - |
652 | + |
653 | @param width: the width of the gtk.Label object |
654 | ''' |
655 | period_label = gtk.Label(_("Check for new tasks every")) |
656 | |
657 | === modified file 'GTG/gtk/backends_dialog/parameters_ui/textui.py' |
658 | --- GTG/gtk/backends_dialog/parameters_ui/textui.py 2012-03-05 15:23:05 +0000 |
659 | +++ GTG/gtk/backends_dialog/parameters_ui/textui.py 2012-06-23 11:09:19 +0000 |
660 | @@ -20,11 +20,9 @@ |
661 | import gtk |
662 | |
663 | |
664 | - |
665 | class TextUI(gtk.HBox): |
666 | '''A widget to display a simple textbox and a label to describe its content |
667 | ''' |
668 | - |
669 | |
670 | def __init__(self, req, backend, width, description, parameter_name): |
671 | ''' |
672 | @@ -44,7 +42,7 @@ |
673 | |
674 | def _populate_gtk(self, width): |
675 | '''Creates the gtk widgets |
676 | - |
677 | + |
678 | @param width: the width of the gtk.Label object |
679 | ''' |
680 | label = gtk.Label("%s:" % self.description) |
681 | |
682 | === modified file 'GTG/gtk/browser/CellRendererTags.py' |
683 | --- GTG/gtk/browser/CellRendererTags.py 2012-03-22 12:24:50 +0000 |
684 | +++ GTG/gtk/browser/CellRendererTags.py 2012-06-23 11:09:19 +0000 |
685 | @@ -66,7 +66,7 @@ |
686 | if self.tag_list != None: |
687 | for my_tag in self.tag_list: |
688 | my_tag_color = my_tag.get_attribute("color") |
689 | - my_tag_icon = my_tag.get_attribute("icon") |
690 | + my_tag_icon = my_tag.get_attribute("icon") |
691 | if my_tag_color or my_tag_icon: |
692 | count = count + 1 |
693 | elif self.tag != None: |
694 | @@ -80,10 +80,10 @@ |
695 | def __init__(self): #pylint: disable-msg=W0231 |
696 | self.__gobject_init__() |
697 | self.tag_list = None |
698 | - self.tag = None |
699 | - self.xpad = 1 |
700 | - self.ypad = 1 |
701 | - self.PADDING = 1 |
702 | + self.tag = None |
703 | + self.xpad = 1 |
704 | + self.ypad = 1 |
705 | + self.PADDING = 1 |
706 | |
707 | def do_set_property(self, pspec, value): |
708 | if pspec.name == "tag-list": |
709 | @@ -101,7 +101,7 @@ |
710 | self, window, widget, background_area, cell_area, expose_area, flags): |
711 | |
712 | vw_tags = self.__count_viewable_tags() |
713 | - count = 0 |
714 | + count = 0 |
715 | |
716 | # Select source |
717 | if self.tag_list != None: |
718 | @@ -112,25 +112,25 @@ |
719 | return |
720 | |
721 | # Drawing context |
722 | - cr = window.cairo_create() |
723 | + cr = window.cairo_create() |
724 | gdkcontext = gtk.gdk.CairoContext(cr) |
725 | gdkcontext.set_antialias(cairo.ANTIALIAS_NONE) |
726 | |
727 | # Coordinates of the origin point |
728 | x_align = self.get_property("xalign") |
729 | y_align = self.get_property("yalign") |
730 | - orig_x = cell_area.x + int((cell_area.width - 16*vw_tags -\ |
731 | + orig_x = cell_area.x + int((cell_area.width - 16*vw_tags -\ |
732 | self.PADDING*2*(vw_tags-1)) * x_align) |
733 | - orig_y = cell_area.y + int((cell_area.height - 16) * y_align) |
734 | + orig_y = cell_area.y + int((cell_area.height - 16) * y_align) |
735 | |
736 | # We draw the icons & squares |
737 | for my_tag in tags: |
738 | |
739 | - my_tag_icon = my_tag.get_attribute("icon") |
740 | + my_tag_icon = my_tag.get_attribute("icon") |
741 | my_tag_color = my_tag.get_attribute("color") |
742 | |
743 | - rect_x = orig_x + self.PADDING*2*count + 16*count |
744 | - rect_y = orig_y |
745 | + rect_x = orig_x + self.PADDING*2*count + 16*count |
746 | + rect_y = orig_y |
747 | |
748 | if my_tag_icon: |
749 | try: |
750 | @@ -162,10 +162,10 @@ |
751 | |
752 | if self.tag and my_tag: #pylint: disable-msg=W0631 |
753 | |
754 | - my_tag_icon = my_tag.get_attribute("icon") |
755 | + my_tag_icon = my_tag.get_attribute("icon") |
756 | my_tag_color = my_tag.get_attribute("color") |
757 | |
758 | - if not my_tag_icon and not my_tag_color: |
759 | + if not my_tag_icon and not my_tag_color: |
760 | |
761 | # Draw rounded rectangle |
762 | gdkcontext.set_source_rgba(0.95, 0.95, 0.95, 1) |
763 | |
764 | === modified file 'GTG/gtk/browser/__init__.py' |
765 | --- GTG/gtk/browser/__init__.py 2012-04-21 15:55:54 +0000 |
766 | +++ GTG/gtk/browser/__init__.py 2012-06-23 11:09:19 +0000 |
767 | @@ -29,24 +29,25 @@ |
768 | |
769 | class GnomeConfig: |
770 | current_rep = os.path.dirname(os.path.abspath(__file__)) |
771 | - GLADE_FILE = os.path.join(current_rep, "taskbrowser.glade") |
772 | - MODIFYTAGS_GLADE_FILE = os.path.join(current_rep, "modifytags_dialog.glade") |
773 | - TAGEDITOR_GLADE_FILE = os.path.join(current_rep, "tageditor.glade") |
774 | + GLADE_FILE = os.path.join(current_rep, "taskbrowser.glade") |
775 | + MODIFYTAGS_GLADE_FILE= os.path.join(current_rep, "modifytags_dialog.glade") |
776 | + TAGEDITOR_GLADE_FILE = os.path.join(current_rep, "tageditor.glade") |
777 | |
778 | - MARK_DONE = _("Mark as Done") |
779 | - MARK_DONE_TOOLTIP = _("Mark the selected task as done") |
780 | - MARK_UNDONE = _("Mark as not Done") |
781 | - MARK_UNDONE_TOOLTIP = _("Mark the selected task as to be done") |
782 | - MARK_DISMISS = _("Dismiss") |
783 | - MARK_DISMISS_TOOLTIP = _("Mark the task as not to be done anymore") |
784 | - MARK_UNDISMISS = _("Undismiss") |
785 | - MARK_UNDISMISS_TOOLTIP = _("Mark the selected task as to be done") |
786 | - DELETE_TOOLTIP = _("Permanently remove the selected task") |
787 | - EDIT_TOOLTIP = _("Edit the selected task") |
788 | - NEW_TASK_TOOLTIP = _("Create a new task") |
789 | - NEW_SUBTASK_TOOLTIP = _("Create a new subtask") |
790 | + MARK_DONE = _("Mark as Done") |
791 | + MARK_DONE_TOOLTIP = _("Mark the selected task as done") |
792 | + MARK_UNDONE = _("Mark as not Done") |
793 | + MARK_UNDONE_TOOLTIP = _("Mark the selected task as to be done") |
794 | + MARK_DISMISS = _("Dismiss") |
795 | + MARK_DISMISS_TOOLTIP = _("Mark the task as not to be done anymore") |
796 | + MARK_UNDISMISS = _("Undismiss") |
797 | + MARK_UNDISMISS_TOOLTIP = _("Mark the selected task as to be done") |
798 | + DELETE_TOOLTIP = _("Permanently remove the selected task") |
799 | + EDIT_TOOLTIP = _("Edit the selected task") |
800 | + NEW_TASK_TOOLTIP = _("Create a new task") |
801 | + NEW_SUBTASK_TOOLTIP = _("Create a new subtask") |
802 | WORKVIEW_TOGGLE_TOOLTIP = _("Display only the currently actionable tasks") |
803 | - TAG_IN_WORKVIEW_TOGG = _("Hide this tag from the workview") |
804 | + TAG_IN_WORKVIEW_TOGG = _("Hide this tag from the workview") |
805 | TAG_NOTIN_WORKVIEW_TOGG = _("Show this tag in the workview") |
806 | - QUICKADD_ENTRY_TOOLTIP = _("You can create, open or filter your tasks here") |
807 | - QUICKADD_ICON_TOOLTIP = _("Clear") |
808 | + QUICKADD_ENTRY_TOOLTIP = _( |
809 | + "You can create, open or filter your tasks here") |
810 | + QUICKADD_ICON_TOOLTIP = _("Clear") |
811 | |
812 | === modified file 'GTG/gtk/browser/browser.py' |
813 | --- GTG/gtk/browser/browser.py 2012-06-21 09:51:32 +0000 |
814 | +++ GTG/gtk/browser/browser.py 2012-06-23 11:09:19 +0000 |
815 | @@ -48,8 +48,6 @@ |
816 | |
817 | #=== MAIN CLASS =============================================================== |
818 | |
819 | - |
820 | - |
821 | class Timer: |
822 | |
823 | def __init__(self, name): |
824 | @@ -405,7 +403,7 @@ |
825 | ### HELPER FUNCTIONS ######################################################## |
826 | def open_preferences(self, widget): |
827 | self.vmanager.open_preferences(self.config) |
828 | - |
829 | + |
830 | def open_plugins(self, widget): |
831 | self.vmanager.configure_plugins() |
832 | |
833 | |
834 | === modified file 'GTG/gtk/browser/custominfobar.py' |
835 | --- GTG/gtk/browser/custominfobar.py 2012-04-02 18:06:56 +0000 |
836 | +++ GTG/gtk/browser/custominfobar.py 2012-06-23 11:09:19 +0000 |
837 | @@ -25,7 +25,6 @@ |
838 | from GTG.tools.networkmanager import is_connection_up |
839 | |
840 | |
841 | - |
842 | class CustomInfoBar(gtk.InfoBar): |
843 | ''' |
844 | A gtk.InfoBar specialized for displaying errors and requests for |
845 | @@ -33,9 +32,9 @@ |
846 | ''' |
847 | |
848 | |
849 | - AUTHENTICATION_MESSAGE = _("The <b>%s</b> synchronization service cannot login with the " |
850 | - "supplied authentication data and has been" |
851 | - " disabled. To retry the login, re-enable the service.") |
852 | + AUTHENTICATION_MESSAGE = _("The <b>%s</b> synchronization service cannot" |
853 | + "supplied authentication data and has been disabled" |
854 | + ". To retry the login, re-enable the service.") |
855 | |
856 | NETWORK_MESSAGE = _("Due to a network problem, I cannot contact " |
857 | "the <b>%s</b> synchronization service.") |
858 | @@ -92,8 +91,8 @@ |
859 | ''' |
860 | Sets this infobar to show an error to the user |
861 | |
862 | - @param error_code: the code of the error to show. Error codes are listed |
863 | - in BackendSignals |
864 | + @param error_code: the code of the error to show. Error codes are |
865 | + listed in BackendSignals |
866 | ''' |
867 | self._populate() |
868 | self.connect("response", self._on_error_response) |
869 | @@ -102,7 +101,8 @@ |
870 | if error_code == BackendSignals.ERRNO_AUTHENTICATION: |
871 | self.set_message_type(gtk.MESSAGE_ERROR) |
872 | self.label.set_markup(self.AUTHENTICATION_MESSAGE % backend_name) |
873 | - self.add_button(_('Configure synchronization service'), gtk.RESPONSE_ACCEPT) |
874 | + self.add_button(_('Configure synchronization service'), |
875 | + gtk.RESPONSE_ACCEPT) |
876 | self.add_button(_('Ignore'), gtk.RESPONSE_CLOSE) |
877 | |
878 | elif error_code == BackendSignals.ERRNO_NETWORK: |
879 | @@ -112,7 +112,7 @@ |
880 | self.label.set_markup(self.NETWORK_MESSAGE % backend_name) |
881 | #FIXME: use gtk stock button instead |
882 | self.add_button(_('Ok'), gtk.RESPONSE_CLOSE) |
883 | - |
884 | + |
885 | elif error_code == BackendSignals.ERRNO_DBUS: |
886 | self.set_message_type(gtk.MESSAGE_WARNING) |
887 | self.label.set_markup(self.DBUS_MESSAGE % backend_name) |
888 | @@ -206,5 +206,5 @@ |
889 | ''' |
890 | text = self.text_box.get_text() |
891 | self.dialog.destroy() |
892 | - threading.Thread(target = getattr(self.backend, self.callback), |
893 | + threading.Thread(target = getattr(self.backend, self.callback), |
894 | args = ("set_text", text)).start() |
895 | |
896 | === modified file 'GTG/gtk/browser/simple_color_selector.py' |
897 | --- GTG/gtk/browser/simple_color_selector.py 2012-05-04 19:45:19 +0000 |
898 | +++ GTG/gtk/browser/simple_color_selector.py 2012-06-23 11:09:19 +0000 |
899 | @@ -40,10 +40,12 @@ |
900 | "#CE5C00", "#C4A000", "#BABDB6", "#2E3436", |
901 | ] |
902 | |
903 | -BUTTON_WIDTH = 36 |
904 | +BUTTON_WIDTH = 36 |
905 | BUTTON_HEIGHT = 24 |
906 | |
907 | -class SimpleColorSelectorPaletteItem(gtk.DrawingArea): # pylint: disable-msg=R0904,C0301 |
908 | + |
909 | +class SimpleColorSelectorPaletteItem(gtk.DrawingArea): |
910 | + # pylint: disable-msg=R0904,C0301 |
911 | """An item of the color selecctor palette""" |
912 | |
913 | def __init__(self, color=None): |
914 | @@ -61,7 +63,7 @@ |
915 | alloc = self.get_allocation() |
916 | alloc_w, alloc_h = alloc[2], alloc[3] |
917 | # Drawing context |
918 | - cr_ctxt = self.window.cairo_create() # pylint: disable-msg=E1101 |
919 | + cr_ctxt = self.window.cairo_create() # pylint: disable-msg=E1101 |
920 | gdkcontext = gtk.gdk.CairoContext(cr_ctxt) |
921 | |
922 | # Draw rectangle |
923 | @@ -93,13 +95,12 @@ |
924 | gdkcontext.stroke() |
925 | gdkcontext.set_source_rgba(0, 0, 0, 0.50) |
926 | gdkcontext.set_line_width(3.0) |
927 | - gdkcontext.move_to(pos_x , pos_y+size/2) |
928 | + gdkcontext.move_to(pos_x, pos_y+size/2) |
929 | gdkcontext.line_to(pos_x+size/2, pos_y+size) |
930 | - gdkcontext.line_to(pos_x+size , pos_y) |
931 | + gdkcontext.line_to(pos_x+size, pos_y) |
932 | gdkcontext.stroke() |
933 | |
934 | ### callbacks ### |
935 | - |
936 | def on_expose(self, widget, params): # pylint: disable-msg=W0613 |
937 | """Callback: redraws the widget when it is exposed""" |
938 | self.__draw() |
939 | @@ -109,7 +110,6 @@ |
940 | self.__draw() |
941 | |
942 | ### PUBLIC IF ### |
943 | - |
944 | def set_color(self, color): |
945 | """Defines the widget color""" |
946 | self.color = color |
947 | @@ -125,8 +125,8 @@ |
948 | |
949 | |
950 | class SimpleColorSelector(gtk.VBox): # pylint: disable-msg=R0904,C0301 |
951 | - """Widget displaying a palette of colors, possibly with a button allowing to |
952 | - define new colors.""" |
953 | + """Widget displaying a palette of colors, possibly with a button allowing |
954 | + to define new colors.""" |
955 | |
956 | def __init__(self, width=9, colors=None, custom_colors=None): |
957 | gtk.VBox.__init__(self) |
958 | @@ -281,7 +281,6 @@ |
959 | color_dialog.destroy() |
960 | |
961 | # public IF |
962 | - |
963 | def has_color(self, col): |
964 | """Returns True if the color is already present""" |
965 | return col in self.colors or col in self.custom_colors |
966 | |
967 | === modified file 'GTG/gtk/browser/tag_context_menu.py' |
968 | --- GTG/gtk/browser/tag_context_menu.py 2012-05-04 20:49:39 +0000 |
969 | +++ GTG/gtk/browser/tag_context_menu.py 2012-06-23 11:09:19 +0000 |
970 | @@ -21,7 +21,7 @@ |
971 | """ |
972 | tag_context_menu: |
973 | Implements a context (pop-up) menu for the tag item in the sidebar. |
974 | -Right now it is just a void shell It is supposed to become a more generic |
975 | +Right now it is just a void shell It is supposed to become a more generic |
976 | sidebar context for all kind of item displayed there. |
977 | Also, it is supposed to handle more complex menus (with non-std widgets, |
978 | like a color picker) |
979 | @@ -33,6 +33,7 @@ |
980 | |
981 | from GTG import _ |
982 | |
983 | + |
984 | class TagContextMenu(gtk.Menu): # pylint: disable-msg=R0904 |
985 | """Context menu fo the tag i the sidebar""" |
986 | |
987 | @@ -67,14 +68,12 @@ |
988 | self.show_all() |
989 | |
990 | ### PUBLIC API ### |
991 | - |
992 | def set_tag(self, tag): |
993 | """Update the context menu items using the tag attributes.""" |
994 | self.tag = tag |
995 | self.__build_menu() |
996 | |
997 | ### CALLBACKS ### |
998 | - |
999 | def on_mi_cc_activate(self, widget): # pylint: disable-msg=W0613 |
1000 | """Callback: show the tag editor upon request""" |
1001 | self.vmanager.open_tag_editor(self.tag) |
1002 | |
1003 | === modified file 'GTG/gtk/browser/treeview_factory.py' |
1004 | --- GTG/gtk/browser/treeview_factory.py 2012-06-12 03:58:56 +0000 |
1005 | +++ GTG/gtk/browser/treeview_factory.py 2012-06-23 11:09:19 +0000 |
1006 | @@ -38,7 +38,8 @@ |
1007 | def __init__(self, tree, desc): |
1008 | TreeView.__init__(self, tree, desc) |
1009 | self.show_expander = False |
1010 | - self.treemodel.connect("row-has-child-toggled", self.__show_expander_col) |
1011 | + self.treemodel.connect("row-has-child-toggled", |
1012 | + self.__show_expander_col) |
1013 | self.__show_expander_col(self.treemodel, None, None) |
1014 | |
1015 | def __has_child(self, model, path, iter): |
1016 | @@ -51,16 +52,17 @@ |
1017 | treemodel.foreach(self.__has_child) |
1018 | self.set_show_expanders(self.show_expander) |
1019 | |
1020 | + |
1021 | class TreeviewFactory(): |
1022 | |
1023 | - def __init__(self,requester,config): |
1024 | + def __init__(self, requester, config): |
1025 | self.req = requester |
1026 | self.mainview = self.req.get_tasks_tree() |
1027 | self.config = config |
1028 | - |
1029 | + |
1030 | #Initial unactive color |
1031 | - #This is a crude hack. As we don't have a reference to the |
1032 | - #treeview to retrieve the style, we save that color when we |
1033 | + #This is a crude hack. As we don't have a reference to the |
1034 | + #treeview to retrieve the style, we save that color when we |
1035 | #build the treeview. |
1036 | self.unactive_color = "#888a85" |
1037 | |
1038 | @@ -69,12 +71,11 @@ |
1039 | |
1040 | # Cache tags treeview for on_rename_tag callback |
1041 | self.tags_view = None |
1042 | - |
1043 | + |
1044 | ############################# |
1045 | #Functions for tasks columns |
1046 | ################################ |
1047 | - |
1048 | - def _has_hidden_subtask(self,task): |
1049 | + def _has_hidden_subtask(self, task): |
1050 | #not recursive |
1051 | display_count = self.mainview.node_n_children(task.get_id()) |
1052 | real_count = 0 |
1053 | @@ -84,35 +85,36 @@ |
1054 | if sub_task and sub_task.get_status() == Task.STA_ACTIVE: |
1055 | real_count = real_count + 1 |
1056 | return display_count < real_count |
1057 | - |
1058 | + |
1059 | def task_bg_color(self, node, default_color): |
1060 | if self.config.get('bg_color_enable'): |
1061 | return colors.background_color(node.get_tags(), default_color) |
1062 | else: |
1063 | return None |
1064 | - |
1065 | + |
1066 | #return an ordered list of tags of a task |
1067 | - def task_tags_column(self,node): |
1068 | + def task_tags_column(self, node): |
1069 | tags = node.get_tags() |
1070 | |
1071 | search_parent = self.req.get_tag(CoreConfig.SEARCH_TAG) |
1072 | for search_tag in search_parent.get_children(): |
1073 | tag = self.req.get_tag(search_tag) |
1074 | - match = search_filter(node, parse_search_query(tag.get_attribute('query'))) |
1075 | + match = search_filter(node, |
1076 | + parse_search_query(tag.get_attribute('query'))) |
1077 | if match and search_tag not in tags: |
1078 | tags.append(tag) |
1079 | |
1080 | tags.sort(key = lambda x: x.get_name()) |
1081 | return tags |
1082 | - |
1083 | + |
1084 | #task title |
1085 | def task_title_column(self, node): |
1086 | return saxutils.escape(node.get_title()) |
1087 | - |
1088 | + |
1089 | #task title/label |
1090 | def task_label_column(self, node): |
1091 | str_format = "%s" |
1092 | - |
1093 | + |
1094 | if node.get_status() == Task.STA_ACTIVE: |
1095 | # we mark in bold tasks which are due today or as Now |
1096 | days_left = node.get_days_left() |
1097 | @@ -120,11 +122,12 @@ |
1098 | str_format = "<b>%s</b>" |
1099 | if self._has_hidden_subtask(node): |
1100 | str_format = "<span color='%s'>%s</span>"\ |
1101 | - % (self.unactive_color, str_format) |
1102 | + % (self.unactive_color, str_format) |
1103 | |
1104 | title = str_format % saxutils.escape(node.get_title()) |
1105 | if node.get_status() == Task.STA_ACTIVE: |
1106 | - count = self.mainview.node_n_children(node.get_id(), recursive=True) |
1107 | + count = self.mainview.node_n_children(node.get_id(), |
1108 | + recursive=True) |
1109 | if count != 0: |
1110 | title += " (%s)" % count |
1111 | elif node.get_status() == Task.STA_DISMISSED: |
1112 | @@ -134,35 +137,35 @@ |
1113 | excerpt = saxutils.escape(node.get_excerpt(lines=1, |
1114 | strip_tags=True, strip_subtasks=True)) |
1115 | title += " <span size='small' color='%s'>%s</span>" \ |
1116 | - % (self.unactive_color, excerpt) |
1117 | + % (self.unactive_color, excerpt) |
1118 | return title |
1119 | - |
1120 | + |
1121 | #task start date |
1122 | - def task_sdate_column(self,node): |
1123 | + def task_sdate_column(self, node): |
1124 | return node.get_start_date().to_readable_string() |
1125 | - |
1126 | - def task_duedate_column(self,node): |
1127 | + |
1128 | + def task_duedate_column(self, node): |
1129 | return node.get_due_date().to_readable_string() |
1130 | - |
1131 | - def task_cdate_column(self,node): |
1132 | + |
1133 | + def task_cdate_column(self, node): |
1134 | return node.get_closed_date().to_readable_string() |
1135 | - |
1136 | - def start_date_sorting(self,task1,task2,order): |
1137 | - sort = self.__date_comp(task1,task2,'start',order) |
1138 | - return sort |
1139 | - |
1140 | - def due_date_sorting(self,task1,task2,order): |
1141 | - sort = self.__date_comp(task1,task2,'due',order) |
1142 | - return sort |
1143 | - |
1144 | - def closed_date_sorting(self,task1,task2,order): |
1145 | - sort = self.__date_comp(task1,task2,'closed',order) |
1146 | - return sort |
1147 | - |
1148 | - def title_sorting(self,task1,task2,order): |
1149 | - return cmp(task1.get_title(),task2.get_title()) |
1150 | - |
1151 | - def __date_comp(self,task1,task2,para,order): |
1152 | + |
1153 | + def start_date_sorting(self, task1, task2, order): |
1154 | + sort = self.__date_comp(task1, task2, 'start', order) |
1155 | + return sort |
1156 | + |
1157 | + def due_date_sorting(self, task1, task2, order): |
1158 | + sort = self.__date_comp(task1, task2, 'due', order) |
1159 | + return sort |
1160 | + |
1161 | + def closed_date_sorting(self, task1, task2, order): |
1162 | + sort = self.__date_comp(task1, task2, 'closed', order) |
1163 | + return sort |
1164 | + |
1165 | + def title_sorting(self, task1, task2, order): |
1166 | + return cmp(task1.get_title(), task2.get_title()) |
1167 | + |
1168 | + def __date_comp(self, task1, task2, para, order): |
1169 | '''This is a quite complex method to sort tasks by date, |
1170 | handling fuzzy date and complex situation. |
1171 | Return -1 if nid1 is before nid2, return 1 otherwise |
1172 | @@ -179,39 +182,40 @@ |
1173 | t2 = task2.get_closed_date() |
1174 | else: |
1175 | raise ValueError('invalid date comparison parameter: %s')%para |
1176 | - sort = cmp(t2,t1) |
1177 | + sort = cmp(t2, t1) |
1178 | else: |
1179 | sort = 0 |
1180 | - |
1181 | + |
1182 | #local function |
1183 | def reverse_if_descending(s): |
1184 | - """Make a cmp() result relative to the top instead of following |
1185 | - user-specified sort direction""" |
1186 | + """Make a cmp() result relative to the top instead of following |
1187 | + user-specified sort direction""" |
1188 | if order == gtk.SORT_ASCENDING: |
1189 | return s |
1190 | else: |
1191 | return -1*s |
1192 | |
1193 | - if sort == 0: # Group tasks with the same tag together for visual cleanness |
1194 | + if sort == 0: |
1195 | + # Group tasks with the same tag together for visual cleanness |
1196 | t1_tags = task1.get_tags_name() |
1197 | t1_tags.sort() |
1198 | t2_tags = task2.get_tags_name() |
1199 | t2_tags.sort() |
1200 | sort = reverse_if_descending(cmp(t1_tags, t2_tags)) |
1201 | - |
1202 | + |
1203 | if sort == 0: # Break ties by sorting by title |
1204 | t1_title = task1.get_title() |
1205 | t2_title = task2.get_title() |
1206 | t1_title = locale.strxfrm(t1_title) |
1207 | t2_title = locale.strxfrm(t2_title) |
1208 | sort = reverse_if_descending(cmp(t1_title, t2_title)) |
1209 | - |
1210 | + |
1211 | return sort |
1212 | - |
1213 | + |
1214 | ############################# |
1215 | #Functions for tags columns |
1216 | ############################# |
1217 | - def tag_name(self,node): |
1218 | + def tag_name(self, node): |
1219 | label = node.get_attribute("label") |
1220 | if label.startswith('@'): |
1221 | label = label[1:] |
1222 | @@ -220,18 +224,18 @@ |
1223 | return "<span color='%s'>%s</span>" %(self.unactive_color, label) |
1224 | else: |
1225 | return label |
1226 | - |
1227 | - def get_tag_count(self,node): |
1228 | + |
1229 | + def get_tag_count(self, node): |
1230 | if node.get_id() == 'search': |
1231 | return "" |
1232 | else: |
1233 | toreturn = node.get_active_tasks_count() |
1234 | - return "<span color='%s'>%s</span>" %(self.unactive_color,toreturn) |
1235 | - |
1236 | - def is_tag_separator_filter(self,tag): |
1237 | + return "<span color='%s'>%s</span>"%(self.unactive_color, toreturn) |
1238 | + |
1239 | + def is_tag_separator_filter(self, tag): |
1240 | return tag.get_attribute('special') == 'sep' |
1241 | - |
1242 | - def tag_sorting(self,t1,t2,order): |
1243 | + |
1244 | + def tag_sorting(self, t1, t2, order): |
1245 | t1_sp = t1.get_attribute("special") |
1246 | t2_sp = t2.get_attribute("special") |
1247 | t1_name = locale.strxfrm(t1.get_name()) |
1248 | @@ -246,8 +250,8 @@ |
1249 | t1_order = t1.get_attribute("order") |
1250 | t2_order = t2.get_attribute("order") |
1251 | return cmp(t1_order, t2_order) |
1252 | - |
1253 | - def ontag_task_dnd(self,source,target): |
1254 | + |
1255 | + def ontag_task_dnd(self, source, target): |
1256 | task = self.req.get_task(source) |
1257 | if target.startswith('@'): |
1258 | task.add_tag(target) |
1259 | @@ -259,7 +263,7 @@ |
1260 | ############################################ |
1261 | ######## The Factory ####################### |
1262 | ############################################ |
1263 | - def tags_treeview(self,tree): |
1264 | + def tags_treeview(self, tree): |
1265 | desc = {} |
1266 | |
1267 | #Tag id |
1268 | @@ -271,32 +275,32 @@ |
1269 | col['order'] = 0 |
1270 | col['sorting_func'] = self.tag_sorting |
1271 | desc[col_name] = col |
1272 | - |
1273 | + |
1274 | #Tags color |
1275 | col_name = 'color' |
1276 | col = {} |
1277 | render_tags = CellRendererTags() |
1278 | render_tags.set_property('ypad', 3) |
1279 | col['title'] = _("Tags") |
1280 | - col['renderer'] = ['tag',render_tags] |
1281 | - col['value'] = [gobject.TYPE_PYOBJECT,lambda node: node] |
1282 | + col['renderer'] = ['tag', render_tags] |
1283 | + col['value'] = [gobject.TYPE_PYOBJECT, lambda node: node] |
1284 | col['expandable'] = False |
1285 | col['resizable'] = False |
1286 | col['order'] = 1 |
1287 | desc[col_name] = col |
1288 | - |
1289 | + |
1290 | #Tag names |
1291 | col_name = 'tagname' |
1292 | col = {} |
1293 | render_text = gtk.CellRendererText() |
1294 | render_text.set_property('ypad', 3) |
1295 | - col['renderer'] = ['markup',render_text] |
1296 | - col['value'] = [str,self.tag_name] |
1297 | + col['renderer'] = ['markup', render_text] |
1298 | + col['value'] = [str, self.tag_name] |
1299 | col['expandable'] = True |
1300 | col['new_column'] = False |
1301 | col['order'] = 2 |
1302 | desc[col_name] = col |
1303 | - |
1304 | + |
1305 | #Tag count |
1306 | col_name = 'tagcount' |
1307 | col = {} |
1308 | @@ -304,8 +308,8 @@ |
1309 | render_text.set_property('xpad', 3) |
1310 | render_text.set_property('ypad', 3) |
1311 | render_text.set_property('xalign', 1.0) |
1312 | - col['renderer'] = ['markup',render_text] |
1313 | - col['value'] = [str,self.get_tag_count] |
1314 | + col['renderer'] = ['markup', render_text] |
1315 | + col['value'] = [str, self.get_tag_count] |
1316 | col['expandable'] = False |
1317 | col['new_column'] = False |
1318 | col['order'] = 3 |
1319 | @@ -313,13 +317,14 @@ |
1320 | |
1321 | self.enable_update_tags() |
1322 | |
1323 | - return self.build_tag_treeview(tree,desc) |
1324 | + return self.build_tag_treeview(tree, desc) |
1325 | |
1326 | def enable_update_tags(self): |
1327 | self.tag_cllbcks = [] |
1328 | |
1329 | tasks = self.req.get_tasks_tree() |
1330 | - for event in 'node-added-inview', 'node-modified-inview', 'node-deleted-inview': |
1331 | + l =['node-added-inview', 'node-modified-inview', 'node-deleted-inview'] |
1332 | + for event in l: |
1333 | handle = tasks.register_cllbck(event, self._update_tags) |
1334 | self.tag_cllbcks.append((event, handle)) |
1335 | |
1336 | @@ -342,18 +347,18 @@ |
1337 | if task: |
1338 | for t in self.req.get_task(node_id).get_tags(): |
1339 | tree.refresh_node(t.get_name()) |
1340 | - |
1341 | - def active_tasks_treeview(self,tree): |
1342 | + |
1343 | + def active_tasks_treeview(self, tree): |
1344 | #Build the title/label/tags columns |
1345 | desc = self.common_desc_for_tasks(tree) |
1346 | - |
1347 | + |
1348 | # "startdate" column |
1349 | col_name = 'startdate' |
1350 | col = {} |
1351 | col['title'] = _("Start date") |
1352 | col['expandable'] = False |
1353 | col['resizable'] = False |
1354 | - col['value'] = [str,self.task_sdate_column] |
1355 | + col['value'] = [str, self.task_sdate_column] |
1356 | col['order'] = 3 |
1357 | col['sorting_func'] = self.start_date_sorting |
1358 | desc[col_name] = col |
1359 | @@ -364,40 +369,40 @@ |
1360 | col['title'] = _("Due") |
1361 | col['expandable'] = False |
1362 | col['resizable'] = False |
1363 | - col['value'] = [str,self.task_duedate_column] |
1364 | + col['value'] = [str, self.task_duedate_column] |
1365 | col['order'] = 4 |
1366 | col['sorting_func'] = self.due_date_sorting |
1367 | desc[col_name] = col |
1368 | |
1369 | #Returning the treeview |
1370 | - treeview = self.build_task_treeview(tree,desc) |
1371 | + treeview = self.build_task_treeview(tree, desc) |
1372 | treeview.set_sort_column('duedate') |
1373 | return treeview |
1374 | - |
1375 | - def closed_tasks_treeview(self,tree): |
1376 | + |
1377 | + def closed_tasks_treeview(self, tree): |
1378 | #Build the title/label/tags columns |
1379 | desc = self.common_desc_for_tasks(tree) |
1380 | - |
1381 | + |
1382 | # "startdate" column |
1383 | col_name = 'closeddate' |
1384 | col = {} |
1385 | col['title'] = _("Closed date") |
1386 | col['expandable'] = False |
1387 | col['resizable'] = False |
1388 | - col['value'] = [str,self.task_cdate_column] |
1389 | + col['value'] = [str, self.task_cdate_column] |
1390 | col['order'] = 3 |
1391 | col['sorting_func'] = self.closed_date_sorting |
1392 | desc[col_name] = col |
1393 | |
1394 | #Returning the treeview |
1395 | - treeview = self.build_task_treeview(tree,desc) |
1396 | + treeview = self.build_task_treeview(tree, desc) |
1397 | treeview.set_sort_column('closeddate') |
1398 | return treeview |
1399 | - |
1400 | - |
1401 | + |
1402 | + |
1403 | #This build the first tag/title columns, common |
1404 | #to both active and closed tasks treeview |
1405 | - def common_desc_for_tasks(self,tree): |
1406 | + def common_desc_for_tasks(self, tree): |
1407 | desc = {} |
1408 | |
1409 | #invisible 'task_id' column |
1410 | @@ -421,20 +426,20 @@ |
1411 | col = {} |
1412 | render_text = gtk.CellRendererText() |
1413 | render_text.set_property("ellipsize", pango.ELLIPSIZE_END) |
1414 | - col['renderer'] = ['markup',render_text] |
1415 | - col['value'] = [str,self.task_title_column] |
1416 | + col['renderer'] = ['markup', render_text] |
1417 | + col['value'] = [str, self.task_title_column] |
1418 | col['visible'] = False |
1419 | col['order'] = 0 |
1420 | col['sorting_func'] = self.title_sorting |
1421 | desc[col_name] = col |
1422 | - |
1423 | + |
1424 | # "tags" column (no title) |
1425 | col_name = 'tags' |
1426 | col = {} |
1427 | render_tags = CellRendererTags() |
1428 | render_tags.set_property('xalign', 0.0) |
1429 | - col['renderer'] = ['tag_list',render_tags] |
1430 | - col['value'] = [gobject.TYPE_PYOBJECT,self.task_tags_column] |
1431 | + col['renderer'] = ['tag_list', render_tags] |
1432 | + col['value'] = [gobject.TYPE_PYOBJECT, self.task_tags_column] |
1433 | col['expandable'] = False |
1434 | col['resizable'] = False |
1435 | col['order'] = 1 |
1436 | @@ -446,18 +451,17 @@ |
1437 | col['title'] = _("Title") |
1438 | render_text = gtk.CellRendererText() |
1439 | render_text.set_property("ellipsize", pango.ELLIPSIZE_END) |
1440 | - col['renderer'] = ['markup',render_text] |
1441 | - col['value'] = [str,self.task_label_column] |
1442 | + col['renderer'] = ['markup', render_text] |
1443 | + col['value'] = [str, self.task_label_column] |
1444 | col['expandable'] = True |
1445 | col['resizable'] = True |
1446 | col['sorting'] = 'title' |
1447 | col['order'] = 2 |
1448 | desc[col_name] = col |
1449 | return desc |
1450 | - |
1451 | - |
1452 | - def build_task_treeview(self,tree,desc): |
1453 | - treeview = AutoExpandTreeView(tree,desc) |
1454 | + |
1455 | + def build_task_treeview(self, tree, desc): |
1456 | + treeview = AutoExpandTreeView(tree, desc) |
1457 | #Now that the treeview is done, we can polish |
1458 | treeview.set_main_search_column('label') |
1459 | treeview.set_expander_column('label') |
1460 | @@ -472,19 +476,19 @@ |
1461 | self.unactive_color = \ |
1462 | treeview.style.text[gtk.STATE_INSENSITIVE].to_string() |
1463 | return treeview |
1464 | - |
1465 | - def build_tag_treeview(self,tree,desc): |
1466 | - treeview = AutoExpandTreeView(tree,desc) |
1467 | + |
1468 | + def build_tag_treeview(self, tree, desc): |
1469 | + treeview = AutoExpandTreeView(tree, desc) |
1470 | # Global treeview properties |
1471 | treeview.set_property("enable-tree-lines", False) |
1472 | treeview.set_rules_hint(False) |
1473 | treeview.set_row_separator_func(self.is_tag_separator_filter) |
1474 | treeview.set_headers_visible(False) |
1475 | treeview.set_dnd_name('gtg/tag-iter-str') |
1476 | - treeview.set_dnd_external('gtg/task-iter-str',self.ontag_task_dnd) |
1477 | + treeview.set_dnd_external('gtg/task-iter-str', self.ontag_task_dnd) |
1478 | #Updating the unactive color (same for everyone) |
1479 | self.unactive_color = \ |
1480 | treeview.style.text[gtk.STATE_INSENSITIVE].to_string() |
1481 | treeview.set_sort_column('tag_id') |
1482 | self.tags_view = treeview |
1483 | - return treeview |
1484 | + return treeview |
1485 | |
1486 | === modified file 'GTG/gtk/colors.py' |
1487 | --- GTG/gtk/colors.py 2012-03-05 15:23:05 +0000 |
1488 | +++ GTG/gtk/colors.py 2012-06-23 11:09:19 +0000 |
1489 | @@ -20,6 +20,7 @@ |
1490 | |
1491 | #Take list of Tags and give the background color that should be applied |
1492 | #The returned color might be None (in which case, the default is used) |
1493 | + |
1494 | def background_color(tags, bgcolor = None): |
1495 | if not bgcolor: |
1496 | bgcolor = gtk.gdk.color_parse("#FFFFFF") |
1497 | @@ -31,27 +32,28 @@ |
1498 | blue = 0 |
1499 | for my_tag in tags: |
1500 | my_color_str = my_tag.get_attribute("color") |
1501 | - if my_color_str : |
1502 | + if my_color_str: |
1503 | my_color = gtk.gdk.color_parse(my_color_str) |
1504 | color_count = color_count + 1 |
1505 | - red = red + my_color.red |
1506 | + red = red + my_color.red |
1507 | green = green + my_color.green |
1508 | - blue = blue + my_color.blue |
1509 | + blue = blue + my_color.blue |
1510 | if color_count != 0: |
1511 | - red = int(red / color_count) |
1512 | - green = int(green / color_count) |
1513 | - blue = int(blue / color_count) |
1514 | + red = int(red / color_count) |
1515 | + green = int(green / color_count) |
1516 | + blue = int(blue / color_count) |
1517 | brightness = (red+green+blue) / 3.0 |
1518 | target_brightness = (bgcolor.red+bgcolor.green+bgcolor.blue)/3.0 |
1519 | - |
1520 | + |
1521 | alpha = (1-abs(brightness-target_brightness)/65535.0)/2.0 |
1522 | red = int(red*alpha + bgcolor.red*(1-alpha)) |
1523 | green = int(green*alpha + bgcolor.green*(1-alpha)) |
1524 | blue = int(blue*alpha + bgcolor.blue*(1-alpha)) |
1525 | - |
1526 | + |
1527 | my_color = gtk.gdk.Color(red, green, blue).to_string() |
1528 | return my_color |
1529 | |
1530 | + |
1531 | def get_colored_tag_markup(req, tag_name, html = False): |
1532 | ''' |
1533 | Given a tag name, returns a string containing the markup to color the |
1534 | @@ -73,6 +75,7 @@ |
1535 | else: |
1536 | return tag_name |
1537 | |
1538 | + |
1539 | def get_colored_tags_markup(req, tag_names): |
1540 | ''' |
1541 | Calls get_colored_tag_markup for each tag_name in tag_names |
1542 | |
1543 | === modified file 'GTG/gtk/crashhandler.py' |
1544 | --- GTG/gtk/crashhandler.py 2012-05-20 19:05:20 +0000 |
1545 | +++ GTG/gtk/crashhandler.py 2012-06-23 11:09:19 +0000 |
1546 | @@ -332,7 +332,7 @@ |
1547 | yield |
1548 | |
1549 | initialize(app_name = "Getting Things GNOME!", |
1550 | - message = "GTG" + info.VERSION + |
1551 | + message = "GTG" + info.VERSION + |
1552 | _(" has crashed. Please report the bug on <a href=\"" |
1553 | "http://bugs.edge.launchpad.net/gtg\">our Launchpad page</a>." |
1554 | " If you have Apport installed, it will be started for you."), |
1555 | |
1556 | === modified file 'GTG/gtk/delete_dialog.py' |
1557 | --- GTG/gtk/delete_dialog.py 2012-03-26 15:38:57 +0000 |
1558 | +++ GTG/gtk/delete_dialog.py 2012-06-23 11:09:19 +0000 |
1559 | @@ -24,18 +24,19 @@ |
1560 | |
1561 | |
1562 | class DeletionUI(): |
1563 | - |
1564 | + |
1565 | MAXIMUM_TIDS_TO_SHOW = 5 |
1566 | + |
1567 | def __init__(self, req): |
1568 | self.req = req |
1569 | self.tids_todelete = [] |
1570 | # Tags which must be updated |
1571 | self.update_tags = [] |
1572 | # Load window tree |
1573 | - self.builder = gtk.Builder() |
1574 | + self.builder = gtk.Builder() |
1575 | self.builder.add_from_file(ViewConfig.DELETE_GLADE_FILE) |
1576 | - signals = { "on_delete_confirm": self.on_delete_confirm, |
1577 | - "on_delete_cancel": lambda x: x.hide,} |
1578 | + signals = {"on_delete_confirm": self.on_delete_confirm, |
1579 | + "on_delete_cancel": lambda x: x.hide, } |
1580 | self.builder.connect_signals(signals) |
1581 | |
1582 | def on_delete_confirm(self, widget): |
1583 | @@ -43,7 +44,7 @@ |
1584 | otherwise, we will look which tid is selected""" |
1585 | for tid in self.tids_todelete: |
1586 | if self.req.has_task(tid): |
1587 | - self.req.delete_task(tid,recursive=True) |
1588 | + self.req.delete_task(tid, recursive=True) |
1589 | self.tids_todelete = [] |
1590 | |
1591 | # Update tags |
1592 | @@ -60,10 +61,11 @@ |
1593 | tasklist=[] |
1594 | self.update_tags = [] |
1595 | for tid in self.tids_todelete: |
1596 | + |
1597 | def recursive_list_tasks(task_list, root): |
1598 | - """Populate a list of all the subtasks and |
1599 | + """Populate a list of all the subtasks and |
1600 | their children, recursively. |
1601 | - |
1602 | + |
1603 | Also collect the list of affected tags |
1604 | which should be refreshed""" |
1605 | if root not in task_list: |
1606 | @@ -78,7 +80,7 @@ |
1607 | task = self.req.get_task(tid) |
1608 | recursive_list_tasks(tasklist, task) |
1609 | |
1610 | - # We fill the text and the buttons' labels according to the number |
1611 | + # We fill the text and the buttons' labels according to the number |
1612 | # of tasks to delete |
1613 | label = self.builder.get_object("label1") |
1614 | label_text = label.get_text() |
1615 | @@ -104,7 +106,7 @@ |
1616 | "Permanently remove tasks", |
1617 | singular)) |
1618 | label_text = label_text[0:label_text.find(":") + 1] |
1619 | - |
1620 | + |
1621 | #we don't want to end with just one task that doesn't fit the |
1622 | # screen and a line saying "And one more task", so we go a |
1623 | # little over our limit |
1624 | @@ -123,7 +125,7 @@ |
1625 | cancel_button = self.builder.get_object("cancel") |
1626 | cancel_button.grab_focus() |
1627 | if delete_dialog.run() != 1: |
1628 | - tasklist = [] |
1629 | + tasklist = [] |
1630 | delete_dialog.hide() |
1631 | return tasklist |
1632 | else: |
1633 | |
1634 | === modified file 'GTG/gtk/editor/__init__.py' |
1635 | --- GTG/gtk/editor/__init__.py 2012-03-26 22:14:55 +0000 |
1636 | +++ GTG/gtk/editor/__init__.py 2012-06-23 11:09:19 +0000 |
1637 | @@ -26,7 +26,7 @@ |
1638 | |
1639 | class GnomeConfig: |
1640 | current_rep = os.path.dirname(os.path.abspath(__file__)) |
1641 | - GLADE_FILE = os.path.join(current_rep, "taskeditor.glade") |
1642 | + GLADE_FILE = os.path.join(current_rep, "taskeditor.glade") |
1643 | |
1644 | MARK_DONE = _("Mark as Done") |
1645 | MARK_UNDONE = _("Mark as not Done") |
1646 | |
1647 | === modified file 'GTG/gtk/editor/editor.py' |
1648 | --- GTG/gtk/editor/editor.py 2012-05-20 18:14:23 +0000 |
1649 | +++ GTG/gtk/editor/editor.py 2012-06-23 11:09:19 +0000 |
1650 | @@ -28,7 +28,7 @@ |
1651 | import gtk |
1652 | |
1653 | from GTG import _, ngettext |
1654 | -from GTG.gtk.editor import GnomeConfig |
1655 | +from GTG.gtk.editor import GnomeConfig |
1656 | from GTG.gtk.editor.taskview import TaskView |
1657 | from GTG.core.plugins.engine import PluginEngine |
1658 | from GTG.core.plugins.api import PluginAPI |
1659 | @@ -36,12 +36,13 @@ |
1660 | from GTG.tools.dates import Date |
1661 | from GTG.gtk.editor.calendar import GTGCalendar |
1662 | |
1663 | + |
1664 | class TaskEditor: |
1665 | |
1666 | - def __init__(self, |
1667 | - requester, |
1668 | - vmanager, |
1669 | - task, |
1670 | + def __init__(self, |
1671 | + requester, |
1672 | + vmanager, |
1673 | + task, |
1674 | taskconfig = None, |
1675 | thisisnew = False, |
1676 | clipboard = None): |
1677 | @@ -89,13 +90,13 @@ |
1678 | "on_move": self.on_move, |
1679 | } |
1680 | self.builder.connect_signals(dic) |
1681 | - self.window = self.builder.get_object("TaskEditor") |
1682 | + self.window = self.builder.get_object("TaskEditor") |
1683 | #Removing the Normal textview to replace it by our own |
1684 | #So don't try to change anything with glade, this is a home-made widget |
1685 | textview = self.builder.get_object("textview") |
1686 | scrolled = self.builder.get_object("scrolledtask") |
1687 | scrolled.remove(textview) |
1688 | - self.textview = TaskView(self.req, self.clipboard) |
1689 | + self.textview = TaskView(self.req, self.clipboard) |
1690 | self.textview.show() |
1691 | self.textview.set_subtask_callback(self.new_subtask) |
1692 | self.textview.open_task_callback(self.vmanager.open_task) |
1693 | @@ -103,11 +104,11 @@ |
1694 | self.textview.set_right_margin(5) |
1695 | scrolled.add(self.textview) |
1696 | #Voila! it's done |
1697 | - self.calendar = GTGCalendar(self.builder) |
1698 | + self.calendar = GTGCalendar(self.builder) |
1699 | self.duedate_widget = self.builder.get_object("duedate_entry") |
1700 | self.startdate_widget = self.builder.get_object("startdate_entry") |
1701 | self.closeddate_widget = self.builder.get_object("closeddate_entry") |
1702 | - self.dayleft_label = self.builder.get_object("dayleft") |
1703 | + self.dayleft_label = self.builder.get_object("dayleft") |
1704 | self.tasksidebar = self.builder.get_object("tasksidebar") |
1705 | # Define accelerator keys |
1706 | self.init_accelerators() |
1707 | @@ -164,14 +165,15 @@ |
1708 | if tid in self.config: |
1709 | if "position" in self.config[tid]: |
1710 | pos = self.config[tid]["position"] |
1711 | - self.move(pos[0],pos[1]) |
1712 | + self.move(pos[0], pos[1]) |
1713 | #print "restoring position %s %s" %(pos[0],pos[1]) |
1714 | if "size" in self.config[tid]: |
1715 | size = self.config[tid]["size"] |
1716 | #print "size %s - %s" %(str(size[0]), str(size[1])) |
1717 | - #this eval(str()) is a ugly (!) hack to accept both int and str |
1718 | + #this eval(str()) is a ugly (!) hack to accept both int and |
1719 | + # str |
1720 | #FIXME: Fix this! |
1721 | - self.window.resize(eval(str(size[0])),eval(str(size[1]))) |
1722 | + self.window.resize(eval(str(size[0])), eval(str(size[1]))) |
1723 | |
1724 | self.textview.set_editable(True) |
1725 | self.window.show() |
1726 | @@ -196,18 +198,21 @@ |
1727 | |
1728 | # Ctrl-Shift-N creates a new subtask |
1729 | insert_subtask = self.builder.get_object("insert_subtask") |
1730 | - key, mod = gtk.accelerator_parse("<Control><Shift>n") |
1731 | - insert_subtask.add_accelerator('clicked', agr, key, mod, gtk.ACCEL_VISIBLE) |
1732 | + key, mod = gtk.accelerator_parse("<Control><Shift>n") |
1733 | + insert_subtask.add_accelerator('clicked', |
1734 | + agr, key, mod, gtk.ACCEL_VISIBLE) |
1735 | |
1736 | # Ctrl-D marks task as done |
1737 | mark_as_done_editor = self.builder.get_object('mark_as_done_editor') |
1738 | key, mod = gtk.accelerator_parse('<Control>d') |
1739 | - mark_as_done_editor.add_accelerator('clicked', agr, key, mod, gtk.ACCEL_VISIBLE) |
1740 | + mark_as_done_editor.add_accelerator('clicked', |
1741 | + agr, key, mod, gtk.ACCEL_VISIBLE) |
1742 | |
1743 | # Ctrl-I marks task as dismissed |
1744 | dismiss_editor = self.builder.get_object('dismiss_editor') |
1745 | key, mod = gtk.accelerator_parse('<Control>i') |
1746 | - dismiss_editor.add_accelerator('clicked', agr, key, mod, gtk.ACCEL_VISIBLE) |
1747 | + dismiss_editor.add_accelerator('clicked', agr, key, mod, |
1748 | + gtk.ACCEL_VISIBLE) |
1749 | |
1750 | #Can be called at any time to reflect the status of the Task |
1751 | #Refresh should never interfere with the TaskView. |
1752 | @@ -219,34 +224,37 @@ |
1753 | if self.window == None: |
1754 | return |
1755 | to_save = False |
1756 | - #title of the window |
1757 | + #title of the window |
1758 | if title: |
1759 | self.window.set_title(title) |
1760 | to_save = True |
1761 | else: |
1762 | self.window.set_title(self.task.get_title()) |
1763 | |
1764 | - status = self.task.get_status() |
1765 | + status = self.task.get_status() |
1766 | if status == Task.STA_DISMISSED: |
1767 | self.donebutton.set_label(GnomeConfig.MARK_DONE) |
1768 | self.donebutton.set_tooltip_text(GnomeConfig.MARK_DONE_TOOLTIP) |
1769 | self.donebutton.set_icon_name("gtg-task-done") |
1770 | self.dismissbutton.set_label(GnomeConfig.MARK_UNDISMISS) |
1771 | - self.dismissbutton.set_tooltip_text(GnomeConfig.MARK_UNDISMISS_TOOLTIP) |
1772 | + self.dismissbutton.set_tooltip_text( |
1773 | + GnomeConfig.MARK_UNDISMISS_TOOLTIP) |
1774 | self.dismissbutton.set_icon_name("gtg-task-undismiss") |
1775 | elif status == Task.STA_DONE: |
1776 | self.donebutton.set_label(GnomeConfig.MARK_UNDONE) |
1777 | self.donebutton.set_tooltip_text(GnomeConfig.MARK_UNDONE_TOOLTIP) |
1778 | self.donebutton.set_icon_name("gtg-task-undone") |
1779 | self.dismissbutton.set_label(GnomeConfig.MARK_DISMISS) |
1780 | - self.dismissbutton.set_tooltip_text(GnomeConfig.MARK_DISMISS_TOOLTIP) |
1781 | + self.dismissbutton.set_tooltip_text( |
1782 | + GnomeConfig.MARK_DISMISS_TOOLTIP) |
1783 | self.dismissbutton.set_icon_name("gtg-task-dismiss") |
1784 | else: |
1785 | self.donebutton.set_label(GnomeConfig.MARK_DONE) |
1786 | self.donebutton.set_tooltip_text(GnomeConfig.MARK_DONE_TOOLTIP) |
1787 | self.donebutton.set_icon_name("gtg-task-done") |
1788 | self.dismissbutton.set_label(GnomeConfig.MARK_DISMISS) |
1789 | - self.dismissbutton.set_tooltip_text(GnomeConfig.MARK_DISMISS_TOOLTIP) |
1790 | + self.dismissbutton.set_tooltip_text( |
1791 | + GnomeConfig.MARK_DISMISS_TOOLTIP) |
1792 | self.dismissbutton.set_icon_name("gtg-task-dismiss") |
1793 | self.donebutton.show() |
1794 | self.tasksidebar.show() |
1795 | @@ -260,14 +268,14 @@ |
1796 | else: |
1797 | self.builder.get_object("label4").hide() |
1798 | self.builder.get_object("hbox4").hide() |
1799 | - self.builder.get_object("label2").show() |
1800 | + self.builder.get_object("label2").show() |
1801 | self.builder.get_object("hbox1").show() |
1802 | |
1803 | #refreshing the start date field |
1804 | startdate = self.task.get_start_date() |
1805 | prevdate = Date.parse(self.startdate_widget.get_text()) |
1806 | if startdate != prevdate: |
1807 | - self.startdate_widget.set_text(str(startdate)) |
1808 | + self.startdate_widget.set_text(str(startdate)) |
1809 | |
1810 | #refreshing the due date field |
1811 | duedate = self.task.get_due_date() |
1812 | @@ -282,8 +290,8 @@ |
1813 | self.closeddate_widget.set_text(str(closeddate)) |
1814 | |
1815 | #refreshing the day left label |
1816 | - #If the task is marked as done, we display the delay between the |
1817 | - #due date and the actual closing date. If the task isn't marked |
1818 | + #If the task is marked as done, we display the delay between the |
1819 | + #due date and the actual closing date. If the task isn't marked |
1820 | #as done, we display the number of days left. |
1821 | if status in [Task.STA_DISMISSED, Task.STA_DONE]: |
1822 | delay = self.task.get_days_late() |
1823 | @@ -292,22 +300,30 @@ |
1824 | elif delay == 0: |
1825 | txt = "Completed on time" |
1826 | elif delay >= 1: |
1827 | - txt = ngettext("Completed %(days)d day late", "Completed %(days)d days late", delay) % {'days': delay} |
1828 | + txt = ngettext("Completed %(days)d day late", |
1829 | + "Completed %(days)d days late", |
1830 | + delay) % {'days': delay} |
1831 | elif delay <= -1: |
1832 | abs_delay = abs(delay) |
1833 | - txt = ngettext("Completed %(days)d day early", "Completed %(days)d days early", abs_delay) % {'days': abs_delay} |
1834 | + txt = ngettext("Completed %(days)d day early", |
1835 | + "Completed %(days)d days early", |
1836 | + abs_delay) % {'days': abs_delay} |
1837 | else: |
1838 | due_date = self.task.get_due_date() |
1839 | result = due_date.days_left() |
1840 | if due_date.is_fuzzy(): |
1841 | txt = "" |
1842 | elif result > 0: |
1843 | - txt = ngettext("Due tomorrow!", "%(days)d days left", result) % {'days': result} |
1844 | + txt = ngettext("Due tomorrow!", |
1845 | + "%(days)d days left", |
1846 | + result) % {'days': result} |
1847 | elif result == 0: |
1848 | txt = _("Due today!") |
1849 | elif result < 0: |
1850 | abs_result = abs(result) |
1851 | - txt = ngettext("Due yesterday!", "Was %(days)d days ago", abs_result) % {'days': abs_result} |
1852 | + txt = ngettext("Due yesterday!", |
1853 | + "Was %(days)d days ago", |
1854 | + abs_result) % {'days': abs_result} |
1855 | window_style = self.window.get_style() |
1856 | color = str(window_style.text[gtk.STATE_INSENSITIVE]) |
1857 | self.dayleft_label.set_markup("<span color='"+color+"'>"+txt+"</span>") |
1858 | @@ -333,7 +349,7 @@ |
1859 | if to_save: |
1860 | self.light_save() |
1861 | |
1862 | - def date_changed(self,widget,data): |
1863 | + def date_changed(self, widget, data): |
1864 | text = widget.get_text() |
1865 | valid = True |
1866 | if not text: |
1867 | @@ -412,7 +428,7 @@ |
1868 | for task in all_subtasks: |
1869 | self.vmanager.close_task(task.get_id()) |
1870 | |
1871 | - def dismiss(self,widget): #pylint: disable-msg=W0613 |
1872 | + def dismiss(self, widget): #pylint: disable-msg=W0613 |
1873 | stat = self.task.get_status() |
1874 | if stat == "Dismiss": |
1875 | self.task.set_status("Active") |
1876 | @@ -422,7 +438,7 @@ |
1877 | self.close_all_subtasks() |
1878 | self.close(None) |
1879 | |
1880 | - def change_status(self,widget): #pylint: disable-msg=W0613 |
1881 | + def change_status(self, widget): #pylint: disable-msg=W0613 |
1882 | stat = self.task.get_status() |
1883 | if stat == "Done": |
1884 | self.task.set_status("Active") |
1885 | @@ -441,7 +457,7 @@ |
1886 | self.vmanager.ask_delete_tasks([self.task.get_id()]) |
1887 | |
1888 | #Take the title as argument and return the subtask ID |
1889 | - def new_subtask(self,title=None,tid=None): |
1890 | + def new_subtask(self, title=None, tid=None): |
1891 | if tid: |
1892 | self.task.add_child(tid) |
1893 | elif title: |
1894 | @@ -456,25 +472,25 @@ |
1895 | task_id = task.get_id() |
1896 | self.vmanager.open_task(task_id) |
1897 | |
1898 | - def insert_subtask(self,widget): #pylint: disable-msg=W0613 |
1899 | + def insert_subtask(self, widget): #pylint: disable-msg=W0613 |
1900 | self.textview.insert_newtask() |
1901 | self.textview.grab_focus() |
1902 | |
1903 | - def inserttag_clicked(self,widget): #pylint: disable-msg=W0613 |
1904 | + def inserttag_clicked(self, widget): #pylint: disable-msg=W0613 |
1905 | itera = self.textview.get_insert() |
1906 | if itera.starts_line(): |
1907 | - self.textview.insert_text("@",itera) |
1908 | + self.textview.insert_text("@", itera) |
1909 | else: |
1910 | - self.textview.insert_text(" @",itera) |
1911 | + self.textview.insert_text(" @", itera) |
1912 | self.textview.grab_focus() |
1913 | |
1914 | - def inserttag(self,widget,tag): #pylint: disable-msg=W0613 |
1915 | + def inserttag(self, widget, tag): #pylint: disable-msg=W0613 |
1916 | self.textview.insert_tags([tag]) |
1917 | self.textview.grab_focus() |
1918 | |
1919 | def save(self): |
1920 | self.task.set_title(self.textview.get_title()) |
1921 | - self.task.set_text(self.textview.get_text()) |
1922 | + self.task.set_text(self.textview.get_text()) |
1923 | self.task.sync() |
1924 | if self.config != None: |
1925 | self.config.write() |
1926 | @@ -493,22 +509,22 @@ |
1927 | if tosave: |
1928 | self.save() |
1929 | |
1930 | - #This will bring the Task Editor to front |
1931 | + #This will bring the Task Editor to front |
1932 | def present(self): |
1933 | self.window.present() |
1934 | |
1935 | - def move(self,x,y): |
1936 | + def move(self, x, y): |
1937 | try: |
1938 | xx=int(x) |
1939 | yy=int(y) |
1940 | - self.window.move(xx,yy) |
1941 | + self.window.move(xx, yy) |
1942 | except: |
1943 | pass |
1944 | |
1945 | def get_position(self): |
1946 | return self.window.get_position() |
1947 | |
1948 | - def on_move(self,widget,event): |
1949 | + def on_move(self, widget, event): |
1950 | #saving the position |
1951 | if self.config != None: |
1952 | tid = self.task.get_id() |
1953 | @@ -519,17 +535,18 @@ |
1954 | self.config[tid]["size"] = self.window.get_size() |
1955 | |
1956 | #We define dummy variable for when close is called from a callback |
1957 | - def close(self,window=None,a=None,b=None,c=None): #pylint: disable-msg=W0613 |
1958 | + def close(self, window=None, a=None, b=None, c=None): |
1959 | + #pylint: disable-msg=W0613 |
1960 | #We should also destroy the whole taskeditor object. |
1961 | if self.window: |
1962 | self.window.destroy() |
1963 | self.window = None |
1964 | |
1965 | - #The destroy signal is linked to the "close" button. So if we call |
1966 | - #destroy in the close function, this will cause the close to be called twice |
1967 | + #The destroy signal is linked to the "close" button. So if we call destroy |
1968 | + #in the close function, this will cause the close to be called twice |
1969 | #To solve that, close will just call "destroy" and the destroy signal |
1970 | #Will be linked to this destruction method that will save the task |
1971 | - def destruction(self,a=None): |
1972 | + def destruction(self, a=None): |
1973 | #Save should be also called when buffer is modified |
1974 | self.pengine.onTaskClose(self.plugin_api) |
1975 | self.pengine.remove_api(self.plugin_api) |
1976 | |
1977 | === modified file 'GTG/gtk/editor/taskview.py' |
1978 | --- GTG/gtk/editor/taskview.py 2012-05-20 19:05:20 +0000 |
1979 | +++ GTG/gtk/editor/taskview.py 2012-06-23 11:09:19 +0000 |
1980 | @@ -16,8 +16,6 @@ |
1981 | # You should have received a copy of the GNU General Public License along with |
1982 | # this program. If not, see <http://www.gnu.org/licenses/>. |
1983 | # ----------------------------------------------------------------------------- |
1984 | - |
1985 | - |
1986 | """ |
1987 | This class implements a gtk.TextView but with many other features |
1988 | like hyperlink and other stuff special for GTG |
1989 | @@ -40,10 +38,10 @@ |
1990 | from GTG.gtk.editor import taskviewserial |
1991 | from GTG.tools import urlregex |
1992 | |
1993 | -separators = [' ', ',', '\n', '\t', '!', '?', ';', '\0','(',')'] |
1994 | +separators = [' ', ',', '\n', '\t', '!', '?', ';', '\0', '(', ')'] |
1995 | #those separators are only separators if followed by a space. Else, they |
1996 | #are part of the word |
1997 | -specials_separators = ['.','/'] |
1998 | +specials_separators = ['.', '/'] |
1999 | |
2000 | bullet1_ltr = '→' |
2001 | bullet1_rtl = '←' |
2002 | @@ -83,7 +81,8 @@ |
2003 | raise AttributeError('unknown property %s' % prop.name) |
2004 | |
2005 | #Yes, we want to redefine the buffer. Disabling pylint on that error. |
2006 | - def __init__(self, requester, clipboard, buffer=None): #pylint: disable-msg=W0622 |
2007 | + def __init__(self, requester, clipboard, buffer=None): |
2008 | + #pylint: disable-msg=W0622 |
2009 | gtk.TextView.__init__(self, buffer) |
2010 | self.buff = self.get_buffer() |
2011 | self.req = requester |
2012 | @@ -94,11 +93,11 @@ |
2013 | self.failedlink = {'background': 'white', 'foreground': '#ff5454', \ |
2014 | 'underline': pango.UNDERLINE_NONE, \ |
2015 | 'strikethrough': False} |
2016 | - self.done = {'background': 'white', 'foreground': 'gray',\ |
2017 | + self.done = {'background': 'white', 'foreground': 'gray',\ |
2018 | 'strikethrough': True} |
2019 | self.active = {'background': 'light gray', 'foreground': '#ff1e00',\ |
2020 | 'underline': pango.UNDERLINE_SINGLE} |
2021 | - self.hover = {'background': 'light gray'} |
2022 | + self.hover = {'background': 'light gray'} |
2023 | self.tag = {'background': "#FFea00", 'foreground': 'black'} |
2024 | self.indent = {'scale': 1.4, 'editable': False, 'left-margin': 10, |
2025 | "accumulative-margin": True} |
2026 | @@ -108,7 +107,7 @@ |
2027 | # but set in self.modified) |
2028 | self.table = self.buff.get_tag_table() |
2029 | # Tag for title |
2030 | - self.title_tag = self.buff.create_tag("title", foreground="#007bff", \ |
2031 | + self.title_tag = self.buff.create_tag("title", foreground="#007bff",\ |
2032 | scale=1.6, underline=1) |
2033 | self.title_tag.set_property("pixels-above-lines", 10) |
2034 | self.title_tag.set_property("pixels-below-lines", 10) |
2035 | @@ -129,9 +128,10 @@ |
2036 | e: self.table.foreach(self.__tag_reset, e.window)) |
2037 | self.insert_sigid = self.buff.connect('insert-text', \ |
2038 | self._insert_at_cursor) |
2039 | - self.delete_sigid = self.buff.connect("delete-range", self._delete_range) |
2040 | - self.connect('copy-clipboard', self.copy_clipboard,"copy") |
2041 | - self.connect('cut-clipboard', self.copy_clipboard,"cut") |
2042 | + self.delete_sigid = self.buff.connect("delete-range", |
2043 | + self._delete_range) |
2044 | + self.connect('copy-clipboard', self.copy_clipboard, "copy") |
2045 | + self.connect('cut-clipboard', self.copy_clipboard, "cut") |
2046 | self.connect('paste-clipboard', self.paste_clipboard) |
2047 | |
2048 | self.connect('drag-data-received', self.drag_receive) |
2049 | @@ -146,8 +146,10 @@ |
2050 | self.mime_type = 'application/x-gtg-task' |
2051 | serializer = taskviewserial.Serializer() |
2052 | unserializer = taskviewserial.Unserializer(self) |
2053 | - self.buff.register_serialize_format(self.mime_type, serializer.serialize, None) |
2054 | - self.buff.register_deserialize_format(self.mime_type, unserializer.unserialize, None) |
2055 | + self.buff.register_serialize_format(self.mime_type, |
2056 | + serializer.serialize, None) |
2057 | + self.buff.register_deserialize_format(self.mime_type, |
2058 | + unserializer.unserialize, None) |
2059 | |
2060 | #The list of callbacks we have to set |
2061 | self.remove_tag_callback = None |
2062 | @@ -156,7 +158,7 @@ |
2063 | self.get_subtasks = None |
2064 | self.remove_subtask =None |
2065 | self.__refresh_cb = None # refresh the editor window |
2066 | - self.open_task = None # open another task |
2067 | + self.open_task = None # open another task |
2068 | self.new_subtask_callback = None # create a subtask |
2069 | self.save_task = None #This will save the task without refreshing all |
2070 | |
2071 | @@ -185,7 +187,8 @@ |
2072 | #editable means that the user can edit the taskview |
2073 | #this is initially set at False and then to True once the editor window |
2074 | #is displayed. |
2075 | - #this is used to avoid saving the task when the window is still not displayed |
2076 | + #this is used to avoid saving the task when the window is still |
2077 | + #not displayed |
2078 | def set_editable(self, boule): |
2079 | self.editable = boule |
2080 | |
2081 | @@ -270,7 +273,8 @@ |
2082 | |
2083 | #reconnect |
2084 | if reconnect_insert: |
2085 | - self.insert_sigid = self.buff.connect('insert-text', self._insert_at_cursor) |
2086 | + self.insert_sigid = self.buff.connect('insert-text', |
2087 | + self._insert_at_cursor) |
2088 | if reconnect_modified: |
2089 | self.modified_sigid = self.buff.connect("changed", self.modified) |
2090 | |
2091 | @@ -308,7 +312,6 @@ |
2092 | else: |
2093 | return True |
2094 | |
2095 | - |
2096 | def create_anchor_tag(self, b, anchor, text=None, typ=None): |
2097 | #We cannot have two tags with the same name |
2098 | #That's why the link tag has no name |
2099 | @@ -326,7 +329,8 @@ |
2100 | if linktype == 'link' and not self.check_link(anchor): |
2101 | linktype = 'failedlink' |
2102 | |
2103 | - tag = b.create_tag(None, **self.get_property(linktype)) #pylint: disable-msg=W0142 |
2104 | + tag = b.create_tag(None, **self.get_property(linktype)) |
2105 | + #pylint: disable-msg=W0142 |
2106 | tag.set_data('is_anchor', True) |
2107 | tag.set_data('link', anchor) |
2108 | if typ: |
2109 | @@ -349,7 +353,8 @@ |
2110 | if ss.begins_tag(t) and ee.ends_tag(t): |
2111 | already = True |
2112 | if not texttag: |
2113 | - texttag = buff.create_tag(None,**self.get_property('tag'))#pylint: disable-msg=W0142 |
2114 | + texttag = buff.create_tag(None, **self.get_property('tag')) |
2115 | + #pylint: disable-msg=W0142 |
2116 | texttag.set_data('is_tag', True) |
2117 | texttag.set_data('tagname', tag) |
2118 | #This one is for marks |
2119 | @@ -371,7 +376,8 @@ |
2120 | tex = buff.get_text(i_s, i_e) |
2121 | if len(tex) > 0: |
2122 | self.req.get_task(subtask).set_title(tex) |
2123 | - texttag = self.create_anchor_tag(buff, subtask, text=tex, typ="subtask") |
2124 | + texttag = self.create_anchor_tag(buff, subtask, text=tex, |
2125 | + typ="subtask") |
2126 | texttag.set_data('is_subtask', True) |
2127 | texttag.set_data('child', subtask) |
2128 | #This one is for marks |
2129 | @@ -382,7 +388,8 @@ |
2130 | buff.delete_mark(e) |
2131 | |
2132 | def create_indent_tag(self, buff, level): |
2133 | - tag = buff.create_tag(None, **self.get_property('indent'))#pylint: disable-msg=W0142 |
2134 | + tag = buff.create_tag(None, **self.get_property('indent')) |
2135 | + #pylint: disable-msg=W0142 |
2136 | tag.set_data('is_indent', True) |
2137 | tag.set_data('indent_level', level) |
2138 | return tag |
2139 | @@ -409,10 +416,12 @@ |
2140 | if tt.get_data('is_tag'): |
2141 | newline = False |
2142 | firstline.forward_to_line_end() |
2143 | - #Now we should check if the current char is a separator or not |
2144 | + #Now we should check if the current char |
2145 | + #is a separator or not |
2146 | #Currently, we insert a space |
2147 | self.insert_text(" ", firstline) |
2148 | - #Now we check if this newline is empty (it contains only " " and ",") |
2149 | + #Now we check if this newline is empty |
2150 | + #(it contains only " " and ",") |
2151 | # if newline: |
2152 | # endline = firstline.copy() |
2153 | # if not endline.ends_line(): |
2154 | @@ -434,7 +443,7 @@ |
2155 | ntags = ntags - 1 |
2156 | self.insert_at_mark(self.buff, line_mark, t) |
2157 | if ntags != 0: |
2158 | - self.insert_at_mark(self.buff, line_mark,",") |
2159 | + self.insert_at_mark(self.buff, line_mark, ",") |
2160 | self.buff.delete_mark(line_mark) |
2161 | self.modified(full=True) |
2162 | |
2163 | @@ -490,7 +499,7 @@ |
2164 | stripped = title.strip(' \n\t') |
2165 | return stripped |
2166 | |
2167 | -### PRIVATE FUNCTIONS ########################################################## |
2168 | +### PRIVATE FUNCTIONS ####################################################### |
2169 | |
2170 | |
2171 | #This function is called so frequently that we should optimize it more. |
2172 | @@ -538,7 +547,9 @@ |
2173 | #subt_list = self.get_subtasks() |
2174 | #First, we remove the olds tags |
2175 | tag_list = [] |
2176 | - def subfunc(texttag, data=None): #pylint: disable-msg=W0613 |
2177 | + |
2178 | + def subfunc(texttag, data=None): |
2179 | + #pylint: disable-msg=W0613 |
2180 | if texttag.get_data('is_subtask'): |
2181 | tag_list.append(texttag) |
2182 | table.foreach(subfunc) |
2183 | @@ -581,8 +592,10 @@ |
2184 | def _detect_url(self, buff, start, end): |
2185 | #subt_list = self.get_subtasks() |
2186 | #First, we remove the olds tags |
2187 | + |
2188 | tag_list = [] |
2189 | table = buff.get_tag_table() |
2190 | + |
2191 | def subfunc(texttag, data=None): |
2192 | if texttag.get_data('is_anchor'): |
2193 | tag_list.append(texttag) |
2194 | @@ -592,7 +605,7 @@ |
2195 | #Now we add the tag URL |
2196 | it = start.copy() |
2197 | prev = start.copy() |
2198 | - while (it.get_offset() < end.get_offset()) and (it.get_char() != '\0'): |
2199 | + while(it.get_offset() < end.get_offset()) and (it.get_char() != '\0'): |
2200 | it.forward_word_end() |
2201 | prev = it.copy() |
2202 | prev.backward_word_start() |
2203 | @@ -606,7 +619,8 @@ |
2204 | # For short URL we must add http:// prefix |
2205 | if text == "www": |
2206 | url = "http://" + url |
2207 | - texttag = self.create_anchor_tag(buff, url, text=None, typ="http") |
2208 | + texttag = self.create_anchor_tag(buff, url, |
2209 | + text=None, typ="http") |
2210 | it = prev.copy() |
2211 | it.forward_chars(m.end()) |
2212 | buff.apply_tag(texttag, prev, it) |
2213 | @@ -624,11 +638,14 @@ |
2214 | if url.startswith("bug #") or url.startswith("lp #"): |
2215 | topoint = "https://launchpad.net/bugs/%s" %nbr |
2216 | elif url.startswith("bgo #"): |
2217 | - topoint = "http://bugzilla.gnome.org/show_bug.cgi?id=%s" %nbr |
2218 | + topoint = "http://bugzilla.gnome.org/show_bug.cgi?\ |
2219 | + id=%s" %nbr |
2220 | elif url.startswith("bko #"): |
2221 | - topoint = "https://bugs.kde.org/show_bug.cgi?id=%s" %nbr |
2222 | + topoint = "https://bugs.kde.org/show_bug.cgi?id=%s"\ |
2223 | + %nbr |
2224 | elif url.startswith("fdo #"): |
2225 | - topoint = "http://bugs.freedesktop.org/show_bug.cgi?id=%s" %nbr |
2226 | + topoint = "http://bugs.freedesktop.org/show_bug.cgi?\ |
2227 | + id=%s" %nbr |
2228 | if topoint: |
2229 | texttag = self.create_anchor_tag(buff,\ |
2230 | topoint, text=None, typ="http") |
2231 | @@ -645,7 +662,7 @@ |
2232 | new_tags = [] |
2233 | #We must be strictly < than the end_offset. If not, we might |
2234 | #find the beginning of a tag on the nextline |
2235 | - while (it.get_offset() < end.get_offset()) and (it.get_char() != '\0'): |
2236 | + while(it.get_offset() < end.get_offset()) and (it.get_char() != '\0'): |
2237 | if it.begins_tag(): |
2238 | tags = it.get_toggled_tags(True) |
2239 | for ta in tags: |
2240 | @@ -658,30 +675,34 @@ |
2241 | #Removing the marks if they exist |
2242 | mark1 = buff.get_mark(tagname) |
2243 | if mark1: |
2244 | - offset1 = buff.get_iter_at_mark(mark1).get_offset() |
2245 | - if start.get_offset() <= offset1 <= end.get_offset(): |
2246 | + iterator = buff.get_iter_at_mark(mark1) |
2247 | + offset1 = iterator.get_offset() |
2248 | + if start.get_offset() <= offset1 <= \ |
2249 | + end.get_offset(): |
2250 | buff.delete_mark_by_name(tagname) |
2251 | mark2 = buff.get_mark("/%s"%tagname) |
2252 | if mark2: |
2253 | - offset2 = buff.get_iter_at_mark(mark2).get_offset() |
2254 | - if start.get_offset() <= offset2 <= end.get_offset(): |
2255 | + iterator = buff.get_iter_at_mark(mark2) |
2256 | + offset2 = iterator.get_offset() |
2257 | + if start.get_offset() <= offset2 <= \ |
2258 | + end.get_offset(): |
2259 | buff.delete_mark_by_name("/%s"%tagname) |
2260 | it.forward_char() |
2261 | |
2262 | # Set iterators for word |
2263 | word_start = start.copy() |
2264 | - word_end = start.copy() |
2265 | + word_end = start.copy() |
2266 | |
2267 | # Set iterators for char |
2268 | char_start = start.copy() |
2269 | - char_end = start.copy() |
2270 | + char_end = start.copy() |
2271 | char_end.forward_char() |
2272 | last_char = None |
2273 | |
2274 | # Iterate over characters of the line to get words |
2275 | while char_end.compare(end) <= 0: |
2276 | do_word_check = False |
2277 | - my_char = buff.get_text(char_start, char_end) |
2278 | + my_char = buff.get_text(char_start, char_end) |
2279 | if my_char not in separators: |
2280 | last_char = my_char |
2281 | word_end = char_end.copy() |
2282 | @@ -707,7 +728,8 @@ |
2283 | #and it shouldn't start with @@ (bug 531553) |
2284 | if len(my_word) > 1 and my_word[0] == '@' \ |
2285 | and not my_word[1] == '@': |
2286 | - #self.apply_tag_tag(buff, my_word, word_start, word_end) |
2287 | + #self.apply_tag_tag(buff, my_word, |
2288 | + # word_start, word_end) |
2289 | #We will add mark where tag should be applied |
2290 | buff.create_mark(my_word, word_start, True) |
2291 | buff.create_mark("/%s"%my_word, word_end, False) |
2292 | @@ -718,7 +740,7 @@ |
2293 | |
2294 | # We set new word boundaries |
2295 | word_start = char_end.copy() |
2296 | - word_end = char_end.copy() |
2297 | + word_end = char_end.copy() |
2298 | |
2299 | # Stop loop if we are at the end |
2300 | if char_end.compare(end) == 0: |
2301 | @@ -768,7 +790,7 @@ |
2302 | # buff.remove_tag(ta, start, endindent) |
2303 | #Now we delete all, char after char |
2304 | it = start.copy() |
2305 | - while (it.get_offset() <= end.get_offset()) and (it.get_char() != '\0'): |
2306 | + while(it.get_offset() <= end.get_offset()) and (it.get_char() != '\0'): |
2307 | if it.begins_tag(): |
2308 | tags = it.get_tags() |
2309 | for ta in tags: |
2310 | @@ -798,7 +820,8 @@ |
2311 | #now we really delete the selected stuffs |
2312 | selec = self.buff.get_selection_bounds() |
2313 | # if selec: |
2314 | -# print "deleted text is ##%s##" %self.buff.get_text(selec[0], selec[1])#(start, end) |
2315 | +# print "deleted text is ##%s##" |
2316 | +# %self.buff.get_text(selec[0], selec[1])#(start, end) |
2317 | # self.buff.disconnect(self.delete_sigid) |
2318 | # self.disconnect(self.backspace_sigid) |
2319 | # self.buff.stop_emission("delete-range") |
2320 | @@ -807,16 +830,18 @@ |
2321 | # else: |
2322 | # end.forward_char() |
2323 | # self.buff.backspace(end, False, True) |
2324 | -# self.delete_sigid = self.buff.connect("delete-range", self._delete_range) |
2325 | +# self.delete_sigid = self.buff.connect("delete-range", |
2326 | +# self._delete_range) |
2327 | # self.backspace_sigid = self.connect("backspace", self.backspace) |
2328 | #We return false so the parent still get the signal |
2329 | return False |
2330 | |
2331 | - #Apply the title and return an iterator after that title.buff.get_iter_at_mar |
2332 | + #Apply the title and return an iterator after that |
2333 | + #title.buff.get_iter_at_mar |
2334 | def _apply_title(self, buff, refresheditor=True): |
2335 | - start = buff.get_start_iter() |
2336 | - end = buff.get_end_iter() |
2337 | - line_nbr = 1 |
2338 | + start = buff.get_start_iter() |
2339 | + end = buff.get_end_iter() |
2340 | + line_nbr = 1 |
2341 | linecount = buff.get_line_count() |
2342 | |
2343 | # Apply the title tag on the first line |
2344 | @@ -828,14 +853,14 @@ |
2345 | # Applying title on the first line |
2346 | title_end = buff.get_iter_at_line(line_nbr-1) |
2347 | title_end.forward_to_line_end() |
2348 | - stripped = buff.get_text(title_start, title_end).strip('\n\t ') |
2349 | + stripped = buff.get_text(title_start, title_end).strip('\n\t ') |
2350 | # Here we ignore lines that are blank |
2351 | # Title is the first written line |
2352 | while line_nbr <= linecount and not stripped: |
2353 | - line_nbr += 1 |
2354 | - title_end = buff.get_iter_at_line(line_nbr-1) |
2355 | + line_nbr += 1 |
2356 | + title_end = buff.get_iter_at_line(line_nbr-1) |
2357 | title_end.forward_to_line_end() |
2358 | - stripped = buff.get_text(title_start, title_end).strip('\n\t ') |
2359 | + stripped = buff.get_text(title_start, title_end).strip('\n\t ') |
2360 | # Or to all the buffer if there is only one line |
2361 | else: |
2362 | title_end = end.copy() |
2363 | @@ -846,8 +871,6 @@ |
2364 | self.refresh(buff.get_text(title_start, title_end).strip('\n\t')) |
2365 | return title_end |
2366 | |
2367 | - |
2368 | - |
2369 | def __newsubtask(self, buff, title, line_nbr, level=1): |
2370 | anchor = self.new_subtask_callback(title) |
2371 | end_i = self.write_subtask(buff, line_nbr, anchor, level=level) |
2372 | @@ -875,10 +898,10 @@ |
2373 | #be in the subtask title |
2374 | start_i = buff.get_iter_at_line(line_nbr) |
2375 | start_i.forward_to_line_end() |
2376 | - buff.insert(start_i,"\n") |
2377 | + buff.insert(start_i, "\n") |
2378 | #Ok, now we can start working |
2379 | start_i = buff.get_iter_at_line(line_nbr) |
2380 | - end_i = start_i.copy() |
2381 | + end_i = start_i.copy() |
2382 | #We go back at the end of the previous line |
2383 | # start_i.backward_char() |
2384 | # #But only if this is not the title. |
2385 | @@ -886,9 +909,9 @@ |
2386 | # if start_i.has_tag(self.title_tag): |
2387 | # start_i.forward_char() |
2388 | # insert_enter = False |
2389 | - start = buff.create_mark("start", start_i, True) |
2390 | + start = buff.create_mark("start", start_i, True) |
2391 | end_i.forward_line() |
2392 | - end = buff.create_mark("end", end_i, False) |
2393 | + end = buff.create_mark("end", end_i, False) |
2394 | buff.delete(start_i, end_i) |
2395 | start_i = buff.get_iter_at_mark(start) |
2396 | self.insert_indent(buff, start_i, level, enter=insert_enter) |
2397 | @@ -905,7 +928,8 @@ |
2398 | #buff.delete_mark(end) |
2399 | |
2400 | if reconnect_insert: |
2401 | - self.insert_sigid = self.buff.connect('insert-text', self._insert_at_cursor) |
2402 | + self.insert_sigid = self.buff.connect('insert-text', |
2403 | + self._insert_at_cursor) |
2404 | if reconnect_modified: |
2405 | self.modified_sigid = self.buff.connect("changed", self.modified) |
2406 | return end_i |
2407 | @@ -936,7 +960,7 @@ |
2408 | if line == self.buff.get_line_count(): |
2409 | itera.forward_to_line_end() |
2410 | mark = self.buff.create_mark(None, itera, True) |
2411 | - self.buff.insert(itera,"\n") |
2412 | + self.buff.insert(itera, "\n") |
2413 | itera = self.buff.get_iter_at_mark(mark) |
2414 | self.buff.delete_mark(mark) |
2415 | |
2416 | @@ -946,7 +970,7 @@ |
2417 | enter = True |
2418 | if itera.starts_line(): |
2419 | mark = self.buff.create_mark(None, itera, True) |
2420 | - self.buff.insert(itera,"\n") |
2421 | + self.buff.insert(itera, "\n") |
2422 | itera = self.buff.get_iter_at_mark(mark) |
2423 | self.buff.delete_mark(mark) |
2424 | enter = False |
2425 | @@ -977,9 +1001,9 @@ |
2426 | #It will be later replaced by the good one with right gravity |
2427 | temp_mark = self.buff.create_mark("temp", start_i, True) |
2428 | |
2429 | - end = buff.create_mark("end", start_i, False) |
2430 | + end = buff.create_mark("end", start_i, False) |
2431 | if enter: |
2432 | - buff.insert(start_i,"\n") |
2433 | + buff.insert(start_i, "\n") |
2434 | |
2435 | #Moving the end of subtask mark to the position of the temp mark |
2436 | if stag: |
2437 | @@ -994,7 +1018,7 @@ |
2438 | #This is normally not needed and purely defensive |
2439 | if itera.get_line() <= 0: |
2440 | itera = buff.get_iter_at_line(1) |
2441 | - start = buff.create_mark("start", itera, True) |
2442 | + start = buff.create_mark("start", itera, True) |
2443 | indentation = "" |
2444 | #adding two spaces by level |
2445 | spaces = " " |
2446 | @@ -1007,7 +1031,6 @@ |
2447 | self.__apply_tag_to_mark(start, end, tag=indenttag) |
2448 | return end |
2449 | |
2450 | - |
2451 | def __apply_tag_to_mark(self, start, end, tag=None, name=None): |
2452 | start_i = self.buff.get_iter_at_mark(start) |
2453 | end_i = self.buff.get_iter_at_mark(end) |
2454 | @@ -1027,9 +1050,8 @@ |
2455 | else: |
2456 | buff.insert(ite, text) |
2457 | |
2458 | - |
2459 | def _get_indent_level(self, itera): |
2460 | - line_nbr = itera.get_line() |
2461 | + line_nbr = itera.get_line() |
2462 | start_line = itera.copy() |
2463 | start_line.set_line(line_nbr) |
2464 | tags = start_line.get_tags() |
2465 | @@ -1046,10 +1068,10 @@ |
2466 | |
2467 | #First, we analyse the selection to put in our own |
2468 | #GTG clipboard a selection with description of subtasks |
2469 | - bounds = self.buff.get_selection_bounds() |
2470 | + bounds = self.buff.get_selection_bounds() |
2471 | if not bounds: |
2472 | return |
2473 | - start, stop = self.buff.get_selection_bounds() |
2474 | + start, stop = self.buff.get_selection_bounds() |
2475 | |
2476 | self.clipboard.copy(start, stop, bullet=self.bullet1) |
2477 | |
2478 | @@ -1105,10 +1127,10 @@ |
2479 | |
2480 | #First, we will get the actual indentation value |
2481 | #The nbr just before the \n |
2482 | - line_nbr = itera.get_line() |
2483 | + line_nbr = itera.get_line() |
2484 | start_line = itera.copy() |
2485 | start_line.set_line(line_nbr) |
2486 | - end_line = itera.copy() |
2487 | + end_line = itera.copy() |
2488 | tags = start_line.get_tags() |
2489 | subtask_nbr = None |
2490 | current_indent = self._get_indent_level(itera) |
2491 | @@ -1157,24 +1179,28 @@ |
2492 | #the "-" might be after a space |
2493 | #Python 2.5 should allow both tests in one |
2494 | if current_indent == 0: |
2495 | - if (line.startswith('-') or line.startswith(' -')) and line.lstrip(' -').strip() != "": |
2496 | + if (line.startswith('-') or line.startswith(' -')) \ |
2497 | + and line.lstrip(' -').strip() != "": |
2498 | line = line.lstrip(' -') |
2499 | - end_i = self.__newsubtask(self.buff, line, line_nbr) |
2500 | + end_i = self.__newsubtask(self.buff, |
2501 | + line, line_nbr) |
2502 | #Here, we should increment indent level |
2503 | #If we inserted enter in the middle of a line |
2504 | if restofline and restofline.strip() != "": |
2505 | #it means we have two subtask to create |
2506 | if self.buff.get_line_count() > line_nbr+1: |
2507 | #but don't merge with the next line |
2508 | - itera = self.buff.get_iter_at_line(line_nbr+1) |
2509 | - self.buff.insert(itera,"\n\n") |
2510 | + buff = self.buff |
2511 | + itera = buff.get_iter_at_line(line_nbr+1) |
2512 | + self.buff.insert(itera, "\n\n") |
2513 | self.__newsubtask(self.buff, restofline,\ |
2514 | line_nbr+1) |
2515 | else: |
2516 | - self.insert_indent(self.buff, end_i, 1, enter=True) |
2517 | + self.insert_indent(self.buff, end_i, |
2518 | + 1, enter=True) |
2519 | tv.emit_stop_by_name('insert-text') |
2520 | else: |
2521 | - self.buff.insert(itera,"\n") |
2522 | + self.buff.insert(itera, "\n") |
2523 | tv.emit_stop_by_name('insert-text') |
2524 | |
2525 | #Then, if indent > 0, we increment it |
2526 | @@ -1191,22 +1217,26 @@ |
2527 | else: |
2528 | #we first put the subtask one line below |
2529 | itera2 = self.buff.get_iter_at_line(line_nbr) |
2530 | - self.buff.insert(itera2,"\n") |
2531 | + self.buff.insert(itera2, "\n") |
2532 | #and increment the new white line |
2533 | itera2 = self.buff.get_iter_at_line(line_nbr) |
2534 | - self.insert_indent(self.buff, itera2, current_indent, enter=False) |
2535 | + self.insert_indent(self.buff, itera2, |
2536 | + current_indent, enter=False) |
2537 | elif current_indent == 1: |
2538 | - self.insert_indent(self.buff, itera, current_indent) |
2539 | + self.insert_indent(self.buff, itera, |
2540 | + current_indent) |
2541 | #we stop the signal in all cases |
2542 | tv.emit_stop_by_name('insert-text') |
2543 | #Then we close the tag tag |
2544 | if closed_tag: |
2545 | insert_mark = self.buff.get_mark("insert_point") |
2546 | insert_iter = self.buff.get_iter_at_mark(insert_mark) |
2547 | - self.buff.move_mark_by_name("/%s"%closed_tag, insert_iter) |
2548 | + self.buff.move_mark_by_name("/%s"%closed_tag, |
2549 | + insert_iter) |
2550 | self.buff.delete_mark(insert_mark) |
2551 | if cutting_subtask: |
2552 | - cursor = self.buff.get_iter_at_mark(self.buff.get_insert()) |
2553 | + mark = self.buff.get_insert() |
2554 | + cursor = self.buff.get_iter_at_mark(mark) |
2555 | endl = cursor.copy() |
2556 | if not endl.ends_line(): |
2557 | endl.forward_to_line_end() |
2558 | @@ -1222,7 +1252,7 @@ |
2559 | if itera.starts_line(): |
2560 | #we are at the start of an existing subtask |
2561 | #we simply move that subtask down |
2562 | - self.buff.insert(itera,"\n") |
2563 | + self.buff.insert(itera, "\n") |
2564 | itera2 = self.buff.get_iter_at_line(line_nbr) |
2565 | self.buff.insert(itera2, tex) |
2566 | itera3 = self.buff.get_iter_at_line(line_nbr) |
2567 | @@ -1230,25 +1260,28 @@ |
2568 | self.buff.place_cursor(itera3) |
2569 | tv.emit_stop_by_name('insert-text') |
2570 | else: |
2571 | - #self.__newsubtask(self.buff, tex, line_nbr, level=current_indent) |
2572 | + #self.__newsubtask(self.buff, tex, line_nbr, |
2573 | + # level=current_indent) |
2574 | anchor = self.new_subtask_callback(tex) |
2575 | self.buff.create_mark(anchor, itera, True) |
2576 | self.buff.create_mark("/%s"%anchor, itera, False) |
2577 | - self.insert_sigid = self.buff.connect('insert-text', self._insert_at_cursor) |
2578 | + self.insert_sigid = self.buff.connect('insert-text', |
2579 | + self._insert_at_cursor) |
2580 | self.connect('key_press_event', self._keypress) |
2581 | self.modified_sigid = self.buff.connect("changed", self.modified) |
2582 | |
2583 | def _keypress(self, widget, event): |
2584 | # Check for Ctrl-Return/Enter |
2585 | - if event.state & gtk.gdk.CONTROL_MASK and event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter): |
2586 | + if event.state & gtk.gdk.CONTROL_MASK and event.keyval in \ |
2587 | + (gtk.keysyms.Return, gtk.keysyms.KP_Enter): |
2588 | buff = self.buff |
2589 | cursor_mark = buff.get_insert() |
2590 | cursor_iter = buff.get_iter_at_mark(cursor_mark) |
2591 | local_start = cursor_iter.copy() |
2592 | |
2593 | for tag in local_start.get_tags(): |
2594 | - anchor = tag.get_data('link') |
2595 | - typ = tag.get_data('type') |
2596 | + anchor = tag.get_data('link') |
2597 | + typ = tag.get_data('type') |
2598 | if(anchor): |
2599 | if typ == "subtask": |
2600 | self.open_task(anchor) |
2601 | @@ -1284,7 +1317,6 @@ |
2602 | #newiter = self.buff.get_iter_at_mark(tempm) |
2603 | #self.buff.delete_mark(tempm) |
2604 | #self.insert_indent(self.buff, newiter, newlevel, enter=False) |
2605 | - |
2606 | def backspace(self, tv): |
2607 | self.buff.disconnect(self.insert_sigid) |
2608 | insert_mark = self.buff.get_insert() |
2609 | @@ -1319,7 +1351,8 @@ |
2610 | tag_table.foreach(self.__tag_reset, window) |
2611 | |
2612 | #We clicked on a link |
2613 | - def _tag_event(self, tag, view, ev, _iter, text, anchor, typ): #pylint: disable-msg=W0613 |
2614 | + def _tag_event(self, tag, view, ev, _iter, text, anchor, typ): |
2615 | + #pylint: disable-msg=W0613 |
2616 | _type = ev.type |
2617 | if _type == gtk.gdk.MOTION_NOTIFY: |
2618 | return |
2619 | @@ -1330,14 +1363,17 @@ |
2620 | if typ == "subtask": |
2621 | self.open_task(anchor) |
2622 | elif typ == "http": |
2623 | - if button == 1 and self.check_link(anchor) and self.buff.get_has_selection() == False: |
2624 | + if button == 1 and self.check_link(anchor) and\ |
2625 | + self.buff.get_has_selection() == False: |
2626 | openurl(anchor) |
2627 | else: |
2628 | print "Unknown link type for %s" %anchor |
2629 | self.emit('anchor-clicked', text, anchor, button) |
2630 | - self.__set_anchor(ev.window, tag, cursor, self.get_property('hover')) |
2631 | + self.__set_anchor(ev.window, tag, cursor, |
2632 | + self.get_property('hover')) |
2633 | elif button in [1, 2]: |
2634 | - self.__set_anchor(ev.window, tag, cursor, self.get_property('active')) |
2635 | + self.__set_anchor(ev.window, tag, cursor, |
2636 | + self.get_property('active')) |
2637 | |
2638 | def __tag_reset(self, tag, window): |
2639 | if tag.get_data('is_anchor'): |
2640 | @@ -1351,7 +1387,8 @@ |
2641 | linktype = 'link' |
2642 | else: |
2643 | linktype = 'failedlink' |
2644 | - self.__set_anchor(window, tag, editing_cursor, self.get_property(linktype)) |
2645 | + self.__set_anchor(window, tag, editing_cursor, |
2646 | + self.get_property(linktype)) |
2647 | |
2648 | def __set_anchor(self, window, tag, cursor, prop): |
2649 | window.set_cursor(cursor) |
2650 | |
2651 | === modified file 'GTG/gtk/editor/taskviewserial.py' |
2652 | --- GTG/gtk/editor/taskviewserial.py 2012-05-01 11:04:39 +0000 |
2653 | +++ GTG/gtk/editor/taskviewserial.py 2012-06-23 11:09:19 +0000 |
2654 | @@ -107,8 +107,8 @@ |
2655 | elif ta.get_data('is_subtask'): |
2656 | #The current gtkTextTag is a subtask |
2657 | tagname = "subtask" |
2658 | - subt = doc.createElement(tagname) |
2659 | - target = ta.get_data('child') |
2660 | + subt = doc.createElement(tagname) |
2661 | + target = ta.get_data('child') |
2662 | subt.appendChild(doc.createTextNode(target)) |
2663 | parent.appendChild(subt) |
2664 | parent.appendChild(doc.createTextNode("\n")) |
2665 | @@ -187,7 +187,7 @@ |
2666 | #parse the XML and put the content in the buffer |
2667 | def parsexml(self, buf, ite, element): |
2668 | start = buf.create_mark(None, ite, True) |
2669 | - end = buf.create_mark(None, ite, False) |
2670 | + end = buf.create_mark(None, ite, False) |
2671 | subtasks = self.tv.get_subtasks() |
2672 | taglist2 = [] |
2673 | if element: |
2674 | |
2675 | === modified file 'GTG/gtk/manager.py' |
2676 | --- GTG/gtk/manager.py 2012-05-31 23:56:54 +0000 |
2677 | +++ GTG/gtk/manager.py 2012-06-23 11:09:19 +0000 |
2678 | @@ -32,7 +32,7 @@ |
2679 | import GTG |
2680 | from GTG.gtk.delete_dialog import DeletionUI |
2681 | from GTG.gtk.browser.browser import TaskBrowser |
2682 | -from GTG.gtk.editor.editor import TaskEditor |
2683 | +from GTG.gtk.editor.editor import TaskEditor |
2684 | from GTG.gtk.preferences import PreferencesDialog |
2685 | from GTG.gtk.plugins import PluginsDialog |
2686 | from GTG.gtk.dbuswrapper import DBusTaskWrapper |
2687 | @@ -46,7 +46,7 @@ |
2688 | |
2689 | |
2690 | class Manager(object): |
2691 | - |
2692 | + |
2693 | |
2694 | ############## init ##################################################### |
2695 | def __init__(self, req): |
2696 | @@ -54,12 +54,12 @@ |
2697 | self.config_obj = self.req.get_global_config() |
2698 | self.config = self.config_obj.conf_dict |
2699 | self.task_config = self.config_obj.task_conf_dict |
2700 | - |
2701 | + |
2702 | # Editors |
2703 | - self.opened_task = {} # This is the list of tasks that are already |
2704 | + self.opened_task = {} # This is the list of tasks that are already |
2705 | # opened in an editor of course it's empty |
2706 | # right now |
2707 | - |
2708 | + |
2709 | self.browser = None |
2710 | self.__start_browser_hidden = False |
2711 | self.gtk_terminate = False #if true, the gtk main is not started |
2712 | @@ -67,21 +67,21 @@ |
2713 | # if true, closing the last window doesn't quit GTG |
2714 | # (GTG lives somewhere else without GUI, e.g. notification area) |
2715 | self.daemon_mode = False |
2716 | - |
2717 | + |
2718 | #Shared clipboard |
2719 | self.clipboard = clipboard.TaskClipboard(self.req) |
2720 | |
2721 | #Browser (still hidden) |
2722 | self.browser = TaskBrowser(self.req, self) |
2723 | - |
2724 | + |
2725 | self.__init_plugin_engine() |
2726 | - |
2727 | + |
2728 | if not self.__start_browser_hidden: |
2729 | self.show_browser() |
2730 | - |
2731 | + |
2732 | #Deletion UI |
2733 | self.delete_dialog = None |
2734 | - |
2735 | + |
2736 | #Preferences and Backends windows |
2737 | # Initialize dialogs |
2738 | self.preferences = PreferencesDialog(self.req) |
2739 | @@ -90,11 +90,11 @@ |
2740 | |
2741 | # Tag Editor |
2742 | self.tag_editor_dialog = None |
2743 | - |
2744 | + |
2745 | #DBus |
2746 | DBusTaskWrapper(self.req, self) |
2747 | Log.debug("Manager initialization finished") |
2748 | - |
2749 | + |
2750 | def __init_plugin_engine(self): |
2751 | self.pengine = PluginEngine(GTG.PLUGIN_DIR) |
2752 | # initializes the plugin api class |
2753 | @@ -109,9 +109,8 @@ |
2754 | plugin.enabled = plugin.module_name in plugins_enabled |
2755 | # initializes and activates each plugin (that is enabled) |
2756 | self.pengine.activate_plugins() |
2757 | - |
2758 | + |
2759 | ############## Browser ################################################# |
2760 | - |
2761 | def open_browser(self): |
2762 | if not self.browser: |
2763 | self.browser = TaskBrowser(self.req, self) |
2764 | @@ -120,24 +119,24 @@ |
2765 | #FIXME : the browser should not be the center of the universe. |
2766 | # In fact, we should build a system where view can register themselves |
2767 | # as "stay_alive" views. As long as at least one "stay_alive" view |
2768 | - # is registered, gtg keeps running. It quit only when the last |
2769 | + # is registered, gtg keeps running. It quit only when the last |
2770 | # "stay_alive view" is closed (and then unregistered). |
2771 | # Currently, the browser is our only "stay_alive" view. |
2772 | - def close_browser(self,sender=None): |
2773 | + def close_browser(self, sender=None): |
2774 | self.hide_browser() |
2775 | #may take a while to quit |
2776 | self.quit() |
2777 | |
2778 | - def hide_browser(self,sender=None): |
2779 | + def hide_browser(self, sender=None): |
2780 | self.browser.hide() |
2781 | |
2782 | - def iconify_browser(self,sender=None): |
2783 | + def iconify_browser(self, sender=None): |
2784 | self.browser.iconify() |
2785 | |
2786 | - def show_browser(self,sender=None): |
2787 | + def show_browser(self, sender=None): |
2788 | self.browser.show() |
2789 | - |
2790 | - def is_browser_visible(self,sender=None): |
2791 | + |
2792 | + def is_browser_visible(self, sender=None): |
2793 | return self.browser.is_visible() |
2794 | |
2795 | def get_browser(self): |
2796 | @@ -153,7 +152,6 @@ |
2797 | self.daemon_mode = in_daemon_mode |
2798 | |
2799 | ################# Task Editor ############################################ |
2800 | - |
2801 | def get_opened_editors(self): |
2802 | ''' |
2803 | Returns a dict of task_uid -> TaskEditor, one for each opened editor |
2804 | @@ -192,13 +190,13 @@ |
2805 | def close_task(self, tid): |
2806 | # When an editor is closed, it should de-register itself. |
2807 | if tid in self.opened_task: |
2808 | - #the following line has the side effect of removing the |
2809 | + #the following line has the side effect of removing the |
2810 | # tid key in the opened_task dictionary. |
2811 | editor = self.opened_task[tid] |
2812 | if editor: |
2813 | del self.opened_task[tid] |
2814 | #we have to remove the tid from opened_task first |
2815 | - #else, it close_task would be called once again |
2816 | + #else, it close_task would be called once again |
2817 | #by editor.close |
2818 | editor.close() |
2819 | if tid in self.config["browser"]["opened_tasks"]: |
2820 | @@ -210,12 +208,12 @@ |
2821 | ''' |
2822 | checking if we need to shut down the whole GTG (if no window is open) |
2823 | ''' |
2824 | - if not self.daemon_mode and not self.is_browser_visible() and not self.opened_task: |
2825 | + if not self.daemon_mode and not self.is_browser_visible() \ |
2826 | + and not self.opened_task: |
2827 | #no need to live" |
2828 | self.quit() |
2829 | - |
2830 | + |
2831 | ################ Others dialog ############################################ |
2832 | - |
2833 | def open_edit_backends(self, sender = None, backend_id = None): |
2834 | if not self.edit_backends_dialog: |
2835 | self.edit_backends_dialog = BackendsDialog(self.req) |
2836 | @@ -231,7 +229,7 @@ |
2837 | |
2838 | def configure_plugins(self): |
2839 | self.plugins.activate() |
2840 | - |
2841 | + |
2842 | def ask_delete_tasks(self, tids): |
2843 | if not self.delete_dialog: |
2844 | self.delete_dialog = DeletionUI(self.req) |
2845 | @@ -252,7 +250,6 @@ |
2846 | self.tag_editor_dialog.hide() |
2847 | |
2848 | ### URIS ################################################################### |
2849 | - |
2850 | def open_uri_list(self, unused, uri_list): |
2851 | ''' |
2852 | Open the Editor windows of the tasks associated with the uris given. |
2853 | @@ -264,9 +261,9 @@ |
2854 | #if no window was opened, we just quit |
2855 | self.check_quit_condition() |
2856 | |
2857 | - |
2858 | + |
2859 | ### MAIN ################################################################### |
2860 | - def main(self, once_thru = False, uri_list = []): |
2861 | + def main(self, once_thru = False, uri_list = []): |
2862 | if uri_list: |
2863 | #before opening the requested tasks, we make sure that all of them |
2864 | #are loaded. |
2865 | @@ -282,16 +279,16 @@ |
2866 | else: |
2867 | gtk.main() |
2868 | return 0 |
2869 | - |
2870 | - def quit(self,sender=None): |
2871 | + |
2872 | + def quit(self, sender=None): |
2873 | gtk.main_quit() |
2874 | #save opened tasks and their positions. |
2875 | open_task = [] |
2876 | - for otid in self.opened_task.keys(): |
2877 | + for otid in self.opened_task.keys(): |
2878 | open_task.append(otid) |
2879 | self.opened_task[otid].close() |
2880 | self.config["browser"]["opened_tasks"] = open_task |
2881 | - |
2882 | + |
2883 | # adds the plugin settings to the conf |
2884 | #FIXME: this code is replicated in the preference window. |
2885 | if len(self.pengine.plugins) > 0: |
2886 | @@ -302,4 +299,3 @@ |
2887 | [p.module_name for p in self.pengine.get_plugins("enabled")] |
2888 | # plugins are deactivated |
2889 | self.pengine.deactivate_plugins() |
2890 | - |
2891 | |
2892 | === modified file 'GTG/tools/borg.py' |
2893 | --- GTG/tools/borg.py 2012-03-05 15:23:05 +0000 |
2894 | +++ GTG/tools/borg.py 2012-06-23 11:09:19 +0000 |
2895 | @@ -17,7 +17,6 @@ |
2896 | # this program. If not, see <http://www.gnu.org/licenses/>. |
2897 | # ----------------------------------------------------------------------------- |
2898 | |
2899 | - |
2900 | class Borg(object): |
2901 | """ |
2902 | This pattern ensures that all instances of a particular class share |
2903 | @@ -25,6 +24,6 @@ |
2904 | """ |
2905 | |
2906 | _borg_state = {} |
2907 | - |
2908 | + |
2909 | def __init__(self): |
2910 | self.__dict__ = self._borg_state |
2911 | |
2912 | === modified file 'GTG/tools/cleanxml.py' |
2913 | --- GTG/tools/cleanxml.py 2012-05-01 15:53:24 +0000 |
2914 | +++ GTG/tools/cleanxml.py 2012-06-23 11:09:19 +0000 |
2915 | @@ -17,7 +17,8 @@ |
2916 | # this program. If not, see <http://www.gnu.org/licenses/>. |
2917 | # ----------------------------------------------------------------------------- |
2918 | |
2919 | -import os, xml.dom.minidom |
2920 | +import os |
2921 | +import xml.dom.minidom |
2922 | import shutil |
2923 | import sys |
2924 | import time |
2925 | @@ -32,17 +33,19 @@ |
2926 | BACKUP_NBR = 7 |
2927 | |
2928 | #Those two functions are there only to be able to read prettyXML |
2929 | -#Source : http://yumenokaze.free.fr/?/Informatique/Snipplet/Python/cleandom |
2930 | -def cleanDoc(document,indent="",newl=""): |
2931 | +#Source : http://yumenokaze.free.fr/?/Informatique/Snipplet/Python/cleandom |
2932 | + |
2933 | +def cleanDoc(document, indent="", newl=""): |
2934 | node = document.documentElement |
2935 | - cleanNode(node,indent,newl) |
2936 | - |
2937 | -def cleanNode(currentNode,indent,newl): |
2938 | + cleanNode(node, indent, newl) |
2939 | + |
2940 | + |
2941 | +def cleanNode(currentNode, indent, newl): |
2942 | myfilter = indent+newl |
2943 | if currentNode.hasChildNodes: |
2944 | toremove = [] |
2945 | for node in currentNode.childNodes: |
2946 | - if node.nodeType == 3 : |
2947 | + if node.nodeType == 3: |
2948 | val = node.nodeValue.lstrip(myfilter).strip(myfilter) |
2949 | if val == "": |
2950 | toremove.append(node) |
2951 | @@ -52,36 +55,39 @@ |
2952 | for n in toremove: |
2953 | currentNode.removeChild(n) |
2954 | for node in currentNode.childNodes: |
2955 | - cleanNode(node,indent,newl) |
2956 | - |
2957 | -def cleanString(string,indent="",newl=""): |
2958 | + cleanNode(node, indent, newl) |
2959 | + |
2960 | + |
2961 | +def cleanString(string, indent="", newl=""): |
2962 | #we will remove the pretty XML stuffs. |
2963 | #Firt, we remove the \n and tab in elements |
2964 | e = re.compile('>\n\t*') |
2965 | - toreturn = e.sub('>',string) |
2966 | + toreturn = e.sub('>', string) |
2967 | #then we remove the \n tab before closing elements |
2968 | f = re.compile('\n\t*</') |
2969 | - toreturn = f.sub('</',toreturn) |
2970 | + toreturn = f.sub('</', toreturn) |
2971 | return toreturn |
2972 | |
2973 | #This add a text node to the node parent. We don't return anything |
2974 | #Because the doc object itself is modified. |
2975 | -def addTextNode(doc,parent,title,content) : |
2976 | - if content : |
2977 | + |
2978 | +def addTextNode(doc, parent, title, content): |
2979 | + if content: |
2980 | element = doc.createElement(title) |
2981 | parent.appendChild(element) |
2982 | element.appendChild(doc.createTextNode(content)) |
2983 | - |
2984 | + |
2985 | #This is a method to read the textnode of the XML |
2986 | -def readTextNode(node,title) : |
2987 | + |
2988 | +def readTextNode(node, title): |
2989 | n = node.getElementsByTagName(title) |
2990 | - if n and n[0].hasChildNodes() : |
2991 | + if n and n[0].hasChildNodes(): |
2992 | content = n[0].childNodes[0].nodeValue |
2993 | - if content : |
2994 | + if content: |
2995 | return content |
2996 | return None |
2997 | |
2998 | - |
2999 | + |
3000 | def _try_openxmlfile(zefile, root): |
3001 | """ Open an XML file and clean whitespaces in it """ |
3002 | f = open(zefile, "r") |
3003 | @@ -115,7 +121,7 @@ |
3004 | return _try_openxmlfile(zefile, root) |
3005 | else: |
3006 | # Creating empty file |
3007 | - doc,xmlproject = emptydoc(root) |
3008 | + doc, xmlproject = emptydoc(root) |
3009 | newfile = savexml(zefile, doc) |
3010 | if not newfile: |
3011 | Log.error("Could not create a new file %s" % zefile) |
3012 | @@ -125,7 +131,7 @@ |
3013 | except IOError, msg: |
3014 | print msg |
3015 | sys.exit(1) |
3016 | - |
3017 | + |
3018 | except xml.parsers.expat.ExpatError, msg: |
3019 | errormsg = "Error parsing XML file %s: %s" % (zefile, msg) |
3020 | Log.error(errormsg) |
3021 | @@ -153,14 +159,16 @@ |
3022 | |
3023 | |
3024 | #Return a doc element with only one root element of the name "root" |
3025 | -def emptydoc(root) : |
3026 | + |
3027 | +def emptydoc(root): |
3028 | doc = xml.dom.minidom.Document() |
3029 | rootproject = doc.createElement(root) |
3030 | doc.appendChild(rootproject) |
3031 | return doc, rootproject |
3032 | - |
3033 | + |
3034 | #write a XML doc to a file |
3035 | -def savexml(zefile,doc,backup=False): |
3036 | + |
3037 | +def savexml(zefile, doc, backup=False): |
3038 | # print "writing %s file" %(zefile) |
3039 | tmpfile = zefile+'__' |
3040 | try: |
3041 | @@ -175,27 +183,28 @@ |
3042 | f.close() |
3043 | return False |
3044 | f.close() |
3045 | - |
3046 | + |
3047 | if os.path.exists(tmpfile): |
3048 | os.unlink(tmpfile) |
3049 | - |
3050 | - if backup : |
3051 | + |
3052 | + if backup: |
3053 | #We will now backup the file |
3054 | backup_nbr = BACKUP_NBR |
3055 | #We keep BACKUP_NBR versions of the file |
3056 | #The 0 is the youngest one |
3057 | - while backup_nbr > 0 : |
3058 | - older = "%s.bak.%s" %(zefile,backup_nbr) |
3059 | + while backup_nbr > 0: |
3060 | + older = "%s.bak.%s" %(zefile, backup_nbr) |
3061 | backup_nbr -= 1 |
3062 | - newer = "%s.bak.%s" %(zefile,backup_nbr) |
3063 | - if os.path.exists(newer) : |
3064 | - shutil.move(newer,older) |
3065 | + newer = "%s.bak.%s" %(zefile, backup_nbr) |
3066 | + if os.path.exists(newer): |
3067 | + shutil.move(newer, older) |
3068 | #The bak.0 is always a fresh copy of the closed file |
3069 | #So that it's not touched in case of bad opening next time |
3070 | current = "%s.bak.0" %(zefile) |
3071 | - shutil.copy(zefile,current) |
3072 | + shutil.copy(zefile, current) |
3073 | |
3074 | - daily_backup = "%s.%s.bak" % (zefile, datetime.date.today().strftime("%Y-%m-%d")) |
3075 | + daily_backup = "%s.%s.bak" % (zefile, |
3076 | + datetime.date.today().strftime("%Y-%m-%d")) |
3077 | if not os.path.exists(daily_backup): |
3078 | shutil.copy(zefile, daily_backup) |
3079 | return True |
3080 | |
3081 | === modified file 'GTG/tools/clipboard.py' |
3082 | --- GTG/tools/clipboard.py 2012-03-05 15:23:05 +0000 |
3083 | +++ GTG/tools/clipboard.py 2012-06-23 11:09:19 +0000 |
3084 | @@ -21,15 +21,19 @@ |
3085 | TaskClipboard allows to cut/copy the content of a TaskView accross multiples |
3086 | taskeditors, preserving subtasks |
3087 | """ |
3088 | + |
3089 | + |
3090 | class TaskClipboard(): |
3091 | - def __init__(self,req): |
3092 | + |
3093 | + def __init__(self, req): |
3094 | self.description = None |
3095 | self.content = [] |
3096 | self.req = req |
3097 | - |
3098 | + |
3099 | """"take two gtk.TextIter as parameter and copy the |
3100 | """ |
3101 | - def copy(self,start,stop,bullet=None): |
3102 | + |
3103 | + def copy(self, start, stop, bullet=None): |
3104 | self.clear() |
3105 | #Now, we take care of the normal, cross application clipboard |
3106 | text = start.get_text(stop) |
3107 | @@ -39,7 +43,7 @@ |
3108 | self.description = newtext |
3109 | elif text: |
3110 | self.description = text |
3111 | - |
3112 | + |
3113 | end_line = start.copy() |
3114 | #we take line after line in the selection |
3115 | nextline = True |
3116 | @@ -49,7 +53,7 @@ |
3117 | #we want to detect subtasks in the selection |
3118 | tags = end_line.get_tags()+end_line.get_toggled_tags(False) |
3119 | is_subtask = False |
3120 | - for ta in tags : |
3121 | + for ta in tags: |
3122 | if (ta.get_data('is_subtask')): |
3123 | is_subtask = True |
3124 | tid = ta.get_data('child') |
3125 | @@ -59,7 +63,8 @@ |
3126 | self.content.append(['subtask', tid]) |
3127 | if not is_subtask: |
3128 | if end_line.get_line() < stop.get_line(): |
3129 | - self.content.append(['text', "%s\n" %start.get_text(end_line)]) |
3130 | + self.content.append(['text', "%s\n" \ |
3131 | + %start.get_text(end_line)]) |
3132 | else: |
3133 | self.content.append(['text', start.get_text(stop)]) |
3134 | end_line.forward_char() |
3135 | @@ -67,10 +72,10 @@ |
3136 | |
3137 | def paste_text(self): |
3138 | return self.description |
3139 | - |
3140 | + |
3141 | def paste(self): |
3142 | return self.content |
3143 | - |
3144 | + |
3145 | def clear(self): |
3146 | self.descriptiion = None |
3147 | self.content = [] |
3148 | |
3149 | === modified file 'GTG/tools/import_liblarch.py' |
3150 | --- GTG/tools/import_liblarch.py 2012-05-02 10:03:02 +0000 |
3151 | +++ GTG/tools/import_liblarch.py 2012-06-23 11:09:19 +0000 |
3152 | @@ -25,6 +25,7 @@ |
3153 | REQUIRED_LIBLARCH_API = "1.0" |
3154 | GIT_CMD = "git clone https://github.com/liblarch/liblarch ../liblarch" |
3155 | |
3156 | + |
3157 | def import_liblarch(use_local=False): |
3158 | """ Check if liblarch is installed and is compatible |
3159 | |
3160 | |
3161 | === modified file 'GTG/tools/keyring.py' |
3162 | --- GTG/tools/keyring.py 2012-03-05 15:23:05 +0000 |
3163 | +++ GTG/tools/keyring.py 2012-06-23 11:09:19 +0000 |
3164 | @@ -17,7 +17,6 @@ |
3165 | # this program. If not, see <http://www.gnu.org/licenses/>. |
3166 | # ----------------------------------------------------------------------------- |
3167 | |
3168 | - |
3169 | try: |
3170 | import gnomekeyring |
3171 | except ImportError: |
3172 | @@ -26,7 +25,9 @@ |
3173 | from GTG.tools.borg import Borg |
3174 | from GTG.tools.logger import Log |
3175 | |
3176 | + |
3177 | class GNOMEKeyring(Borg): |
3178 | + |
3179 | def __init__(self): |
3180 | super(Keyring, self).__init__() |
3181 | if not hasattr(self, "keyring"): |
3182 | @@ -48,7 +49,9 @@ |
3183 | except (gnomekeyring.DeniedError, gnomekeyring.NoMatchError): |
3184 | return "" |
3185 | |
3186 | + |
3187 | class FallbackKeyring(Borg): |
3188 | + |
3189 | def __init__(self): |
3190 | super(Keyring, self).__init__() |
3191 | if not hasattr(self, "keyring"): |
3192 | @@ -70,7 +73,8 @@ |
3193 | return self.keyring.get(key, "") |
3194 | |
3195 | if gnomekeyring is not None: |
3196 | - Keyring = GNOMEKeyring |
3197 | + Keyring = GNOMEKeyring |
3198 | else: |
3199 | - Log.info("GNOME keyring was not found, passwords will be not stored after restart of GTG") |
3200 | + Log.info("GNOME keyring was not found, passwords will be not \ |
3201 | + stored after restart of GTG") |
3202 | Keyring = FallbackKeyring |
3203 | |
3204 | === modified file 'GTG/tools/logger.py' |
3205 | --- GTG/tools/logger.py 2012-05-01 15:53:24 +0000 |
3206 | +++ GTG/tools/logger.py 2012-06-23 11:09:19 +0000 |
3207 | @@ -33,7 +33,7 @@ |
3208 | class Debug(object): |
3209 | """Singleton class that acts as interface for GTG's logger""" |
3210 | |
3211 | - def __init__ (self): |
3212 | + def __init__(self): |
3213 | """ Configure the GTG logger """ |
3214 | #If we already have a logger, we keep that |
3215 | if not hasattr(Debug, "__logger"): |
3216 | @@ -63,6 +63,7 @@ |
3217 | |
3218 | def set_debugging_mode(self, value): |
3219 | self.debugging_mode = value |
3220 | + |
3221 | def is_debugging_mode(self): |
3222 | return self.debugging_mode |
3223 | |
3224 | |
3225 | === modified file 'GTG/tools/networkmanager.py' |
3226 | --- GTG/tools/networkmanager.py 2012-03-16 23:11:31 +0000 |
3227 | +++ GTG/tools/networkmanager.py 2012-06-23 11:09:19 +0000 |
3228 | @@ -25,13 +25,14 @@ |
3229 | |
3230 | import dbus |
3231 | |
3232 | -# A network device is connected, with global network connectivity. |
3233 | +# A network device is connected, with global network connectivity. |
3234 | NM_STATE_CONNECTED_GLOBAL = 70 |
3235 | |
3236 | + |
3237 | def is_connection_up(): |
3238 | """ Returns True if GTG can access the Internet """ |
3239 | bus = dbus.SystemBus() |
3240 | - proxy = bus.get_object('org.freedesktop.NetworkManager', |
3241 | + proxy = bus.get_object('org.freedesktop.NetworkManager', |
3242 | '/org/freedesktop/NetworkManager') |
3243 | network_manager = dbus.Interface(proxy, 'org.freedesktop.NetworkManager') |
3244 | |
3245 | |
3246 | === modified file 'GTG/tools/taskxml.py' |
3247 | --- GTG/tools/taskxml.py 2012-04-11 10:31:31 +0000 |
3248 | +++ GTG/tools/taskxml.py 2012-06-23 11:09:19 +0000 |
3249 | @@ -32,6 +32,7 @@ |
3250 | else: |
3251 | return "" |
3252 | |
3253 | + |
3254 | def read_node(xmlnode, name): |
3255 | node_list =xmlnode.getElementsByTagName(name) |
3256 | if len(node_list) > 0: |
3257 | @@ -41,7 +42,8 @@ |
3258 | |
3259 | |
3260 | #Take an empty task, an XML node and return a Task. |
3261 | -def task_from_xml(task, xmlnode) : |
3262 | + |
3263 | +def task_from_xml(task, xmlnode): |
3264 | #print "********************************" |
3265 | #print xmlnode.toprettyxml() |
3266 | |
3267 | @@ -55,7 +57,7 @@ |
3268 | duedate = Date(read_node(xmlnode, "duedate")) |
3269 | task.set_due_date(duedate) |
3270 | |
3271 | - startdate = Date(read_node(xmlnode,"startdate")) |
3272 | + startdate = Date(read_node(xmlnode, "startdate")) |
3273 | task.set_start_date(startdate) |
3274 | |
3275 | modified = read_node(xmlnode, "modified") |
3276 | @@ -63,7 +65,7 @@ |
3277 | modified = datetime.strptime(modified, "%Y-%m-%dT%H:%M:%S") |
3278 | task.set_modified(modified) |
3279 | |
3280 | - tags = xmlnode.getAttribute("tags").replace(' ','') |
3281 | + tags = xmlnode.getAttribute("tags").replace(' ', '') |
3282 | tags = (tag for tag in tags.split(',') if tag.strip() != "") |
3283 | for tag in tags: |
3284 | #FIXME why unescape???? |
3285 | @@ -89,7 +91,8 @@ |
3286 | task.set_attribute(key, value, namespace=namespace) |
3287 | |
3288 | # FIXME do we need remote task ids? I don't think so |
3289 | - # FIXME if so => rework them into a more usable structure!!! (like attributes) |
3290 | + # FIXME if so => rework them into a more usable structure!!! |
3291 | + #(like attributes) |
3292 | #REMOTE TASK IDS |
3293 | ''' |
3294 | remote_ids_list = xmlnode.getElementsByTagName("task-remote-ids") |
3295 | @@ -105,25 +108,28 @@ |
3296 | |
3297 | #FIXME maybe pretty XML should be enough for this... |
3298 | #Task as parameter the doc where to put the XML node |
3299 | -def task_to_xml(doc,task) : |
3300 | + |
3301 | +def task_to_xml(doc, task): |
3302 | t_xml = doc.createElement("task") |
3303 | - t_xml.setAttribute("id",task.get_id()) |
3304 | - t_xml.setAttribute("status" , task.get_status()) |
3305 | - t_xml.setAttribute("uuid" , task.get_uuid()) |
3306 | + t_xml.setAttribute("id", task.get_id()) |
3307 | + t_xml.setAttribute("status", task.get_status()) |
3308 | + t_xml.setAttribute("uuid", task.get_uuid()) |
3309 | tags_str = "" |
3310 | - for tag in task.get_tags_name(): |
3311 | + for tag in task.get_tags_name(): |
3312 | tags_str = tags_str + saxutils.escape(str(tag)) + "," |
3313 | t_xml.setAttribute("tags", tags_str[:-1]) |
3314 | - cleanxml.addTextNode(doc,t_xml,"title",task.get_title()) |
3315 | - cleanxml.addTextNode(doc,t_xml,"duedate", task.get_due_date().xml_str()) |
3316 | - cleanxml.addTextNode(doc,t_xml,"modified",task.get_modified_string()) |
3317 | - cleanxml.addTextNode(doc,t_xml,"startdate", task.get_start_date().xml_str()) |
3318 | - cleanxml.addTextNode(doc,t_xml,"donedate", task.get_closed_date().xml_str()) |
3319 | + cleanxml.addTextNode(doc, t_xml, "title", task.get_title()) |
3320 | + cleanxml.addTextNode(doc, t_xml, "duedate", task.get_due_date().xml_str()) |
3321 | + cleanxml.addTextNode(doc, t_xml, "modified", task.get_modified_string()) |
3322 | + cleanxml.addTextNode(doc, t_xml, "startdate", |
3323 | + task.get_start_date().xml_str()) |
3324 | + cleanxml.addTextNode(doc, t_xml, "donedate", |
3325 | + task.get_closed_date().xml_str()) |
3326 | childs = task.get_children() |
3327 | - for c in childs : |
3328 | - cleanxml.addTextNode(doc,t_xml,"subtask",c) |
3329 | + for c in childs: |
3330 | + cleanxml.addTextNode(doc, t_xml, "subtask", c) |
3331 | for a in task.attributes: |
3332 | - namespace,key=a |
3333 | + namespace, key=a |
3334 | content=task.attributes[a] |
3335 | element = doc.createElement('attribute') |
3336 | element.setAttribute("namespace", namespace) |
3337 | @@ -131,14 +137,15 @@ |
3338 | element.appendChild(doc.createTextNode(content)) |
3339 | t_xml.appendChild(element) |
3340 | tex = task.get_text() |
3341 | - if tex : |
3342 | + if tex: |
3343 | #We take the xml text and convert it to a string |
3344 | - #but without the "<content />" |
3345 | + #but without the "<content />" |
3346 | element = minidom.parseString(tex) |
3347 | - temp = element.firstChild.toxml().partition("<content>")[2] #pylint: disable-msg=E1103 |
3348 | + temp = element.firstChild.toxml().partition("<content>")[2] |
3349 | + #pylint: disable-msg=E1103 |
3350 | desc = temp.partition("</content>")[0] |
3351 | #t_xml.appendChild(element.firstChild) |
3352 | - cleanxml.addTextNode(doc,t_xml,"content",desc) |
3353 | + cleanxml.addTextNode(doc, t_xml, "content", desc) |
3354 | #self.__write_textnode(doc,t_xml,"content",t.get_text()) |
3355 | |
3356 | #REMOTE TASK IDS |
3357 | |
3358 | === modified file 'GTG/tools/twokeydict.py' |
3359 | --- GTG/tools/twokeydict.py 2012-05-01 15:53:24 +0000 |
3360 | +++ GTG/tools/twokeydict.py 2012-06-23 11:09:19 +0000 |
3361 | @@ -24,7 +24,6 @@ |
3362 | from GTG.tools.bidict import BiDict |
3363 | |
3364 | |
3365 | - |
3366 | class TwoKeyDict(object): |
3367 | ''' |
3368 | It's a standard Dictionary with a secondary key. |
3369 | @@ -34,11 +33,10 @@ |
3370 | twokey['2'] ==> 'two' |
3371 | twokey['II'] ==> 'two' |
3372 | You can also request the other key, given one. |
3373 | - Function calls start with _ because you'll probably want to rename them when |
3374 | - you use this dictionary, for the sake of clarity. |
3375 | + Function calls start with _ because you'll probably want to rename them |
3376 | + when you use this dictionary, for the sake of clarity. |
3377 | ''' |
3378 | |
3379 | - |
3380 | def __init__(self, *triplets): |
3381 | ''' |
3382 | Creates the TwoKeyDict and optionally populates it with some data |
3383 | @@ -120,7 +118,7 @@ |
3384 | def _get_all_primary_keys(self): |
3385 | ''' |
3386 | Returns all primary keys |
3387 | - |
3388 | + |
3389 | @returns list: list of all primary keys |
3390 | ''' |
3391 | return self._key_to_key_bidict._get_all_first() |
3392 | @@ -128,8 +126,7 @@ |
3393 | def _get_all_secondary_keys(self): |
3394 | ''' |
3395 | Returns all secondary keys |
3396 | - |
3397 | + |
3398 | @returns list: list of all secondary keys |
3399 | ''' |
3400 | return self._key_to_key_bidict._get_all_second() |
3401 | - |
3402 | |
3403 | === modified file 'GTG/tools/urlregex.py' |
3404 | --- GTG/tools/urlregex.py 2012-03-05 15:23:05 +0000 |
3405 | +++ GTG/tools/urlregex.py 2012-06-23 11:09:19 +0000 |
3406 | @@ -31,12 +31,12 @@ |
3407 | SUBST_DICT = { |
3408 | "pre": ur'(?:[^/"\':!=]|^|\:)', |
3409 | "domain": ur'([\.-]|[^\s_\!\.\/])+\.[a-z]{2,}(?::[0-9]+)?', |
3410 | - "path":ur'(?:[\.,]?[%s!\*\'\(\);:=\+\$/%s#\[\]\-_,~@])' % (UTF_CHARS, '%'), |
3411 | + "path": ur'(?:[\.,]?[%s!\*\'\(\);:=\+\$/%s#\[\]\-_,~@])' % \ |
3412 | + (UTF_CHARS, '%'), |
3413 | "query": ur'[a-z0-9!\*\'\(\);:&=\+\$/%#\[\]\-_\.,~]', |
3414 | # Valid end-of-path characters (so /foo. does not gobble the period). |
3415 | "path_end": r'[%s\)=#/]' % UTF_CHARS, |
3416 | - "query_end": '[a-z0-9_&=#]' |
3417 | -} |
3418 | + "query_end": '[a-z0-9_&=#]'} |
3419 | |
3420 | HTTP_URI= '((%(pre)s)((https?://|www\\.)(%(domain)s)(\/%(path)s*' \ |
3421 | '%(path_end)s?)?(\?%(query)s*%(query_end)s)?))' % SUBST_DICT |
3422 | @@ -44,5 +44,6 @@ |
3423 | |
3424 | URL_REGEX = re.compile('%s|%s' % (HTTP_URI, FILE_URI), re.IGNORECASE) |
3425 | |
3426 | + |
3427 | def match(text): |
3428 | return re.match(URL_REGEX, text) |
3429 | |
3430 | === modified file 'GTG/tools/watchdog.py' |
3431 | --- GTG/tools/watchdog.py 2012-05-01 15:53:24 +0000 |
3432 | +++ GTG/tools/watchdog.py 2012-06-23 11:09:19 +0000 |
3433 | @@ -18,6 +18,7 @@ |
3434 | # ----------------------------------------------------------------------------- |
3435 | import threading |
3436 | |
3437 | + |
3438 | class Watchdog(object): |
3439 | ''' |
3440 | a simple thread-safe watchdog. |
3441 | |
3442 | === modified file 'gtg' |
3443 | --- gtg 2012-06-07 14:00:34 +0000 |
3444 | +++ gtg 2012-06-23 11:09:19 +0000 |
3445 | @@ -41,7 +41,7 @@ |
3446 | |
3447 | def main(): |
3448 | """ Parse arguments and run GTG |
3449 | - |
3450 | + |
3451 | Importing GTG.gtg must be done after importing and setting up paths |
3452 | for Liblarch """ |
3453 | |
3454 | |
3455 | === modified file 'setup.py' |
3456 | --- setup.py 2012-06-07 19:45:16 +0000 |
3457 | +++ setup.py 2012-06-23 11:09:19 +0000 |
3458 | @@ -29,14 +29,14 @@ |
3459 | |
3460 | ### CONSTANTS ################################################################ |
3461 | |
3462 | -DATA_DIR = "share/gtg" |
3463 | +DATA_DIR = "share/gtg" |
3464 | GLOBAL_ICON_DIR = "share/icons/hicolor" |
3465 | |
3466 | ### TOOLS #################################################################### |
3467 | |
3468 | def create_icon_list(): |
3469 | fileList = [] |
3470 | - rootdir = "data/icons" |
3471 | + rootdir = "data/icons" |
3472 | for root, subFolders, files in os.walk(rootdir): |
3473 | dirList = [] |
3474 | for file in files: |
3475 | @@ -113,13 +113,13 @@ |
3476 | author = 'The GTG Team' |
3477 | |
3478 | setup( |
3479 | - name = 'gtg', |
3480 | - version = info.VERSION, |
3481 | - url = info.URL, |
3482 | - author = author, |
3483 | + name = 'gtg', |
3484 | + version = info.VERSION, |
3485 | + url = info.URL, |
3486 | + author = author, |
3487 | author_email = info.EMAIL, |
3488 | - description = info.SHORT_DESCRIPTION, |
3489 | - packages = [ |
3490 | + description = info.SHORT_DESCRIPTION, |
3491 | + packages = [ |
3492 | 'GTG', |
3493 | 'GTG.backends', |
3494 | 'GTG.backends.rtm', |
you can check with the command
make lint | grep "<filename>"
On 6/23/12, Nimit Shah <email address hidden> wrote: /code.launchpad .net/~nimit- svnit/gtg/ cleanup/ +merge/ 111709 browser/ simple_ color_selector. py browser/ cellRendereTags .py browser/ custominfobar. py browser/ treeview_ factory. py browser/ tag_context_ menu.py editor/ editor. py editor/ taskview. py editor/ taskviewserial. py editor/ init.py backends_ dialog/ parameters_ ui/pathui. py backends_ dialog/ parameters_ ui/textui. py backends_ dialog/ parameters_ ui/__init_ _.py backends_ dialog/ parameters_ ui/checkboxui. py backends_ dialog/ parameters_ ui/periodui. py backends_ dialog/ parameters_ ui/passwordui. py crashhandler. py twokeydict. py clipboard. py backends_ dialog/ backendscombo. py backends_ dialog/ backendstree. py backends_ dialog/ configurepanel. py backends_ dialog/ __init_ _.py backends_ dialog/ addpanel. py cleanxml. py keyring. py urlregex. py watchdog. py /code.launchpad .net/~nimit- svnit/gtg/ cleanup/ +merge/ 111709
> Nimit Shah has proposed merging lp:~nimit-svnit/gtg/cleanup into lp:gtg.
>
> Requested reviews:
> Gtg developers (gtg)
>
> For more details, see:
> https:/
>
> Following files have been made to comply with lint and pep8 standards
>
> setup.py
> GTG/gtk/colors.py
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> gtg
> init.py
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/manager.py
> GTG/gtk/
> GTG/__init__.py
> GTG/tools/
> GTG/tools/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/gtk/
> GTG/tools/
> GTG/tools/
> GTG/tools/logger.py
> GTG/tools/
> GTG/tools/
> --
> https:/
> You are the owner of lp:~nimit-svnit/gtg/cleanup.
>
-- says.blogspot. com
Nimit Shah,
B Tech 3rd year,
Computer Engineering Department,
SVNIT Surat
Secretary ACM-NIT Surat
www.dude-