forked from Hopetree/TMTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ToolUI.py
255 lines (247 loc) · 15 KB
/
ToolUI.py
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# -*- coding: utf-8 -*-
#
# Form implementation generated from reading ui file 'ToolUI.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
# 导入样式文件
from QSSwhite import QSS
class Ui_MainWindow(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(640, 540)
MainWindow.setWindowIcon(QtGui.QIcon("White/ooopic_1484987787.ico"))
MainWindow.setMaximumSize(QtCore.QSize(640, 540))
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
self.tabWidget.setGeometry(QtCore.QRect(20, 4, 604, 473))
self.tabWidget.setObjectName("tabWidget")
self.tab_1 = QtWidgets.QWidget()
self.tab_1.setObjectName("tab_1")
self.groupBox_11 = QtWidgets.QGroupBox(self.tab_1)
self.groupBox_11.setGeometry(QtCore.QRect(30, 10, 535, 151))
self.groupBox_11.setObjectName("groupBox_11")
self.label_11 = QtWidgets.QLabel(self.groupBox_11)
self.label_11.setGeometry(QtCore.QRect(50, 18, 461, 123))
self.label_11.setObjectName("label_11")
self.groupBox_12 = QtWidgets.QGroupBox(self.tab_1)
self.groupBox_12.setGeometry(QtCore.QRect(30, 180, 535, 251))
self.groupBox_12.setObjectName("groupBox_12")
self.label_4 = QtWidgets.QLabel(self.groupBox_12)
self.label_4.setGeometry(QtCore.QRect(40, 30, 60, 24))
self.label_4.setObjectName("label_4")
self.lineEdit_1 = QtWidgets.QLineEdit(self.groupBox_12)
self.lineEdit_1.setGeometry(QtCore.QRect(102, 30, 156, 24))
self.lineEdit_1.setObjectName("lineEdit_1")
self.radioButton_1 = QtWidgets.QRadioButton(self.groupBox_12)
self.radioButton_1.setGeometry(QtCore.QRect(270, 26, 110, 32))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("White/e52d9567c015cdb440344305380739e7.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.radioButton_1.setIcon(icon)
self.radioButton_1.setIconSize(QtCore.QSize(30, 30))
self.radioButton_1.setObjectName("radioButton_1")
self.radioButton_2 = QtWidgets.QRadioButton(self.groupBox_12)
self.radioButton_2.setGeometry(QtCore.QRect(398, 26, 111, 32))
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap("White/b721a1c9956b6e836cbdb6c57691ef09.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.radioButton_2.setIcon(icon1)
self.radioButton_2.setIconSize(QtCore.QSize(22, 22))
self.radioButton_2.setObjectName("radioButton_2")
self.pushButton_1 = QtWidgets.QPushButton(self.groupBox_12)
self.pushButton_1.setGeometry(QtCore.QRect(40, 70, 91, 30))
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap("White/ooopic_1494068712.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_1.setIcon(icon2)
self.pushButton_1.setIconSize(QtCore.QSize(20, 20))
self.pushButton_1.setObjectName("pushButton_1")
self.label_5 = QtWidgets.QLabel(self.groupBox_12)
self.label_5.setGeometry(QtCore.QRect(160, 72, 71, 24))
self.label_5.setObjectName("label_5")
self.progressBar_1 = QtWidgets.QProgressBar(self.groupBox_12)
self.progressBar_1.setGeometry(QtCore.QRect(240, 75, 250, 20))
self.progressBar_1.setProperty("value", 0)
self.progressBar_1.setObjectName("progressBar_1")
self.textEdit_1 = QtWidgets.QTextEdit(self.groupBox_12)
self.textEdit_1.setGeometry(QtCore.QRect(40, 120, 455, 121))
self.textEdit_1.setObjectName("textEdit_1")
self.tabWidget.addTab(self.tab_1, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.groupBox_21 = QtWidgets.QGroupBox(self.tab_2)
self.groupBox_21.setGeometry(QtCore.QRect(30, 180, 535, 251))
self.groupBox_21.setObjectName("groupBox_21")
self.lineEdit_2 = QtWidgets.QLineEdit(self.groupBox_21)
self.lineEdit_2.setGeometry(QtCore.QRect(102, 30, 156, 24))
self.lineEdit_2.setObjectName("lineEdit_2")
self.label_6 = QtWidgets.QLabel(self.groupBox_21)
self.label_6.setGeometry(QtCore.QRect(40, 30, 60, 24))
self.label_6.setObjectName("label_6")
self.label_7 = QtWidgets.QLabel(self.groupBox_21)
self.label_7.setGeometry(QtCore.QRect(160, 72, 71, 24))
self.label_7.setObjectName("label_7")
self.pushButton_2 = QtWidgets.QPushButton(self.groupBox_21)
self.pushButton_2.setGeometry(QtCore.QRect(40, 70, 91, 30))
self.pushButton_2.setIcon(icon2)
self.pushButton_2.setIconSize(QtCore.QSize(20, 20))
self.pushButton_2.setObjectName("pushButton_2")
self.progressBar_2 = QtWidgets.QProgressBar(self.groupBox_21)
self.progressBar_2.setGeometry(QtCore.QRect(240, 75, 250, 20))
self.progressBar_2.setProperty("value", 0)
self.progressBar_2.setObjectName("progressBar_2")
self.textEdit_2 = QtWidgets.QTextEdit(self.groupBox_21)
self.textEdit_2.setGeometry(QtCore.QRect(40, 120, 455, 121))
self.textEdit_2.setObjectName("textEdit_2")
self.groupBox_22 = QtWidgets.QGroupBox(self.tab_2)
self.groupBox_22.setGeometry(QtCore.QRect(30, 10, 535, 151))
self.groupBox_22.setObjectName("groupBox_22")
self.label_2 = QtWidgets.QLabel(self.groupBox_22)
self.label_2.setGeometry(QtCore.QRect(50, 18, 461, 123))
self.label_2.setObjectName("label_2")
self.tabWidget.addTab(self.tab_2, "")
self.tab_3 = QtWidgets.QWidget()
self.tab_3.setObjectName("tab_3")
self.groupBox_31 = QtWidgets.QGroupBox(self.tab_3)
self.groupBox_31.setGeometry(QtCore.QRect(30, 180, 535, 251))
self.groupBox_31.setObjectName("groupBox_31")
self.progressBar_3 = QtWidgets.QProgressBar(self.groupBox_31)
self.progressBar_3.setGeometry(QtCore.QRect(240, 75, 250, 20))
self.progressBar_3.setProperty("value", 0)
self.progressBar_3.setObjectName("progressBar_3")
self.pushButton_3 = QtWidgets.QPushButton(self.groupBox_31)
self.pushButton_3.setGeometry(QtCore.QRect(40, 70, 91, 30))
self.pushButton_3.setIcon(icon2)
self.pushButton_3.setIconSize(QtCore.QSize(20, 20))
self.pushButton_3.setObjectName("pushButton_3")
self.label_8 = QtWidgets.QLabel(self.groupBox_31)
self.label_8.setGeometry(QtCore.QRect(40, 30, 60, 24))
self.label_8.setObjectName("label_8")
self.lineEdit_31 = QtWidgets.QLineEdit(self.groupBox_31)
self.lineEdit_31.setGeometry(QtCore.QRect(102, 30, 156, 24))
self.lineEdit_31.setObjectName("lineEdit_31")
self.textEdit_3 = QtWidgets.QTextEdit(self.groupBox_31)
self.textEdit_3.setGeometry(QtCore.QRect(40, 120, 455, 121))
self.textEdit_3.setObjectName("textEdit_3")
self.label_9 = QtWidgets.QLabel(self.groupBox_31)
self.label_9.setGeometry(QtCore.QRect(160, 72, 71, 24))
self.label_9.setObjectName("label_9")
self.label_10 = QtWidgets.QLabel(self.groupBox_31)
self.label_10.setGeometry(QtCore.QRect(272, 30, 72, 24))
self.label_10.setObjectName("label_10")
self.lineEdit_32 = QtWidgets.QLineEdit(self.groupBox_31)
self.lineEdit_32.setGeometry(QtCore.QRect(348, 30, 146, 24))
self.lineEdit_32.setObjectName("lineEdit_32")
self.groupBox_32 = QtWidgets.QGroupBox(self.tab_3)
self.groupBox_32.setGeometry(QtCore.QRect(30, 10, 535, 151))
self.groupBox_32.setObjectName("groupBox_32")
self.label_3 = QtWidgets.QLabel(self.groupBox_32)
self.label_3.setGeometry(QtCore.QRect(50, 18, 461, 123))
self.label_3.setObjectName("label_3")
self.tabWidget.addTab(self.tab_3, "")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 640, 23))
self.menubar.setObjectName("menubar")
self.menu_F = QtWidgets.QMenu(self.menubar)
self.menu_F.setObjectName("menu_F")
self.menu_H = QtWidgets.QMenu(self.menubar)
self.menu_H.setObjectName("menu_H")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionOpenfile = QtWidgets.QAction(MainWindow)
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap("White/2017522122222.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionOpenfile.setIcon(icon3)
self.actionOpenfile.setObjectName("actionOpenfile")
self.actionQiut = QtWidgets.QAction(MainWindow)
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap("White/ooopic_1495455270.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionQiut.setIcon(icon4)
self.actionQiut.setObjectName("actionQiut")
self.actionAbout = QtWidgets.QAction(MainWindow)
icon5 = QtGui.QIcon()
icon5.addPixmap(QtGui.QPixmap("White/201752212221.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionAbout.setIcon(icon5)
self.actionAbout.setObjectName("actionAbout")
self.actionAuthor = QtWidgets.QAction(MainWindow)
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap("White/2017522122216.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionAuthor.setIcon(icon6)
self.actionAuthor.setObjectName("actionAuthor")
self.menu_F.addAction(self.actionOpenfile)
self.menu_F.addSeparator()
self.menu_F.addAction(self.actionQiut)
self.menu_H.addAction(self.actionAbout)
self.menu_H.addSeparator()
self.menu_H.addAction(self.actionAuthor)
self.menubar.addAction(self.menu_F.menuAction())
self.menubar.addAction(self.menu_H.menuAction())
self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "电商小工具"))
self.groupBox_11.setTitle(_translate("MainWindow", "操作流程"))
self.label_11.setText(_translate("MainWindow", "<html><head/><body><p>1、程序运行可以获取天猫或京东商品的DSR信息并生成数据表格</p><p>2、在程序所在目录创建一个文本文件,在其中放入商品ID,每行放一个</p><p>3、在文件名称输入框中输入放有商品ID的文件名称或直接使用默认文件名称</p><p>4、选择商品类型,启动开始按钮,等待程序运行结束后获取信息表格</p></body></html>"))
self.groupBox_12.setTitle(_translate("MainWindow", "运行过程"))
self.label_4.setText(_translate("MainWindow", "文件名称:"))
self.radioButton_1.setText(_translate("MainWindow", "天猫商品"))
self.radioButton_1.setChecked(True) #设置默认选中
self.radioButton_2.setText(_translate("MainWindow", "京东商品"))
self.pushButton_1.setText(_translate("MainWindow", "开始"))
self.label_5.setText(_translate("MainWindow", "完成进度:"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_1), _translate("MainWindow", "商品DSR提取"))
self.groupBox_21.setTitle(_translate("MainWindow", "运行过程"))
self.label_6.setText(_translate("MainWindow", "文件名称:"))
self.label_7.setText(_translate("MainWindow", "完成进度:"))
self.pushButton_2.setText(_translate("MainWindow", "开始"))
self.groupBox_22.setTitle(_translate("MainWindow", "操作流程"))
self.label_2.setText(_translate("MainWindow", "<html><head/><body><p>1、程序运行可以获取天猫商品的主图链接和价格(原价&折扣价)</p><p>2、在程序所在目录创建一个文本文件,在其中放入商品ID,每行放一个</p><p>3、在文件名称输入框中输入放有商品ID的文件名称或直接使用默认文件名称</p><p>4、上述步骤完成后按下开始按钮,等待程序运行结束后获取信息表格</p></body></html>"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "天猫主图提取"))
self.groupBox_31.setTitle(_translate("MainWindow", "运行过程"))
self.pushButton_3.setText(_translate("MainWindow", "开始"))
self.label_8.setText(_translate("MainWindow", "文件名称:"))
self.label_9.setText(_translate("MainWindow", "完成进度:"))
self.label_10.setText(_translate("MainWindow", "图片文件夹:"))
self.groupBox_32.setTitle(_translate("MainWindow", "操作流程"))
self.label_3.setText(_translate("MainWindow", "<html><head/><body><p>1、程序运行可以按照所给图片链接下载图片并按要求给图片命名</p><p>2、在程序所在目录创建一个文本,在其中放入图片链接和名称,每行放一个</p><p>3、文件中格式如:1234,https://www.img.jpg,即名称和链接用英文逗号连接</p><p>4、输入包含链接的文件名称和图片保存文件夹名称,按开始按钮开始下载图片</p></body></html>"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "图片批量下载"))
self.menu_F.setTitle(_translate("MainWindow", "文件(F)"))
self.menu_H.setTitle(_translate("MainWindow", "帮助(H)"))
self.actionOpenfile.setText(_translate("MainWindow", "查看文件夹"))
self.actionOpenfile.setShortcut(_translate("MainWindow", "Ctrl+O"))
self.actionQiut.setText(_translate("MainWindow", "退出"))
self.actionQiut.setShortcut(_translate("MainWindow", "Ctrl+Q"))
self.actionAbout.setText(_translate("MainWindow", "关于"))
self.actionAuthor.setText(_translate("MainWindow", "作者"))
# 添加默认值
self.lineEdit_1.setText("dsr_ids.txt")
self.lineEdit_2.setText("link_ids.txt")
self.lineEdit_31.setText("img_links.txt")
self.lineEdit_32.setText("PICs")
# 设置提示语
for each in [self.lineEdit_1,self.lineEdit_2,self.lineEdit_31]:
each.setToolTip("温馨提示:请先确认文件是否存在!")
self.lineEdit_32.setToolTip("警告:请勿使用非法文件名称,否则程序会崩溃!")
#设置鼠标样式和提示语
for each in [self.pushButton_1,self.pushButton_2,self.pushButton_3]:
each.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
# 添加样式风格
self.mystyle()
def mystyle(self):
qss = QSS()
self.setStyleSheet(qss.White)
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
myui = Ui_MainWindow()
myui.show()
sys.exit(app.exec_())