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

Class Konqueror

Lib/webbrowser.py:360–411  ·  view source on GitHub ↗

Controller for the KDE File Manager (kfm, or Konqueror). See the output of ``kfmclient --commands`` for more information on the Konqueror remote-control interface.

Source from the content-addressed store, hash-verified

358
359
360class Konqueror(BaseBrowser):
361 """Controller for the KDE File Manager (kfm, or Konqueror).
362
363 See the output of ``kfmclient --commands``
364 for more information on the Konqueror remote-control interface.
365 """
366
367 def open(self, url, new=0, autoraise=True):
368 sys.audit("webbrowser.open", url)
369 self._check_url(url)
370 # XXX Currently I know no way to prevent KFM from opening a new win.
371 if new == 2:
372 action = "newTab"
373 else:
374 action = "openURL"
375
376 devnull = subprocess.DEVNULL
377
378 try:
379 p = subprocess.Popen(["kfmclient", action, url],
380 close_fds=True, stdin=devnull,
381 stdout=devnull, stderr=devnull)
382 except OSError:
383 # fall through to next variant
384 pass
385 else:
386 p.wait()
387 # kfmclient's return code unfortunately has no meaning as it seems
388 return True
389
390 try:
391 p = subprocess.Popen(["konqueror", "--silent", url],
392 close_fds=True, stdin=devnull,
393 stdout=devnull, stderr=devnull,
394 start_new_session=True)
395 except OSError:
396 # fall through to next variant
397 pass
398 else:
399 if p.poll() is None:
400 # Should be running now.
401 return True
402
403 try:
404 p = subprocess.Popen(["kfm", "-d", url],
405 close_fds=True, stdin=devnull,
406 stdout=devnull, stderr=devnull,
407 start_new_session=True)
408 except OSError:
409 return False
410 else:
411 return p.poll() is None
412
413
414class Edge(UnixBrowser):

Callers 1

register_X_browsersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…