@@ -64,10 +64,28 @@ def open_in_central_pane(self, filepath):
6464 # Menu action methods -----------------------------------------------------
6565
6666 def request_open_new_path (self ):
67- pass
67+ from traits .api import HasStrictTraits , File
68+
69+ class PathSelector (HasStrictTraits ):
70+ filepath = File
71+
72+ selector = PathSelector ()
73+ ui = selector .edit_traits (kind = "livemodal" )
74+ if ui .result :
75+ self .open_in_central_pane (selector .filepath )
6876
6977 def scan_current_path (self ):
70- pass
78+ if self .central_pane .active_editor is None :
79+ msg = "No active tab/path. You must open a path before you can " \
80+ "scan it for faces"
81+ error (None , msg )
82+
83+ active_editor = self .central_pane .active_editor
84+ model = active_editor .obj
85+ if isinstance (model , ImageFolder ):
86+ model .compute_num_faces ()
87+ else :
88+ model .detect_faces ()
7189
7290 # Initialization methods --------------------------------------------------
7391
@@ -97,9 +115,8 @@ def _menu_bar_default(self):
97115 SGroup (
98116 TaskAction (name = 'Open...' ,
99117 accelerator = 'Ctrl+N' ,
100- method = 'request_open_new_path' ,
101- enabled_name = 'repository.scanned' ),
102- id = 'SelectionGroup' , name = 'SelectionGroup' ,
118+ method = 'request_open_new_path' ),
119+ id = 'OpenGroup' , name = 'OpenGroup' ,
103120 ),
104121 SGroup (
105122 TaskWindowAction (
@@ -116,9 +133,9 @@ def _menu_bar_default(self):
116133 SGroup (
117134 TaskAction (name = 'Scan' ,
118135 accelerator = 'Ctrl+R' ,
119- method = 'request_rescan_repository ' ,
136+ method = 'scan_current_path ' ,
120137 image = ImageResource ('zoom-draw' )),
121- id = 'RepositoryGroup ' , name = 'RepositoryGroup '
138+ id = 'ScanGroup ' , name = 'ScanGroup '
122139 ),
123140 id = 'Tools' , name = '&Tools' ,
124141 ),
0 commit comments