Ignore:
Timestamp:
Nov 21, 2018 5:47:46 AM (6 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
44c15fc
Parents:
7f41584
Message:

Allow directories (and mixed file/dir) to be dropped onto Data Explorer.
SASVIEW-1102

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DroppableDataLoadWidget.py

    r53c771e rba400d1  
    11# global 
     2import os 
    23from PyQt5 import QtCore 
    34from PyQt5 import QtGui 
     
    5859            filenames=[] 
    5960            for url in event.mimeData().urls(): 
    60                 filenames.append(url.toLocalFile()) 
     61                files = url.toLocalFile() 
     62                if os.path.isdir(files): 
     63                # get content of dir into a list 
     64                    content = [os.path.join(os.path.abspath(files), filename) 
     65                                for filename in os.listdir(files)] 
     66                    filenames += content 
     67                else: 
     68                    filenames.append(files) 
    6169            self.communicator.fileReadSignal.emit(filenames) 
    6270            event.accept() 
Note: See TracChangeset for help on using the changeset viewer.