@@ -2105,7 +2105,7 @@ def load_settings(self):
2105
2105
2106
2106
# Load Recent Projects
2107
2107
self .load_recent_menu ()
2108
-
2108
+
2109
2109
# The method restoreState restores the visibility of the toolBar,
2110
2110
# but does not set the correct flag in the actionView_Toolbar.
2111
2111
self .actionView_Toolbar .setChecked (self .toolBar .isVisibleTo (self ))
@@ -2391,33 +2391,22 @@ def InitCacheSettings(self):
2391
2391
self .cache_object = new_cache_object
2392
2392
2393
2393
def FrameExported (self , title_message , start_frame , end_frame , current_frame ):
2394
- """Connect to Unity launcher (for Linux )"""
2394
+ """Update progress in Unity Launcher (if connected )"""
2395
2395
try :
2396
- if sys .platform == "linux" and self .has_launcher :
2397
- if not self .unity_launchers :
2398
- # Get launcher only once
2399
- from gi .repository import Unity
2400
- self .unity_launchers .append (Unity .LauncherEntry .get_for_desktop_id ("openshot-qt.desktop" ))
2401
- self .unity_launchers .append (Unity .LauncherEntry .get_for_desktop_id ("appimagekit-openshot-qt.desktop" ))
2402
-
2403
- # Set progress and show progress bar
2404
- for launcher in self .unity_launchers :
2405
- launcher .set_property ("progress" , current_frame / (end_frame - start_frame ))
2406
- launcher .set_property ("progress_visible" , True )
2407
-
2408
- except :
2396
+ # Set progress and show progress bar
2397
+ self .unity_launcher .set_property ("progress" , current_frame / (end_frame - start_frame ))
2398
+ self .unity_launcher .set_property ("progress_visible" , True )
2399
+ except Exception :
2409
2400
# Just ignore
2410
- self . has_launcher = False
2401
+ pass
2411
2402
2412
2403
def ExportFinished (self , path ):
2413
- """Export has completed """
2404
+ """Show completion in Unity Launcher (if connected) """
2414
2405
try :
2415
- if sys .platform == "linux" and self .has_launcher :
2416
- for launcher in self .unity_launchers :
2417
- # Set progress on Unity launcher and hide progress bar
2418
- launcher .set_property ("progress" , 0.0 )
2419
- launcher .set_property ("progress_visible" , False )
2420
- except :
2406
+ # Set progress on Unity launcher and hide progress bar
2407
+ self .unity_launcher .set_property ("progress" , 0.0 )
2408
+ self .unity_launcher .set_property ("progress_visible" , False )
2409
+ except Exception :
2421
2410
pass
2422
2411
2423
2412
def transformTriggered (self , clip_id ):
@@ -2642,11 +2631,18 @@ def __init__(self, mode=None):
2642
2631
self .tutorial_manager = TutorialManager (self )
2643
2632
2644
2633
# Connect to Unity DBus signal (if linux)
2645
- if sys .platform == "linux" :
2646
- self .unity_launchers = []
2647
- self .has_launcher = True
2648
- self .ExportFrame .connect (self .FrameExported )
2649
- self .ExportEnded .connect (self .ExportFinished )
2634
+ self .unity_launcher = None
2635
+ if "linux" in sys .platform :
2636
+ try :
2637
+ # Get connection to Unity Launcher
2638
+ from gi .repository import Unity
2639
+ self .unity_launcher = Unity .LauncherEntry .get_for_desktop_id (info .DESKTOP_ID )
2640
+ except Exception :
2641
+ # Guess we're not on Ubuntu
2642
+ pass
2643
+ else :
2644
+ self .ExportFrame .connect (self .FrameExported )
2645
+ self .ExportEnded .connect (self .ExportFinished )
2650
2646
2651
2647
# Save settings
2652
2648
s .save ()
0 commit comments