#!/usr/bin/python
#dv3d_gui_FileDialogs.py
#standrd file dialogs for opening and saving files
#DV3D refactor 2
#AG 25/07/2013

#import libraries
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import os


def dv3dFileOpen(the_parent_window, formatRestrictionString):

    tpw = the_parent_window #for brevity

    dir = os.path.dirname('~/')
    formats = [formatRestrictionString]
    fname = unicode(QFileDialog.getOpenFileName(tpw, 
                    "Choose a file to open ..", dir,
                    "%s" % " ".join(formats)))
    if len(fname) > 0:
        return fname
    else:
        return None



