@@ -362,94 +362,6 @@ def __exit__(self, exc_type, exc_val, exc_tb):
362362 sys .stdout .close ()
363363 sys .stdout = self ._original_stdout
364364
365- def get_filenames (app = None ):
366-
367- from PySide2 .QtCore import Qt , QCoreApplication
368- from PySide2 .QtWidgets import QApplication , QFileDialog
369- from pathlib import Path
370-
371- app = QApplication (sys .argv )
372- file_dialog = QFileDialog ()
373- file_dialog .setWindowFlags (Qt .WindowStaysOnTopHint )
374- file_location , _ = file_dialog .getOpenFileNames ()
375-
376- if file_location :
377- QCoreApplication .processEvents ()
378- return file_location
379-
380- else :
381-
382- return None
383-
384- def get_filename (app = None ):
385-
386- from PySide2 .QtCore import Qt , QCoreApplication
387- from PySide2 .QtWidgets import QApplication , QFileDialog
388- from pathlib import Path
389-
390- app = QApplication (sys .argv )
391- file_dialog = QFileDialog ()
392- file_dialog .setWindowFlags (Qt .WindowStaysOnTopHint )
393- file_location , _ = file_dialog .getOpenFileName ()
394-
395- if file_location :
396- QCoreApplication .processEvents ()
397- return Path (file_location )
398-
399- else :
400-
401- return None
402-
403- def get_dirname (app = None ):
404-
405- from PySide2 .QtCore import Qt , QCoreApplication
406- from PySide2 .QtWidgets import QApplication , QFileDialog
407- from pathlib import Path
408-
409- app = QApplication (sys .argv )
410- file_dialog = QFileDialog ()
411- file_dialog .setWindowFlags (Qt .WindowStaysOnTopHint )
412- file_location = file_dialog .getExistingDirectory ()
413-
414- if file_location :
415- QCoreApplication .processEvents ()
416- return Path (file_location )
417-
418- else :
419-
420- return None
421-
422- def get_dirnames (app = None ):
423-
424- from PySide2 .QtCore import Qt , QCoreApplication
425- from PySide2 .QtWidgets import QApplication , QFileDialog , QTreeView , QListView , QAbstractItemView
426- from pathlib import Path
427-
428- if not app :
429- app = QApplication (sys .argv )
430- # file_dialog = QFileDialog()
431- # file_dialog.setWindowFlags(Qt.WindowStaysOnTopHint)
432- # file_location = file_dialog.getOpenFileNames()
433-
434- file_dialog = QFileDialog ()
435- file_dialog .setFileMode (QFileDialog .DirectoryOnly )
436- file_dialog .setOption (QFileDialog .DontUseNativeDialog , True )
437- file_view = file_dialog .findChild (QListView , 'listView' )
438-
439- # to make it possible to select multiple directories:
440- if file_view :
441- file_view .setSelectionMode (QAbstractItemView .MultiSelection )
442- f_tree_view = file_dialog .findChild (QTreeView )
443- if f_tree_view :
444- f_tree_view .setSelectionMode (QAbstractItemView .MultiSelection )
445-
446- if file_dialog .exec ():
447- paths = file_dialog .selectedFiles ()
448-
449- QCoreApplication .processEvents ()
450- for path in paths :
451- yield Path (path )
452-
453365def chunks (lst , n ):
454366 """Yield successive n-sized chunks from lst."""
455367 for i in range (0 , len (lst ), n ):
@@ -461,4 +373,4 @@ def corems_md5(fname):
461373
462374 md5_returned = hashlib .sha256 (bytes_io ).hexdigest ()
463375
464- return "{}:{}" .format ("sha256" , md5_returned )
376+ return "{}:{}" .format ("sha256" , md5_returned )
0 commit comments