12 import pathlib |
12 import pathlib |
13 import re |
13 import re |
14 import sys |
14 import sys |
15 |
15 |
16 from PyQt6.Qsci import QsciScintilla |
16 from PyQt6.Qsci import QsciScintilla |
17 from PyQt6.QtCore import QEvent, Qt, pyqtSignal, pyqtSlot |
17 from PyQt6.QtCore import QEvent, QPoint, Qt, pyqtSignal, pyqtSlot |
18 from PyQt6.QtGui import QClipboard, QFont, QPalette, QShortcut |
18 from PyQt6.QtGui import QClipboard, QFont, QPalette, QShortcut |
19 from PyQt6.QtWidgets import ( |
19 from PyQt6.QtWidgets import ( |
20 QApplication, |
20 QApplication, |
21 QDialog, |
21 QDialog, |
22 QHBoxLayout, |
22 QHBoxLayout, |
330 self.menu.addAction(self.tr("Active Name"), self.__showVenvName) |
330 self.menu.addAction(self.tr("Active Name"), self.__showVenvName) |
331 self.menu.addSeparator() |
331 self.menu.addSeparator() |
332 self.menu.addAction(self.tr("Save Contents..."), self.saveContents) |
332 self.menu.addAction(self.tr("Save Contents..."), self.saveContents) |
333 self.menu.addSeparator() |
333 self.menu.addSeparator() |
334 self.menu.addAction(self.tr("Configure..."), self.__configure) |
334 self.menu.addAction(self.tr("Configure..."), self.__configure) |
|
335 |
|
336 self.customContextMenuRequested.connect(self.__showContextMenu) |
|
337 self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) |
335 |
338 |
336 self.__bindLexer() |
339 self.__bindLexer() |
337 self.__setTextDisplay() |
340 self.__setTextDisplay() |
338 self.__setMargin0() |
341 self.__setMargin0() |
339 |
342 |
2012 if nextChild and self.inContinue: |
2015 if nextChild and self.inContinue: |
2013 return False |
2016 return False |
2014 |
2017 |
2015 return QsciScintillaCompat.focusNextPrevChild(self, nextChild) |
2018 return QsciScintillaCompat.focusNextPrevChild(self, nextChild) |
2016 |
2019 |
2017 def contextMenuEvent(self, ev): |
2020 @pyqtSlot(QPoint) |
2018 """ |
2021 def __showContextMenu(self, pos): |
2019 Protected method to show our own context menu. |
2022 """ |
2020 |
2023 Private slot to show a context menu. |
2021 @param ev context menu event (QContextMenuEvent) |
2024 |
|
2025 @param pos position for the context menu |
|
2026 @type QPoint |
2022 """ |
2027 """ |
2023 if not self.__windowed: |
2028 if not self.__windowed: |
2024 self.menu.popup(ev.globalPos()) |
2029 self.menu.popup(self.mapToGlobal(pos)) |
2025 ev.accept() |
|
2026 |
2030 |
2027 def clear(self): |
2031 def clear(self): |
2028 """ |
2032 """ |
2029 Public slot to clear the display. |
2033 Public slot to clear the display. |
2030 """ |
2034 """ |