def __get_datafile(self, app=False):
        """
        Draw a dialog for directory selection.
        """

        if self.cache is not None:
            cache_loadfiledir = self.cache.get_or_none('loadfiledir')
            self.loadfiledir = str(cache_loadfiledir)

        if self.loadfiledir is None:
            self.loadfiledir = ''
        directory = str(self.loadfiledir)
        from PyQt4.QtGui import QFileDialog
        if not app:
            inner_app = QApplication(sys.argv)
        if self._skip_get_path_dialog_for_tests:
            dcmdir = self.datapath
        else:
            dcmdir = QFileDialog.getOpenFileName(
                caption='Select Data File',
                directory=directory
                # ptions=QFileDialog.ShowDirsOnly,
            )
        # dcmdir = QFileDialog.getOpenFileName(
        #     caption='Select Data file',
        #     # ptions=QFileDialog.ShowDirsOnly,
        #     directory=directory
        # )
        # pp.exec_()
        if not app:
            inner_app.exit(0)

        dcmdir = get_str(dcmdir)

        if len(dcmdir) > 0:
        #
        #     dcmdir = "%s" % (dcmdir)
        #     dcmdir = dcmdir.encode("utf8")
            pass
        else:
            dcmdir = None


        head, teil = os.path.split(dcmdir)
        if self.cache is not None:
            self.cache.update('loadfiledir', head)
        return dcmdir