@@ -173,6 +173,7 @@ def set_path_info(self, path, data_size, files_count):
173173
174174 # enable sorting again
175175 self .sourceFilesWidget .setSortingEnabled (sorting )
176+ self .update_total_size ()
176177
177178 def update_path_info (self , index_row : int ):
178179 """
@@ -245,7 +246,7 @@ def populate_from_profile(self):
245246
246247 for source in SourceFileModel .select ().where (SourceFileModel .profile == profile ):
247248 self .add_source_to_table (source , False )
248-
249+ self . update_total_size ()
249250 # Fetch the Sort by Column and order
250251 sourcetab_sort_column = int (SettingsModel .get (key = 'sourcetab_sort_column' ).str_value )
251252 sourcetab_sort_order = int (SettingsModel .get (key = 'sourcetab_sort_order' ).str_value )
@@ -288,6 +289,7 @@ def source_add(self):
288289 if created :
289290 self .add_source_to_table (new_source )
290291 new_source .save ()
292+ self .update_total_size ()
291293
292294 def source_copy (self , index = None ):
293295 """
@@ -326,6 +328,27 @@ def source_remove(self):
326328 self .sourceFilesWidget .removeRow (index .row ())
327329
328330 logger .debug (f"Removed source in row { index .row ()} " )
331+ self .update_total_size ()
332+
333+ def update_total_size (self ):
334+ """
335+ Update the total size and files count for all sources.
336+ """
337+ total_size , total_files = 0 , 0
338+
339+ sources = SourceFileModel .select ().where (SourceFileModel .profile == self .profile ())
340+ for source in sources :
341+ if source .dir_size > 0 :
342+ total_size += source .dir_size
343+ if source .dir_files_count > 0 :
344+ total_files += source .dir_files_count
345+
346+ if total_size > 0 :
347+ self .totalSizeLabel .setText (
348+ self .tr ("Total Size: {}, {} files" ).format (pretty_bytes (total_size ), total_files )
349+ )
350+ else :
351+ self .totalSizeLabel .setText ("" )
329352
330353 def show_exclude_dialog (self ):
331354 window = ExcludeDialog (self .profile (), self )
0 commit comments