@@ -539,34 +539,29 @@ def new(self):
539
539
self .statusBar ().showMessage ("Viewer has been reset" , 4000 )
540
540
541
541
def _open_file (self , filepath ):
542
- def _update_arrays (current_file_name , session ):
543
- self ._reset ()
544
- self .set_current_file (current_file_name )
545
- self ._add_arrays (session )
546
- self ._listwidget .setCurrentRow (0 )
547
- self .unsaved_modifications = False
548
-
549
542
session = Session ()
550
543
if '.csv' in filepath :
551
544
filepath = [filepath ]
552
545
if isinstance (filepath , (list , tuple )):
553
- dirname = os .path .dirname (filepath [0 ])
554
- basenames = [os .path .basename (fpath ) for fpath in filepath ]
555
- try :
556
- session .load (None , filepath )
557
- _update_arrays (dirname , session )
558
- self .statusBar ().showMessage ("CSV files {} loaded" .format (' ,' .join (basenames )), 4000 )
559
- except Exception as e :
560
- QMessageBox .critical (self , "Error" , "Something went wrong during load of CSV files {}:\n {}"
561
- .format (' ,' .join (basenames ), e ))
546
+ current_file_name = os .path .dirname (filepath [0 ])
547
+ display_name = ',' .join (os .path .basename (fpath ) for fpath in filepath )
548
+ names = filepath
549
+ filepath = None
562
550
else :
563
- try :
564
- session .load (filepath )
565
- _update_arrays (filepath , session )
566
- self .statusBar ().showMessage ("File {} loaded" .format (os .path .basename (filepath ), 4000 ))
567
- except Exception as e :
568
- QMessageBox .critical (self , "Error" , "Something went wrong during load of file {}:\n {}"
569
- .format (filepath , e ))
551
+ names = None
552
+ current_file_name = filepath
553
+ display_name = os .path .basename (filepath )
554
+ try :
555
+ session .load (filepath , names )
556
+ self ._reset ()
557
+ self .set_current_file (current_file_name )
558
+ self ._add_arrays (session )
559
+ self ._listwidget .setCurrentRow (0 )
560
+ self .unsaved_modifications = False
561
+ self .statusBar ().showMessage ("Loaded: {}" .format (display_name ), 4000 )
562
+ except Exception as e :
563
+ QMessageBox .critical (self , "Error" , "Something went wrong during load of file(s) {}:\n {}"
564
+ .format (filepath , e ))
570
565
571
566
def open (self ):
572
567
if self ._ask_to_save_if_unsaved_modifications ():
0 commit comments