Use GLib to retrieve the pictures directory.
Also remove an unused function.
This commit is contained in:
parent
f15497b0c0
commit
bd07478574
|
@ -497,19 +497,6 @@ r'Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders')
|
||||||
win32api.RegCloseKey(rkey)
|
win32api.RegCloseKey(rkey)
|
||||||
return val
|
return val
|
||||||
|
|
||||||
def get_my_pictures_path():
|
|
||||||
"""
|
|
||||||
Windows-only atm
|
|
||||||
"""
|
|
||||||
return get_windows_reg_env('My Pictures')
|
|
||||||
|
|
||||||
def get_desktop_path():
|
|
||||||
if os.name == 'nt':
|
|
||||||
path = get_windows_reg_env('Desktop')
|
|
||||||
else:
|
|
||||||
path = os.path.join(os.path.expanduser('~'), 'Desktop')
|
|
||||||
return path
|
|
||||||
|
|
||||||
def get_documents_path():
|
def get_documents_path():
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
path = get_windows_reg_env('Personal')
|
path = get_windows_reg_env('Personal')
|
||||||
|
|
|
@ -4960,13 +4960,7 @@ class ImageChooserDialog(FileChooserDialog):
|
||||||
else:
|
else:
|
||||||
callback(widget, path_to_file)
|
callback(widget, path_to_file)
|
||||||
|
|
||||||
try:
|
path = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES)
|
||||||
if os.name == 'nt':
|
|
||||||
path = helpers.get_my_pictures_path()
|
|
||||||
else:
|
|
||||||
path = os.environ['HOME']
|
|
||||||
except Exception:
|
|
||||||
path = ''
|
|
||||||
FileChooserDialog.__init__(self,
|
FileChooserDialog.__init__(self,
|
||||||
title_text = _('Choose Image'),
|
title_text = _('Choose Image'),
|
||||||
action = Gtk.FileChooserAction.OPEN,
|
action = Gtk.FileChooserAction.OPEN,
|
||||||
|
|
Loading…
Reference in New Issue