1- from traits .api import cached_property , Instance , Property
2- from traitsui .api import Item , ModelView , View
1+ from traits .api import Instance
2+ from traitsui .api import (
3+ HGroup , Item , Label , ModelView , Spring , View
4+ )
35from traitsui .ui_editors .data_frame_editor import DataFrameEditor
46
5- from pycasa .model .image_folder import ImageFolder
7+ # Local imports
8+ from pycasa .model .image_folder import FILENAME_COL , ImageFolder , NUM_FACE_COL
69
7- DISPLAYED_COLUMNS = [
10+
11+ DISPLAYED_COLUMNS = [FILENAME_COL , NUM_FACE_COL ] + [
812 'ApertureValue' , 'ExifVersion' , 'Model' , 'Make' , 'LensModel' , 'DateTime' ,
9- 'ShutterSpeedValue' , 'XResolution' , 'YResolution'
13+ 'ShutterSpeedValue' , 'ExposureTime' , 'XResolution' , 'YResolution' ,
14+ 'Orientation' , 'GPSInfo' , 'DigitalZoomRatio' , 'FocalLengthIn35mmFilm' ,
15+ 'ISOSpeedRatings' , 'SceneType'
1016]
1117
1218
@@ -15,23 +21,23 @@ class ImageFolderView(ModelView):
1521 """
1622 model = Instance (ImageFolder )
1723
18- metadata_df = Property (depends_on = "model.images.items" )
19-
2024 view = View (
2125 Item ('model.directory' , style = "readonly" , show_label = False ),
2226 Item (
23- 'metadata_df ' ,
27+ 'model.data ' ,
2428 editor = DataFrameEditor (columns = DISPLAYED_COLUMNS ),
2529 show_label = False ,
26- width = 1200 ,
30+ visible_when = "len(model.data) > 0" ,
31+ ),
32+ HGroup (
33+ Spring (),
34+ Label ("No images found. No data to show" ),
35+ Spring (),
36+ visible_when = "len(model.data) == 0" ,
2737 ),
2838 resizable = True
2939 )
3040
31- @cached_property
32- def _get_metadata_df (self ):
33- return self .model .create_metadata_df ()
34-
3541
3642if __name__ == '__main__' :
3743 from os .path import dirname , join
0 commit comments