@@ -65,19 +65,25 @@ def __init__(self, *args, **kwargs):
6565 super ().__init__ (* args , ** kwargs )
6666 smooth = self .parent .parentApp .settings ['smooth_scroll' ] # is smooth scroll enabled ?
6767 self .slow_scroll = True if smooth == 'true' else False
68+ self .space_selected_values = [] # stores list of files which was selected for batch tagging using <Space>
6869
6970 def set_status (self , filename ):
7071 """Set the the value of self.parent.wStatus2 with metadata of file under cursor."""
7172 self .parent .wStatus2 .value = self .parent .value .parse_meta_for_status (filename = filename )
73+ self .parent .display ()
7274
7375 def get_selected (self ):
76+ """Return the name of file under the cursor line"""
7477 return self .values [self .cursor_line ]
7578
7679 def set_up_handlers (self ):
7780 super ().set_up_handlers ()
78- self .handlers ['u' ] = self .h_reload_files
79- self .handlers ['2' ] = self .h_switch_to_settings
80- self .handlers [curses .ascii .ESC ] = self .h_revert_escape
81+ self .handlers .update ({
82+ 'u' : self .h_reload_files ,
83+ '2' : self .h_switch_to_settings ,
84+ curses .ascii .SP : self .h_multi_select ,
85+ curses .ascii .ESC : self .h_revert_escape ,
86+ })
8187
8288
8389 def h_reload_files (self , char ):
@@ -97,6 +103,12 @@ def h_revert_escape(self, char):
97103
98104# TODO: make it faster
99105
106+ def filter_value (self , index ):
107+ if self ._filter in self .display_value (self .values [index ]).lower (): # ignore case
108+ return True
109+ else :
110+ return False
111+
100112 def h_switch_to_settings (self , char ):
101113 self .parent .parentApp .switchForm ("SETTINGS" )
102114
@@ -111,7 +123,6 @@ def h_cursor_line_down(self, char):
111123 if (self .cursor_line + 1 ) < len (self .values ): # need to +1 as cursor_line is the index
112124 filename = self .values [self .cursor_line + 1 ]
113125 self .set_status (filename )
114- self .parent .display ()
115126
116127 super ().h_cursor_line_down (char ) # code has some returns in between
117128
@@ -123,26 +134,23 @@ def h_cursor_line_up(self, char):
123134
124135 if self .cursor_line - 1 > 0 :
125136 self .set_status (self .get_selected ())
126- self .parent .display ()
127137
128138 def h_cursor_page_down (self , char ):
129139 super ().h_cursor_page_down (char )
130140 if self .cursor_line != - 1 : # -1 if there is nothing to display
131141 self .set_status (self .get_selected ())
132- self .parent .display ()
133142
134143 def h_cursor_page_up (self , char ):
135144 super ().h_cursor_page_up (char )
136145 if self .cursor_line - 1 > 0 :
137146 self .set_status (self .get_selected ())
138- self .parent .display ()
139147
140148 def h_select (self , char ):
141- self .parent .parentApp .current_file = self .parent .value .file_dict [self .values [ self . cursor_line ] ]
149+ self .parent .parentApp .current_file = self .parent .value .file_dict [self .get_selected () ]
142150 self .parent .parentApp .switchForm ("EDIT" )
143151
144- # TODO: smooth scroll
145-
152+ def h_multi_select ( self , char ):
153+ pass
146154
147155class ClidInterface (npy .FormMuttActiveTraditional ):
148156 """The main app with the ui.
0 commit comments