Show More
@@ -13,7 +13,7 b' from IPython.external.qt import QtCore, QtGui' | |||||
13 | from IPython.core.inputsplitter import InputSplitter, transform_classic_prompt |
|
13 | from IPython.core.inputsplitter import InputSplitter, transform_classic_prompt | |
14 | from IPython.core.oinspect import call_tip |
|
14 | from IPython.core.oinspect import call_tip | |
15 | from IPython.frontend.qt.base_frontend_mixin import BaseFrontendMixin |
|
15 | from IPython.frontend.qt.base_frontend_mixin import BaseFrontendMixin | |
16 | from IPython.utils.traitlets import Bool, Instance |
|
16 | from IPython.utils.traitlets import Bool, Instance, Unicode | |
17 | from bracket_matcher import BracketMatcher |
|
17 | from bracket_matcher import BracketMatcher | |
18 | from call_tip_widget import CallTipWidget |
|
18 | from call_tip_widget import CallTipWidget | |
19 | from completion_lexer import CompletionLexer |
|
19 | from completion_lexer import CompletionLexer | |
@@ -75,8 +75,8 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
75 | """ A Qt frontend for a generic Python kernel. |
|
75 | """ A Qt frontend for a generic Python kernel. | |
76 | """ |
|
76 | """ | |
77 |
|
77 | |||
78 | enable_calltips = Bool(True, config=True, |
|
78 | # The text to show when the kernel is (re)started. | |
79 | help="Whether to draw information calltips on open-parentheses.") |
|
79 | banner = Unicode() | |
80 |
|
80 | |||
81 | # An option and corresponding signal for overriding the default kernel |
|
81 | # An option and corresponding signal for overriding the default kernel | |
82 | # interrupt behavior. |
|
82 | # interrupt behavior. | |
@@ -89,6 +89,10 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
89 | custom_restart_kernel_died = QtCore.Signal(float) |
|
89 | custom_restart_kernel_died = QtCore.Signal(float) | |
90 | custom_restart_requested = QtCore.Signal() |
|
90 | custom_restart_requested = QtCore.Signal() | |
91 |
|
91 | |||
|
92 | # Whether to automatically show calltips on open-parentheses. | |||
|
93 | enable_calltips = Bool(True, config=True, | |||
|
94 | help="Whether to draw information calltips on open-parentheses.") | |||
|
95 | ||||
92 | # Emitted when a user visible 'execute_request' has been submitted to the |
|
96 | # Emitted when a user visible 'execute_request' has been submitted to the | |
93 | # kernel from the FrontendWidget. Contains the code to be executed. |
|
97 | # kernel from the FrontendWidget. Contains the code to be executed. | |
94 | executing = QtCore.Signal(object) |
|
98 | executing = QtCore.Signal(object) | |
@@ -463,7 +467,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
463 | self._highlighter.highlighting_on = False |
|
467 | self._highlighter.highlighting_on = False | |
464 |
|
468 | |||
465 | self._control.clear() |
|
469 | self._control.clear() | |
466 |
self._append_plain_text(self. |
|
470 | self._append_plain_text(self.banner) | |
467 | self._show_interpreter_prompt() |
|
471 | self._show_interpreter_prompt() | |
468 |
|
472 | |||
469 | def restart_kernel(self, message, now=False): |
|
473 | def restart_kernel(self, message, now=False): | |
@@ -543,13 +547,6 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
543 | info = self._CompletionRequest(msg_id, pos) |
|
547 | info = self._CompletionRequest(msg_id, pos) | |
544 | self._request_info['complete'] = info |
|
548 | self._request_info['complete'] = info | |
545 |
|
549 | |||
546 | def _get_banner(self): |
|
|||
547 | """ Gets a banner to display at the beginning of a session. |
|
|||
548 | """ |
|
|||
549 | banner = 'Python %s on %s\nType "help", "copyright", "credits" or ' \ |
|
|||
550 | '"license" for more information.' |
|
|||
551 | return banner % (sys.version, sys.platform) |
|
|||
552 |
|
||||
553 | def _get_context(self, cursor=None): |
|
550 | def _get_context(self, cursor=None): | |
554 | """ Gets the context for the specified cursor (or the current cursor |
|
551 | """ Gets the context for the specified cursor (or the current cursor | |
555 | if none is specified). |
|
552 | if none is specified). | |
@@ -620,3 +617,12 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
620 | document = self._control.document() |
|
617 | document = self._control.document() | |
621 | if position == self._get_cursor().position(): |
|
618 | if position == self._get_cursor().position(): | |
622 | self._call_tip() |
|
619 | self._call_tip() | |
|
620 | ||||
|
621 | #------ Trait default initializers ----------------------------------------- | |||
|
622 | ||||
|
623 | def _banner_default(self): | |||
|
624 | """ Returns the standard Python banner. | |||
|
625 | """ | |||
|
626 | banner = 'Python %s on %s\nType "help", "copyright", "credits" or ' \ | |||
|
627 | '"license" for more information.' | |||
|
628 | return banner % (sys.version, sys.platform) |
@@ -20,7 +20,6 b' from IPython.external.qt import QtCore, QtGui' | |||||
20 | # Local imports |
|
20 | # Local imports | |
21 | from IPython.core.inputsplitter import IPythonInputSplitter, \ |
|
21 | from IPython.core.inputsplitter import IPythonInputSplitter, \ | |
22 | transform_ipy_prompt |
|
22 | transform_ipy_prompt | |
23 | from IPython.core.usage import default_gui_banner |
|
|||
24 | from IPython.utils.traitlets import Bool, Unicode |
|
23 | from IPython.utils.traitlets import Bool, Unicode | |
25 | from frontend_widget import FrontendWidget |
|
24 | from frontend_widget import FrontendWidget | |
26 | import styles |
|
25 | import styles | |
@@ -278,11 +277,6 b' class IPythonWidget(FrontendWidget):' | |||||
278 | info = self._CompletionRequest(msg_id, pos) |
|
277 | info = self._CompletionRequest(msg_id, pos) | |
279 | self._request_info['complete'] = info |
|
278 | self._request_info['complete'] = info | |
280 |
|
279 | |||
281 | def _get_banner(self): |
|
|||
282 | """ Reimplemented to return IPython's default banner. |
|
|||
283 | """ |
|
|||
284 | return default_gui_banner |
|
|||
285 |
|
||||
286 | def _process_execute_error(self, msg): |
|
280 | def _process_execute_error(self, msg): | |
287 | """ Reimplemented for IPython-style traceback formatting. |
|
281 | """ Reimplemented for IPython-style traceback formatting. | |
288 | """ |
|
282 | """ | |
@@ -512,3 +506,8 b' class IPythonWidget(FrontendWidget):' | |||||
512 | else: |
|
506 | else: | |
513 | self._highlighter.set_style_sheet(self.style_sheet) |
|
507 | self._highlighter.set_style_sheet(self.style_sheet) | |
514 |
|
508 | |||
|
509 | #------ Trait default initializers ----------------------------------------- | |||
|
510 | ||||
|
511 | def _banner_default(self): | |||
|
512 | from IPython.core.usage import default_gui_banner | |||
|
513 | return default_gui_banner |
General Comments 0
You need to be logged in to leave comments.
Login now