This file is indexed.

/usr/lib/gjots2/find.py is in gjots2 2.4.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
import gtk.keysyms
import gtk.glade
import re
import inspect

class find_dialog:
		
	def destroy(self):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		self.find_get_widget(self.name).destroy()
		self.gui.remove_tag()
		
	def saveSettings(self):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		w = self.find_get_widget("caseCheckbutton")
		if w:
			self.gui.client.set_bool(self.gui.find_match_case_path, w.get_active())

		w = self.find_get_widget("globalCheckbutton")
		if w:
			self.gui.client.set_bool(self.gui.find_global_path, w.get_active())

		w = self.find_get_widget("regexCheckbutton")
		if w:
			self.gui.client.set_bool(self.gui.find_regex_path, w.get_active())

		w = self.find_get_widget("backwardsCheckbutton")
		if w:
			self.gui.client.set_bool(self.gui.find_backwards_path, w.get_active())

		w = self.find_get_widget("findEntry")
		if w:
			self.gui.client.set_string(self.gui.find_text_path, w.get_text())
			m = self.find_get_widget("menubar_find_entry")
			if not m:
				# glade2
				m = self.gui.gui_get_widget("menubar_find_combobox").child
				
			if m:
				m.set_text(w.get_text())

		w = self.find_get_widget("replaceEntry")
		if w:
			self.gui.client.set_string(self.gui.replace_text_path, w.get_text())
		
		return
	
	def on_findDialog_destroy(self, widget):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		self.gui.find_dialog = None
		return
	
	def on_replaceEntry_key_press_event(self, widget, key_event):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2], vars()
		if key_event.keyval == gtk.keysyms.Return or key_event.keyval == gtk.keysyms.KP_Enter:
			self.on_replaceStartButton_clicked(widget)
		if key_event.keyval == gtk.keysyms.Escape:
			self.on_findCancelButton_clicked(widget)
		return

	def feedback(self, msg):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2], vars()
		w = self.find_get_widget("findFeedback")
		if w:
			w.set_text(msg)
		return
		
	def on_findStartButton_clicked(self, widget):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		self.gui.sync_text_buffer()
		self.saveSettings()
		self.feedback("")

		if not self.gui.find_next():
			self.feedback(_("Not found"))
		else:
			self.feedback(_("Found"))

		w = self.find_get_widget("findEntry")
		if w:
			w.grab_focus()

	def on_findCloseButton_clicked(self, widget):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		self.saveSettings()
		self.destroy()
		return

	def on_replaceStartButton_clicked(self, widget):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		self.gui.sync_text_buffer()
		self.saveSettings()
		self.feedback("")

		if not self.gui.replace_next():
			self.feedback(_("Not found"))
			return

		self.feedback(_("Replace?"))

		w = self.find_get_widget("findEntry")
		if w:
			w.grab_focus()
		return
		
	def on_replaceAllButton_clicked(self, widget):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		self.gui.sync_text_buffer()
		self.saveSettings()
		total = 0
		i = 1
		while i:
			i = self.gui.replace_next()
			total = total + i
		self.feedback(_("%d substitutions") % total)

		w = self.find_get_widget("findEntry")
		if w:
			w.grab_focus()
		return
	
	def on_findCancelButton_clicked(self, widget):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		self.destroy()
		return
	
	def on_findClearButton_clicked(self, widget):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		w = self.find_get_widget("findEntry")
		if w:
			w.set_text("")
			w.grab_focus()

		w = self.find_get_widget("replaceEntry")
		if w:
			w.set_text("")
		return
	
	def update_find_entry(self):
		# Potential for wonderful infinite loops here?
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		m = self.find_get_widget("findEntry")
		if m:
			m.set_text(self.gui.client.get_string(self.gui.find_text_path))

	def _set_readonly(self, mode):
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]
		if mode:
			w = self.find_get_widget("replaceStartButton")
			w.hide()
			w = self.find_get_widget("replaceEntry")
			w.hide()
			w = self.find_get_widget("replaceLabel")
			w.hide()
			w = self.find_get_widget("replaceAllButton")
			w.hide()
		else:
			w = self.find_get_widget("replaceStartButton")
			w.show()
			w = self.find_get_widget("replaceEntry")
			w.show()
			w = self.find_get_widget("replaceLabel")
			w.show()
			w = self.find_get_widget("replaceAllButton")
			w.show()
	
	def __init__(self, gui):
		"""
		Find dialog
		"""

		self.gui = gui
		if self.gui.debug:
			print inspect.getframeinfo(inspect.currentframe())[2]

		callbacks = {
			"on_findDialog_destroy":					self.on_findDialog_destroy,
			"on_replaceEntry_key_press_event":			self.on_replaceEntry_key_press_event,
			"on_findStartButton_clicked":				self.on_findStartButton_clicked,
			"on_findCloseButton_clicked":				self.on_findCloseButton_clicked,
			"on_replaceStartButton_clicked":			self.on_replaceStartButton_clicked,
			"on_replaceAllButton_clicked":				self.on_replaceAllButton_clicked,
			"on_findCancelButton_clicked":				self.on_findCancelButton_clicked,
			"on_findClearButton_clicked":				self.on_findClearButton_clicked 
		}
		self.name = "findDialog"
		if self.gui.builder:
			self.gui.builder.add_from_file(self.gui.sharedir + "ui/findDialog.ui")
			self.gui.builder.connect_signals(callbacks)
			self.find_get_widget = self.gui.gui_get_widget
		else:
			self.xml = gtk.glade.XML(self.gui.gui_filename, self.name, domain="gjots2")
			self.xml.signal_autoconnect(callbacks)
			self.find_get_widget = self.xml.get_widget

		w = self.find_get_widget("caseCheckbutton")
		if w:
			w.set_active(self.gui.client.get_bool(self.gui.find_match_case_path))

		w = self.find_get_widget("globalCheckbutton")
		if w:
			w.set_active(self.gui.client.get_bool(self.gui.find_global_path))

		w = self.find_get_widget("regexCheckbutton")
		if w:
			w.set_active(self.gui.client.get_bool(self.gui.find_regex_path))

		w = self.find_get_widget("backwardsCheckbutton")
		if w:
			w.set_active(self.gui.client.get_bool(self.gui.find_backwards_path))

		w = self.find_get_widget("findEntry")
		if w:
			w.set_text(self.gui.client.get_string(self.gui.find_text_path))
			w.select_region(0, -1)

		w = self.find_get_widget("replaceEntry")
		if w:
			w.set_text(self.gui.client.get_string(self.gui.replace_text_path))
			
		self.feedback("")
		self._set_readonly(self.gui.readonly)
		
# find_dialog

# Local variables:
# eval:(setq compile-command "cd ..; ./gjots2 test.gjots")
# eval:(setq-default indent-tabs-mode 1)
# eval:(setq tab-width 4)
# eval:(setq python-indent 4)
# End: