(self, item: HyperlinkItem, screen_pos)
| 2056 | super().mousePressEvent(event) |
| 2057 | |
| 2058 | def _hyperlink_context_menu(self, item: HyperlinkItem, screen_pos) -> None: |
| 2059 | from PySide6.QtWidgets import QMenu |
| 2060 | from PySide6.QtGui import QDesktopServices |
| 2061 | from PySide6.QtCore import QUrl, QPoint |
| 2062 | menu = QMenu() |
| 2063 | url_display = item.url if len(item.url) <= 60 else item.url[:57] + "…" |
| 2064 | open_act = menu.addAction(f"Open {url_display}") |
| 2065 | open_act.setEnabled(bool(item.url)) |
| 2066 | menu.addSeparator() |
| 2067 | edit_act = menu.addAction("Edit Hyperlink…") |
| 2068 | chosen = menu.exec(QPoint(int(screen_pos.x()), int(screen_pos.y()))) |
| 2069 | if chosen is open_act and item.url: |
| 2070 | QDesktopServices.openUrl(QUrl(item.url)) |
| 2071 | elif chosen is edit_act: |
| 2072 | from .hyperlink_dialog import HyperlinkDialog |
| 2073 | dlg = HyperlinkDialog(item.url, item.label) |
| 2074 | if dlg.exec(): |
| 2075 | self._push_undo() |
| 2076 | item.url = dlg.url() |
| 2077 | item.label = dlg.label() |
| 2078 | item.setText(item.label or item.url) |
| 2079 | |
| 2080 | def _wires_on_same_net(self, wire: WireItem) -> list: |
| 2081 | """Return all WireItems connected to wire on the same electrical net.""" |
no test coverage detected