-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathedit_lemmas_text_field.py
More file actions
39 lines (33 loc) · 975 Bytes
/
edit_lemmas_text_field.py
File metadata and controls
39 lines (33 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from PyQt5.QtCore import pyqtSignal
from autocomplete_line_text_field import AutocompleteLineTextField
class EditLemmasTextField(AutocompleteLineTextField):
"""
Text field that suggest autocompletions of lines and sends a signal when a colon is
typed.
"""
colonTyped = pyqtSignal() # Custom signal emitted when a colon is typed
def __init__(
self,
styling,
position=None,
styling_key=None,
num_lines=None,
unfocus_on_click=True,
hide_scrollbar=True,
use_web=True,
legilo_translator=None,
):
super().__init__(
styling,
position,
styling_key,
num_lines,
unfocus_on_click,
hide_scrollbar,
use_web,
legilo_translator,
)
def keyPressEvent(self, event):
if event.text() == ":":
self.colonTyped.emit()
super().keyPressEvent(event)