add icons to actions
This commit is contained in:
20
bigtext.py
20
bigtext.py
@@ -136,9 +136,7 @@ class InnerBigText(QWidget):
|
||||
elif e.modifiers() == Qt.KeyboardModifier.ControlModifier and e.key() == 67: # ctrl + c
|
||||
self.copy_selection()
|
||||
elif e.modifiers() == Qt.KeyboardModifier.ControlModifier and e.key() == 65: # ctrl + a
|
||||
self.selection_highlight.start_byte = 0
|
||||
self.selection_highlight.end_byte = self.model.byte_count()
|
||||
self.update()
|
||||
self._select_all()
|
||||
|
||||
def wheelEvent(self, event: QWheelEvent):
|
||||
direction = 1 if event.angleDelta().y() < 0 else -1
|
||||
@@ -156,15 +154,22 @@ class InnerBigText(QWidget):
|
||||
def _open_menu(self, position):
|
||||
menu = QMenu(self)
|
||||
|
||||
copy_clipboard = QAction(self.tr("&Copy to Clipboard"), self, triggered=self.copy_selection)
|
||||
copy_clipboard = QAction(QIcon.fromTheme("edit-copy"), self.tr("&Copy to Clipboard"), self,
|
||||
triggered=self.copy_selection)
|
||||
copy_clipboard.setShortcut("CTRL+C")
|
||||
copy_clipboard.setDisabled(not self._has_selection())
|
||||
menu.addAction(copy_clipboard)
|
||||
|
||||
copy_to_file = QAction(self.tr("Copy to &File"), self, triggered=self._copy_selection_to_file)
|
||||
copy_to_file = QAction(QIcon.fromTheme("document-save-as"), self.tr("Copy to &File"), self,
|
||||
triggered=self._copy_selection_to_file)
|
||||
copy_to_file.setDisabled(not self._has_selection())
|
||||
menu.addAction(copy_to_file)
|
||||
|
||||
select_all = QAction(QIcon.fromTheme("edit-select-all"), self.tr("Select &All"), self,
|
||||
triggered=self._select_all)
|
||||
select_all.setShortcut("CTRL+A")
|
||||
menu.addAction(select_all)
|
||||
|
||||
manage_highlighting = QAction(
|
||||
self.tr("&Highlighter"),
|
||||
self,
|
||||
@@ -328,6 +333,11 @@ class InnerBigText(QWidget):
|
||||
if selected_file:
|
||||
self.model.write_range(start, end, selected_file)
|
||||
|
||||
def _select_all(self):
|
||||
self.selection_highlight.start_byte = 0
|
||||
self.selection_highlight.end_byte = self.model.byte_count()
|
||||
self.update()
|
||||
|
||||
def paintEvent(self, event: QPaintEvent) -> None:
|
||||
# print("paintEvent")
|
||||
painter = QPainter(self)
|
||||
|
||||
Reference in New Issue
Block a user