Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python_shell: Pass __init__ keyword arguments also to _create_control #451

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pyface/i_python_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
""" The interface for an interactive Python shell. """

# Enthought library imports.
from traits.api import Event
from traits.api import Event, String

# Local imports.
from pyface.key_pressed_event import KeyPressedEvent
Expand All @@ -32,6 +32,8 @@ class IPythonShell(IWidget):
#: A key has been pressed.
key_pressed = Event(KeyPressedEvent)

welcome_message = String

###########################################################################
# 'IPythonShell' interface.
###########################################################################
Expand Down
6 changes: 4 additions & 2 deletions pyface/ui/qt4/python_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pygments.lexers import PythonLexer

# Enthought library imports.
from traits.api import Event, provides
from traits.api import Event, provides, String
from traits.util.clean_strings import python_name

# Local imports.
Expand All @@ -46,6 +46,8 @@ class PythonShell(MPythonShell, Widget):

command_executed = Event

welcome_message = String

key_pressed = Event(KeyPressedEvent)

#--------------------------------------------------------------------------
Expand Down Expand Up @@ -423,7 +425,7 @@ def _get_banner(self):
"""
banner = 'Python %s on %s\nType "help", "copyright", "credits" or ' \
'"license" for more information.'
return banner % (sys.version, sys.platform)
return banner % (sys.version, sys.platform) + self.welcome_message

def _get_context(self, cursor=None):
""" Gets the context for the specified cursor (or the current cursor
Expand Down
6 changes: 4 additions & 2 deletions pyface/ui/wx/python_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import wx

# Enthought library imports.
from traits.api import Event, provides
from traits.api import Event, provides, String

# Private Enthought library imports.
from traits.util.clean_strings import python_name
Expand All @@ -49,6 +49,8 @@ class PythonShell(MPythonShell, Widget):

key_pressed = Event(KeyPressedEvent)

welcome_message = String

###########################################################################
# 'object' interface.
###########################################################################
Expand Down Expand Up @@ -167,7 +169,7 @@ def set_history(self, history, history_index):
###########################################################################

def _create_control(self, parent):
shell = PyShell(parent, -1)
shell = PyShell(parent, -1, introText=self.welcome_message)

# Listen for key press events.
wx.EVT_CHAR(shell, self._wx_on_char)
Expand Down