Skip to content

Commit

Permalink
add support for Russian SSA files
Browse files Browse the repository at this point in the history
  • Loading branch information
zocker-160 committed Dec 19, 2020
1 parent 3dceb14 commit 25c9135
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 40 deletions.
15 changes: 12 additions & 3 deletions src/EEStudio2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from lib.SSTtool.src import SSTtool
from lib.SSTslicer.src import SSTslicer

VERSION = "v0.2"
VERSION = "v0.2.1"
PLACEHOLDER_STR = "$$$"

class AboutWindow(QDialog, Ui_aboutWindow.Ui_Dialog):
Expand Down Expand Up @@ -302,7 +302,10 @@ def SSAinSelector(self, event):

# add file list to listWidget
try:
filelist = SSAtool.getFileList(filepath)
if self.tab_ssa_kyrillicencode.isChecked():
filelist = SSAtool.getFileList(filepath, encoding="CP1251")
else:
filelist = SSAtool.getFileList(filepath)
#print(filelist)
except ImportError as e:
self.showErrorMSG(e.args[0])
Expand Down Expand Up @@ -331,11 +334,17 @@ def SSAoutSelector(self):
self.SSAcheckButton()

def SSAconvert(self):
if self.tab_ssa_kyrillicencode.isChecked():
encoding = "CP1251"
else:
encoding = None

