Merge lp:~sinzui/ubuntu/quantal/gedit-developer-plugins/0.5.15 into lp:ubuntu/quantal/gedit-developer-plugins

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 14
Proposed branch: lp:~sinzui/ubuntu/quantal/gedit-developer-plugins/0.5.15
Merge into: lp:ubuntu/quantal/gedit-developer-plugins
Diff against target: 864 lines (+339/-225)
11 files modified
ChangeLog (+39/-0)
configure (+10/-10)
configure.ac (+1/-1)
debian/changelog (+6/-0)
plugins/gdp/__init__.py (+7/-1)
plugins/gdp/find.py (+35/-1)
plugins/gdp/find.ui (+76/-209)
plugins/gdp/tests/test_find.py (+100/-1)
plugins/gdp/tests/test_gdp.py (+62/-0)
testing/__init__.py (+2/-2)
testing/testrunner.py (+1/-0)
To merge this branch: bzr merge lp:~sinzui/ubuntu/quantal/gedit-developer-plugins/0.5.15
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Review via email: mp+110820@code.launchpad.net

Description of the change

Update the package to the current release of 0.5.15. The release Fixes a few bugs in the the find panel and introduces a new UI for the find panel.

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks! Merged with fixing LP: # syntax in debian/changelog.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-03-30 14:24:59 +0000
3+++ ChangeLog 2012-06-18 13:32:54 +0000
4@@ -1,5 +1,44 @@
5 <Generated by bzr log --log-format=gnu>
6
7+2012-06-16 Curtis Hovey <sinzui.is@verizon.net>
8+
9+ [579] Increment version.
10+
11+2012-04-28 Curtis Hovey <sinzui.is@verizon.net>
12+
13+ [578] Show relative path in find results.
14+
15+2012-04-28 Curtis Hovey <sinzui.is@verizon.net>
16+
17+ [577] Do not mutate gsettings.
18+
19+2012-04-28 Curtis Hovey <sinzui.is@verizon.net>
20+
21+ [576] Use the FileChooserDialog to set the directory to find in.
22+
23+2012-04-28 Curtis Hovey <sinzui.is@verizon.net>
24+
25+ [575] Extend object.
26+
27+2012-04-28 Curtis Hovey <sinzui.is@verizon.net>
28+
29+ [574] Warn when the directory path does not exist. Convert the path
30+ from a uri to a directory path.
31+
32+2012-04-28 Curtis Hovey <sinzui.is@verizon.net>
33+
34+ [573] Added on_replace_in_files_icon_press for substituion entry.
35+
36+2012-04-28 Curtis Hovey <sinzui.is@verizon.net>
37+
38+ [572] Introduce on_find_in_files_icon_press to handle the icon-press
39+ event from the entry.
40+
41+2012-04-10 Curtis Hovey <sinzui.is@verizon.net>
42+
43+ [571] Quick glade hack to make the panel use less space by using
44+ secondary icons instead buttons.
45+
46 2012-03-29 Curtis Hovey <sinzui.is@verizon.net>
47
48 [570] Do not look for missing in a branch without a parent.
49
50=== modified file 'configure'
51--- configure 2012-03-30 14:24:59 +0000
52+++ configure 2012-06-18 13:32:54 +0000
53@@ -1,6 +1,6 @@
54 #! /bin/sh
55 # Guess values for system-dependent variables and create Makefiles.
56-# Generated by GNU Autoconf 2.68 for gedit-developer-plugins 0.5.14.
57+# Generated by GNU Autoconf 2.68 for gedit-developer-plugins 0.5.15.
58 #
59 # Report bugs to <sinzui.is@verizon.net>.
60 #
61@@ -560,8 +560,8 @@
62 # Identity of this package.
63 PACKAGE_NAME='gedit-developer-plugins'
64 PACKAGE_TARNAME='gedit-developer-plugins'
65-PACKAGE_VERSION='0.5.14'
66-PACKAGE_STRING='gedit-developer-plugins 0.5.14'
67+PACKAGE_VERSION='0.5.15'
68+PACKAGE_STRING='gedit-developer-plugins 0.5.15'
69 PACKAGE_BUGREPORT='sinzui.is@verizon.net'
70 PACKAGE_URL=''
71
72@@ -1319,7 +1319,7 @@
73 # Omit some internal or obsolete options to make the list less imposing.
74 # This message is too long to be a string in the A/UX 3.1 sh.
75 cat <<_ACEOF
76-\`configure' configures gedit-developer-plugins 0.5.14 to adapt to many kinds of systems.
77+\`configure' configures gedit-developer-plugins 0.5.15 to adapt to many kinds of systems.
78
79 Usage: $0 [OPTION]... [VAR=VALUE]...
80
81@@ -1386,7 +1386,7 @@
82
83 if test -n "$ac_init_help"; then
84 case $ac_init_help in
85- short | recursive ) echo "Configuration of gedit-developer-plugins 0.5.14:";;
86+ short | recursive ) echo "Configuration of gedit-developer-plugins 0.5.15:";;
87 esac
88 cat <<\_ACEOF
89
90@@ -1491,7 +1491,7 @@
91 test -n "$ac_init_help" && exit $ac_status
92 if $ac_init_version; then
93 cat <<\_ACEOF
94-gedit-developer-plugins configure 0.5.14
95+gedit-developer-plugins configure 0.5.15
96 generated by GNU Autoconf 2.68
97
98 Copyright (C) 2010 Free Software Foundation, Inc.
99@@ -1860,7 +1860,7 @@
100 This file contains any messages produced by compilers while
101 running configure, to aid debugging if configure makes a mistake.
102
103-It was created by gedit-developer-plugins $as_me 0.5.14, which was
104+It was created by gedit-developer-plugins $as_me 0.5.15, which was
105 generated by GNU Autoconf 2.68. Invocation command line was
106
107 $ $0 $@
108@@ -2675,7 +2675,7 @@
109
110 # Define the identity of the package.
111 PACKAGE='gedit-developer-plugins'
112- VERSION='0.5.14'
113+ VERSION='0.5.15'
114
115
116 cat >>confdefs.h <<_ACEOF
117@@ -6525,7 +6525,7 @@
118 # report actual input values of CONFIG_FILES etc. instead of their
119 # values after options handling.
120 ac_log="
121-This file was extended by gedit-developer-plugins $as_me 0.5.14, which was
122+This file was extended by gedit-developer-plugins $as_me 0.5.15, which was
123 generated by GNU Autoconf 2.68. Invocation command line was
124
125 CONFIG_FILES = $CONFIG_FILES
126@@ -6582,7 +6582,7 @@
127 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
128 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
129 ac_cs_version="\\
130-gedit-developer-plugins config.status 0.5.14
131+gedit-developer-plugins config.status 0.5.15
132 configured by $0, generated by GNU Autoconf 2.68,
133 with options \\"\$ac_cs_config\\"
134
135
136=== modified file 'configure.ac'
137--- configure.ac 2012-03-30 14:24:59 +0000
138+++ configure.ac 2012-06-18 13:32:54 +0000
139@@ -4,7 +4,7 @@
140
141 m4_define(gdp_major_version, 0)
142 m4_define(gdp_minor_version, 5)
143-m4_define(gdp_micro_version, 14)
144+m4_define(gdp_micro_version, 15)
145 m4_define(gdp_version, gdp_major_version.gdp_minor_version.gdp_micro_version)
146
147 AC_INIT(gedit-developer-plugins, gdp_version, sinzui.is@verizon.net)
148
149=== modified file 'debian/changelog'
150--- debian/changelog 2012-03-30 14:30:40 +0000
151+++ debian/changelog 2012-06-18 13:32:54 +0000
152@@ -1,3 +1,9 @@
153+gedit-developer-plugins (0.5.15-0ubuntu1) quantal; urgency=low
154+
155+ * New upstream release. Fixes LP:#990561, LP:#990585, LP:#990688
156+
157+ -- Curtis C. Hovey <sinzui.is@verizon.net> Mon, 18 Jun 2012 09:25:07 -0400
158+
159 gedit-developer-plugins (0.5.14-0ubuntu1) precise; urgency=low
160
161 * New upstream bug-fix release.
162
163=== modified file 'plugins/gdp/__init__.py'
164--- plugins/gdp/__init__.py 2012-03-12 13:04:13 +0000
165+++ plugins/gdp/__init__.py 2012-06-18 13:32:54 +0000
166@@ -147,7 +147,13 @@
167 text = model.get_value(piter, 3)
168 if text is None:
169 if cell_type == 'text':
170- cell.props.text = file_path
171+ relative_file_path = file_path
172+ base_dir = model.get_value(piter, 4)
173+ if base_dir:
174+ if base_dir[-1] != '/':
175+ base_dir = '%s/' % base_dir
176+ relative_file_path = file_path.replace(base_dir, './')
177+ cell.props.text = relative_file_path
178 else:
179 # cell_type == 'line_no'
180 cell.props.text = ''
181
182=== modified file 'plugins/gdp/find.py'
183--- plugins/gdp/find.py 2012-03-12 13:04:13 +0000
184+++ plugins/gdp/find.py 2012-06-18 13:32:54 +0000
185@@ -247,8 +247,13 @@
186 def ui_callbacks(self):
187 """The dict of callbacks for the ui widgets."""
188 return {
189+ 'on_choose_directory_icon_press':
190+ self.on_choose_directory_icon_press,
191 'on_find_in_files': self.on_find_in_files,
192+ 'on_find_in_files_icon_press': self.on_find_in_files_icon_press,
193 'on_replace_in_files': self.on_replace_in_files,
194+ 'on_replace_in_files_icon_press':
195+ self.on_replace_in_files_icon_press,
196 'on_save_results': self.on_save_results,
197 }
198
199@@ -272,7 +277,8 @@
200 path_ = '.'
201 elif path_ == self.CURRENT_FILE:
202 document = self.active_document
203- path_ = os.path.dirname(document.get_uri_for_display())
204+ path_ = document.get_uri_for_display().replace('file://', '')
205+ path_ = os.path.dirname(path_)
206 return path_
207
208 @property
209@@ -323,11 +329,31 @@
210 self.widgets.get_object('match_case_checkbox').get_active(),
211 self.file_pattern)
212
213+ def on_choose_directory_icon_press(self, widget, position, event):
214+ """Choose a directory using a dialog."""
215+ dialog = Gtk.FileChooserDialog(
216+ title="Choose a directory to find in", parent=self.window,
217+ action=Gtk.FileChooserAction.SELECT_FOLDER,
218+ buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
219+ Gtk.STOCK_OPEN, Gtk.ResponseType.ACCEPT))
220+ dialog.set_current_folder(os.getcwd())
221+ if dialog.run() == Gtk.ResponseType.ACCEPT:
222+ path = dialog.get_filename()
223+ if path:
224+ self.path_comboentry.get_child().set_text(path)
225+ dialog.destroy()
226+
227 def on_find_in_files(self, widget=None, substitution=None):
228 """Find and present the matches."""
229 treestore = self.file_lines_view.get_model()
230 treestore.clear()
231 find_params = self.get_find_params()
232+ if (find_params.path != self.CURRENT_FILE
233+ and not os.path.exists(find_params.path)):
234+ message = 'The directory path does not exist!'
235+ self.file_lines_view.get_model().append(
236+ None, (message, 'stock_dialog-info', 0, None, None))
237+ return
238 self.last_find = find_params
239 pattern = find_params.pattern
240 self.save_find_data()
241@@ -339,6 +365,10 @@
242 # of this method.
243 GObject.idle_add(find_worker.start)
244
245+ def on_find_in_files_icon_press(self, widget, position, event):
246+ """Handle find pattern entry icon-press event."""
247+ self.on_find_in_files()
248+
249 def on_find_complete(self):
250 if self.path_comboentry.get_active_text() == self.CURRENT_FILE:
251 self.file_lines_view.expand_all()
252@@ -394,6 +424,10 @@
253 elif response == Gtk.ResponseType.ACCEPT:
254 self.on_find_in_files(substitution=substitution)
255
256+ def on_replace_in_files_icon_press(self, widget, position, event):
257+ """Handle replace pattern entry icon-press event."""
258+ self.on_replace_in_files()
259+
260 def on_save_results(self, widget=None):
261 """Save the search results to a file."""
262 dialog = Gtk.FileChooserDialog(
263
264=== modified file 'plugins/gdp/find.ui'
265--- plugins/gdp/find.ui 2012-03-12 13:04:13 +0000
266+++ plugins/gdp/find.ui 2012-06-18 13:32:54 +0000
267@@ -13,128 +13,24 @@
268 <property name="orientation">vertical</property>
269 <property name="spacing">2</property>
270 <child>
271- <object class="GtkGrid" id="find_controls">
272+ <object class="GtkComboBoxText" id="path_comboentry">
273 <property name="visible">True</property>
274 <property name="can_focus">False</property>
275- <property name="row_spacing">6</property>
276- <property name="column_spacing">6</property>
277- <child>
278- <object class="GtkLabel" id="path_label">
279- <property name="visible">True</property>
280- <property name="can_focus">False</property>
281- <property name="xalign">0</property>
282- <property name="ypad">5</property>
283- <property name="label" translatable="yes">Look in: </property>
284- </object>
285- <packing>
286- <property name="left_attach">0</property>
287- <property name="top_attach">0</property>
288- <property name="width">1</property>
289- <property name="height">1</property>
290- </packing>
291- </child>
292- <child>
293- <object class="GtkLabel" id="match_label">
294- <property name="visible">True</property>
295- <property name="can_focus">False</property>
296- <property name="label" translatable="yes">Search for:</property>
297- </object>
298- <packing>
299- <property name="left_attach">0</property>
300- <property name="top_attach">1</property>
301- <property name="width">1</property>
302- <property name="height">1</property>
303- </packing>
304- </child>
305- <child>
306- <object class="GtkBox" id="hbox1">
307- <property name="visible">True</property>
308- <property name="can_focus">False</property>
309- <property name="spacing">6</property>
310- <child>
311- <object class="GtkComboBoxText" id="pattern_comboentry">
312- <property name="visible">True</property>
313- <property name="can_focus">False</property>
314- <property name="has_tooltip">True</property>
315- <property name="tooltip_markup" translatable="yes">The plain text or Python regular expression to find in files.</property>
316- <property name="tooltip_text" translatable="yes">The plain text or Python regular expression to find in files.</property>
317- <property name="has_entry">True</property>
318- <child internal-child="entry">
319- <object class="GtkEntry" id="comboboxtext-entry3">
320- <property name="can_focus">True</property>
321- <property name="invisible_char">•</property>
322- <signal name="activate" handler="on_find_in_files" swapped="no"/>
323- </object>
324- </child>
325- </object>
326- <packing>
327- <property name="expand">True</property>
328- <property name="fill">True</property>
329- <property name="position">0</property>
330- </packing>
331- </child>
332- <child>
333- <object class="GtkButton" id="find_in_files_button">
334- <property name="label" translatable="yes"> Find </property>
335- <property name="use_action_appearance">False</property>
336- <property name="visible">True</property>
337- <property name="can_focus">True</property>
338- <property name="receives_default">True</property>
339- <property name="use_action_appearance">False</property>
340- <signal name="clicked" handler="on_find_in_files" swapped="no"/>
341- </object>
342- <packing>
343- <property name="expand">False</property>
344- <property name="fill">True</property>
345- <property name="position">1</property>
346- </packing>
347- </child>
348- </object>
349- <packing>
350- <property name="left_attach">1</property>
351- <property name="top_attach">1</property>
352- <property name="width">1</property>
353- <property name="height">1</property>
354- </packing>
355- </child>
356- <child>
357- <object class="GtkComboBoxText" id="path_comboentry">
358- <property name="visible">True</property>
359- <property name="can_focus">False</property>
360- <property name="has_tooltip">True</property>
361- <property name="tooltip_markup" translatable="yes">The directory to start searching in.</property>
362- <property name="tooltip_text" translatable="yes">The directory to start searching in.</property>
363- <property name="hexpand">True</property>
364- <property name="has_entry">True</property>
365- <child internal-child="entry">
366- <object class="GtkEntry" id="comboboxtext-entry4">
367- <property name="can_focus">True</property>
368- <property name="invisible_char">•</property>
369- <signal name="activate" handler="on_find_in_files" swapped="no"/>
370- </object>
371- </child>
372- </object>
373- <packing>
374- <property name="left_attach">1</property>
375- <property name="top_attach">0</property>
376- <property name="width">1</property>
377- <property name="height">1</property>
378- </packing>
379- </child>
380- <child>
381- <placeholder/>
382- </child>
383- <child>
384- <placeholder/>
385- </child>
386- <child>
387- <placeholder/>
388- </child>
389- <child>
390- <placeholder/>
391- </child>
392- <child>
393- <placeholder/>
394+ <property name="has_tooltip">True</property>
395+ <property name="tooltip_markup" translatable="yes">The directory to start searching in.</property>
396+ <property name="tooltip_text" translatable="yes">The directory to start searching in.</property>
397+ <property name="hexpand">True</property>
398+ <property name="has_entry">True</property>
399+ <child internal-child="entry">
400+ <object class="GtkEntry" id="comboboxtext-entry4">
401+ <property name="can_focus">True</property>
402+ <property name="invisible_char">•</property>
403+ <property name="primary_icon_stock">gtk-directory</property>
404+ <property name="secondary_icon_activatable">False</property>
405+ <property name="secondary_icon_sensitive">False</property>
406+ <signal name="activate" handler="on_find_in_files" swapped="no"/>
407+ <signal name="icon-press" handler="on_choose_directory_icon_press" swapped="no"/>
408+ </object>
409 </child>
410 </object>
411 <packing>
412@@ -144,6 +40,35 @@
413 </packing>
414 </child>
415 <child>
416+ <object class="GtkComboBoxText" id="pattern_comboentry">
417+ <property name="visible">True</property>
418+ <property name="can_focus">False</property>
419+ <property name="has_tooltip">True</property>
420+ <property name="tooltip_markup" translatable="yes">The plain text or Python regular expression to find in files.</property>
421+ <property name="tooltip_text" translatable="yes">The plain text or Python regular expression to find in files.</property>
422+ <property name="has_entry">True</property>
423+ <property name="entry_text_column">0</property>
424+ <property name="id_column">1</property>
425+ <child internal-child="entry">
426+ <object class="GtkEntry" id="comboboxtext-entry">
427+ <property name="can_focus">True</property>
428+ <property name="invisible_char">•</property>
429+ <property name="primary_icon_stock">gtk-find</property>
430+ <property name="secondary_icon_stock">gtk-refresh</property>
431+ <property name="primary_icon_activatable">False</property>
432+ <property name="placeholder_text">Matching text</property>
433+ <signal name="activate" handler="on_find_in_files" swapped="no"/>
434+ <signal name="icon-press" handler="on_find_in_files_icon_press" swapped="no"/>
435+ </object>
436+ </child>
437+ </object>
438+ <packing>
439+ <property name="expand">False</property>
440+ <property name="fill">True</property>
441+ <property name="position">1</property>
442+ </packing>
443+ </child>
444+ <child>
445 <object class="GtkExpander" id="options">
446 <property name="visible">True</property>
447 <property name="can_focus">True</property>
448@@ -193,42 +118,22 @@
449 </packing>
450 </child>
451 <child>
452- <object class="GtkBox" id="hbox4">
453+ <object class="GtkComboBoxText" id="file_comboentry">
454 <property name="visible">True</property>
455 <property name="can_focus">False</property>
456- <property name="spacing">6</property>
457- <child>
458- <object class="GtkLabel" id="file_name_label">
459- <property name="visible">True</property>
460- <property name="can_focus">False</property>
461- <property name="label" translatable="yes">File name pattern:</property>
462- </object>
463- <packing>
464- <property name="expand">False</property>
465- <property name="fill">True</property>
466- <property name="position">0</property>
467- </packing>
468- </child>
469- <child>
470- <object class="GtkComboBoxText" id="file_comboentry">
471- <property name="visible">True</property>
472- <property name="can_focus">False</property>
473- <property name="has_entry">True</property>
474- <child internal-child="entry">
475- <object class="GtkEntry" id="comboboxtext-entry25">
476- <property name="can_focus">True</property>
477- <property name="tooltip_text" translatable="yes">A regular expression pattern used to match the directory or file name.
478+ <property name="has_entry">True</property>
479+ <child internal-child="entry">
480+ <object class="GtkEntry" id="comboboxtext-entry25">
481+ <property name="can_focus">True</property>
482+ <property name="tooltip_text" translatable="yes">A regular expression pattern used to match the directory or file name.
483 eg. py or tests/ or \.(py|html)$</property>
484- <property name="invisible_char">•</property>
485- <signal name="activate" handler="on_find_in_files" swapped="no"/>
486- </object>
487- </child>
488+ <property name="invisible_char">•</property>
489+ <property name="primary_icon_stock">gtk-file</property>
490+ <property name="secondary_icon_activatable">False</property>
491+ <property name="secondary_icon_sensitive">False</property>
492+ <property name="placeholder_text">File name pattern</property>
493+ <signal name="activate" handler="on_find_in_files" swapped="no"/>
494 </object>
495- <packing>
496- <property name="expand">True</property>
497- <property name="fill">True</property>
498- <property name="position">1</property>
499- </packing>
500 </child>
501 </object>
502 <packing>
503@@ -250,7 +155,7 @@
504 <packing>
505 <property name="expand">False</property>
506 <property name="fill">True</property>
507- <property name="position">1</property>
508+ <property name="position">2</property>
509 </packing>
510 </child>
511 <child>
512@@ -274,7 +179,7 @@
513 <packing>
514 <property name="expand">True</property>
515 <property name="fill">True</property>
516- <property name="position">2</property>
517+ <property name="position">3</property>
518 </packing>
519 </child>
520 <child>
521@@ -288,64 +193,26 @@
522 <property name="orientation">vertical</property>
523 <property name="spacing">6</property>
524 <child>
525- <object class="GtkBox" id="hbox5">
526+ <object class="GtkComboBoxText" id="substitution_comboentry">
527 <property name="visible">True</property>
528 <property name="can_focus">False</property>
529- <property name="spacing">6</property>
530- <child>
531- <object class="GtkLabel" id="label2">
532- <property name="visible">True</property>
533- <property name="can_focus">False</property>
534- <property name="label" translatable="yes">Replace with:</property>
535- </object>
536- <packing>
537- <property name="expand">False</property>
538- <property name="fill">False</property>
539- <property name="position">0</property>
540- </packing>
541- </child>
542- <child>
543- <object class="GtkComboBoxText" id="substitution_comboentry">
544- <property name="visible">True</property>
545- <property name="can_focus">False</property>
546- <property name="has_tooltip">True</property>
547- <property name="tooltip_markup" translatable="yes">The text to replace each found match with.
548-The replacement may use backslash escapes to access groups in match expression</property>
549- <property name="tooltip_text" translatable="yes">The text to replace each found match with.
550-The replacement may use backslash escapes to access groups in match expression</property>
551- <property name="has_entry">True</property>
552- <child internal-child="entry">
553- <object class="GtkEntry" id="comboboxtext-entry23">
554- <property name="can_focus">True</property>
555- <property name="invisible_char">•</property>
556- </object>
557- </child>
558- </object>
559- <packing>
560- <property name="expand">True</property>
561- <property name="fill">True</property>
562- <property name="position">1</property>
563- </packing>
564- </child>
565- <child>
566- <object class="GtkButton" id="replace_in_files_button">
567- <property name="label" translatable="yes">Replace</property>
568- <property name="use_action_appearance">False</property>
569- <property name="visible">True</property>
570+ <property name="has_tooltip">True</property>
571+ <property name="tooltip_markup" translatable="yes">The text to replace each found match with.
572+The replacement may use backslash escapes to access groups in match expression</property>
573+ <property name="tooltip_text" translatable="yes">The text to replace each found match with.
574+The replacement may use backslash escapes to access groups in match expression</property>
575+ <property name="has_entry">True</property>
576+ <child internal-child="entry">
577+ <object class="GtkEntry" id="comboboxtext-entry23">
578 <property name="can_focus">True</property>
579- <property name="receives_default">True</property>
580- <property name="has_tooltip">True</property>
581- <property name="tooltip_markup" translatable="yes">Replace the matched text.</property>
582- <property name="tooltip_text" translatable="yes">Replace the matched text.</property>
583- <property name="use_action_appearance">False</property>
584- <signal name="clicked" handler="on_replace_in_files" swapped="no"/>
585+ <property name="invisible_char">•</property>
586+ <property name="primary_icon_stock">gtk-find-and-replace</property>
587+ <property name="secondary_icon_stock">gtk-refresh</property>
588+ <property name="primary_icon_activatable">False</property>
589+ <property name="placeholder_text">Replacement text</property>
590+ <signal name="activate" handler="on_replace_in_files" swapped="no"/>
591+ <signal name="icon-press" handler="on_replace_in_files_icon_press" swapped="no"/>
592 </object>
593- <packing>
594- <property name="expand">False</property>
595- <property name="fill">False</property>
596- <property name="pack_type">end</property>
597- <property name="position">2</property>
598- </packing>
599 </child>
600 </object>
601 <packing>
602@@ -400,7 +267,7 @@
603 <property name="expand">False</property>
604 <property name="fill">True</property>
605 <property name="padding">6</property>
606- <property name="position">3</property>
607+ <property name="position">4</property>
608 </packing>
609 </child>
610 </object>
611
612=== modified file 'plugins/gdp/tests/test_find.py'
613--- plugins/gdp/tests/test_find.py 2012-03-12 13:04:13 +0000
614+++ plugins/gdp/tests/test_find.py 2012-06-18 13:32:54 +0000
615@@ -13,7 +13,10 @@
616 Finder,
617 FinderWorker,
618 )
619-from testing import GeditTestCase
620+from testing import (
621+ GeditTestCase,
622+ MockMethod,
623+ )
624
625
626 class TestCallback:
627@@ -182,6 +185,39 @@
628 self.assertEqual(['one', 'three', 'two'], words)
629 self.assertEqual('two', comboentry.get_active_text())
630
631+ def test_path(self):
632+ self.make_config(find, Config)
633+ window, view, document = self.make_gedit(
634+ 'plugins/gdp/data/snark12.txt')
635+ finder = Finder(window)
636+ finder.update_comboentry(
637+ finder.path_comboentry, '/fnord/pting', True)
638+ self.assertEqual('/fnord/pting', finder.path)
639+ finder.update_comboentry(
640+ finder.path_comboentry, '<Working Directory>', True)
641+ self.assertEqual('.', finder.path)
642+ finder.update_comboentry(
643+ finder.path_comboentry, '<Current File>', True)
644+ self.assertIs(False, finder.path.startswith('file://'))
645+ self.assertIs(True, finder.path.endswith('plugins/gdp/data'))
646+
647+ def test_file_pattern(self):
648+ self.make_config(find, Config)
649+ window, view, document = self.make_gedit(
650+ 'plugins/gdp/data/snark12.txt')
651+ finder = Finder(window)
652+ finder.update_comboentry(
653+ finder.file_comboentry, 'txt', True)
654+ self.assertEqual('txt', finder.file_pattern)
655+ finder.update_comboentry(
656+ finder.file_comboentry, '<Any Text File>', True)
657+ self.assertEqual('.', finder.file_pattern)
658+ finder.update_comboentry(
659+ finder.path_comboentry, '<Current File>', True)
660+ finder.update_comboentry(
661+ finder.file_comboentry, 'ignored', True)
662+ self.assertEqual('snark12.txt', finder.file_pattern)
663+
664 def test_save_find_data(self):
665 # Setup a test config so that the singleton is not mutated.
666 file_ = self.make_config(find, Config)
667@@ -210,6 +246,23 @@
668 self.assertIn('matches = eleven\n', config_data)
669 self.assertNotIn('\t.\n', config_data)
670
671+ def test_on_choose_directory_icon_press(self):
672+ # Setup a test config so that the singleton is not mutated.
673+ self.make_config(find, Config)
674+ window, view, document = self.make_gedit(
675+ 'plugins/gdp/data/snark12.txt')
676+ finder = Finder(window)
677+ expected_path = os.path.abspath('plugins/gdp/data/snark12.txt')
678+ MockMethod.bind(
679+ self, Gtk.FileChooserDialog, 'run', Gtk.ResponseType.ACCEPT)
680+ MockMethod.bind(
681+ self, Gtk.FileChooserDialog, 'get_filename', expected_path)
682+ finder.on_choose_directory_icon_press(
683+ finder.path_comboentry, Gtk.EntryIconPosition.SECONDARY, None)
684+ self.assertIs(True, Gtk.FileChooserDialog.run.called)
685+ self.assertEqual(
686+ expected_path, finder.path_comboentry.get_active_text())
687+
688 def test_on_find_in_files(self):
689 # Setup a test config so that the singleton is not mutated.
690 file_ = self.make_config(find, Config)
691@@ -226,6 +279,37 @@
692 finder.file_lines_view.get_column(0).props.title)
693 self.assertIn('matches = snark\n', file_.read())
694
695+ def test_on_find_in_files_icon_press(self):
696+ # Setup a test config so that the singleton is not mutated.
697+ self.make_config(find, Config)
698+ window, view, document = self.make_gedit(
699+ 'plugins/gdp/data/snark12.txt')
700+ finder = Finder(window)
701+ finder.update_comboentry(finder.pattern_comboentry, 'snark', True)
702+ finder.update_comboentry(
703+ finder.path_comboentry, '<Current File>', True)
704+ MockMethod.bind(self, finder, 'on_find_in_files')
705+ finder.on_find_in_files_icon_press(
706+ finder.pattern_comboentry, Gtk.EntryIconPosition.SECONDARY, None)
707+ self.assertTrue(finder.on_find_in_files.called)
708+
709+ def test_on_find_in_files_nonexistant_path(self):
710+ # Setup a test config so that the singleton is not mutated.
711+ self.make_config(find, Config)
712+ window, view, document = self.make_gedit(
713+ 'plugins/gdp/data/snark12.txt')
714+ finder = Finder(window)
715+ finder.update_comboentry(finder.pattern_comboentry, 'snark', True)
716+ finder.update_comboentry(
717+ finder.path_comboentry, '/fnord/pting/snarf', True)
718+ MockMethod.bind(self, find, 'FinderWorker')
719+ finder.on_find_in_files()
720+ self.assertIs(False, find.FinderWorker.called)
721+ self.assertIs(None, finder.last_find)
722+ self.assertEqual(
723+ 'The directory path does not exist!',
724+ finder.file_lines_view.get_model()[0][0])
725+
726 def test_show_replace(self):
727 window, view, document = self.make_gedit(
728 'plugins/gdp/data/snark12.txt')
729@@ -235,6 +319,21 @@
730 finder.show_replace(None)
731 self.assertTrue(panel.props.visible)
732
733+ def test_on_replace_in_files_icon_press(self):
734+ # Setup a test config so that the singleton is not mutated.
735+ self.make_config(find, Config)
736+ window, view, document = self.make_gedit(
737+ 'plugins/gdp/data/snark12.txt')
738+ finder = Finder(window)
739+ finder.update_comboentry(finder.pattern_comboentry, 'snark', True)
740+ finder.update_comboentry(
741+ finder.path_comboentry, '<Current File>', True)
742+ MockMethod.bind(self, finder, 'on_replace_in_files')
743+ finder.on_replace_in_files_icon_press(
744+ finder.substitution_comboentry,
745+ Gtk.EntryIconPosition.SECONDARY, None)
746+ self.assertTrue(finder.on_replace_in_files.called)
747+
748 def test_get_untested_replacement_dialog(self):
749 # If the plugin's last_find is not equal to the current find,
750 # a window is presented to confirm the replace.
751
752=== modified file 'plugins/gdp/tests/test_gdp.py'
753--- plugins/gdp/tests/test_gdp.py 2012-02-07 12:20:48 +0000
754+++ plugins/gdp/tests/test_gdp.py 2012-06-18 13:32:54 +0000
755@@ -6,12 +6,74 @@
756
757 from xdg import BaseDirectory
758
759+from gi.repository import (
760+ GObject,
761+ Gtk,
762+ )
763+
764 from gdp import (
765 Config,
766+ set_file_line,
767 )
768 from testing import GeditTestCase
769
770
771+class FileLinesViewTestCase(GeditTestCase):
772+
773+ def makeTreeStore(self):
774+ return Gtk.TreeStore(
775+ GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_INT,
776+ GObject.TYPE_STRING, GObject.TYPE_STRING)
777+
778+ def test_set_file_type_line_no_and_message(self):
779+ model = self.makeTreeStore()
780+ piter = model.append(
781+ None, ('/fnord/pting', 'some-icon', 5, 'message', '/fnord'))
782+ cell = Gtk.CellRendererText()
783+ set_file_line(None, cell, model, piter, 'line_no')
784+ self.assertEqual('5', cell.props.text)
785+
786+ def test_set_file_type_line_no_without_message(self):
787+ model = self.makeTreeStore()
788+ piter = model.append(
789+ None, ('/fnord/pting', 'some-icon', 5, None, '/fnord'))
790+ cell = Gtk.CellRendererText()
791+ set_file_line(None, cell, model, piter, 'line_no')
792+ self.assertEqual('', cell.props.text)
793+
794+ def test_set_file_type_text_and_message(self):
795+ model = self.makeTreeStore()
796+ piter = model.append(
797+ None, ('/fnord/pting', 'some-icon', 5, 'message', '/fnord'))
798+ cell = Gtk.CellRendererText()
799+ set_file_line(None, cell, model, piter, 'text')
800+ self.assertEqual('message', cell.props.text)
801+
802+ def test_set_file_type_text_without_message(self):
803+ model = self.makeTreeStore()
804+ piter = model.append(
805+ None, ('/fnord/pting', 'some-icon', 5, None, '/fnord'))
806+ cell = Gtk.CellRendererText()
807+ set_file_line(None, cell, model, piter, 'text')
808+ self.assertEqual('./pting', cell.props.text)
809+
810+ def test_set_file_type_text_without_message_with_trailing_slash(self):
811+ model = self.makeTreeStore()
812+ piter = model.append(
813+ None, ('/fnord/pting', 'some-icon', 5, None, '/fnord/'))
814+ cell = Gtk.CellRendererText()
815+ set_file_line(None, cell, model, piter, 'text')
816+ self.assertEqual('./pting', cell.props.text)
817+
818+ def test_set_file_type_text_without_message_or_base_dir(self):
819+ model = self.makeTreeStore()
820+ piter = model.append(
821+ None, ('/fnord/pting', 'some-icon', 5, None, None))
822+ cell = Gtk.CellRendererText()
823+ set_file_line(None, cell, model, piter, 'text')
824+ self.assertEqual('/fnord/pting', cell.props.text)
825+
826+
827 class ConfigTestCase(GeditTestCase):
828
829 def make_config(self, text=''):
830
831=== modified file 'testing/__init__.py'
832--- testing/__init__.py 2012-03-12 13:04:13 +0000
833+++ testing/__init__.py 2012-06-18 13:32:54 +0000
834@@ -50,8 +50,8 @@
835 self.addCleanup(
836 os.environ.update, {'GSETTINGS_BACKEND': old_backend})
837 else:
838- os.environ['GSETTINGS_BACKEND'] = 'memory'
839 self.addCleanup(os.environ.__delitem__, 'GSETTINGS_BACKEND')
840+ os.environ['GSETTINGS_BACKEND'] = 'memory'
841 settings = Gio.Settings.new('org.gnome.gedit.plugins')
842 return settings
843
844@@ -74,7 +74,7 @@
845 return text_file
846
847
848-class MockMethod:
849+class MockMethod(object):
850
851 @classmethod
852 def bind(klass, test_instance, obj, method_name,
853
854=== modified file 'testing/testrunner.py'
855--- testing/testrunner.py 2012-03-12 13:04:13 +0000
856+++ testing/testrunner.py 2012-06-18 13:32:54 +0000
857@@ -196,6 +196,7 @@
858 setup_env(params)
859 os.chdir(project_dir())
860 os.environ['use_fake_gedit'] = 'true'
861+ os.environ['GSETTINGS_BACKEND'] = 'memory'
862 # Format the output.
863 unittest.runner._WritelnDecorator = Env.write_decorator
864 suite = unittest.TestSuite()

Subscribers

People subscribed via source and target branches

to all changes: