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