-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathuntitled.py
More file actions
148 lines (125 loc) · 6.23 KB
/
Copy pathuntitled.py
File metadata and controls
148 lines (125 loc) · 6.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# -*- coding: utf-8 -*-
import configparser
import os
# Form implementation generated from reading ui file 'untitled.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QFileDialog
def a(b):
return str(b).lower()
class Ui_Form(object):
def setupUi(self, Form):
self.cwd = os.getcwd()
Form.setObjectName("Form")
Form.resize(437, 345)
Form.setStyleSheet("font-size: 20px;")
# 头像选项
self.avatarCheckBox = QtWidgets.QCheckBox(Form)
self.avatarCheckBox.setGeometry(QtCore.QRect(20, 10, 71, 22))
self.avatarCheckBox.setTabletTracking(False)
self.avatarCheckBox.setAcceptDrops(False)
self.avatarCheckBox.setChecked(False)
self.avatarCheckBox.setObjectName("avatarCheckBox")
# 谱面选项
self.chartCheckBox = QtWidgets.QCheckBox(Form)
self.chartCheckBox.setGeometry(QtCore.QRect(20, 35, 71, 22))
self.chartCheckBox.setObjectName("chartCheckBox")
# 曲绘(高质量)选项
self.illustrationCheckBox = QtWidgets.QCheckBox(Form)
self.illustrationCheckBox.setGeometry(QtCore.QRect(20, 60, 71, 22))
self.illustrationCheckBox.setObjectName("illustrationCheckBox")
# 曲绘(模糊)选项
self.illustrationBlurCheckBox = QtWidgets.QCheckBox(Form)
self.illustrationBlurCheckBox.setGeometry(QtCore.QRect(20, 85, 140, 22))
self.illustrationBlurCheckBox.setObjectName("illustrationBlurCheckBox")
# 曲绘(低质量)选项
self.illustrationLowResCheckBox = QtWidgets.QCheckBox(Form)
self.illustrationLowResCheckBox.setGeometry(QtCore.QRect(20, 110, 160, 22))
self.illustrationLowResCheckBox.setObjectName("illustrationLowResCheckBox")
# 音乐选项
self.musicCheckBox = QtWidgets.QCheckBox(Form)
self.musicCheckBox.setGeometry(QtCore.QRect(20, 135, 71, 22))
self.musicCheckBox.setObjectName("musicCheckBox")
# APK文件路径选择
self.apkPathTextEdit = QtWidgets.QTextEdit(Form)
self.apkPathTextEdit.setGeometry(QtCore.QRect(80, 160, 281, 23))
self.apkPathTextEdit.setObjectName("apkPathTextEdit")
# 浏览位置按钮
self.browsePushButton = QtWidgets.QPushButton(Form)
self.browsePushButton.setGeometry(QtCore.QRect(350, 160, 75, 25))
self.browsePushButton.setObjectName("browsePushButton")
# apk提示文本
self.apkLabel = QtWidgets.QLabel(Form)
self.apkLabel.setGeometry(QtCore.QRect(10, 160, 70, 23))
self.apkLabel.setObjectName("apkLabel")
# 提取资源按钮
self.extractPushButton = QtWidgets.QPushButton(Form)
self.extractPushButton.setGeometry(QtCore.QRect(20, 185, 75, 25))
self.extractPushButton.setObjectName("extractPushButton")
# 生成自制谱按钮
self.generateCustomChartPushButton = QtWidgets.QPushButton(Form)
self.generateCustomChartPushButton.setGeometry(QtCore.QRect(110, 185, 110, 25))
self.generateCustomChartPushButton.setObjectName(
"generateCustomChartPushButton"
)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def slot_btn_chooseFile(self):
fileName_choose, filetype = QFileDialog.getOpenFileName(
self, "选取文件", self.cwd, "Apk Files (*.apk)"
)
self.apkPathTextEdit.setText(fileName_choose)
def extract_apk_file(self):
self.checkboxstate()
os.system(
"python gameInformation.py {}".format(self.apkPathTextEdit.toPlainText())
)
os.system("python resource.py {}".format(self.apkPathTextEdit.toPlainText()))
def build_pez_file(self):
os.system("python phira.py")
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.avatarCheckBox.setText(_translate("Form", "头像"))
self.chartCheckBox.setText(_translate("Form", "谱面"))
self.illustrationCheckBox.setText(_translate("Form", "曲绘"))
self.illustrationBlurCheckBox.setText(_translate("Form", "曲绘(模糊)"))
self.illustrationLowResCheckBox.setText(_translate("Form", "曲绘(低质量)"))
self.musicCheckBox.setText(_translate("Form", "音乐"))
self.browsePushButton.setText(_translate("Form", "浏览"))
self.extractPushButton.setText(_translate("Form", "提取"))
self.apkLabel.setText(_translate("Form", "apk路径"))
self.generateCustomChartPushButton.setText(_translate("Form", "生成自制谱"))
self.extractPushButton.clicked.connect(self.extract_apk_file)
self.browsePushButton.clicked.connect(self.slot_btn_chooseFile)
self.generateCustomChartPushButton.clicked.connect(self.build_pez_file)
def checkboxstate(self):
chkl = []
chkAvatarStatus = a(bool(self.avatarCheckBox.isChecked()))
chkl.append(chkAvatarStatus)
chkChartStatus = a(bool(self.chartCheckBox.isChecked()))
chkl.append(chkChartStatus)
chkIllustrationStatus = a(bool(self.illustrationCheckBox.isChecked()))
chkl.append(chkIllustrationStatus)
chkIllustrationBlurStatus = a(bool(self.illustrationBlurCheckBox.isChecked()))
chkl.append(chkIllustrationBlurStatus)
chkIllustrationLowResStatus = a(
bool(self.illustrationLowResCheckBox.isChecked())
)
chkl.append(chkIllustrationLowResStatus)
chkMusicStatus = a(bool(self.musicCheckBox.isChecked()))
chkl.append(chkMusicStatus)
config = configparser.ConfigParser()
config.read("config.ini", encoding="utf-8")
config.set("TYPES", "avatar", chkl[0])
config.set("TYPES", "Chart", chkl[1])
config.set("TYPES", "Illustration", chkl[2])
config.set("TYPES", "IllustrationBlur", chkl[3])
config.set("TYPES", "IllustrationLowRes", chkl[4])
config.set("TYPES", "music", chkl[5])
with open("config.ini", "w", encoding="utf-8") as f:
config.write(f)