This file is indexed.

/usr/share/pyshared/seascope/view/FileView.py is in seascope 0.8-3.

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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#!/usr/bin/python

# Copyright (c) 2010 Anil Kumar
# All rights reserved.
#
# License: BSD 

import os

from PyQt4.QtGui import *
from PyQt4.QtCore import *

dir_prefix = None

class DirTab(QWidget):
	sig_show_file = pyqtSignal(str)
	
	def __init__(self, parent=None):
		QWidget.__init__(self)

		self.is_ft = False

		# Tree view
		self.tmodel = QFileSystemModel()
		self.tmodel.setRootPath(QDir.rootPath())
		self.tview = QTreeView()
		self.tview.setHeaderHidden(True)

		self.ted = QLineEdit()
		self.completer = QCompleter()
		self.completer.setCompletionMode(QCompleter.PopupCompletion)
		self.ted.setToolTip("Current folder")
		self.ted.setCompleter(self.completer)
		self.tdbtn = QPushButton()
		self.tdbtn.setIcon(QApplication.style().standardIcon(QStyle.SP_DirIcon))
		self.tdbtn.setToolTip("Open folder for browsing")
		self.trbtn = QPushButton()
		self.trbtn.setIcon(QApplication.style().standardIcon(QStyle.SP_BrowserReload))
		self.trbtn.setToolTip("Reset to common top-level folder of file in list")

		self.completer.setModel(self.tmodel)
		self.tview.setModel(self.tmodel)

		thlay = QHBoxLayout()
		thlay.addWidget(self.ted)
		thlay.addWidget(self.tdbtn)
		thlay.addWidget(self.trbtn)
		tvlay = QVBoxLayout()
		tvlay.addLayout(thlay)
		tvlay.addWidget(self.tview)
		
		self.setLayout(tvlay)

		self.tview.activated.connect(self.tview_itemActivated)
		self.tdbtn.clicked.connect(self.change_btn_cb)
		self.ted.editingFinished.connect(self.ted_editingFinished)
		self.trbtn.clicked.connect(self.reset_btn_cb)

		self.hide_view_columns(self.tview)

	def hide_view_columns(self, view):
		header = view.header()
		for col in range(header.count()):
			if col > 0:
				view.setColumnHidden(col, True)


	def tview_itemActivated(self):
		list = self.tview.selectionModel().selectedIndexes()
		for item in list:
			if self.tmodel.fileInfo(item).isFile():
				self.sig_show_file.emit(self.tmodel.fileInfo(item).absoluteFilePath())
	
	def set_tab_name(self, dirstr):
		# Set tab name
		inx = self.parent.indexOf(self)
		try:
			if dirstr != dir_prefix:
				name = os.path.split(dirstr)[1]
			else:
				name = ''
			self.parent.setTabText(inx, name)
		except:
			pass

	def dir_reset(self, dirstr):
		self.set_tab_name(dirstr)
		self.tview.setRootIndex(self.tmodel.index(dirstr))
		self.ted.setText(dirstr)
		
	def ted_editingFinished(self):
		path = str(self.ted.text())
		if not os.path.isdir(path):
			path = os.path.dirname(path)
		if os.path.isdir(path):
			self.dir_reset(path)
		else:
			self.dir_reset(dir_prefix)

	def change_btn_cb(self):
		fdlg = QFileDialog(None, "Choose directory to browse")
		fdlg.setFileMode(QFileDialog.Directory)
		fdlg.setOptions(QFileDialog.ShowDirsOnly) # and QFileDialog.HideNameFilterDetails)
		fdlg.setDirectory(self.ted.text())
		if (fdlg.exec_()):
			browse_dir = fdlg.selectedFiles()[0]
			self.dir_reset(str(browse_dir))

	def reset_btn_cb(self):
		self.dir_reset(dir_prefix)

	def resizeEvent(self, event):
		self.tdbtn.setMaximumHeight(self.ted.height())
		self.trbtn.setMaximumHeight(self.ted.height())

