Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EMUAFactory
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mayinghao
EMUAFactory
Commits
56db9ff0
Commit
56db9ff0
authored
Jun 23, 2025
by
mayinghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载完成后自动删除进度条
parent
1630144b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
41 deletions
+71
-41
main.py
main.py
+71
-41
thread_resume.cpython-38.pyc
multipleThread/__pycache__/thread_resume.cpython-38.pyc
+0
-0
thread_upload.cpython-38.pyc
multipleThread/__pycache__/thread_upload.cpython-38.pyc
+0
-0
No files found.
main.py
View file @
56db9ff0
...
@@ -30,7 +30,7 @@ from multipleThread.config import *
...
@@ -30,7 +30,7 @@ from multipleThread.config import *
# certutil -hashfile music.mp4 MD5
# certutil -hashfile music.mp4 MD5
# 上传文件固定参数
# 上传文件固定参数
#emsc08
# 当前用户
# 当前用户
user_now
=
''
user_now
=
''
token
=
''
token
=
''
...
@@ -64,6 +64,9 @@ class OrderDetail(QMainWindow):
...
@@ -64,6 +64,9 @@ class OrderDetail(QMainWindow):
self
.
send_data
=
0
self
.
send_data
=
0
self
.
uuid_str
=
''
self
.
uuid_str
=
''
# 把组件放一起,等下载完毕去掉
self
.
progress_widgets
=
[]
# 为每个进程创建进度条
# 为每个进程创建进度条
self
.
progress_bars
=
[]
self
.
progress_bars
=
[]
# 暂停按钮
# 暂停按钮
...
@@ -138,10 +141,19 @@ class OrderDetail(QMainWindow):
...
@@ -138,10 +141,19 @@ class OrderDetail(QMainWindow):
type_info
=
3
type_info
=
3
print
(
self
.
data
[
row
][
0
])
print
(
self
.
data
[
row
][
0
])
"""上传图纸文件"""
"""上传图纸文件"""
file_path
,
_
=
QFileDialog
.
getOpenFileName
(
# file_path, _ = QFileDialog.getOpenFileName(
self
,
"选择图纸文件"
,
""
,
"图纸文件 (*.dwg *.dxf *.pdf);;所有文件 (*)"
# self, "选择图纸文件", "", "图纸文件 (*.dwg *.dxf *.pdf);;所有文件 (*)"
# )
files
,
_
=
QFileDialog
.
getOpenFileNames
(
self
,
"添加文件"
,
""
,
# 默认目录
"All Files (*);;Text Files (*.txt);;Python Files (*.py)"
)
)
if
file_path
:
if
files
:
for
file_path
in
files
:
if
os
.
path
.
getsize
(
file_path
)
<
part_size
:
if
os
.
path
.
getsize
(
file_path
)
<
part_size
:
self
.
upload_file
(
file_path
,
self
.
data
[
row
][
0
],
type_info
)
self
.
upload_file
(
file_path
,
self
.
data
[
row
][
0
],
type_info
)
else
:
else
:
...
@@ -176,7 +188,9 @@ class OrderDetail(QMainWindow):
...
@@ -176,7 +188,9 @@ class OrderDetail(QMainWindow):
# 新上传就开启一个upload_thread线程并添加进度条和暂停按钮
# 新上传就开启一个upload_thread线程并添加进度条和暂停按钮
def
add_progress_bar_and_button
(
self
,
file_path
,
order_id
,
type_info
):
def
add_progress_bar_and_button
(
self
,
file_path
,
order_id
,
type_info
):
# 创建水平布局
# 创建水平布局
h_layout
=
QHBoxLayout
()
widget
=
QWidget
()
h_layout
=
QVBoxLayout
(
widget
)
# 创建进度条
# 创建进度条
progress_bar
=
QProgressBar
()
progress_bar
=
QProgressBar
()
...
@@ -184,18 +198,22 @@ class OrderDetail(QMainWindow):
...
@@ -184,18 +198,22 @@ class OrderDetail(QMainWindow):
progress_bar
.
setValue
(
0
)
progress_bar
.
setValue
(
0
)
# 创建按钮
# 创建按钮
button
=
QPushButton
(
f
"上传"
)
#button = QPushButton(f"上传")
status_label
=
QLabel
(
f
"正在上传{file_path}"
)
# 将部件添加到水平布局
# 将部件添加到水平布局
h_layout
.
addWidget
(
progress_bar
)
h_layout
.
addWidget
(
progress_bar
)
h_layout
.
addWidget
(
button
)
#h_layout.addWidget(button)
h_layout
.
addWidget
(
status_label
)
# 将水平布局添加到主布局
# 将水平布局添加到主布局
self
.
main_layout
.
addLayout
(
h_layou
t
)
self
.
main_layout
.
insertWidget
(
self
.
main_layout
.
count
()
-
1
,
widge
t
)
# 存储部件引用
# 存储部件引用
self
.
progress_bars
.
append
(
progress_bar
)
self
.
progress_bars
.
append
(
progress_bar
)
self
.
buttons
.
append
(
button
)
current_index
=
len
(
self
.
progress_widgets
)
self
.
progress_widgets
.
append
({
"widget"
:
widget
,
"progess_bar"
:
progress_bar
,
"label"
:
status_label
,
"index"
:
current_index
})
#self.buttons.append(button)
thread
=
QThread
()
thread
=
QThread
()
upload
=
Upload_Thread
(
self
.
counter
,
order_id
,
type_info
)
upload
=
Upload_Thread
(
self
.
counter
,
order_id
,
type_info
)
upload
.
filename
=
file_path
upload
.
filename
=
file_path
...
@@ -205,7 +223,7 @@ class OrderDetail(QMainWindow):
...
@@ -205,7 +223,7 @@ class OrderDetail(QMainWindow):
self
.
threads
.
append
(
thread
)
self
.
threads
.
append
(
thread
)
thread
.
started
.
connect
(
self
.
uploads
[
-
1
]
.
run
)
thread
.
started
.
connect
(
self
.
uploads
[
-
1
]
.
run
)
thread
.
start
()
thread
.
start
()
button
.
clicked
.
connect
(
lambda
checked
,
idx
=
self
.
counter
:
upload
.
resume_thread
())
#
button.clicked.connect(lambda checked, idx=self.counter: upload.resume_thread())
print
(
self
.
counter
)
print
(
self
.
counter
)
# 增加计数器
# 增加计数器
...
@@ -213,6 +231,10 @@ class OrderDetail(QMainWindow):
...
@@ -213,6 +231,10 @@ class OrderDetail(QMainWindow):
# 更新进度条
# 更新进度条
def
changeProcessbar
(
self
,
value
):
def
changeProcessbar
(
self
,
value
):
if
value
[
1
]
==
100
:
data
=
self
.
progress_widgets
[
value
[
0
]]
data
[
"widget"
]
.
deleteLater
()
else
:
self
.
progress_bars
[
value
[
0
]]
.
setValue
(
value
[
1
])
self
.
progress_bars
[
value
[
0
]]
.
setValue
(
value
[
1
])
# 从本地 upload_tag文件夹检查是否有未完成的任务,有就加载
# 从本地 upload_tag文件夹检查是否有未完成的任务,有就加载
...
@@ -485,7 +507,7 @@ class EqipInfoWindow(QMainWindow):
...
@@ -485,7 +507,7 @@ class EqipInfoWindow(QMainWindow):
self
.
table_view
.
verticalHeader
()
.
setVisible
(
False
)
self
.
table_view
.
verticalHeader
()
.
setVisible
(
False
)
self
.
table_view
.
setSelectionBehavior
(
QTableView
.
SelectRows
)
self
.
table_view
.
setSelectionBehavior
(
QTableView
.
SelectRows
)
self
.
table_view
.
setEditTriggers
(
QTableView
.
NoEditTriggers
)
self
.
table_view
.
setEditTriggers
(
QTableView
.
NoEditTriggers
)
self
.
table_view
.
setColumnHidden
(
0
,
True
)
self
.
table_view
.
setColumnHidden
(
0
,
True
)
# 为操作列添加按钮
# 为操作列添加按钮
for
row
in
range
(
len
(
self
.
devices
)):
for
row
in
range
(
len
(
self
.
devices
)):
...
@@ -608,8 +630,12 @@ class EqipInfoWindow(QMainWindow):
...
@@ -608,8 +630,12 @@ class EqipInfoWindow(QMainWindow):
headers
=
{
'token'
:
token
,
headers
=
{
'token'
:
token
,
'User-Agent'
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
'User-Agent'
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
response
=
requests
.
post
(
order_detail_url
,
headers
=
headers
,
data
=
datas
)
response
=
requests
.
post
(
order_detail_url
,
headers
=
headers
,
data
=
datas
)
print
(
response
.
text
==
""
)
if
response
.
text
!=
""
:
data1
=
response
.
json
()
data1
=
response
.
json
()
all_orders
=
[]
all_orders
=
[]
print
(
len
(
data1
[
"obj"
][
"allChilds"
]))
for
j
in
data1
[
"obj"
][
"allChilds"
]:
for
j
in
data1
[
"obj"
][
"allChilds"
]:
if
j
[
"expect_finishtime"
]
is
not
None
:
if
j
[
"expect_finishtime"
]
is
not
None
:
...
@@ -634,6 +660,9 @@ class EqipInfoWindow(QMainWindow):
...
@@ -634,6 +660,9 @@ class EqipInfoWindow(QMainWindow):
self
.
detail_page
=
OrderDetail
(
all_orders
)
self
.
detail_page
=
OrderDetail
(
all_orders
)
self
.
detail_page
.
destroyed
.
connect
(
self
.
handle_close
)
self
.
detail_page
.
destroyed
.
connect
(
self
.
handle_close
)
self
.
detail_page
.
show
()
self
.
detail_page
.
show
()
else
:
QMessageBox
.
information
(
self
,
"提示"
,
"该项没有其他子订单"
)
else
:
else
:
self
.
detail_page
.
raise_
()
self
.
detail_page
.
raise_
()
self
.
detail_page
.
activateWindow
()
self
.
detail_page
.
activateWindow
()
...
@@ -683,6 +712,7 @@ class LoginWindow(QMainWindow):
...
@@ -683,6 +712,7 @@ class LoginWindow(QMainWindow):
myobj
=
{
'username'
:
account
,
'password'
:
password
}
myobj
=
{
'username'
:
account
,
'password'
:
password
}
response
=
requests
.
post
(
login_url
,
data
=
myobj
)
response
=
requests
.
post
(
login_url
,
data
=
myobj
)
print
(
response
.
text
)
data
=
response
.
json
()
data
=
response
.
json
()
if
data
[
'resMsg'
]
==
"登录成功"
:
if
data
[
'resMsg'
]
==
"登录成功"
:
print
(
"access success"
)
print
(
"access success"
)
...
...
multipleThread/__pycache__/thread_resume.cpython-38.pyc
View file @
56db9ff0
No preview for this file type
multipleThread/__pycache__/thread_upload.cpython-38.pyc
View file @
56db9ff0
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment