@@ -2533,34 +2533,21 @@ def InitCacheSettings(self):
2533
2533
self .cache_object = new_cache_object
2534
2534
2535
2535
def FrameExported (self , title_message , start_frame , end_frame , current_frame ):
2536
- """Connect to Unity launcher (for Linux )"""
2536
+ """Update progress in Unity Launcher (if connected )"""
2537
2537
try :
2538
- if sys .platform == "linux" and self .has_launcher :
2539
- if not self .unity_launchers :
2540
- # Get launcher only once
2541
- import gi
2542
- gi .require_version ('Unity' , '7.0' )
2543
- from gi .repository import Unity
2544
- self .unity_launchers .append (Unity .LauncherEntry .get_for_desktop_id ("openshot-qt.desktop" ))
2545
- self .unity_launchers .append (Unity .LauncherEntry .get_for_desktop_id ("appimagekit-openshot-qt.desktop" ))
2546
-
2547
- # Set progress and show progress bar
2548
- for launcher in self .unity_launchers :
2549
- launcher .set_property ("progress" , current_frame / (end_frame - start_frame ))
2550
- launcher .set_property ("progress_visible" , True )
2551
-
2538
+ # Set progress and show progress bar
2539
+ self .unity_launcher .set_property ("progress" , current_frame / (end_frame - start_frame ))
2540
+ self .unity_launcher .set_property ("progress_visible" , True )
2552
2541
except Exception :
2553
2542
# Just ignore
2554
- self . has_launcher = False
2543
+ pass
2555
2544
2556
2545
def ExportFinished (self , path ):
2557
- """Export has completed """
2546
+ """Show completion in Unity Launcher (if connected) """
2558
2547
try :
2559
- if sys .platform == "linux" and self .has_launcher :
2560
- for launcher in self .unity_launchers :
2561
- # Set progress on Unity launcher and hide progress bar
2562
- launcher .set_property ("progress" , 0.0 )
2563
- launcher .set_property ("progress_visible" , False )
2548
+ # Set progress on Unity launcher and hide progress bar
2549
+ self .unity_launcher .set_property ("progress" , 0.0 )
2550
+ self .unity_launcher .set_property ("progress_visible" , False )
2564
2551
except Exception :
2565
2552
pass
2566
2553
@@ -2796,11 +2783,18 @@ def __init__(self, mode=None):
2796
2783
self .tutorial_manager = TutorialManager (self )
2797
2784
2798
2785
# Connect to Unity DBus signal (if linux)
2799
- if sys .platform == "linux" :
2800
- self .unity_launchers = []
2801
- self .has_launcher = True
2802
- self .ExportFrame .connect (self .FrameExported )
2803
- self .ExportEnded .connect (self .ExportFinished )
2786
+ self .unity_launcher = None
2787
+ if "linux" in sys .platform :
2788
+ try :
2789
+ # Get connection to Unity Launcher
2790
+ from gi .repository import Unity
2791
+ self .unity_launcher = Unity .LauncherEntry .get_for_desktop_id (info .DESKTOP_ID )
2792
+ except Exception :
2793
+ # Guess we're not on Ubuntu
2794
+ pass
2795
+ else :
2796
+ self .ExportFrame .connect (self .FrameExported )
2797
+ self .ExportEnded .connect (self .ExportFinished )
2804
2798
2805
2799
# Save settings
2806
2800
s .save ()
0 commit comments