class FileTab(QWidget):
	sig_show_file = pyqtSignal(str)
	
	def __init__(self, parent=None):
		QWidget.__init__(self)

		self.is_ft = True

		# List view
		self.le = QLineEdit()

		self.lview = QTreeWidget(self)
		self.lview.setColumnCount(2)
		self.lview.setHeaderLabels(['File', 'Path'])
		self.lview.setFont(QFont("San Serif", 8))
		self.lview.setIndentation(-2)
		self.lview.setAllColumnsShowFocus(True)

		lvlay = QVBoxLayout()
		lvlay.addWidget(self.le)
		lvlay.addWidget(self.lview)
		self.setLayout(lvlay)

		self.le.textChanged.connect(self.le_textChanged)
		self.le.returnPressed.connect(self.le_returnPressed)
		self.lview.itemActivated.connect(self.lview_itemActivated)

		global dir_prefix
		dir_prefix = QDir.rootPath() 

	def le_textChanged(self, text):
		if (text == ''):
			return
		self.lview.keyboardSearch('')
		self.lview.keyboardSearch(text)

	def le_returnPressed(self):
		self.le.clear()
		items = self.lview.selectedItems()
		if len(items) == 0:
			return
		self.lview.itemActivated.emit(items[0], 0)

	def lview_itemActivated(self, item):
		filename = str(item.data(1, Qt.DisplayRole).toString())
		if self.is_rel_path:
			filename = filename.replace("...", dir_prefix, 1)
		self.sig_show_file.emit(filename)

	def keyPressEvent(self, ev):
		if ev.key() in [Qt.Key_Up, Qt.Key_Down, Qt.Key_PageUp or Qt.Key_PageDown]:
			self.lview.keyPressEvent(ev)
			return

	def search_file_cb(self):
		self.le.setFocus()
		self.le.selectAll()

	def clear(self):
		global dir_prefix
		dir_prefix = QDir.rootPath() 
		self.is_rel_path = False
		self.le.clear()
		self.lview.clear()

	def add_files(self, flist):
		global dir_prefix
		self.clear()
		dir_prefix = os.path.dirname(os.path.commonprefix(flist))
		if len(dir_prefix) > 16:
			self.is_rel_path = True
		for f in flist:
			if self.is_rel_path:
				f =  f.replace(dir_prefix, "...", 1)
			item = QTreeWidgetItem([os.path.basename(f), f])
			self.lview.addTopLevelItem(item)
			#if (self.lview.topLevelItemCount() > 0):
				#self.lview.resizeColumnToContents(0)
				#self.lview.resizeColumnToContents(1)
		self.lview.sortByColumn(0, Qt.AscendingOrder)

class FileTree(QTabWidget):
	sig_show_file = pyqtSignal(str)
	
	def __init__(self, parent=None):
		QTabWidget.__init__(self)
		
		self.setMovable(True)

		t = FileTab()
		icon = QApplication.style().standardIcon(QStyle.SP_FileDialogDetailedView)
		self.addTab(t, icon, '')
		self.ft = t

		self.dlist = []

		self.new_dir_tab_cb()

		self.clear()

		# setup popup menu
		self.pmenu = QMenu()
		self.pmenu.addAction("&New Dir View", self.new_dir_tab_cb)
		self.pmenu.addAction("&Close Active Dir View", self.close_active_dir_tab_cb)
		self.pmenu.addAction("&Close All Dir View", self.close_all_dir_tab_cb)
	
	def new_dir_tab_cb(self, d=None):
		t = DirTab()
		t.parent = self
		self.dlist.append(t)
		icon = QApplication.style().standardIcon(QStyle.SP_DirClosedIcon)
		self.addTab(t, icon, '')
		if d:
			t.dir_reset(d)
		else:
			t.reset_btn_cb()

	def close_all_dir_tab_cb(self):
		for t in self.dlist:
			inx = self.indexOf(t)
			self.removeTab(inx)
		self.dlist = []
		# Always have atleast one dir view
		self.new_dir_tab_cb()

	def open_dir_view(self, filename):
		d = os.path.dirname(str(filename))
		self.new_dir_tab_cb(d)

	def close_active_dir_tab_cb(self):
		inx = self.currentIndex()
		if inx < 0:
			return
		t = self.widget(inx)
		if t.is_ft:
			return
		if self.count() <= 2:
			self.close_all_dir_tab_cb()
			return
		self.dlist.remove(t)
		self.removeTab(inx)

	def addTab(self, t, icon, x):
		t.sig_show_file.connect(self.sig_show_file)
		QTabWidget.addTab(self, t, icon, x)
		if self.count() > 2:
			inx = self.indexOf(t)
		else:
			inx = 0
		self.setCurrentIndex(inx)

	def mousePressEvent(self, m_ev):
		QTabWidget.mousePressEvent(self, m_ev)
		if (m_ev.button() == Qt.RightButton):
			self.pmenu.exec_(QCursor.pos())

	def search_file_cb(self):
		self.ft.search_file_cb()
		self.setCurrentWidget(self.ft)

	def clear(self):
		self.ft.clear()
		self.close_all_dir_tab_cb()

	def add_files(self, flist):
		self.ft.add_files(flist)
		for t in self.dlist:
			t.reset_btn_cb()