Show More
@@ -369,8 +369,7 b' class ConsoleWidget(QtGui.QPlainTextEdit):' | |||||
369 | 'keep_input' is set, restores the old input buffer when the new |
|
369 | 'keep_input' is set, restores the old input buffer when the new | |
370 | prompt is written. |
|
370 | prompt is written. | |
371 | """ |
|
371 | """ | |
372 | super(ConsoleWidget, self).clear() |
|
372 | QtGui.QPlainTextEdit.clear(self) | |
373 |
|
||||
374 | input_buffer = '' |
|
373 | input_buffer = '' | |
375 | if self._reading: |
|
374 | if self._reading: | |
376 | self._reading = False |
|
375 | self._reading = False |
@@ -1,5 +1,6 b'' | |||||
1 | # Standard library imports |
|
1 | # Standard library imports | |
2 | import signal |
|
2 | import signal | |
|
3 | import sys | |||
3 |
|
4 | |||
4 | # System library imports |
|
5 | # System library imports | |
5 | from pygments.lexers import PythonLexer |
|
6 | from pygments.lexers import PythonLexer | |
@@ -256,6 +257,13 b' class FrontendWidget(HistoryConsoleWidget):' | |||||
256 | self._complete_pos = self.textCursor().position() |
|
257 | self._complete_pos = self.textCursor().position() | |
257 | return True |
|
258 | return True | |
258 |
|
259 | |||
|
260 | def _get_banner(self): | |||
|
261 | """ Gets a banner to display at the beginning of a session. | |||
|
262 | """ | |||
|
263 | banner = 'Python %s on %s\nType "help", "copyright", "credits" or ' \ | |||
|
264 | '"license" for more information.' | |||
|
265 | return banner % (sys.version, sys.platform) | |||
|
266 | ||||
259 | def _get_context(self, cursor=None): |
|
267 | def _get_context(self, cursor=None): | |
260 | """ Gets the context at the current cursor location. |
|
268 | """ Gets the context at the current cursor location. | |
261 | """ |
|
269 | """ | |
@@ -280,7 +288,11 b' class FrontendWidget(HistoryConsoleWidget):' | |||||
280 | def _started_channels(self): |
|
288 | def _started_channels(self): | |
281 | """ Called when the kernel manager has started listening. |
|
289 | """ Called when the kernel manager has started listening. | |
282 | """ |
|
290 | """ | |
283 | self.clear() |
|
291 | QtGui.QPlainTextEdit.clear(self) | |
|
292 | if self._reading: | |||
|
293 | self._reading = False | |||
|
294 | self.appendPlainText(self._get_banner()) | |||
|
295 | self._show_prompt() | |||
284 |
|
296 | |||
285 | def _stopped_channels(self): |
|
297 | def _stopped_channels(self): | |
286 | """ Called when the kernel manager has stopped listening. |
|
298 | """ Called when the kernel manager has stopped listening. |
@@ -2,6 +2,7 b'' | |||||
2 | from PyQt4 import QtCore, QtGui |
|
2 | from PyQt4 import QtCore, QtGui | |
3 |
|
3 | |||
4 | # Local imports |
|
4 | # Local imports | |
|
5 | from IPython.core.usage import default_banner | |||
5 | from frontend_widget import FrontendWidget |
|
6 | from frontend_widget import FrontendWidget | |
6 |
|
7 | |||
7 |
|
8 | |||
@@ -51,6 +52,15 b' class IPythonWidget(FrontendWidget):' | |||||
51 | self.execute('run %s' % path, hidden=hidden) |
|
52 | self.execute('run %s' % path, hidden=hidden) | |
52 |
|
53 | |||
53 | #--------------------------------------------------------------------------- |
|
54 | #--------------------------------------------------------------------------- | |
|
55 | # 'FrontendWidget' protected interface | |||
|
56 | #--------------------------------------------------------------------------- | |||
|
57 | ||||
|
58 | def _get_banner(self): | |||
|
59 | """ Reimplemented to a return IPython's default banner. | |||
|
60 | """ | |||
|
61 | return default_banner | |||
|
62 | ||||
|
63 | #--------------------------------------------------------------------------- | |||
54 | # 'IPythonWidget' interface |
|
64 | # 'IPythonWidget' interface | |
55 | #--------------------------------------------------------------------------- |
|
65 | #--------------------------------------------------------------------------- | |
56 |
|
66 |
General Comments 0
You need to be logged in to leave comments.
Login now