mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
When choosing a program for Open With manually, default to /usr/bin on linux
This commit is contained in:
parent
b5d622335f
commit
76e89a8d38
@ -746,7 +746,7 @@ def choose_osx_app(window, name, title, default_dir='/Applications'):
|
||||
return app
|
||||
|
||||
def choose_files(window, name, title,
|
||||
filters=[], all_files=True, select_only_single_file=False):
|
||||
filters=[], all_files=True, select_only_single_file=False, default_dir=u'~'):
|
||||
'''
|
||||
Ask user to choose a bunch of files.
|
||||
:param name: Unique dialog name used to store the opened directory
|
||||
@ -759,7 +759,7 @@ def choose_files(window, name, title,
|
||||
:param select_only_single_file: If True only one file can be selected
|
||||
'''
|
||||
mode = QFileDialog.ExistingFile if select_only_single_file else QFileDialog.ExistingFiles
|
||||
fd = FileDialog(title=title, name=name, filters=filters,
|
||||
fd = FileDialog(title=title, name=name, filters=filters, default_dir=default_dir,
|
||||
parent=window, add_all_files_filter=all_files, mode=mode,
|
||||
)
|
||||
fd.setParent(None)
|
||||
|
@ -192,7 +192,9 @@ else:
|
||||
ans.setToolTip(comment + _('Command line:') + '\n' + (' '.join(entry['Exec'])))
|
||||
|
||||
def choose_manually(filetype, parent):
|
||||
ans = choose_files(parent, 'choose-open-with-program-manually', _('Choose a program to open %s files') % filetype.upper(), select_only_single_file=True)
|
||||
dd = '/usr/bin' if os.path.isdir('/usr/bin') else '~'
|
||||
ans = choose_files(parent, 'choose-open-with-program-manually', _('Choose a program to open %s files') % filetype.upper(),
|
||||
select_only_single_file=True, default_dir=dd)
|
||||
if ans:
|
||||
ans = ans[0]
|
||||
if not os.access(ans, os.X_OK):
|
||||
|
Loading…
x
Reference in New Issue
Block a user