[Pkg-anonymity-tools] [torbrowser-launcher] 14/16: no longer detach start-tor-browser process, and play modem sound in a separate thread to prevent blocking
Ulrike Uhlig
u-guest at moszumanska.debian.org
Thu Oct 2 17:06:10 UTC 2014
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to annotated tag v0.1.5
in repository torbrowser-launcher.
commit 8972c6ba4d61be5215cf884b039fa012efcee302
Author: Micah Lee <micah at micahflee.com>
Date: Wed Oct 1 00:46:21 2014 +0000
no longer detach start-tor-browser process, and play modem sound in a separate thread to prevent blocking
---
torbrowser_launcher/launcher.py | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/torbrowser_launcher/launcher.py b/torbrowser_launcher/launcher.py
index 6c1d6ff..faad6d2 100644
--- a/torbrowser_launcher/launcher.py
+++ b/torbrowser_launcher/launcher.py
@@ -26,7 +26,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
"""
-import os, subprocess, time, json, tarfile, hashlib, lzma
+import os, subprocess, time, json, tarfile, hashlib, lzma, threading
from twisted.internet import reactor
from twisted.web.client import Agent, RedirectAgent, ResponseDone, ResponseFailed
from twisted.web.http_headers import Headers
@@ -611,22 +611,26 @@ class Launcher:
self.run_task()
def run(self, run_next_task=True):
- devnull = open('/dev/null', 'w')
- subprocess.Popen([self.common.paths['tbb']['start']], stdout=devnull, stderr=devnull)
-
# play modem sound?
if self.common.settings['modem_sound']:
- 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()
+ def play_modem_sound():
+ 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()
+
+ t = threading.Thread(target=play_modem_sound)
+ t.start()
+
+ # run Tor Browser
+ subprocess.call([self.common.paths['tbb']['start']])
if run_next_task:
self.run_task()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/torbrowser-launcher.git
More information about the Pkg-anonymity-tools
mailing list