This file is indexed.

/usr/lib/python2.7/dist-packages/DisplayCAL/wxVRML2X3D.py is in dispcalgui 3.1.0.0-1.

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
# -*- coding: utf-8 -*-

import os
import sys

from meta import name as appname
from safe_print import safe_print
from util_os import launch_file, make_win32_compatible_long_path, waccess
from util_str import safe_unicode
from worker import Worker, show_result_dialog
from wxaddons import wx
from wxfixes import GenBitmapButton as BitmapButton
from wxwindows import BaseApp, BaseFrame, FileDrop
import config
import localization as lang
import x3dom


class VRML2X3DFrame(BaseFrame):

	def __init__(self, html, embed, view, force, cache):
		BaseFrame.__init__(self, None, wx.ID_ANY,
						   lang.getstr("vrml_to_x3d_converter"),
						   style=wx.DEFAULT_FRAME_STYLE & ~(wx.MAXIMIZE_BOX |
															wx.RESIZE_BORDER),
						   name="vrml2x3dframe")
		self.SetIcons(config.get_icon_bundle([256, 48, 32, 16],
											  appname +
											  "-VRML-to-X3D-converter"))
		self.cache = cache
		self.embed = embed
		self.force = force
		self.html = html
		self.worker = Worker(self)
		sizer = wx.BoxSizer(wx.HORIZONTAL)
		self.SetSizer(sizer)
		panel = wx.Panel(self)
		sizer.Add(panel)
		panelsizer = wx.BoxSizer(wx.HORIZONTAL)
		panel.SetSizer(panelsizer)
		self.btn = BitmapButton(panel, wx.ID_ANY,
								config.geticon(256, "document-open"), 
								style=wx.NO_BORDER)
		self.btn.SetToolTipString(lang.getstr("file.select"))
		self.btn.Bind(wx.EVT_BUTTON, lambda event:
									  vrmlfile2x3dfile(None,
													   html=html,
													   embed=embed,
													   view=view,
													   force=force,
													   cache=cache,
													   worker=self.worker))
		self.droptarget = FileDrop(self)
		vrml_drop_handler = lambda vrmlpath: vrmlfile2x3dfile(vrmlpath,
															  html=html,
															  embed=embed,
															  view=view,
															  force=force,
															  cache=cache,
															  worker=self.worker)
		self.droptarget.drophandlers = {
			".vrml": vrml_drop_handler,
			".vrml.gz": vrml_drop_handler,
			".wrl": vrml_drop_handler,
			".wrl.gz": vrml_drop_handler,
			".wrz": vrml_drop_handler
		}
		self.btn.SetDropTarget(self.droptarget)
		panelsizer.Add(self.btn, flag=wx.ALL, border=12)
		self.Fit()
		self.SetMinSize(self.GetSize())
		self.SetMaxSize(self.GetSize())

	def get_commands(self):
		return (self.get_common_commands() +
			    ["VRML-to-X3D-converter [filename...]",
				 "load <filename...>"])

	def process_data(self, data):
		if data[0] in ("VRML-to-X3D-converter", "load"):
			if self.IsIconized():
				self.Restore()
			self.Raise()
			if len(data) > 1:
				self.droptarget.OnDropFiles(0, 0, data[1:])
			return "ok"
		return "invalid"


def main():
	if "--help" in sys.argv[1:]:
		safe_print("Usage: %s [--embed] [--no-gui] [--view] [FILE]" % sys.argv[0])
		safe_print("Convert VRML file to X3D")
		safe_print("The output is written to FILENAME.x3d(.html)")
		safe_print("")
		safe_print("  --embed      Embed viewer components in HTML instead of "
				   "referencing them")
		safe_print("  --force      Force fresh download of viewer components")
		safe_print("  --no-cache   Don't use viewer components cache (only "
				   "uses existing cache if")
		safe_print("               embedding components, can be overridden "
				   "with --force)")
		safe_print("  --no-gui     Don't show GUI (terminal mode)")
		safe_print("  --no-html    Don't generate HTML file")
		safe_print("  --view       View the generated file (if --no-gui)")
		safe_print("  FILE         Filename of VRML file to convert")
		return
	config.initcfg("VRML-to-X3D-converter")
	lang.init()
	lang.update_defaults()
	cache = not "--no-cache" in sys.argv[1:]
	embed = "--embed" in sys.argv
	force = "--force" in sys.argv
	html = not "--no-html" in sys.argv[1:]
	if "--no-gui" in sys.argv[1:]:
		view = "--view" in sys.argv[1:]
		for arg in sys.argv[1:]:
			if os.path.isfile(arg):
				vrmlfile2x3dfile(safe_unicode(arg), html=html, embed=embed,
								 view=view, force=force, cache=cache)
	else:
		view = not "--no-view" in sys.argv[1:]
		app = BaseApp(0)
		app.TopWindow = VRML2X3DFrame(html, embed, view, force, cache)
		if sys.platform == "darwin":
			app.TopWindow.init_menubar()
		wx.CallLater(1, _main, app)
		app.MainLoop()

