Skip to content

Commit 44ed793

Browse files
committed
implement SSA list to CSV exporter feature
1 parent 5983082 commit 44ed793

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

src/EEStudio2.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def initGUIControls(self):
187187
self.actionabout_QT.triggered.connect(self.app.aboutQt)
188188

189189
self.tab_ssa_list.onDrop.connect(self.SSAinSelector)
190+
self.tab_ssa_list_export.clicked.connect(self.SSAexportList)
190191
self.tab_ssa_select_in.clicked.connect(self.SSAinSelector)
191192
self.tab_ssa_select_out.clicked.connect(self.SSAoutSelector)
192193
self.tab_ssa_unpack.clicked.connect(self.SSAconvert)
@@ -288,6 +289,11 @@ def SSAcheckButton(self):
288289
else:
289290
self.tab_ssa_unpack.setDisabled(True)
290291

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+
291297
def SSAinSelector(self, event):
292298
# event is not False, when called from CDropWidget
293299
if not event:
@@ -306,10 +312,9 @@ def SSAinSelector(self, event):
306312
# add file list to listWidget
307313
try:
308314
if self.tab_ssa_kyrillicencode.isChecked():
309-
filelist = SSAtool.getFileList(filepath, encoding="CP1251")
315+
self.tab_ssa_filelist = SSAtool.getFileList(filepath, encoding="CP1251")
310316
else:
311-
filelist = SSAtool.getFileList(filepath)
312-
#print(filelist)
317+
self.tab_ssa_filelist = SSAtool.getFileList(filepath)
313318
except ImportError as e:
314319
self.showErrorMSG(e.args[0])
315320
return
@@ -320,7 +325,7 @@ def SSAinSelector(self, event):
320325

321326
# add files to file list
322327
self.tab_ssa_list.clear()
323-
for file in filelist:
328+
for file in self.tab_ssa_filelist:
324329
self.tab_ssa_list.addItem(file[0])
325330

326331
self.SSAcheckButton()
@@ -357,6 +362,24 @@ def SSAconvert(self):
357362
self.showInfoMSG("Done!")
358363
#self.tab_ssa_label_clear.click()
359364

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?")
360383

361384
### SST
362385
def SSTinSelector(self):

0 commit comments

Comments
 (0)