#-------------------------------------------------------------------------------
#
# Copyright (c) 2012
# IMB, RWTH Aachen University,
# ISM, Brno University of Technology
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in the Spirrid top directory "licence.txt" and may be
# redistributed only under the conditions described in the aforementioned
# license.
#
# Thanks for using Simvisage open source!
#
#-------------------------------------------------------------------------------
from traits.api import \
    HasTraits, Float, Property, cached_property, Int, Array, Bool, \
    Instance, DelegatesTo, Tuple, Button, List, Str, File

from traitsui.api import View, Item, HGroup, EnumEditor, Group, UItem, RangeEditor

from traitsui.ui_editors.array_view_editor import ArrayViewEditor

import numpy as np
from scipy import stats
import os
import re

import platform
import time
if platform.system() == 'Linux':
    sysclock = time.time
elif platform.system() == 'Windows':
    sysclock = time.clock


class NpyData(HasTraits):
    data = Array
    traits = View(
                Item('data',
                        show_label=False,
                        editor=ArrayViewEditor(format='%.4f',
                                               )
                    ),
                )

class NpyViewer(HasTraits):
    npy_file = File

    data = Instance(NpyData)

    load_data = Button()

    def _load_data_fired(self):
        self.load_data.data = np.load(self.npy_file)

    traits = View(
                'npy_file',
                UItem('load_data'),
                Item('@data'),
                title='Array Viewer',
                width=0.3,
                height=0.8,
                resizable=True,
                )

if __name__ == '__main__':
    viewer = NpyViewer()
    viewer.configure_traits()

@@ -782,16 +782,24 @@
 geEditor
+, Tabbed
 %0A%0Afrom t
@@ -1116,16 +1116,74 @@
  = Array
+()%0A    def _data_default(self):%0A        return np.empty(1)
 %0A    tra
@@ -1494,16 +1494,19 @@
 (NpyData
+,()
 )%0A%0A    l
@@ -1525,17 +1525,16 @@
 utton()%0A
-%0A
     def 
@@ -1574,18 +1574,23 @@
 elf.
-load_data.
+data = NpyData(
 data
@@ -1614,17 +1614,26 @@
 py_file)
-%0A
+)%0A        
 %0A    tra
@@ -1636,32 +1636,65 @@
  traits = View(%0A
+                  Group(%0A        
                 
@@ -1721,16 +1721,24 @@
         
+        
 UItem('l
@@ -1769,20 +1769,63 @@
     
+        ),%0A                U
 Item('
-@
 data'
+, style='custom'
 ),%0A 
@@ -1865,63 +1865,8 @@
 r',%0A
-                width=0.3,%0A                height=0.8,%0A
     

load function fixed