@@ -187,6 +187,7 @@ def initGUIControls(self):
187
187
self .actionabout_QT .triggered .connect (self .app .aboutQt )
188
188
189
189
self .tab_ssa_list .onDrop .connect (self .SSAinSelector )
190
+ self .tab_ssa_list_export .clicked .connect (self .SSAexportList )
190
191
self .tab_ssa_select_in .clicked .connect (self .SSAinSelector )
191
192
self .tab_ssa_select_out .clicked .connect (self .SSAoutSelector )
192
193
self .tab_ssa_unpack .clicked .connect (self .SSAconvert )
@@ -288,6 +289,11 @@ def SSAcheckButton(self):
288
289
else :
289
290
self .tab_ssa_unpack .setDisabled (True )
290
291
292
+ if self .tab_ssa_list .count () > 0 :
293
+ self .tab_ssa_list_export .setEnabled (True )
294
+ else :
295
+ self .tab_ssa_list_export .setDisabled (True )
296
+
291
297
def SSAinSelector (self , event ):
292
298
# event is not False, when called from CDropWidget
293
299
if not event :
@@ -306,10 +312,9 @@ def SSAinSelector(self, event):
306
312
# add file list to listWidget
307
313
try :
308
314
if self .tab_ssa_kyrillicencode .isChecked ():
309
- filelist = SSAtool .getFileList (filepath , encoding = "CP1251" )
315
+ self . tab_ssa_filelist = SSAtool .getFileList (filepath , encoding = "CP1251" )
310
316
else :
311
- filelist = SSAtool .getFileList (filepath )
312
- #print(filelist)
317
+ self .tab_ssa_filelist = SSAtool .getFileList (filepath )
313
318
except ImportError as e :
314
319
self .showErrorMSG (e .args [0 ])
315
320
return
@@ -320,7 +325,7 @@ def SSAinSelector(self, event):
320
325
321
326
# add files to file list
322
327
self .tab_ssa_list .clear ()
323
- for file in filelist :
328
+ for file in self . tab_ssa_filelist :
324
329
self .tab_ssa_list .addItem (file [0 ])
325
330
326
331
self .SSAcheckButton ()
@@ -357,6 +362,24 @@ def SSAconvert(self):
357
362
self .showInfoMSG ("Done!" )
358
363
#self.tab_ssa_label_clear.click()
359
364
365
+ def SSAexportList (self ):
366
+ if self .tab_ssa_filelist :
367
+ dlg = QFileDialog .getSaveFileName (
368
+ self ,
369
+ caption = "Save file" ,
370
+ filter = "CSV files (*.csv)"
371
+ )
372
+ if not dlg [0 ]: return
373
+ try :
374
+ with open (dlg [0 ], "w" ) as csvfile :
375
+ csvfile .write (";" .join (["filename" , "start offset" , "end offset" , "size in B" ]) + "\n " )
376
+ for file in self .tab_ssa_filelist :
377
+ csvfile .write (";" .join ( [ str (x ) for x in file ] ) + "\n " )
378
+ except Exception as e :
379
+ self .showErrorMSG (e .args [0 ])
380
+ return
381
+ else :
382
+ self .showErrorMSG ("Could not read filelist, are there any elements?" )
360
383
361
384
### SST
362
385
def SSTinSelector (self ):
0 commit comments