SSAtool.main(
inputfile=self.tab_ssa_label_in.text(),
outputfolder=self.tab_ssa_label_out.text(),
decompress=self.tab_ssa_decompress.isChecked(),
log=False
log=False,
encoding=encoding
)
self.showInfoMSG("Done!")
#self.tab_ssa_label_clear.click()
Expand Down
55 changes: 33 additions & 22 deletions src/lib/Ui_mainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def setupUi(self, MainWindow):
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.widget)
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setContentsMargins(-1, -1, -1, 0)
self.gridLayout_2.setObjectName("gridLayout_2")
self.tab_ssa_label_in = QtWidgets.QLabel(self.widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
Expand Down Expand Up @@ -122,11 +121,20 @@ def setupUi(self, MainWindow):
self.tab_ssa_label_out.setObjectName("tab_ssa_label_out")
self.gridLayout_2.addWidget(self.tab_ssa_label_out, 1, 1, 1, 1)
self.verticalLayout_4.addLayout(self.gridLayout_2)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_4 = QtWidgets.QLabel(self.widget)
self.label_4.setObjectName("label_4")
self.horizontalLayout.addWidget(self.label_4)
self.tab_ssa_decompress = QtWidgets.QCheckBox(self.widget)
self.tab_ssa_decompress.setChecked(True)
self.tab_ssa_decompress.setTristate(False)
self.tab_ssa_decompress.setObjectName("tab_ssa_decompress")
self.verticalLayout_4.addWidget(self.tab_ssa_decompress)
self.horizontalLayout.addWidget(self.tab_ssa_decompress)
self.tab_ssa_kyrillicencode = QtWidgets.QCheckBox(self.widget)
self.tab_ssa_kyrillicencode.setObjectName("tab_ssa_kyrillicencode")
self.horizontalLayout.addWidget(self.tab_ssa_kyrillicencode)
self.verticalLayout_4.addLayout(self.horizontalLayout)
self.tab_ssa_unpack = QtWidgets.QPushButton(self.widget)
self.tab_ssa_unpack.setEnabled(False)
self.tab_ssa_unpack.setCheckable(False)
Expand Down Expand Up @@ -253,48 +261,48 @@ def setupUi(self, MainWindow):
self.tab_sst_convert.setObjectName("tab_sst_convert")
self.verticalLayout_5.addWidget(self.tab_sst_convert)
self.MainTabs.addTab(self.tab_sst, "")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.tab)
self.tab_slicer = QtWidgets.QWidget()
self.tab_slicer.setObjectName("tab_slicer")
self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.tab_slicer)
self.verticalLayout_6.setObjectName("verticalLayout_6")
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setContentsMargins(-1, 0, -1, -1)
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
self.verticalLayout_8 = QtWidgets.QVBoxLayout()
self.verticalLayout_8.setContentsMargins(-1, 0, -1, -1)
self.verticalLayout_8.setObjectName("verticalLayout_8")
self.label = QtWidgets.QLabel(self.tab)
self.label = QtWidgets.QLabel(self.tab_slicer)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.verticalLayout_8.addWidget(self.label)
self.tab_slc_list = CDropWidget(self.tab)
self.tab_slc_list = CDropWidget(self.tab_slicer)
self.tab_slc_list.setObjectName("tab_slc_list")
self.verticalLayout_8.addWidget(self.tab_slc_list)
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
self.horizontalLayout_7.setContentsMargins(-1, 0, -1, -1)
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
self.clear = QtWidgets.QPushButton(self.tab)
self.clear = QtWidgets.QPushButton(self.tab_slicer)
self.clear.setMaximumSize(QtCore.QSize(75, 25))
self.clear.setStyleSheet("color: rgb(255, 0, 0);\n"
"")
self.clear.setObjectName("clear")
self.horizontalLayout_7.addWidget(self.clear)
self.tab_slc_moveup = QtWidgets.QPushButton(self.tab)
self.tab_slc_moveup = QtWidgets.QPushButton(self.tab_slicer)
self.tab_slc_moveup.setMaximumSize(QtCore.QSize(30, 25))
self.tab_slc_moveup.setObjectName("tab_slc_moveup")
self.horizontalLayout_7.addWidget(self.tab_slc_moveup)
self.tab_slc_movedown = QtWidgets.QPushButton(self.tab)
self.tab_slc_movedown = QtWidgets.QPushButton(self.tab_slicer)
self.tab_slc_movedown.setMaximumSize(QtCore.QSize(45, 25))
self.tab_slc_movedown.setObjectName("tab_slc_movedown")
self.horizontalLayout_7.addWidget(self.tab_slc_movedown)
self.verticalLayout_8.addLayout(self.horizontalLayout_7)
self.horizontalLayout_6.addLayout(self.verticalLayout_8)
self.line_5 = QtWidgets.QFrame(self.tab)
self.line_5 = QtWidgets.QFrame(self.tab_slicer)
self.line_5.setFrameShape(QtWidgets.QFrame.VLine)
self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_5.setObjectName("line_5")
self.horizontalLayout_6.addWidget(self.line_5)
self.widget_2 = QtWidgets.QWidget(self.tab)
self.widget_2 = QtWidgets.QWidget(self.tab_slicer)
self.widget_2.setObjectName("widget_2")
self.verticalLayout_9 = QtWidgets.QVBoxLayout(self.widget_2)
self.verticalLayout_9.setObjectName("verticalLayout_9")
Expand Down Expand Up @@ -381,11 +389,11 @@ def setupUi(self, MainWindow):
self.verticalLayout_6.addLayout(self.horizontalLayout_6)
self.gridLayout_3 = QtWidgets.QGridLayout()
self.gridLayout_3.setObjectName("gridLayout_3")
self.tab_slc_select_out = QtWidgets.QPushButton(self.tab)
self.tab_slc_select_out = QtWidgets.QPushButton(self.tab_slicer)
self.tab_slc_select_out.setMaximumSize(QtCore.QSize(150, 30))
self.tab_slc_select_out.setObjectName("tab_slc_select_out")
self.gridLayout_3.addWidget(self.tab_slc_select_out, 2, 0, 1, 1)
self.tab_slc_label_in = CDropLabel(self.tab)
self.tab_slc_label_in = CDropLabel(self.tab_slicer)
self.tab_slc_label_in.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border: 2px dashed rgb(200, 200, 200);\n"
"border-radius: 10;\n"
Expand All @@ -395,37 +403,37 @@ def setupUi(self, MainWindow):
self.tab_slc_label_in.setWordWrap(True)
self.tab_slc_label_in.setObjectName("tab_slc_label_in")
self.gridLayout_3.addWidget(self.tab_slc_label_in, 1, 1, 1, 1)
self.tab_slc_label_out = QtWidgets.QLabel(self.tab)
self.tab_slc_label_out = QtWidgets.QLabel(self.tab_slicer)
self.tab_slc_label_out.setText("")
self.tab_slc_label_out.setWordWrap(True)
self.tab_slc_label_out.setObjectName("tab_slc_label_out")
self.gridLayout_3.addWidget(self.tab_slc_label_out, 2, 1, 1, 1)
self.tab_slc_select_in = QtWidgets.QPushButton(self.tab)
self.tab_slc_select_in = QtWidgets.QPushButton(self.tab_slicer)
self.tab_slc_select_in.setMaximumSize(QtCore.QSize(150, 30))
self.tab_slc_select_in.setObjectName("tab_slc_select_in")
self.gridLayout_3.addWidget(self.tab_slc_select_in, 1, 0, 1, 1)
self.label_9 = QtWidgets.QLabel(self.tab)
self.label_9 = QtWidgets.QLabel(self.tab_slicer)
self.label_9.setObjectName("label_9")
self.gridLayout_3.addWidget(self.label_9, 0, 0, 1, 1)
self.label_3 = QtWidgets.QLabel(self.tab)
self.label_3 = QtWidgets.QLabel(self.tab_slicer)
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
self.label_3.setObjectName("label_3")
self.gridLayout_3.addWidget(self.label_3, 0, 1, 1, 1)
self.verticalLayout_6.addLayout(self.gridLayout_3)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.tab_slc_slice = QtWidgets.QPushButton(self.tab)
self.tab_slc_slice = QtWidgets.QPushButton(self.tab_slicer)
self.tab_slc_slice.setEnabled(False)
self.tab_slc_slice.setMinimumSize(QtCore.QSize(0, 50))
self.tab_slc_slice.setObjectName("tab_slc_slice")
self.horizontalLayout_2.addWidget(self.tab_slc_slice)
self.tab_slc_join = QtWidgets.QPushButton(self.tab)
self.tab_slc_join = QtWidgets.QPushButton(self.tab_slicer)
self.tab_slc_join.setEnabled(False)
self.tab_slc_join.setMinimumSize(QtCore.QSize(0, 50))
self.tab_slc_join.setObjectName("tab_slc_join")
self.horizontalLayout_2.addWidget(self.tab_slc_join)
self.verticalLayout_6.addLayout(self.horizontalLayout_2)
self.MainTabs.addTab(self.tab, "")
self.MainTabs.addTab(self.tab_slicer, "")
self.verticalLayout_2.addWidget(self.MainTabs)
self.main_infotext = QtWidgets.QLabel(self.centralwidget)
self.main_infotext.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
Expand Down Expand Up @@ -493,7 +501,10 @@ def retranslateUi(self, MainWindow):
self.tab_ssa_label_clear.setText(_translate("MainWindow", "clear"))
self.tab_ssa_select_in.setText(_translate("MainWindow", "Select SSA"))
self.tab_ssa_select_out.setText(_translate("MainWindow", "Output folder"))
self.label_4.setText(_translate("MainWindow", "options:"))
self.tab_ssa_decompress.setText(_translate("MainWindow", "decompress"))
self.tab_ssa_kyrillicencode.setToolTip(_translate("MainWindow", "check this for Russian files"))
self.tab_ssa_kyrillicencode.setText(_translate("MainWindow", "use CP1251 encoding"))
self.tab_ssa_unpack.setText(_translate("MainWindow", "UNPACK"))
self.MainTabs.setTabText(self.MainTabs.indexOf(self.tab_ssa), _translate("MainWindow", "Archives (SSA)"))
self.tab_sst_droplabel.setText(_translate("MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:14pt; font-weight:600;\">DRAG &amp; DROP HERE!!</span></p><p align=\"center\"><br/>You can drop TGA and SST files!</p><p align=\"center\">(autoconvert on drop)</p></body></html>"))
Expand Down Expand Up @@ -527,7 +538,7 @@ def retranslateUi(self, MainWindow):
self.label_3.setText(_translate("MainWindow", "(there are no options for now)"))
self.tab_slc_slice.setText(_translate("MainWindow", "SLICE"))
self.tab_slc_join.setText(_translate("MainWindow", "JOIN"))
self.MainTabs.setTabText(self.MainTabs.indexOf(self.tab), _translate("MainWindow", "Slicer (SST)"))
self.MainTabs.setTabText(self.MainTabs.indexOf(self.tab_slicer), _translate("MainWindow", "Slicer (SST)"))
self.main_infotext.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-weight:600;\">Empire Earth Studio II</span> by the Empire Earth: Reborn Team - EE-modders - $$$ | GPLv3 | 2020</p></body></html>"))
self.menuAbout.setTitle(_translate("MainWindow", "About"))
self.menuFile.setTitle(_translate("MainWindow", "File"))
Expand Down
48 changes: 33 additions & 15 deletions src/lib/mainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QLabel" name="tab_ssa_label_in">
<property name="sizePolicy">
Expand Down Expand Up @@ -262,17 +259,38 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="tab_ssa_decompress">
<property name="text">
<string>decompress</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>options:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="tab_ssa_decompress">
<property name="text">
<string>decompress</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="tab_ssa_kyrillicencode">
<property name="toolTip">
<string>check this for Russian files</string>
</property>
<property name="text">
<string>use CP1251 encoding</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="tab_ssa_unpack">
Expand Down Expand Up @@ -544,7 +562,7 @@ border-radius: 10;
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="tab_slicer">
<attribute name="title">
<string>Slicer (SST)</string>
</attribute>
Expand Down

0 comments on commit 25c9135

Please sign in to comment.