use os.system() with & to send in the bg because app we call may not return soon. we use that for playing sounds and opening url/mailto
This commit is contained in:
parent
ed26c8fa77
commit
5d05e52d34
1 changed files with 5 additions and 12 deletions
17
src/gajim.py
17
src/gajim.py
|
@ -90,7 +90,7 @@ except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class User:
|
class User:
|
||||||
'''Information concerning each users'''
|
'''Information concerning each contact'''
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
self.jid = ''
|
self.jid = ''
|
||||||
|
@ -144,16 +144,12 @@ class Interface:
|
||||||
command = gajim.config.get('custommailapp')
|
command = gajim.config.get('custommailapp')
|
||||||
if command == '': # if no app is configured
|
if command == '': # if no app is configured
|
||||||
return
|
return
|
||||||
command = command + ' ' + uri
|
command = command + ' ' + uri + ' &'
|
||||||
try:
|
try:
|
||||||
os.system(command)
|
os.system(command)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def play_timeout(self, pid):
|
|
||||||
pidp, r = os.waitpid(pid, os.WNOHANG)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def play_sound(self, event):
|
def play_sound(self, event):
|
||||||
if not gajim.config.get('sounds_on'):
|
if not gajim.config.get('sounds_on'):
|
||||||
return
|
return
|
||||||
|
@ -169,12 +165,9 @@ class Interface:
|
||||||
elif os.name == 'posix':
|
elif os.name == 'posix':
|
||||||
if gajim.config.get('soundplayer') == '':
|
if gajim.config.get('soundplayer') == '':
|
||||||
return
|
return
|
||||||
argv = gajim.config.get('soundplayer').split()
|
player = gajim.config.get('soundplayer')
|
||||||
argv.append(path_to_soundfile)
|
command = player + ' ' + path_to_soundfile + ' &'
|
||||||
pid = os.spawnvp(os.P_NOWAIT, argv[0], argv)
|
os.system(command)
|
||||||
pidp, r = os.waitpid(pid, os.WNOHANG)
|
|
||||||
if pidp == 0:
|
|
||||||
gobject.timeout_add(10000, self.play_timeout, pid)
|
|
||||||
|
|
||||||
def handle_event_roster(self, account, data):
|
def handle_event_roster(self, account, data):
|
||||||
#('ROSTER', account, array)
|
#('ROSTER', account, array)
|
||||||
|
|
Loading…
Add table
Reference in a new issue