WebBrowser/WebBrowserTabWidget.py

branch
QtWebEngine
changeset 4745
285bfd224a1b
parent 4741
f9e1adc69076
child 4749
750577d35452
equal deleted inserted replaced
4744:ad3f6c1caf8d 4745:285bfd224a1b
443 """ 443 """
444 Public slot called to handle the close action. 444 Public slot called to handle the close action.
445 """ 445 """
446 self.closeBrowserAt(self.currentIndex()) 446 self.closeBrowserAt(self.currentIndex())
447 447
448 def closeAllBrowsers(self): 448 def closeAllBrowsers(self, shutdown=False):
449 """ 449 """
450 Public slot called to handle the close all action. 450 Public slot called to handle the close all action.
451
452 @param shutdown flag indicating a shutdown action
453 @type bool
451 """ 454 """
452 for index in range(self.count() - 1, -1, -1): 455 for index in range(self.count() - 1, -1, -1):
453 self.closeBrowserAt(index) 456 self.closeBrowserAt(index, shutdown=shutdown)
454 457
455 def closeBrowserAt(self, index): 458 def closeBrowserAt(self, index, shutdown=False):
456 """ 459 """
457 Public slot to close a browser based on its index. 460 Public slot to close a browser based on its index.
458 461
459 @param index index of browser to close (integer) 462 @param index index of browser to close
463 @type int
464 @param shutdown flag indicating a shutdown action
465 @type bool
460 """ 466 """
461 browser = self.widget(index) 467 browser = self.widget(index)
462 if browser is None: 468 if browser is None:
463 return 469 return
464 470
485 self.removeTab(index) 491 self.removeTab(index)
486 self.browserClosed.emit(browser) 492 self.browserClosed.emit(browser)
487 browser.deleteLater() 493 browser.deleteLater()
488 del browser 494 del browser
489 495
490 if self.count() == 0: 496 if self.count() == 0 and not shutdown:
491 self.newBrowser() 497 self.newBrowser()
492 else: 498 else:
493 self.currentChanged[int].emit(self.currentIndex()) 499 self.currentChanged[int].emit(self.currentIndex())
494 500
495 def currentBrowser(self): 501 def currentBrowser(self):

eric ide

mercurial