Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
su
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dmeiss2s
su
Commits
4790a46c
Commit
4790a46c
authored
9 years ago
by
Daniel Meißner
Committed by
Daniel Meißner
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gui: added processbar code and played with threading
parent
63f7df0f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/gui/gui.py
+18
-1
18 additions, 1 deletion
lib/gui/gui.py
lib/gui/update_progress_bar.py
+32
-0
32 additions, 0 deletions
lib/gui/update_progress_bar.py
with
50 additions
and
1 deletion
lib/gui/gui.py
+
18
−
1
View file @
4790a46c
...
...
@@ -15,6 +15,8 @@ from lib.disk import Disk
from
lib.gr.file_sink
import
FileSink
from
lib.gui.update_progress_bar
import
UpdateProgressBar
class
SuGui
(
QtWidgets
.
QMainWindow
):
"""
GUI class used to realise the main window.
...
...
@@ -87,9 +89,24 @@ class SuGui(QtWidgets.QMainWindow):
self
.
button_stop
.
setEnabled
(
True
)
self
.
button_start
.
setEnabled
(
False
)
file_sink
.
capture
()
# Thread stuff
self
.
request
=
UpdateProgressBar
(
options
[
'
capture_time
'
])
print
(
self
.
__class__
)
self
.
connect
(
self
.
request
,
QtCore
.
SIGNAL
(
"
mysignal(QString)
"
),
self
.
update_progress_bar
,
QtCore
.
Qt
.
QueuedConnection
)
self
.
request
.
start
()
#file_sink.capture()
def
update_progress_bar
(
self
,
text
):
"""
Add the text that
'
s given to this function to the
list_submissions QListWidget we have in our GUI and
increase the current value of progress bar by 1
:param text: text to add to the process bar
:type text: str
"""
self
.
progress_bar
.
setValue
(
text
)
def
stop_button
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
lib/gui/update_progress_bar.py
0 → 100644
+
32
−
0
View file @
4790a46c
# -*- coding: utf-8 -*-
import
time
from
PyQt5.QtCore
import
QThread
,
pyqtSignal
class
UpdateProgressBar
(
QThread
):
update_pb
=
pyqtSignal
(
'
QString
'
,
name
=
'
updateProgressBar
'
)
def
__init__
(
self
,
measure_time
):
"""
Make a new thread instance.
:param measure_time: Time to measure spectrum
:type measure_time: int
"""
QThread
.
__init__
(
self
)
self
.
measure_time
=
measure_time
self
.
start_time
=
float
(
time
.
time
())
def
__del__
(
self
):
self
.
wait
()
def
run
(
self
):
while
self
.
sleep
(
2
):
#self.update_pb.emit(SIGNAL('update_progress_bar(QString)'), \ time_to_percent)
self
.
emit
(
QtCore
.
SIGNAL
(
"
mysignal(QString)
"
),
time_to_percent
)
def
time_to_percent
(
self
):
running_time
=
float
(
time
.
time
())
-
self
.
start_time
percent
=
(
running_time
/
self
.
measure_time
)
*
100
return
int
(
percent
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment