~ubuntu-branches/debian/sid/calibre/sid

« back to all changes in this revision

Viewing changes to src/calibre/gui2/__init__.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-02-27 07:48:06 UTC
  • mto: This revision was merged to the branch mainline in revision 74.
  • Revision ID: package-import@ubuntu.com-20140227074806-64wdebb3ptosxhhx
Tags: upstream-1.25.0+dfsg
ImportĀ upstreamĀ versionĀ 1.25.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
defs['cover_grid_texture'] = None
123
123
defs['show_vl_tabs'] = False
124
124
defs['show_highlight_toggle_button'] = False
 
125
defs['add_comments_to_email'] = False
125
126
del defs
126
127
# }}}
127
128
 
721
722
        return fd.get_files()
722
723
    return None
723
724
 
724
 
def choose_save_file(window, name, title, filters=[], all_files=True):
 
725
def choose_save_file(window, name, title, filters=[], all_files=True, initial_dir=None):
725
726
    '''
726
727
    Ask user to choose a file to save to. Can be a non-existent file.
727
728
    :param filters: list of allowable extensions. Each element of the list
730
731
                     of extensions.
731
732
    :param all_files: If True add All files to filters.
732
733
    '''
733
 
    mode = QFileDialog.AnyFile
734
 
    fd = FileDialog(title=title, name=name, filters=filters,
735
 
                    parent=window, add_all_files_filter=all_files, mode=mode)
 
734
    kwargs = dict(title=title, name=name, filters=filters,
 
735
                    parent=window, add_all_files_filter=all_files, mode=QFileDialog.AnyFile)
 
736
    if initial_dir is not None:
 
737
        kwargs['no_save_dir'] = True
 
738
        kwargs['default_dir'] = initial_dir
 
739
    fd = FileDialog(**kwargs)
736
740
    fd.setParent(None)
737
741
    ans = None
738
742
    if fd.accepted:
763
767
    pixmap.save(buf, format, quality=quality)
764
768
    return bytes(ba.data())
765
769
 
 
770
def decouple(prefix):
 
771
    ' Ensure that config files used by utility code are not the same as those used by the main calibre GUI '
 
772
    dynamic.decouple(prefix)
 
773
    from calibre.gui2.widgets import history
 
774
    history.decouple(prefix)
 
775
 
766
776
class ResizableDialog(QDialog):
767
777
 
768
778
    def __init__(self, *args, **kwargs):