command handling
svn: r6233
This commit is contained in:
parent
d9277db7ee
commit
0335638bf4
@ -1,3 +1,7 @@
|
|||||||
|
2006-03-30 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Mime/_GnomeMime.py: filter out bad KDE mime type commands
|
||||||
|
* src/Utils.py: clean up launch routine
|
||||||
|
|
||||||
2006-03-29 Brian Matherly <pez4brian@users.sourceforge.net>
|
2006-03-29 Brian Matherly <pez4brian@users.sourceforge.net>
|
||||||
* src/Sort.py: remove use of deprecated functions
|
* src/Sort.py: remove use of deprecated functions
|
||||||
* src/BaseDoc.py: remove use of deprecated functions
|
* src/BaseDoc.py: remove use of deprecated functions
|
||||||
|
@ -38,13 +38,27 @@ def get_application(type):
|
|||||||
try:
|
try:
|
||||||
applist = mime_get_short_list_applications(type)
|
applist = mime_get_short_list_applications(type)
|
||||||
if applist:
|
if applist:
|
||||||
prog = mime_get_default_application(type)
|
applist = [mime_get_default_application(type)] + applist
|
||||||
return (prog[2],prog[1])
|
for prog in applist:
|
||||||
|
if _is_good_command(prog[2]):
|
||||||
|
return (prog[2],prog[1])
|
||||||
|
else:
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _is_good_command(cmd):
|
||||||
|
"""
|
||||||
|
We don't know what to do with certain substitution values.
|
||||||
|
If we find one, skip the command.
|
||||||
|
"""
|
||||||
|
for sub in [ "%m", "%i", "%c" ]:
|
||||||
|
if cmd.find(sub) != -1:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def get_description(type):
|
def get_description(type):
|
||||||
"""Returns the description of the specfied mime type"""
|
"""Returns the description of the specfied mime type"""
|
||||||
try:
|
try:
|
||||||
|
29
src/Utils.py
29
src/Utils.py
@ -1294,14 +1294,12 @@ class ProgressMeter:
|
|||||||
def launch(prog_str,path):
|
def launch(prog_str,path):
|
||||||
|
|
||||||
subval = {
|
subval = {
|
||||||
'%i' : None,
|
'%F' : path,
|
||||||
'%F' : (True,path),
|
'%f' : path,
|
||||||
'%f' : (True,path),
|
'%u' : path,
|
||||||
'%u' : (True,path),
|
'%U' : path,
|
||||||
'%U' : (True,path),
|
'%n' : path,
|
||||||
'%n' : (True,path),
|
'%N' : path,
|
||||||
'%N' : (True,path),
|
|
||||||
'"%c"' : (False,'"%s"' % path),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prog_data = prog_str.split()
|
prog_data = prog_str.split()
|
||||||
@ -1311,15 +1309,12 @@ def launch(prog_str,path):
|
|||||||
|
|
||||||
if len(prog_data) > 1:
|
if len(prog_data) > 1:
|
||||||
for item in prog_data:
|
for item in prog_data:
|
||||||
value = subval.get(item,item)
|
if subval.has_key(item):
|
||||||
if not value:
|
need_path = False
|
||||||
continue
|
value = subval[item]
|
||||||
if type(value) == tuple:
|
else:
|
||||||
if value[0]:
|
value = item
|
||||||
need_path = False
|
prog_list.append(value)
|
||||||
prog_list.append(value[1])
|
|
||||||
elif value[0] != '%':
|
|
||||||
prog_list.append(value)
|
|
||||||
else:
|
else:
|
||||||
prog_list = [prog_data[0]]
|
prog_list = [prog_data[0]]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user