77# Local imports
88from ..model .image_folder import ImageFolder
99
10+ from traits .api import Instance
11+ from traitsui .api import Item , ModelView , View
12+ from traitsui .ui_editors .data_frame_editor import DataFrameEditor
13+
14+ from pycasa .model .image_folder import ImageFolder
15+
16+ DISPLAYED_COLUMNS = [
17+ 'ApertureValue' , 'ExifVersion' , 'Model' , 'Make' , 'LensModel' , 'DateTime' ,
18+ 'ShutterSpeedValue' , 'XResolution' , 'YResolution'
19+ ]
20+
1021
1122class ImageFolderView (ModelView ):
1223 """ ModelView for an image folder object.
@@ -17,7 +28,8 @@ class ImageFolderView(ModelView):
1728
1829 view = View (
1930 Item ("model.path" , style = "readonly" , show_label = False ),
20- Item ("model.data" , editor = DataFrameEditor (update = "data_updated" ),
31+ Item ("model.data" , editor = DataFrameEditor (columns = DISPLAYED_COLUMNS ,
32+ update = "data_updated" ),
2133 show_label = False , visible_when = "len(model.data) > 0" ),
2234 HGroup (
2335 Spring (),
@@ -35,3 +47,15 @@ class ImageFolderView(ModelView):
3547 @observe ("scan" )
3648 def scan_for_faces (self , event ):
3749 self .model .compute_num_faces ()
50+
51+
52+ if __name__ == '__main__' :
53+ from os .path import dirname , join
54+ import ets_tutorial
55+
56+ TUTORIAL_DIR = dirname (ets_tutorial .__file__ )
57+ SAMPLE_IMG_DIR = join (TUTORIAL_DIR , ".." , "sample_images" )
58+
59+ image_file = ImageFolder (directory = SAMPLE_IMG_DIR )
60+ view = ImageFolderView (model = image_file )
61+ view .configure_traits ()
0 commit comments