@@ -56,16 +56,29 @@ class ClidMultiline(npy.MultiLine):
5656 the screen back to the normal view after a searh has been performed
5757 (the search results will be shown; blank if no matches are found)
5858
59+ Attributes:
60+ space_selected_values(list):
61+ Stores list of files which was selected for batch tagging using <Space>
62+
5963 Note:
6064 self.parent refers to ClidInterface -> class
6165 self.parent.value refers to database.Mp3DataBase -> class
6266 """
6367
6468 def __init__ (self , * args , ** kwargs ):
6569 super ().__init__ (* args , ** kwargs )
70+ self .handlers .update ({
71+ 'u' : self .h_reload_files ,
72+ '2' : self .h_switch_to_settings ,
73+ curses .ascii .SP : self .h_multi_select ,
74+ curses .ascii .ESC : self .h_revert_escape ,
75+ })
76+
77+ self .allow_filtering = False # does NOT refer to search invoked with '/'
78+ self .space_selected_values = []
79+
6680 smooth = self .parent .parentApp .settings ['smooth_scroll' ] # is smooth scroll enabled ?
6781 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>
6982
7083 def set_status (self , filename ):
7184 """Set the the value of self.parent.wStatus2 with metadata of file under cursor."""
@@ -76,16 +89,6 @@ def get_selected(self):
7689 """Return the name of file under the cursor line"""
7790 return self .values [self .cursor_line ]
7891
79- def set_up_handlers (self ):
80- super ().set_up_handlers ()
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- })
87-
88-
8992 def h_reload_files (self , char ):
9093 """Reload files in `music_dir`"""
9194 self .parent .value .load_files_and_set_values ()
@@ -150,7 +153,20 @@ def h_select(self, char):
150153 self .parent .parentApp .switchForm ("EDIT" )
151154
152155 def h_multi_select (self , char ):
153- pass
156+ if self .cursor_line in self .space_selected_values :
157+ self .space_selected_values .remove (self .cursor_line )
158+ else :
159+ self .space_selected_values .append (self .cursor_line )
160+
161+ def _set_line_highlighting (self , line , value_indexer ):
162+ if value_indexer in self .space_selected_values :
163+ self .set_is_line_important (line , True ) # mark as important
164+ else :
165+ self .set_is_line_important (line , False )
166+
167+ # without this line every file will get highlighted as we go down
168+ self .set_is_line_cursor (line , False )
169+
154170
155171class ClidInterface (npy .FormMuttActiveTraditional ):
156172 """The main app with the ui.
0 commit comments