| 1 |
# (C) Copyright 2004-2023 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 |
|
| 11 |
# ------------------------------------------------------------------------- |
| 12 |
# Imports: |
| 13 |
# ------------------------------------------------------------------------- |
| 14 |
|
| 15 |
from traits.api import HasPrivateTraits, Array |
| 16 |
|
| 17 |
from traitsui.api import View, ArrayEditor |
| 18 |
|
| 19 |
# ------------------------------------------------------------------------- |
| 20 |
# 'Test' class: |
| 21 |
# ------------------------------------------------------------------------- |
| 22 |
|
| 23 |
|
| 24 |
class Test(HasPrivateTraits): |
| 25 |
|
| 26 |
# ------------------------------------------------------------------------- |
| 27 |
# Trait definitions: |
| 28 |
# ------------------------------------------------------------------------- |
| 29 |
|
| 30 |
three = Array(int, (3, 3)) |
| 31 |
four = Array(float, (4, 4), editor=ArrayEditor(width=-50)) |
| 32 |
|
| 33 |
# ------------------------------------------------------------------------- |
| 34 |
# Traits view definitions: |
| 35 |
# ------------------------------------------------------------------------- |
| 36 |
|
| 37 |
view = View( |
| 38 |
'three', |
| 39 |
'_', |
| 40 |
'three', |
| 41 |
'_', |
| 42 |
'three~', |
| 43 |
'_', |
| 44 |
'four', |
| 45 |
'_', |
| 46 |
'four', |
| 47 |
'_', |
| 48 |
'four~', |
| 49 |
title='ArrayEditor Test Case', |
| 50 |
resizable=True, |
| 51 |
) |
| 52 |
|
| 53 |
|
| 54 |
# ------------------------------------------------------------------------- |
| 55 |
# Run the test case: |
| 56 |
# ------------------------------------------------------------------------- |
| 57 |
|
| 58 |
if __name__ == '__main__': |
| 59 |
Test().configure_traits() |