Add option to shown full file pathnames in Editor File Browser.

This commit is contained in:
Jim Miller 2016-04-17 23:53:00 -05:00
parent 1460b7a046
commit aaedb911ee
4 changed files with 24 additions and 10 deletions

View File

@ -73,6 +73,7 @@ d['editor_accepts_drops'] = True
d['toolbar_icon_size'] = 24 d['toolbar_icon_size'] = 24
d['insert_full_screen_image'] = False d['insert_full_screen_image'] = False
d['preserve_aspect_ratio_when_inserting_image'] = False d['preserve_aspect_ratio_when_inserting_image'] = False
d['file_list_shows_full_pathname'] = False
del d del d
ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)} ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)}

View File

@ -169,6 +169,7 @@ class Boss(QObject):
if ret == p.Accepted: if ret == p.Accepted:
setup_cssutils_serialization() setup_cssutils_serialization()
self.gui.apply_settings() self.gui.apply_settings()
self.refresh_file_list()
if ret == p.Accepted or p.dictionaries_changed: if ret == p.Accepted or p.dictionaries_changed:
for ed in editors.itervalues(): for ed in editors.itervalues():
ed.apply_settings(dictionaries_changed=p.dictionaries_changed) ed.apply_settings(dictionaries_changed=p.dictionaries_changed)

View File

@ -304,6 +304,9 @@ class FileList(QTreeWidget):
return category return category
def set_display_name(name, item): def set_display_name(name, item):
if tprefs['file_list_shows_full_pathname']:
text = name
else:
if name in processed: if name in processed:
# We have an exact duplicate (can happen if there are # We have an exact duplicate (can happen if there are
# duplicates in the spine) # duplicates in the spine)
@ -315,6 +318,7 @@ class FileList(QTreeWidget):
text = parts.pop() text = parts.pop()
while text in seen and parts: while text in seen and parts:
text = parts.pop() + '/' + text text = parts.pop() + '/' + text
seen[text] = item seen[text] = item
item.setText(0, text) item.setText(0, text)
item.setText(1, hexlify(sort_key(text))) item.setText(1, hexlify(sort_key(text)))

View File

@ -321,6 +321,14 @@ class MainWindowSettings(BasicSettings):
)) ))
l.addRow(nd) l.addRow(nd)
nd = self('file_list_shows_full_pathname')
nd.setText(_('Show full file pathnames in Files Browser'))
nd.setToolTip('<p>' + _(
'Showing the full file pathnames is useful when editing books that contain'
' directories or the same file name more than once.'
))
l.addRow(nd)
class PreviewSettings(BasicSettings): class PreviewSettings(BasicSettings):
def __init__(self, parent=None): def __init__(self, parent=None):