]> git.lizzy.rs Git - torbrowser-launcher.git/commitdiff
Made pygame and modem sound optiomal, the option is simply disabled if you do not...
authorTBBLER <e47gykt+3rm290@sharklasers.com>
Thu, 26 Jun 2014 15:50:42 +0000 (15:50 +0000)
committerTBBLER <e47gykt+3rm290@sharklasers.com>
Thu, 26 Jun 2014 15:50:42 +0000 (15:50 +0000)
README.md
stdeb.cfg
torbrowser-launcher

index cb0adf807b51f5c7f7f586477c7025230f272237..e77f2b0d5a516a6eba55d69d1538217a5f50a67e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -20,16 +20,20 @@ Then install dependencies, build a package, and install:
 
 ### Debian, Ubuntu, Linux Mint, etc.
 
-    sudo apt-get install build-essential python-all python-stdeb python-gtk2 python-psutil python-twisted python-pygame python-lzma wmctrl gnupg fakeroot
+    sudo apt-get install build-essential python-all python-stdeb python-gtk2 python-psutil python-twisted python-lzma wmctrl gnupg fakeroot
     ./build_deb.sh
     sudo dpkg -i deb_dist/torbrowser-launcher_*.deb
 
+Optionally you can install python-pygame if you want to play a modem sound while Tor Browser is launching.
+
 ### Red Hat, Fedora, CentOS, etc.
 
-    sudo yum install python-psutil python-twisted pygame wmctrl gnupg fakeroot
+    sudo yum install python-psutil python-twisted wmctrl gnupg fakeroot
     ./build_rpm.sh
     sudo yum install dist/torbrowser-launcher-*.rpm
 
+Optionally you can install pygame if you want to play a modem sound while Tor Browser is launching.
+
 ## Installing in Ubuntu
 
 I've created a PPA where I'm maintaining torbrowser-launcher binaries. You can install in an Ubuntu-based distribution like this:
index 646e9bff3c4c48e6c827e52f1e356227af3fa871..9e34d6d52dc74ae028ccbc9d1223cd538061c52e 100644 (file)
--- a/stdeb.cfg
+++ b/stdeb.cfg
@@ -1,4 +1,4 @@
 [DEFAULT]
 Package: torbrowser-launcher
-Depends: python-gtk2, python-psutil, python-twisted, python-lzma, python-pygame, gnupg, wmctrl
+Depends: python-gtk2, python-psutil, python-twisted, python-lzma, gnupg, wmctrl
 Suite: trusty
index 893eb9026ab394e2d092c2533b36ce40be8512de..8f243e8dd9643411f43d5108110228cab8368d41 100755 (executable)
@@ -415,10 +415,17 @@ class TBLSettings:
         # modem sound
         self.modem_checkbox = gtk.CheckButton(_("Play modem sound, because Tor is slow :]"))
         self.settings_box.pack_start(self.modem_checkbox, True, True, 0)
-        if self.common.settings['modem_sound']:
-            self.modem_checkbox.set_active(True)
-        else:
+
+        try:
+            import pygame
+            if self.common.settings['modem_sound']:
+                self.modem_checkbox.set_active(True)
+            else:
+                self.modem_checkbox.set_active(False)
+        except ImportError:
             self.modem_checkbox.set_active(False)
+            self.modem_checkbox.set_sensitive(False)
+            self.modem_checkbox.set_tooltip_text(_("This option requires python-pygame to be installed"))
         self.modem_checkbox.show()
 
         # labels
@@ -1067,11 +1074,18 @@ class TBLLauncher:
 
         # play modem sound?
         if self.common.settings['modem_sound']:
-            import pygame
-            pygame.mixer.init()
-            sound = pygame.mixer.Sound(self.common.paths['modem_sound'])
-            sound.play()
-            time.sleep(10)
+            try:
+                import pygame
+                pygame.mixer.init()
+                sound = pygame.mixer.Sound(self.common.paths['modem_sound'])
+                sound.play()
+                time.sleep(10)
+            except ImportError:
+                md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, _("The python-pygame package is missing, the modem sound is unavailable."))
+                md.set_position(gtk.WIN_POS_CENTER)
+                md.run()
+                md.destroy()
+
 
         if run_next_task:
             self.run_task()