@@ -127,6 +127,7 @@ def __init__(self, gcache: DriveCache, file_id: str, new_name: str):
127127
128128 def execute (self ):
129129 self .gcache .rename_file (self .file_id , self .new_name )
130+ self .description = self .description .replace ("Renaming " , "Renamed " )
130131
131132class MoveAction (GDriveAction ):
132133 def __init__ (self , gcache : DriveCache , file_id : str , destination : str | tuple [str | None , str | None ], previous_parents : list [str ] | None = None ):
@@ -165,6 +166,7 @@ def execute(self):
165166 gdrive .move_gfile (self .file_id , self .destination )
166167 else :
167168 self .gcache .move_file (self .file_id , self .destination , previous_parents = self .previous_parents )
169+ self .description = self .description .replace ("Moving " , "Moved " )
168170
169171class CreateFolderAction (GDriveAction ):
170172 def __init__ (self , gcache : DriveCache , parent_id : str , folder_name : str ):
@@ -176,6 +178,7 @@ def __init__(self, gcache: DriveCache, parent_id: str, folder_name: str):
176178
177179 def execute (self ):
178180 self .gcache .create_folder (folder_name = self .folder_name , parent_id = self .parent_id )
181+ self .description = self .description .replace ("Creating " , "Created " )
179182
180183class ThumbnailWorker (QRunnable ):
181184 def __init__ (self , item , cancel_flag , emit_callback ):
@@ -542,9 +545,9 @@ def paintEvent(self, event):
542545 painter .drawEllipse (rect )
543546
544547class GDriveProgressPopover (QDialog ):
545- def __init__ (self , parent , actions : list [GDriveAction ]):
548+ def __init__ (self , parent , gdrive_actions : list [GDriveAction ]):
546549 super ().__init__ (parent , Qt .WindowType .Popup | Qt .WindowType .FramelessWindowHint )
547- self .actions = actions
550+ self .gdrive_actions = gdrive_actions
548551 self .setMinimumWidth (350 )
549552 self .setMaximumHeight (400 )
550553 self .init_ui ()
@@ -595,20 +598,22 @@ def init_ui(self):
595598
596599 def clear_completed (self ):
597600 # We need to notify the parent to actually clear them from the list
598- self .parent ().clear_completed_actions ()
601+ parent = self .parent ()
602+ assert isinstance (parent , GDriveApp )
603+ parent .clear_completed_actions ()
599604 self .refresh_list ()
600605
601606 def refresh_list (self ):
602607 self .list_widget .clear ()
603- if not self .actions :
608+ if not self .gdrive_actions :
604609 item = QListWidgetItem ("No active operations" )
605610 item .setTextAlignment (Qt .AlignmentFlag .AlignCenter )
606611 item .setFlags (Qt .ItemFlag .NoItemFlags )
607612 self .list_widget .addItem (item )
608613 return
609614
610615 # Show most recent first
611- for action in reversed (self .actions ):
616+ for action in reversed (self .gdrive_actions ):
612617 item = QListWidgetItem ()
613618 widget = QWidget ()
614619 item_layout = QHBoxLayout (widget )
@@ -1313,7 +1318,10 @@ def toggle_progress_popover(self):
13131318 def clear_completed_actions (self ):
13141319 self .gdrive_actions = [a for a in self .gdrive_actions if a .status not in ("completed" , "error" )]
13151320 if self .progress_popover :
1316- self .progress_popover .actions = self .gdrive_actions
1321+ self .progress_popover .gdrive_actions = self .gdrive_actions
1322+ self .gdrive_progress_widget .setMaximum (0 )
1323+ self .gdrive_progress_widget .setValue (0 )
1324+ self .gdrive_progress_widget .setToolTip ("No actions" )
13171325
13181326 def queue_gdrive_action (self , action : GDriveAction ):
13191327 action .signals .finished .connect (self ._on_gdrive_action_finished )
0 commit comments