def _main(app):
	app.TopWindow.listen()
	app.process_argv()
	app.TopWindow.Show()


def vrmlfile2x3dfile(vrmlpath=None, x3dpath=None, html=True, embed=False,
					 view=False, force=False, cache=True, worker=None):
	""" Convert VRML to HTML. Output is written to <vrmlfilename>.x3d.html
	unless you set x3dpath to desired output path, or False to be prompted
	for an output path. """
	while not vrmlpath or not os.path.isfile(vrmlpath):
		if "--no-gui" in sys.argv[1:]:
			if not vrmlpath or vrmlpath.startswith("--"):
				safe_print("No filename given.")
			else:
				safe_print("%r is not a file." % vrmlpath)
			sys.exit(1)
		if not wx.GetApp():
			app = BaseApp(0)
		defaultDir, defaultFile = config.get_verified_path("last_vrml_path")
		dlg = wx.FileDialog(None, lang.getstr("file.select"),
							defaultDir=defaultDir, 
							defaultFile=defaultFile, 
							wildcard=lang.getstr("filetype.vrml") +
									 "|*.vrml;*.vrml.gz;*.wrl.gz;*.wrl;*.wrz", 
							style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
		dlg.Center(wx.BOTH)
		result = dlg.ShowModal()
		vrmlpath = dlg.GetPath()
		dlg.Destroy()
		if result != wx.ID_OK:
			return
		config.setcfg("last_vrml_path", vrmlpath)
		config.writecfg(module="VRML-to-X3D-converter",
						options=("last_vrml_path", ))
	filename, ext = os.path.splitext(vrmlpath)
	if x3dpath is None:
		x3dpath = filename + ".x3d"
	if x3dpath:
		dirname = os.path.dirname(x3dpath)
	while not x3dpath or not waccess(dirname, os.W_OK):
		if "--no-gui" in sys.argv[1:]:
			if not x3dpath:
				safe_print("No HTML output filename given.")
			else:
				safe_print("%r is not writable." % dirname)
			sys.exit(1)
		if not wx.GetApp():
			app = BaseApp(0)
		if x3dpath:
			defaultDir, defaultFile = os.path.split(x3dpath)
		else:
			defaultFile = os.path.basename(filename) + ".x3d"
		dlg = wx.FileDialog(None, lang.getstr("error.access_denied.write",
											  dirname),
							defaultDir=defaultDir, 
							defaultFile=defaultFile, 
							wildcard=lang.getstr("filetype.x3d") +
									 "|*.x3d", 
							style=wx.SAVE | wx.FD_OVERWRITE_PROMPT)
		dlg.Center(wx.BOTH)
		result = dlg.ShowModal()
		dlg.Destroy()
		if result != wx.ID_OK:
			return
		x3dpath = dlg.GetPath()
		dirname = os.path.dirname(x3dpath)
	vrmlpath, x3dpath = [safe_unicode(path) for path in (vrmlpath, x3dpath)]
	if sys.platform == "win32":
		vrmlpath = make_win32_compatible_long_path(vrmlpath)
		x3dpath = make_win32_compatible_long_path(x3dpath)
	if html:
		finalpath = x3dpath + ".html"
		if sys.platform == "win32":
			finalpath = make_win32_compatible_long_path(finalpath)
			x3dpath = finalpath[:-5]
	else:
		finalpath = x3dpath
	if worker:
		worker.clear_cmd_output()
		worker.start(lambda result:
					 show_result_dialog(result, wx.GetApp().GetTopWindow())
					 if isinstance(result, Exception)
					 else result and view and launch_file(finalpath),
					 x3dom.vrmlfile2x3dfile,
					 wargs=(vrmlpath, x3dpath, html, embed, force, cache,
							worker),
					 progress_title=lang.getstr("vrml_to_x3d_converter"),
					 progress_start=1,
					 resume=worker.progress_wnd and
							worker.progress_wnd.IsShownOnScreen(), fancy=False)
	else:
		result = x3dom.vrmlfile2x3dfile(vrmlpath, x3dpath, html, embed, force,
										cache, None)
		if not isinstance(result, Exception) and result and view:
			launch_file(finalpath)
		else:
			sys.exit(1)


if __name__ == "__main__":
	main()