Show More
@@ -105,6 +105,11 b' class CallTipWidget(QtGui.QLabel):' | |||||
105 |
|
105 | |||
106 | super(CallTipWidget, self).paintEvent(event) |
|
106 | super(CallTipWidget, self).paintEvent(event) | |
107 |
|
107 | |||
|
108 | def setFont(self, font): | |||
|
109 | """ Reimplemented to allow use of this method as a slot. | |||
|
110 | """ | |||
|
111 | super(CallTipWidget, self).setFont(font) | |||
|
112 | ||||
108 | def showEvent(self, event): |
|
113 | def showEvent(self, event): | |
109 | """ Reimplemented to connect signal handlers and event filter. |
|
114 | """ Reimplemented to connect signal handlers and event filter. | |
110 | """ |
|
115 | """ |
@@ -39,6 +39,8 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
39 | """ |
|
39 | """ | |
40 | __metaclass__ = MetaQObjectHasTraits |
|
40 | __metaclass__ = MetaQObjectHasTraits | |
41 |
|
41 | |||
|
42 | #------ Configuration ------------------------------------------------------ | |||
|
43 | ||||
42 | # Whether to process ANSI escape codes. |
|
44 | # Whether to process ANSI escape codes. | |
43 | ansi_codes = Bool(True, config=True) |
|
45 | ansi_codes = Bool(True, config=True) | |
44 |
|
46 | |||
@@ -72,6 +74,8 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
72 | # priority (when it has focus) over, e.g., window-level menu shortcuts. |
|
74 | # priority (when it has focus) over, e.g., window-level menu shortcuts. | |
73 | override_shortcuts = Bool(False) |
|
75 | override_shortcuts = Bool(False) | |
74 |
|
76 | |||
|
77 | #------ Signals ------------------------------------------------------------ | |||
|
78 | ||||
75 | # Signals that indicate ConsoleWidget state. |
|
79 | # Signals that indicate ConsoleWidget state. | |
76 | copy_available = QtCore.pyqtSignal(bool) |
|
80 | copy_available = QtCore.pyqtSignal(bool) | |
77 | redo_available = QtCore.pyqtSignal(bool) |
|
81 | redo_available = QtCore.pyqtSignal(bool) | |
@@ -81,7 +85,11 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
81 | # specified as 'custom'. |
|
85 | # specified as 'custom'. | |
82 | custom_page_requested = QtCore.pyqtSignal(object) |
|
86 | custom_page_requested = QtCore.pyqtSignal(object) | |
83 |
|
87 | |||
84 | # Protected class variables. |
|
88 | # Signal emitted when the font is changed. | |
|
89 | font_changed = QtCore.pyqtSignal(QtGui.QFont) | |||
|
90 | ||||
|
91 | #------ Protected class variables ------------------------------------------ | |||
|
92 | ||||
85 | _ctrl_down_remap = { QtCore.Qt.Key_B : QtCore.Qt.Key_Left, |
|
93 | _ctrl_down_remap = { QtCore.Qt.Key_B : QtCore.Qt.Key_Left, | |
86 | QtCore.Qt.Key_F : QtCore.Qt.Key_Right, |
|
94 | QtCore.Qt.Key_F : QtCore.Qt.Key_Right, | |
87 | QtCore.Qt.Key_A : QtCore.Qt.Key_Home, |
|
95 | QtCore.Qt.Key_A : QtCore.Qt.Key_Home, | |
@@ -89,6 +97,7 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
89 | QtCore.Qt.Key_P : QtCore.Qt.Key_Up, |
|
97 | QtCore.Qt.Key_P : QtCore.Qt.Key_Up, | |
90 | QtCore.Qt.Key_N : QtCore.Qt.Key_Down, |
|
98 | QtCore.Qt.Key_N : QtCore.Qt.Key_Down, | |
91 | QtCore.Qt.Key_D : QtCore.Qt.Key_Delete, } |
|
99 | QtCore.Qt.Key_D : QtCore.Qt.Key_Delete, } | |
|
100 | ||||
92 | _shortcuts = set(_ctrl_down_remap.keys() + |
|
101 | _shortcuts = set(_ctrl_down_remap.keys() + | |
93 | [ QtCore.Qt.Key_C, QtCore.Qt.Key_G, QtCore.Qt.Key_O, |
|
102 | [ QtCore.Qt.Key_C, QtCore.Qt.Key_G, QtCore.Qt.Key_O, | |
94 | QtCore.Qt.Key_V ]) |
|
103 | QtCore.Qt.Key_V ]) | |
@@ -432,6 +441,8 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
432 | if self._page_control: |
|
441 | if self._page_control: | |
433 | self._page_control.document().setDefaultFont(font) |
|
442 | self._page_control.document().setDefaultFont(font) | |
434 |
|
443 | |||
|
444 | self.font_changed.emit(font) | |||
|
445 | ||||
435 | font = property(_get_font, _set_font) |
|
446 | font = property(_get_font, _set_font) | |
436 |
|
447 | |||
437 | def paste(self, mode=QtGui.QClipboard.Clipboard): |
|
448 | def paste(self, mode=QtGui.QClipboard.Clipboard): |
@@ -123,6 +123,10 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
123 | self.tab_width = 4 |
|
123 | self.tab_width = 4 | |
124 | self._set_continuation_prompt('... ') |
|
124 | self._set_continuation_prompt('... ') | |
125 |
|
125 | |||
|
126 | # Configure the CallTipWidget. | |||
|
127 | self._call_tip_widget.setFont(self.font) | |||
|
128 | self.font_changed.connect(self._call_tip_widget.setFont) | |||
|
129 | ||||
126 | # Configure actions. |
|
130 | # Configure actions. | |
127 | action = self._copy_raw_action |
|
131 | action = self._copy_raw_action | |
128 | key = QtCore.Qt.CTRL | QtCore.Qt.SHIFT | QtCore.Qt.Key_C |
|
132 | key = QtCore.Qt.CTRL | QtCore.Qt.SHIFT | QtCore.Qt.Key_C |
General Comments 0
You need to be logged in to leave comments.
Login now