401 self.__tree.expandAll() |
401 self.__tree.expandAll() |
402 self.__isRefreshing = False |
402 self.__isRefreshing = False |
403 self.__waitForRefresh = False |
403 self.__waitForRefresh = False |
404 |
404 |
405 @pyqtSlot() |
405 @pyqtSlot() |
406 def __processActions(self): |
406 def __processActions(self, act): |
407 """ |
407 """ |
408 Private slot to process the actions. |
408 Private slot to process the actions. |
409 """ |
409 |
410 if self.sender() is None: |
410 @param act reference to the action that triggered |
411 return |
411 @type QAction |
412 |
412 """ |
413 self.__refreshBlocked = True |
413 self.__refreshBlocked = True |
414 |
414 |
415 selectedBrowsers = collections.defaultdict(list) |
415 selectedBrowsers = collections.defaultdict(list) |
416 |
416 |
417 command = self.sender().objectName() |
417 command = act.objectName() |
418 |
418 |
419 for index in range(self.__tree.topLevelItemCount()): |
419 for index in range(self.__tree.topLevelItemCount()): |
420 winItem = self.__tree.topLevelItem(index) |
420 winItem = self.__tree.topLevelItem(index) |
421 if winItem.checkState(0) == Qt.Unchecked: |
421 if winItem.checkState(0) == Qt.Unchecked: |
422 continue |
422 continue |
520 menu.addMenu(groupTypeSubMenu) |
520 menu.addMenu(groupTypeSubMenu) |
521 |
521 |
522 menu.addSeparator() |
522 menu.addSeparator() |
523 |
523 |
524 if self.__isBrowserSelected(): |
524 if self.__isBrowserSelected(): |
525 menu.addAction( |
525 act = menu.addAction( |
526 UI.PixmapCache.getIcon("bookmark22.png"), |
526 UI.PixmapCache.getIcon("bookmark22.png"), |
527 self.tr("&Bookmark checked tabs"), |
527 self.tr("&Bookmark checked tabs")) |
528 self.__processActions).setObjectName("bookmarkSelection") |
528 act.setObjectName("bookmarkSelection") |
529 menu.addAction( |
529 act.triggered.connect(lambda: self.__processActions(act)) |
|
530 act = menu.addAction( |
530 UI.PixmapCache.getIcon("tabClose.png"), |
531 UI.PixmapCache.getIcon("tabClose.png"), |
531 self.tr("&Close checked tabs"), |
532 self.tr("&Close checked tabs")) |
532 self.__processActions).setObjectName("closeSelection") |
533 act.setObjectName("closeSelection") |
|
534 act.triggered.connect(lambda: self.__processActions(act)) |
533 |
535 |
534 menu.exec_(self.__tree.viewport().mapToGlobal(pos)) |
536 menu.exec_(self.__tree.viewport().mapToGlobal(pos)) |
535 |
537 |
536 def mainWindowCreated(self, mainWin, refresh=True): |
538 def mainWindowCreated(self, mainWin, refresh=True): |
537 """ |
539 """ |
558 """ |
560 """ |
559 icon = E5ClickableLabel() |
561 icon = E5ClickableLabel() |
560 icon.setPixmap( |
562 icon.setPixmap( |
561 UI.PixmapCache.getPixmap("tabManager.png").scaled(16, 16)) |
563 UI.PixmapCache.getPixmap("tabManager.png").scaled(16, 16)) |
562 icon.setToolTip(self.tr("Show Tab Manager")) |
564 icon.setToolTip(self.tr("Show Tab Manager")) |
563 icon.clicked.connect(self.raiseTabManager) |
565 icon.clicked.connect(lambda: self.raiseTabManager(icon)) |
564 |
566 |
565 return icon |
567 return icon |
566 |
568 |
567 def raiseTabManager(self): |
569 def raiseTabManager(self, icon): |
568 """ |
570 """ |
569 Public slot to show the tab manager. |
571 Public slot to show the tab manager. |
|
572 |
|
573 @param icon reference to the clicked icon |
|
574 @type E5ClickableLabel or QAction |
570 """ |
575 """ |
571 window = None |
576 window = None |
572 icon = self.sender() |
577 if isinstance(icon, E5ClickableLabel): |
573 if icon: |
578 window = icon.window() |
574 if isinstance(icon, E5ClickableLabel): |
579 elif isinstance(icon, QAction): |
575 window = icon.window() |
580 window = icon.parentWidget() |
576 elif isinstance(icon, QAction): |
|
577 window = icon.parentWidget() |
|
578 |
581 |
579 if window is not None: |
582 if window is not None: |
580 titleBarHeight = self.style().pixelMetric(QStyle.PM_TitleBarHeight) |
583 titleBarHeight = self.style().pixelMetric(QStyle.PM_TitleBarHeight) |
581 |
584 |
582 y = max(0, window.frameGeometry().top() + titleBarHeight + 1) |
585 y = max(0, window.frameGeometry().top() + titleBarHeight + 1) |