Show More
@@ -125,7 +125,7 b' class ConsoleWidget(QtGui.QPlainTextEdit):' | |||||
125 | QtCore.Qt.Key_D : QtCore.Qt.Key_Delete, } |
|
125 | QtCore.Qt.Key_D : QtCore.Qt.Key_Delete, } | |
126 |
|
126 | |||
127 | #--------------------------------------------------------------------------- |
|
127 | #--------------------------------------------------------------------------- | |
128 |
# 'Q |
|
128 | # 'QObject' interface | |
129 | #--------------------------------------------------------------------------- |
|
129 | #--------------------------------------------------------------------------- | |
130 |
|
130 | |||
131 | def __init__(self, parent=None): |
|
131 | def __init__(self, parent=None): | |
@@ -160,15 +160,6 b' class ConsoleWidget(QtGui.QPlainTextEdit):' | |||||
160 | select_all_action.triggered.connect(self.selectAll) |
|
160 | select_all_action.triggered.connect(self.selectAll) | |
161 | self._context_menu.addAction(select_all_action) |
|
161 | self._context_menu.addAction(select_all_action) | |
162 |
|
162 | |||
163 | def contextMenuEvent(self, event): |
|
|||
164 | """ Reimplemented to create a menu without destructive actions like |
|
|||
165 | 'Cut' and 'Delete'. |
|
|||
166 | """ |
|
|||
167 | clipboard_empty = QtGui.QApplication.clipboard().text().isEmpty() |
|
|||
168 | self._paste_action.setEnabled(not clipboard_empty) |
|
|||
169 |
|
||||
170 | self._context_menu.exec_(event.globalPos()) |
|
|||
171 |
|
||||
172 | def event(self, event): |
|
163 | def event(self, event): | |
173 | """ Reimplemented to override shortcuts, if necessary. |
|
164 | """ Reimplemented to override shortcuts, if necessary. | |
174 | """ |
|
165 | """ | |
@@ -181,6 +172,19 b' class ConsoleWidget(QtGui.QPlainTextEdit):' | |||||
181 | else: |
|
172 | else: | |
182 | return QtGui.QPlainTextEdit.event(self, event) |
|
173 | return QtGui.QPlainTextEdit.event(self, event) | |
183 |
|
174 | |||
|
175 | #--------------------------------------------------------------------------- | |||
|
176 | # 'QWidget' interface | |||
|
177 | #--------------------------------------------------------------------------- | |||
|
178 | ||||
|
179 | def contextMenuEvent(self, event): | |||
|
180 | """ Reimplemented to create a menu without destructive actions like | |||
|
181 | 'Cut' and 'Delete'. | |||
|
182 | """ | |||
|
183 | clipboard_empty = QtGui.QApplication.clipboard().text().isEmpty() | |||
|
184 | self._paste_action.setEnabled(not clipboard_empty) | |||
|
185 | ||||
|
186 | self._context_menu.exec_(event.globalPos()) | |||
|
187 | ||||
184 | def keyPressEvent(self, event): |
|
188 | def keyPressEvent(self, event): | |
185 | """ Reimplemented to create a console-like interface. |
|
189 | """ Reimplemented to create a console-like interface. | |
186 | """ |
|
190 | """ | |
@@ -662,7 +666,7 b' class HistoryConsoleWidget(ConsoleWidget):' | |||||
662 | """ |
|
666 | """ | |
663 |
|
667 | |||
664 | #--------------------------------------------------------------------------- |
|
668 | #--------------------------------------------------------------------------- | |
665 |
# 'Q |
|
669 | # 'QObject' interface | |
666 | #--------------------------------------------------------------------------- |
|
670 | #--------------------------------------------------------------------------- | |
667 |
|
671 | |||
668 | def __init__(self, parent=None): |
|
672 | def __init__(self, parent=None): |
@@ -49,7 +49,7 b' class FrontendWidget(HistoryConsoleWidget):' | |||||
49 | executed = QtCore.pyqtSignal(object) |
|
49 | executed = QtCore.pyqtSignal(object) | |
50 |
|
50 | |||
51 | #--------------------------------------------------------------------------- |
|
51 | #--------------------------------------------------------------------------- | |
52 |
# 'Q |
|
52 | # 'QObject' interface | |
53 | #--------------------------------------------------------------------------- |
|
53 | #--------------------------------------------------------------------------- | |
54 |
|
54 | |||
55 | def __init__(self, parent=None): |
|
55 | def __init__(self, parent=None): | |
@@ -69,6 +69,10 b' class FrontendWidget(HistoryConsoleWidget):' | |||||
69 |
|
69 | |||
70 | self.document().contentsChange.connect(self._document_contents_change) |
|
70 | self.document().contentsChange.connect(self._document_contents_change) | |
71 |
|
71 | |||
|
72 | #--------------------------------------------------------------------------- | |||
|
73 | # 'QWidget' interface | |||
|
74 | #--------------------------------------------------------------------------- | |||
|
75 | ||||
72 | def focusOutEvent(self, event): |
|
76 | def focusOutEvent(self, event): | |
73 | """ Reimplemented to hide calltips. |
|
77 | """ Reimplemented to hide calltips. | |
74 | """ |
|
78 | """ |
@@ -10,7 +10,7 b' class IPythonWidget(FrontendWidget):' | |||||
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | #--------------------------------------------------------------------------- |
|
12 | #--------------------------------------------------------------------------- | |
13 |
# ' |
|
13 | # 'QObject' interface | |
14 | #--------------------------------------------------------------------------- |
|
14 | #--------------------------------------------------------------------------- | |
15 |
|
15 | |||
16 | def __init__(self, parent=None): |
|
16 | def __init__(self, parent=None): | |
@@ -18,6 +18,10 b' class IPythonWidget(FrontendWidget):' | |||||
18 |
|
18 | |||
19 | self._magic_overrides = {} |
|
19 | self._magic_overrides = {} | |
20 |
|
20 | |||
|
21 | #--------------------------------------------------------------------------- | |||
|
22 | # 'FrontendWidget' interface | |||
|
23 | #--------------------------------------------------------------------------- | |||
|
24 | ||||
21 | def execute_source(self, source, hidden=False, interactive=False): |
|
25 | def execute_source(self, source, hidden=False, interactive=False): | |
22 | """ Reimplemented to override magic commands. |
|
26 | """ Reimplemented to override magic commands. | |
23 | """ |
|
27 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now