| 1 |
# (C) Copyright 2007-2025 Enthought, Inc., Austin, TX |
| 2 |
# All rights reserved. |
| 3 |
# |
| 4 |
# This software is provided without warranty under the terms of the BSD |
| 5 |
# license included in LICENSE.txt and may be redistributed only under |
| 6 |
# the conditions described in the aforementioned license. The license |
| 7 |
# is also available online at http://www.enthought.com/licenses/BSD.txt |
| 8 |
# |
| 9 |
# Thanks for using Enthought open source! |
| 10 |
""" The traits UI handler for the text editor. """ |
| 11 |
|
| 12 |
|
| 13 |
# Enthought library imports. |
| 14 |
from traitsui.api import Handler |
| 15 |
|
| 16 |
|
| 17 |
class TextEditorHandler(Handler): |
| 18 |
"""The traits UI handler for the text editor.""" |
| 19 |
|
| 20 |
########################################################################### |
| 21 |
# 'TextEditorHandler' interface. |
| 22 |
########################################################################### |
| 23 |
|
| 24 |
# fixme: We need to work out how to create these 'dispatch' methods |
| 25 |
# dynamically! Plugins will want to add bindings to the editor to bind |
| 26 |
# a key to an action. |
| 27 |
def run(self, info): |
| 28 |
"""Run the text as Python code.""" |
| 29 |
|
| 30 |
info.object.run() |
| 31 |
|
| 32 |
def save(self, info): |
| 33 |
"""Save the text to disk.""" |
| 34 |
|
| 35 |
info.object.save() |