Changeset 01f3d34a02f0973bb81905a9ffaaf758c27b75a2


Ignore:
Timestamp:
01/06/12 11:54:02 (5 months ago)
Author:
Luper Rouch <luper.rouch@…>
Children:
672fd040f6413d28c4cfa7831376d377abc57bc9
Parents:
04e2462eaa517a9e3bc8757e8f60409991cce202
git-committer:
Luper Rouch <luper.rouch@…> (01/06/12 11:54:02)
Message:

get_open_path can now select directories

Location:
pyflu/pyflu
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pyflu/pyflu/__init__.py

    r08bf1a4 r01f3d34  
    55 
    66def version(): 
    7     return "0.9.2" 
     7    return "0.9.3" 
    88 
  • pyflu/pyflu/qt/util.py

    r2ea9020 r01f3d34  
    7171 
    7272def get_open_path(parent, settings_path=None, filter=None, 
    73         default_dir=None, default_filename=None): 
     73        default_dir=None, default_filename=None, select_directory=False): 
    7474    """ 
    7575    Shows an 'open file' dialog and returns the selected path. 
     
    8484 
    8585    If *default_filename* is given, select this file. 
     86 
     87    If *select_directory* is ``True``, a directory is selected instead of a  
     88    file. 
    8689 
    8790    Return None if the user canceled. 
     
    99102    dlg = QFileDialog(parent) 
    100103    dlg.setWindowTitle(parent.trUtf8("Open")) 
    101     dlg.setFileMode(QFileDialog.ExistingFile) 
     104    if select_directory: 
     105        dlg.setFileMode(QFileDialog.Directory) 
     106    else: 
     107        dlg.setFileMode(QFileDialog.ExistingFile) 
    102108    dlg.setAcceptMode(QFileDialog.AcceptOpen) 
    103109    dlg.setDirectory(default_dir) 
Note: See TracChangeset for help on using the changeset viewer.