1616    QSpacerItem ,
1717    QGridLayout ,
1818    QSizePolicy ,
19-     QGroupBox 
19+     QGroupBox ,
20+     QDialog 
2021)
2122from  PySide6 .QtGui  import  QIcon , QPainter , QPixmap , QPalette 
22- from  PySide6 .QtCore  import  QSize , Qt , QSettings 
23+ from  PySide6 .QtCore  import  QSize , Qt , QSettings ,  QPropertyAnimation ,  QEasingCurve ,  QTimer 
2324import  multiprocessing 
2425from  qfluentwidgets  import  Theme , setTheme 
2526 # Keep for freeze_support, but remove direct Process usage 
@@ -252,6 +253,146 @@ def show_settings(self):
252253        self ._settings_dialog  =  settings_dialog   # Save dialog reference 
253254        settings_dialog .show () # Use show() instead of exec() to keep dialog non-modal 
254255
256+ class  AnimatedAppDialog (QDialog ):
257+     def  __init__ (self , parent = None , app_type = "" ):
258+         super ().__init__ (parent )
259+         self .app_type  =  app_type 
260+         self .setWindowFlags (Qt .WindowType .Dialog  |  Qt .WindowType .FramelessWindowHint )
261+         self .setAttribute (Qt .WidgetAttribute .WA_TranslucentBackground )
262+         self .setModal (False )  # Non-modal 
263+         
264+         # Animation for showing the dialog 
265+         self .animation  =  QPropertyAnimation (self , b"windowOpacity" )
266+         self .animation .setDuration (250 )  # Duration in milliseconds 
267+         self .animation .setStartValue (0.0 )
268+         self .animation .setEndValue (1.0 )
269+         self .animation .setEasingCurve (QEasingCurve .Type .OutCubic )
270+         
271+         # Animation for closing the dialog 
272+         self .close_animation  =  QPropertyAnimation (self , b"windowOpacity" )
273+         self .close_animation .setDuration (200 )
274+         self .close_animation .setStartValue (1.0 )
275+         self .close_animation .setEndValue (0.0 )
276+         self .close_animation .setEasingCurve (QEasingCurve .Type .OutCubic )
277+         self .close_animation .finished .connect (self ._finish_close )
278+         
279+         self ._should_close  =  False 
280+         
281+     def  showEvent (self , event ):
282+         # Start animation when the dialog is shown 
283+         self .animation .start ()
284+         super ().showEvent (event )
285+         # Start the external app after animation 
286+         QTimer .singleShot (300 , self .start_external_app )
287+         
288+     def  closeEvent (self , event ):
289+         if  not  self ._should_close :
290+             event .ignore ()
291+             self .close_animation .start ()
292+         else :
293+             super ().closeEvent (event )
294+             
295+     def  _finish_close (self ):
296+         self ._should_close  =  True 
297+         self .close ()
298+         
299+     def  start_external_app (self ):
300+         """Start the external app in a separate process""" 
301+         try :
302+             if  self .app_type  ==  "image" :
303+                 multiprocessing .Process (target = run_image ).start ()
304+             elif  self .app_type  ==  "zip" :
305+                 multiprocessing .Process (target = run_zip ).start ()
306+         except  Exception  as  e :
307+             print (f"Error starting { self .app_type } { e }  )
308+         finally :
309+             # Close the animation dialog after starting the external app 
310+             QTimer .singleShot (1000 , self .close )
311+ 
312+ class  ImageAppDialog (AnimatedAppDialog ):
313+     def  __init__ (self , parent = None ):
314+         super ().__init__ (parent , "image" )
315+         self .setFixedSize (400 , 200 )
316+         self .center_on_screen ()
317+         
318+         layout  =  QVBoxLayout (self )
319+         layout .setAlignment (Qt .AlignmentFlag .AlignCenter )
320+         
321+         # Title 
322+         title  =  QLabel ("Image Converter" )
323+         title .setStyleSheet (""" 
324+             font-size: 24px; 
325+             font-weight: bold; 
326+             color: #333; 
327+             margin-bottom: 10px; 
328+         """ )
329+         title .setAlignment (Qt .AlignmentFlag .AlignCenter )
330+         layout .addWidget (title )
331+         
332+         # Subtitle 
333+         subtitle  =  QLabel ("正在启动应用..." )
334+         subtitle .setStyleSheet (""" 
335+             font-size: 14px; 
336+             color: #666; 
337+             margin-bottom: 20px; 
338+         """ )
339+         subtitle .setAlignment (Qt .AlignmentFlag .AlignCenter )
340+         layout .addWidget (subtitle )
341+         
342+         # Loading indicator 
343+         from  qfluentwidgets  import  IndeterminateProgressBar 
344+         progress  =  IndeterminateProgressBar ()
345+         layout .addWidget (progress )
346+         
347+     def  center_on_screen (self ):
348+         screen  =  QApplication .primaryScreen ().geometry ()
349+         self .move (
350+             screen .center ().x () -  self .width () //  2 ,
351+             screen .center ().y () -  self .height () //  2 
352+         )
353+ 
354+ class  ZipAppDialog (AnimatedAppDialog ):
355+     def  __init__ (self , parent = None ):
356+         super ().__init__ (parent , "zip" )
357+         self .setFixedSize (400 , 200 )
358+         self .center_on_screen ()
359+         
360+         layout  =  QVBoxLayout (self )
361+         layout .setAlignment (Qt .AlignmentFlag .AlignCenter )
362+         
363+         # Title 
364+         title  =  QLabel ("Archive Manager" )
365+         title .setStyleSheet (""" 
366+             font-size: 24px; 
367+             font-weight: bold; 
368+             color: #333; 
369+             margin-bottom: 10px; 
370+         """ )
371+         title .setAlignment (Qt .AlignmentFlag .AlignCenter )
372+         layout .addWidget (title )
373+         
374+         # Subtitle 
375+         subtitle  =  QLabel ("正在启动应用..." )
376+         subtitle .setStyleSheet (""" 
377+             font-size: 14px; 
378+             color: #666; 
379+             margin-bottom: 20px; 
380+         """ )
381+         subtitle .setAlignment (Qt .AlignmentFlag .AlignCenter )
382+         layout .addWidget (subtitle )
383+         
384+         # Loading indicator 
385+         from  qfluentwidgets  import  IndeterminateProgressBar 
386+         progress  =  IndeterminateProgressBar ()
387+         layout .addWidget (progress )
388+         
389+     def  center_on_screen (self ):
390+         screen  =  QApplication .primaryScreen ().geometry ()
391+         self .move (
392+             screen .center ().x () -  self .width () //  2 ,
393+             screen .center ().y () -  self .height () //  2 
394+         )
395+ 
255396def  run_zip ():
256397    from  arc_gui  import  ZipAppRunner 
257398    app_runner  =  ZipAppRunner ()
@@ -260,10 +401,53 @@ def run_image():
260401    from  image_converter  import  ICNSConverterApp 
261402    app_runner  =  ICNSConverterApp ()
262403    app_runner .MainLoop ()
263- def  run_zip_app ():
264-     multiprocessing .Process (target = run_zip ).start ()
265404def  run_image_app ():
266-     multiprocessing .Process (target = run_image ).start ()
405+     """Run the image converter app with animation""" 
406+     try :
407+         # Get the main window instance 
408+         app  =  QApplication .instance ()
409+         main_window  =  None 
410+         for  widget  in  app .topLevelWidgets ():
411+             if  isinstance (widget , IconButtonsWindow ):
412+                 main_window  =  widget 
413+                 break 
414+         
415+         if  main_window :
416+             # Create and show the animation dialog 
417+             dialog  =  ImageAppDialog (main_window )
418+             dialog .show ()
419+         else :
420+             # Fallback to multiprocessing if no main window found 
421+             multiprocessing .Process (target = run_image ).start ()
422+             
423+     except  Exception  as  e :
424+         print (f"Error running image app: { e }  )
425+         # Fallback to multiprocessing 
426+         multiprocessing .Process (target = run_image ).start ()
427+ 
428+ def  run_zip_app ():
429+     """Run the archive manager app with animation""" 
430+     try :
431+         # Get the main window instance 
432+         app  =  QApplication .instance ()
433+         main_window  =  None 
434+         for  widget  in  app .topLevelWidgets ():
435+             if  isinstance (widget , IconButtonsWindow ):
436+                 main_window  =  widget 
437+                 break 
438+         
439+         if  main_window :
440+             # Create and show the animation dialog 
441+             dialog  =  ZipAppDialog (main_window )
442+             dialog .show ()
443+         else :
444+             # Fallback to multiprocessing if no main window found 
445+             multiprocessing .Process (target = run_zip ).start ()
446+             
447+     except  Exception  as  e :
448+         print (f"Error running zip app: { e }  )
449+         # Fallback to multiprocessing 
450+         multiprocessing .Process (target = run_zip ).start ()
267451
268452
269453
0 commit comments