MCPcopy Index your code
hub / github.com/python/cpython / browse_file

Method browse_file

Lib/idlelib/query.py:289–307  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

287 .show(initialdir=initdir, initialfile=initfile)
288
289 def browse_file(self):
290 filetypes = [
291 ("HTML Files", "*.htm *.html", "TEXT"),
292 ("Text Files", "*.txt", "TEXT"),
293 ("All Files", "*")]
294 path = self.pathvar.get()
295 if path:
296 dir, base = os.path.split(path)
297 else:
298 base = None
299 if platform[:3] == 'win':
300 dir = os.path.join(os.path.dirname(executable), 'Doc')
301 if not os.path.isdir(dir):
302 dir = os.getcwd()
303 else:
304 dir = os.getcwd()
305 file = self.askfilename(filetypes, dir, base)
306 if file:
307 self.pathvar.set(file)
308
309 item_ok = SectionName.entry_ok # localize for test override
310

Callers 1

Calls 7

askfilenameMethod · 0.95
getMethod · 0.45
splitMethod · 0.45
joinMethod · 0.45
dirnameMethod · 0.45
isdirMethod · 0.45
setMethod · 0.45

Tested by 1