* src/Mime/_WinMime.py: Get application description from registry
svn: r6921
This commit is contained in:
parent
e989a73aea
commit
f1950ef831
@ -1,3 +1,6 @@
|
|||||||
|
2006-06-19 Brian Matherly <brian@gramps-project.org>
|
||||||
|
* src/Mime/_WinMime.py: Get application description from registry
|
||||||
|
|
||||||
2006-06-19 Don Allingham <don@gramps-project.org>
|
2006-06-19 Don Allingham <don@gramps-project.org>
|
||||||
* src/DataViews/_Relationship.py: handle person set to None
|
* src/DataViews/_Relationship.py: handle person set to None
|
||||||
* src/ViewManger.py: try tabs on the side
|
* src/ViewManger.py: try tabs on the side
|
||||||
|
@ -51,20 +51,39 @@ def get_application(type):
|
|||||||
extension = _get_extension(type)
|
extension = _get_extension(type)
|
||||||
progId = _get_prog_id(extension)
|
progId = _get_prog_id(extension)
|
||||||
|
|
||||||
if progId:
|
if not progId:
|
||||||
# Find the application associated with this program ID
|
return None
|
||||||
aReg = ConnectRegistry(None,HKEY_CLASSES_ROOT)
|
|
||||||
subkey = OpenKey(aReg, "%s\shell\open\command" % progId)
|
# Find the application associated with this program ID
|
||||||
|
aReg = ConnectRegistry(None,HKEY_CLASSES_ROOT)
|
||||||
|
subkey = OpenKey(aReg, "%s\shell\open\command" % progId)
|
||||||
|
if subkey:
|
||||||
n,command,type = EnumValue(subkey, 0)
|
n,command,type = EnumValue(subkey, 0)
|
||||||
if type == REG_EXPAND_SZ:
|
if type == REG_EXPAND_SZ:
|
||||||
command = command.replace( '%SystemRoot%',
|
command = command.replace( '%SystemRoot%',
|
||||||
os.getenv('SystemRoot') )
|
os.getenv('SystemRoot') )
|
||||||
|
CloseKey(aReg)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
CloseKey(subkey)
|
||||||
|
|
||||||
# TODO: figure out how to get a description of the application
|
# Find a friendly name for the application
|
||||||
# use that instead of progId
|
if command.startswith('"'):
|
||||||
return (command,progId)
|
app = command.split('"')[1]
|
||||||
|
else:
|
||||||
|
app = command.split()[0]
|
||||||
|
|
||||||
|
hcu = ConnectRegistry(None,HKEY_CURRENT_USER)
|
||||||
|
subkey = OpenKey(hcu, "Software\Microsoft\Windows\ShellNoRoam\MUICache")
|
||||||
|
desc = None
|
||||||
|
if subkey:
|
||||||
|
desc,type = QueryValueEx(subkey, app)
|
||||||
|
CloseKey(subkey)
|
||||||
|
else:
|
||||||
|
desc = progId
|
||||||
|
CloseKey(hcu)
|
||||||
|
|
||||||
return None
|
return (command,desc)
|
||||||
|
|
||||||
def get_description(mime_type):
|
def get_description(mime_type):
|
||||||
"""Returns the description of the specfied mime type"""
|
"""Returns the description of the specfied mime type"""
|
||||||
|
Loading…
Reference in New Issue
Block a user