Skip to content

Commit

Permalink
implement SSA list to CSV exporter feature
Browse files Browse the repository at this point in the history
  • Loading branch information
zocker-160 committed Jun 20, 2021
1 parent 5983082 commit 44ed793
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions src/EEStudio2.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def initGUIControls(self):
self.actionabout_QT.triggered.connect(self.app.aboutQt)

self.tab_ssa_list.onDrop.connect(self.SSAinSelector)
self.tab_ssa_list_export.clicked.connect(self.SSAexportList)
self.tab_ssa_select_in.clicked.connect(self.SSAinSelector)
self.tab_ssa_select_out.clicked.connect(self.SSAoutSelector)
self.tab_ssa_unpack.clicked.connect(self.SSAconvert)
Expand Down Expand Up @@ -288,6 +289,11 @@ def SSAcheckButton(self):
else:
self.tab_ssa_unpack.setDisabled(True)

if self.tab_ssa_list.count() > 0:
self.tab_ssa_list_export.setEnabled(True)
else:
self.tab_ssa_list_export.setDisabled(True)

def SSAinSelector(self, event):
# event is not False, when called from CDropWidget
if not event:
Expand All @@ -306,10 +312,9 @@ def SSAinSelector(self, event):
# add file list to listWidget
try:
if self.tab_ssa_kyrillicencode.isChecked():
filelist = SSAtool.getFileList(filepath, encoding="CP1251")
self.tab_ssa_filelist = SSAtool.getFileList(filepath, encoding="CP1251")
else:
filelist = SSAtool.getFileList(filepath)
#print(filelist)
self.tab_ssa_filelist = SSAtool.getFileList(filepath)
except ImportError as e:
self.showErrorMSG(e.args[0])
return
Expand All @@ -320,7 +325,7 @@ def SSAinSelector(self, event):

# add files to file list
self.tab_ssa_list.clear()
for file in filelist:
for file in self.tab_ssa_filelist:
self.tab_ssa_list.addItem(file[0])

self.SSAcheckButton()
Expand Down Expand Up @@ -357,6 +362,24 @@ def SSAconvert(self):
self.showInfoMSG("Done!")
#self.tab_ssa_label_clear.click()

def SSAexportList(self):
if self.tab_ssa_filelist:
dlg = QFileDialog.getSaveFileName(
self,
caption="Save file",
filter="CSV files (*.csv)"
)
if not dlg[0]: return
try:
with open(dlg[0], "w") as csvfile:
csvfile.write(";".join(["filename", "start offset", "end offset", "size in B"]) + "\n")
for file in self.tab_ssa_filelist:
csvfile.write(";".join( [ str(x) for x in file ] ) + "\n")
except Exception as e:
self.showErrorMSG(e.args[0])
return
else:
self.showErrorMSG("Could not read filelist, are there any elements?")

### SST
def SSTinSelector(self):
Expand Down

0 comments on commit 44ed793

Please sign in to comment.