453 anchor = self.anchorAt(pos) |
453 anchor = self.anchorAt(pos) |
454 linkUrl = self.link().resolved(QUrl(anchor)) if anchor else QUrl() |
454 linkUrl = self.link().resolved(QUrl(anchor)) if anchor else QUrl() |
455 selectedText = self.textCursor().selectedText() |
455 selectedText = self.textCursor().selectedText() |
456 |
456 |
457 act = self.__menu.addAction( |
457 act = self.__menu.addAction( |
458 UI.PixmapCache.getIcon("back"), self.tr("Backward"), self.backward |
458 EricPixmapCache.getIcon("back"), self.tr("Backward"), self.backward |
459 ) |
459 ) |
460 act.setEnabled(self.isBackwardAvailable()) |
460 act.setEnabled(self.isBackwardAvailable()) |
461 |
461 |
462 act = self.__menu.addAction( |
462 act = self.__menu.addAction( |
463 UI.PixmapCache.getIcon("forward"), self.tr("Forward"), self.forward |
463 EricPixmapCache.getIcon("forward"), self.tr("Forward"), self.forward |
464 ) |
464 ) |
465 act.setEnabled(self.isForwardAvailable()) |
465 act.setEnabled(self.isForwardAvailable()) |
466 |
466 |
467 act = self.__menu.addAction( |
467 act = self.__menu.addAction( |
468 UI.PixmapCache.getIcon("reload"), self.tr("Reload"), self.reload |
468 EricPixmapCache.getIcon("reload"), self.tr("Reload"), self.reload |
469 ) |
469 ) |
470 |
470 |
471 if not linkUrl.isEmpty() and linkUrl.scheme() != "javascript": |
471 if not linkUrl.isEmpty() and linkUrl.scheme() != "javascript": |
472 self.__createLinkContextMenu(self.__menu, linkUrl) |
472 self.__createLinkContextMenu(self.__menu, linkUrl) |
473 |
473 |
474 self.__menu.addSeparator() |
474 self.__menu.addSeparator() |
475 |
475 |
476 act = self.__menu.addAction( |
476 act = self.__menu.addAction( |
477 UI.PixmapCache.getIcon("editCopy"), self.tr("Copy Page URL to Clipboard") |
477 EricPixmapCache.getIcon("editCopy"), self.tr("Copy Page URL to Clipboard") |
478 ) |
478 ) |
479 act.setData(self.link()) |
479 act.setData(self.link()) |
480 act.triggered.connect(functools.partial(self.__copyLink, act)) |
480 act.triggered.connect(functools.partial(self.__copyLink, act)) |
481 |
481 |
482 act = self.__menu.addAction( |
482 act = self.__menu.addAction( |
483 UI.PixmapCache.getIcon("bookmark22"), self.tr("Bookmark Page") |
483 EricPixmapCache.getIcon("bookmark22"), self.tr("Bookmark Page") |
484 ) |
484 ) |
485 act.setData({"title": self.pageTitle(), "url": self.link()}) |
485 act.setData({"title": self.pageTitle(), "url": self.link()}) |
486 act.triggered.connect(functools.partial(self.__bookmarkPage, act)) |
486 act.triggered.connect(functools.partial(self.__bookmarkPage, act)) |
487 |
487 |
488 self.__menu.addSeparator() |
488 self.__menu.addSeparator() |
489 |
489 |
490 act = self.__menu.addAction( |
490 act = self.__menu.addAction( |
491 UI.PixmapCache.getIcon("zoomIn"), self.tr("Zoom in"), self.scaleUp |
491 EricPixmapCache.getIcon("zoomIn"), self.tr("Zoom in"), self.scaleUp |
492 ) |
492 ) |
493 act.setEnabled(self.isScaleUpAvailable()) |
493 act.setEnabled(self.isScaleUpAvailable()) |
494 |
494 |
495 act = self.__menu.addAction( |
495 act = self.__menu.addAction( |
496 UI.PixmapCache.getIcon("zoomOut"), self.tr("Zoom out"), self.scaleDown |
496 EricPixmapCache.getIcon("zoomOut"), self.tr("Zoom out"), self.scaleDown |
497 ) |
497 ) |
498 act.setEnabled(self.isScaleDownAvailable()) |
498 act.setEnabled(self.isScaleDownAvailable()) |
499 |
499 |
500 self.__menu.addAction( |
500 self.__menu.addAction( |
501 UI.PixmapCache.getIcon("zoomReset"), self.tr("Zoom reset"), self.resetScale |
501 EricPixmapCache.getIcon("zoomReset"), self.tr("Zoom reset"), self.resetScale |
502 ) |
502 ) |
503 |
503 |
504 self.__menu.addSeparator() |
504 self.__menu.addSeparator() |
505 |
505 |
506 act = self.__menu.addAction( |
506 act = self.__menu.addAction( |
507 UI.PixmapCache.getIcon("editCopy"), self.tr("Copy"), self.copy |
507 EricPixmapCache.getIcon("editCopy"), self.tr("Copy"), self.copy |
508 ) |
508 ) |
509 act.setEnabled(bool(selectedText)) |
509 act.setEnabled(bool(selectedText)) |
510 |
510 |
511 self.__menu.addAction( |
511 self.__menu.addAction( |
512 UI.PixmapCache.getIcon("editSelectAll"), |
512 EricPixmapCache.getIcon("editSelectAll"), |
513 self.tr("Select All"), |
513 self.tr("Select All"), |
514 self.selectAll, |
514 self.selectAll, |
515 ) |
515 ) |
516 |
516 |
517 self.__menu.addSeparator() |
517 self.__menu.addSeparator() |
518 |
518 |
519 self.__menu.addAction( |
519 self.__menu.addAction( |
520 UI.PixmapCache.getIcon("tabClose"), self.tr("Close"), self.__closePage |
520 EricPixmapCache.getIcon("tabClose"), self.tr("Close"), self.__closePage |
521 ) |
521 ) |
522 |
522 |
523 act = self.__menu.addAction( |
523 act = self.__menu.addAction( |
524 UI.PixmapCache.getIcon("tabCloseOther"), |
524 EricPixmapCache.getIcon("tabCloseOther"), |
525 self.tr("Close Others"), |
525 self.tr("Close Others"), |
526 self.__closeOtherPages, |
526 self.__closeOtherPages, |
527 ) |
527 ) |
528 act.setEnabled(self.__helpViewerWidget.openPagesCount() > 1) |
528 act.setEnabled(self.__helpViewerWidget.openPagesCount() > 1) |
529 |
529 |
540 """ |
540 """ |
541 if not menu.isEmpty(): |
541 if not menu.isEmpty(): |
542 menu.addSeparator() |
542 menu.addSeparator() |
543 |
543 |
544 act = menu.addAction( |
544 act = menu.addAction( |
545 UI.PixmapCache.getIcon("openNewTab"), self.tr("Open Link in New Page") |
545 EricPixmapCache.getIcon("openNewTab"), self.tr("Open Link in New Page") |
546 ) |
546 ) |
547 act.setData(linkUrl) |
547 act.setData(linkUrl) |
548 act.triggered.connect(functools.partial(self.__openLinkInNewPage, act)) |
548 act.triggered.connect(functools.partial(self.__openLinkInNewPage, act)) |
549 |
549 |
550 act = menu.addAction( |
550 act = menu.addAction( |
551 UI.PixmapCache.getIcon("newWindow"), self.tr("Open Link in Background Page") |
551 EricPixmapCache.getIcon("newWindow"), |
|
552 self.tr("Open Link in Background Page"), |
552 ) |
553 ) |
553 act.setData(linkUrl) |
554 act.setData(linkUrl) |
554 act.triggered.connect(functools.partial(self.__openLinkInBackgroundPage, act)) |
555 act.triggered.connect(functools.partial(self.__openLinkInBackgroundPage, act)) |
555 |
556 |
556 menu.addSeparator() |
557 menu.addSeparator() |
557 |
558 |
558 act = menu.addAction( |
559 act = menu.addAction( |
559 UI.PixmapCache.getIcon("editCopy"), self.tr("Copy URL to Clipboard") |
560 EricPixmapCache.getIcon("editCopy"), self.tr("Copy URL to Clipboard") |
560 ) |
561 ) |
561 act.setData(linkUrl) |
562 act.setData(linkUrl) |
562 act.triggered.connect(functools.partial(self.__copyLink, act)) |
563 act.triggered.connect(functools.partial(self.__copyLink, act)) |
563 |
564 |
564 def __openLinkInNewPage(self, act): |
565 def __openLinkInNewPage(self, act): |