diff --git a/src/main.py b/src/main.py
index 9a2afc1..bac5ad0 100644
--- a/src/main.py
+++ b/src/main.py
@@ -356,7 +356,7 @@ def extract(self):
if len(tl_name) == 0:
log_print('tl name is empty skip extract file(s)')
continue
- t = extractThread(threadID=cnt, p=i, tl_name=tl_name,dir=None,tl_dir=None,is_open_filter=self.filterCheckBox.isChecked(),filter_length=int(self.filterLengthLineEdit.text()))
+ t = extractThread(threadID=cnt, p=i, tl_name=tl_name,dir=None,tl_dir=None,is_open_filter=self.filterCheckBox.isChecked(),filter_length=int(self.filterLengthLineEdit.text()),is_gen_empty=self.emptyCheckBox.isChecked())
t.start()
extract_threads.append(t)
cnt = cnt + 1
@@ -370,7 +370,7 @@ def extract(self):
continue
t = extractThread(threadID=cnt, p=None, tl_name=tl_name, dir=i, tl_dir=None,
is_open_filter=self.filterCheckBox.isChecked(),
- filter_length=int(self.filterLengthLineEdit.text()))
+ filter_length=int(self.filterLengthLineEdit.text()),is_gen_empty=self.emptyCheckBox.isChecked())
t.start()
extract_threads.append(t)
cnt = cnt + 1
@@ -385,7 +385,7 @@ def extract(self):
else:
if select_dir[len(select_dir) - 1] != '/' and select_dir[len(select_dir) - 1] != '\\':
select_dir = select_dir + '/'
- t = extractThread(threadID=cnt, p=None, tl_name=tl_name,dir=None,tl_dir=select_dir,is_open_filter=self.filterCheckBox.isChecked(),filter_length=int(self.filterLengthLineEdit.text()))
+ t = extractThread(threadID=cnt, p=None, tl_name=tl_name,dir=None,tl_dir=select_dir,is_open_filter=self.filterCheckBox.isChecked(),filter_length=int(self.filterLengthLineEdit.text()),is_gen_empty=self.emptyCheckBox.isChecked())
t.start()
extract_threads.append(t)
cnt = cnt + 1
diff --git a/src/renpy_extract.py b/src/renpy_extract.py
index 2a8e4e3..549eb98 100644
--- a/src/renpy_extract.py
+++ b/src/renpy_extract.py
@@ -16,7 +16,7 @@
class extractThread(threading.Thread):
- def __init__(self, threadID, p, tl_name,dir, tl_dir, is_open_filter, filter_length=8):
+ def __init__(self, threadID, p, tl_name,dir, tl_dir, is_open_filter, filter_length,is_gen_empty):
threading.Thread.__init__(self)
self.threadID = threadID
self.p = p
@@ -25,6 +25,7 @@ def __init__(self, threadID, p, tl_name,dir, tl_dir, is_open_filter, filter_leng
self.tl_dir = tl_dir
self.is_open_filter = is_open_filter
self.filter_length = filter_length
+ self.is_gen_empty = is_gen_empty
def run(self):
try:
@@ -35,11 +36,11 @@ def run(self):
ori_tl = os.path.basename(self.tl_dir)
self.tl_dir = self.tl_dir[:-len(ori_tl)] + self.tl_name
log_print(self.tl_dir + ' begin extract!')
- ExtractAllFilesInDir(self.tl_dir, self.is_open_filter, self.filter_length)
+ ExtractAllFilesInDir(self.tl_dir, self.is_open_filter, self.filter_length,self.is_gen_empty)
else:
if self.p is not None:
log_print(self.p + ' begin extract!')
- ExtractWriteFile(self.p, self.tl_name, self.is_open_filter, self.filter_length)
+ ExtractWriteFile(self.p, self.tl_name, self.is_open_filter, self.filter_length,self.is_gen_empty)
if self.dir is not None:
log_print(self.dir + ' begin extract!')
paths = os.walk(self.dir, topdown=False)
@@ -48,7 +49,7 @@ def run(self):
i = os.path.join(path, file_name)
if not file_name.endswith("rpy"):
continue
- ExtractWriteFile(i, self.tl_name, self.is_open_filter, self.filter_length)
+ ExtractWriteFile(i, self.tl_name, self.is_open_filter, self.filter_length,self.is_gen_empty)
except Exception as e:
msg = traceback.format_exc()
@@ -338,7 +339,7 @@ def GetExtractedSet(p):
return e
-def WriteExtracted(p, extractedSet,is_open_filter, filter_length):
+def WriteExtracted(p, extractedSet,is_open_filter, filter_length,is_gen_empty):
if (p[len(p) - 1] != '/' and p[len(p) - 1] != '\\'):
p = p + '/'
index = p.rfind('tl\\')
@@ -378,7 +379,10 @@ def WriteExtracted(p, extractedSet,is_open_filter, filter_length):
head = head + 'new ' + timestamp + '\n\n'
f.write(head)
for j in eDiff:
- writeData = ' old ' + j + '\n new ' + j + '\n'
+ if not is_gen_empty:
+ writeData = ' old ' + j + '\n new ' + j + '\n'
+ else:
+ writeData = ' old ' + j + '\n new ' + '""' + '\n'
f.write(writeData + '\n')
f.close()
extractedSet = e | extractedSet
@@ -406,7 +410,7 @@ def GetHeaderPath(p):
return dic
-def ExtractWriteFile(p, tl_name, is_open_filter, filter_length):
+def ExtractWriteFile(p, tl_name, is_open_filter, filter_length,is_gen_empty):
dic = GetHeaderPath(p)
header = dic['header']
if (header == ''):
@@ -437,14 +441,17 @@ def ExtractWriteFile(p, tl_name, is_open_filter, filter_length):
head = head + 'new ' + timestamp + '\n\n'
f.write(head)
for j in eDiff:
- writeData = ' old ' + j + '\n new ' + j + '\n'
+ if not is_gen_empty:
+ writeData = ' old ' + j + '\n new ' + j + '\n'
+ else:
+ writeData = ' old ' + j + '\n new ' + '""' + '\n'
f.write(writeData + '\n')
f.close()
extractedSet = e | extractedSet
log_print(target + ' extracted success!')
-def ExtractAllFilesInDir(dirName, is_open_filter, filter_length):
+def ExtractAllFilesInDir(dirName, is_open_filter, filter_length,is_gen_empty):
CreateEmptyFileIfNotExsit(dirName)
ret = GetExtractedSet(dirName)
- WriteExtracted(dirName,ret,is_open_filter, filter_length)
+ WriteExtracted(dirName,ret,is_open_filter, filter_length,is_gen_empty)
diff --git a/src/ui.py b/src/ui.py
index 6ccc3b1..39d35e3 100644
--- a/src/ui.py
+++ b/src/ui.py
@@ -24,7 +24,7 @@ class Ui_MainWindow(object):
def setupUi(self, MainWindow):
if not MainWindow.objectName():
MainWindow.setObjectName(u"MainWindow")
- MainWindow.resize(1463, 909)
+ MainWindow.resize(1463, 953)
self.actioncopyright = QAction(MainWindow)
self.actioncopyright.setObjectName(u"actioncopyright")
self.proxySettings = QAction(MainWindow)
@@ -35,7 +35,7 @@ def setupUi(self, MainWindow):
self.centralwidget.setObjectName(u"centralwidget")
self.log_text = QTextEdit(self.centralwidget)
self.log_text.setObjectName(u"log_text")
- self.log_text.setGeometry(QRect(630, 50, 821, 801))
+ self.log_text.setGeometry(QRect(630, 50, 821, 821))
self.log_text.setReadOnly(True)
self.clearLogBtn = QPushButton(self.centralwidget)
self.clearLogBtn.setObjectName(u"clearLogBtn")
@@ -92,7 +92,7 @@ def setupUi(self, MainWindow):
self.backupCheckBox.setGeometry(QRect(20, 280, 231, 24))
self.widget_2 = QWidget(self.centralwidget)
self.widget_2.setObjectName(u"widget_2")
- self.widget_2.setGeometry(QRect(10, 320, 601, 311))
+ self.widget_2.setGeometry(QRect(10, 320, 601, 341))
self.selectFilesText_2 = QTextEdit(self.widget_2)
self.selectFilesText_2.setObjectName(u"selectFilesText_2")
self.selectFilesText_2.setGeometry(QRect(100, 40, 411, 41))
@@ -118,7 +118,7 @@ def setupUi(self, MainWindow):
self.selectDirText_2.setGeometry(QRect(100, 160, 411, 41))
self.extractBtn = QPushButton(self.widget_2)
self.extractBtn.setObjectName(u"extractBtn")
- self.extractBtn.setGeometry(QRect(270, 280, 75, 24))
+ self.extractBtn.setGeometry(QRect(270, 310, 75, 24))
self.label_8 = QLabel(self.widget_2)
self.label_8.setObjectName(u"label_8")
self.label_8.setGeometry(QRect(20, 235, 61, 31))
@@ -137,22 +137,25 @@ def setupUi(self, MainWindow):
self.selectDirsBtn.setGeometry(QRect(510, 100, 81, 41))
self.filterCheckBox = QCheckBox(self.widget_2)
self.filterCheckBox.setObjectName(u"filterCheckBox")
- self.filterCheckBox.setGeometry(QRect(20, 280, 161, 20))
+ self.filterCheckBox.setGeometry(QRect(20, 280, 91, 20))
self.label_14 = QLabel(self.widget_2)
self.label_14.setObjectName(u"label_14")
- self.label_14.setGeometry(QRect(380, 282, 131, 16))
+ self.label_14.setGeometry(QRect(120, 282, 131, 16))
self.filterLengthLineEdit = QLineEdit(self.widget_2)
self.filterLengthLineEdit.setObjectName(u"filterLengthLineEdit")
- self.filterLengthLineEdit.setGeometry(QRect(510, 280, 61, 20))
+ self.filterLengthLineEdit.setGeometry(QRect(250, 280, 61, 20))
+ self.emptyCheckBox = QCheckBox(self.widget_2)
+ self.emptyCheckBox.setObjectName(u"emptyCheckBox")
+ self.emptyCheckBox.setGeometry(QRect(330, 280, 271, 20))
self.versionLabel = QLabel(self.centralwidget)
self.versionLabel.setObjectName(u"versionLabel")
- self.versionLabel.setGeometry(QRect(10, 860, 91, 16))
+ self.versionLabel.setGeometry(QRect(10, 880, 91, 16))
self.copyrightLabel = QLabel(self.centralwidget)
self.copyrightLabel.setObjectName(u"copyrightLabel")
- self.copyrightLabel.setGeometry(QRect(1190, 860, 241, 16))
+ self.copyrightLabel.setGeometry(QRect(1190, 880, 241, 16))
self.widget_3 = QWidget(self.centralwidget)
self.widget_3.setObjectName(u"widget_3")
- self.widget_3.setGeometry(QRect(10, 630, 601, 221))
+ self.widget_3.setGeometry(QRect(10, 660, 601, 221))
self.label_11 = QLabel(self.widget_3)
self.label_11.setObjectName(u"label_11")
self.label_11.setGeometry(QRect(280, 0, 60, 20))
@@ -247,7 +250,8 @@ def retranslateUi(self, MainWindow):
self.selectDirsBtn.setText(QCoreApplication.translate("MainWindow", u"...", None))
self.filterCheckBox.setText(QCoreApplication.translate("MainWindow", u"Enable filter for extract", None))
self.label_14.setText(QCoreApplication.translate("MainWindow", u"filter length less than", None))
- self.versionLabel.setText(QCoreApplication.translate("MainWindow", u"Version 1.7.1", None))
+ self.emptyCheckBox.setText(QCoreApplication.translate("MainWindow", u"Generate empty strings instead of original", None))
+ self.versionLabel.setText(QCoreApplication.translate("MainWindow", u"Version 1.7.2", None))
self.copyrightLabel.setText(QCoreApplication.translate("MainWindow", u"\u00a92024 Last moment,All rights reserved.", None))
self.label_11.setText(QCoreApplication.translate("MainWindow", u"font", None))
self.selectFontText.setPlaceholderText(QCoreApplication.translate("MainWindow", u"input or choose or drag the font which supports the language after translation. Example : DejaVuSans.ttf (ren'py 's default font)", None))
diff --git a/src/ui.ui b/src/ui.ui
index eec271b..a82bcea 100644
--- a/src/ui.ui
+++ b/src/ui.ui
@@ -7,7 +7,7 @@
0
0
1463
- 909
+ 953
@@ -20,7 +20,7 @@
630
50
821
- 801
+ 821
@@ -246,7 +246,7 @@
10
320
601
- 311
+ 341
@@ -355,7 +355,7 @@
270
- 280
+ 310
75
24
@@ -440,7 +440,7 @@
20
280
- 161
+ 91
20
@@ -451,7 +451,7 @@
- 380
+ 120
282
131
16
@@ -464,32 +464,45 @@
- 510
+ 250
280
61
20
+
+
+
+ 330
+ 280
+ 271
+ 20
+
+
+
+ Generate empty strings instead of original
+
+
10
- 860
+ 880
91
16
- Version 1.7.1
+ Version 1.7.2
1190
- 860
+ 880
241
16
@@ -502,7 +515,7 @@
10
- 630
+ 660
601
221