Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
d52dad9b
Commit
d52dad9b
authored
7 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Progress bar bug fixes
parent
b1be4520
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sakia/gui/dialogs/connection_cfg/view.py
+13
-11
13 additions, 11 deletions
src/sakia/gui/dialogs/connection_cfg/view.py
with
13 additions
and
11 deletions
src/sakia/gui/dialogs/connection_cfg/view.py
+
13
−
11
View file @
d52dad9b
import
asyncio
from
PyQt5.QtWidgets
import
QDialog
from
PyQt5.QtWidgets
import
QDialog
from
PyQt5.QtCore
import
pyqtSignal
,
Qt
,
QElapsedTimer
,
QDateTime
,
QCoreApplication
from
PyQt5.QtCore
import
pyqtSignal
,
Qt
,
QElapsedTimer
,
QDateTime
,
QCoreApplication
from
.connection_cfg_uic
import
Ui_ConnectionConfigurationDialog
from
.connection_cfg_uic
import
Ui_ConnectionConfigurationDialog
...
@@ -5,6 +6,7 @@ from .congratulation_uic import Ui_CongratulationPopup
...
@@ -5,6 +6,7 @@ from .congratulation_uic import Ui_CongratulationPopup
from
duniterpy.key
import
SigningKey
,
ScryptParams
from
duniterpy.key
import
SigningKey
,
ScryptParams
from
math
import
ceil
,
log
from
math
import
ceil
,
log
from
sakia.gui.widgets
import
toast
from
sakia.gui.widgets
import
toast
from
sakia.decorators
import
asyncify
from
sakia.helpers
import
timestamp_to_dhms
from
sakia.helpers
import
timestamp_to_dhms
from
sakia.gui.widgets.dialogs
import
dialog_async_exec
,
QAsyncMessageBox
from
sakia.gui.widgets.dialogs
import
dialog_async_exec
,
QAsyncMessageBox
from
sakia.constants
import
ROOT_SERVERS
,
G1_LICENCE
from
sakia.constants
import
ROOT_SERVERS
,
G1_LICENCE
...
@@ -156,16 +158,16 @@ class ConnectionConfigView(QDialog, Ui_ConnectionConfigurationDialog):
...
@@ -156,16 +158,16 @@ class ConnectionConfigView(QDialog, Ui_ConnectionConfigurationDialog):
:param float ratio: the ratio of progress of current step (between 0 and 1)
:param float ratio: the ratio of progress of current step (between 0 and 1)
:return:
:return:
"""
"""
QCoreApplication
.
processEvents
()
SMOOTHING_FACTOR
=
0.005
if
self
.
timer
.
elapsed
()
>
0
:
value
=
self
.
progress_bar
.
value
()
value
=
self
.
progress_bar
.
value
()
next_value
=
value
+
1000000
*
step_ratio
next_value
=
value
+
1000000
*
step_ratio
SMOOTHING_FACTOR
=
0.005
speed_percent_by_ms
=
(
next_value
-
value
)
/
self
.
timer
.
elapsed
()
speed_percent_by_ms
=
(
next_value
-
value
)
/
self
.
timer
.
elapsed
()
self
.
average_speed
=
SMOOTHING_FACTOR
*
self
.
last_speed
+
(
1
-
SMOOTHING_FACTOR
)
*
self
.
average_speed
self
.
average_speed
=
SMOOTHING_FACTOR
*
self
.
last_speed
+
(
1
-
SMOOTHING_FACTOR
)
*
self
.
average_speed
remaining
=
(
self
.
progress_bar
.
maximum
()
-
next_value
)
/
self
.
average_speed
remaining
=
(
self
.
progress_bar
.
maximum
()
-
next_value
)
/
self
.
average_speed
self
.
last_speed
=
speed_percent_by_ms
self
.
last_speed
=
speed_percent_by_ms
displayed_remaining_time
=
QDateTime
.
fromTime_t
(
remaining
).
toUTC
().
toString
(
"
hh:mm:ss
"
)
displayed_remaining_time
=
QDateTime
.
fromTime_t
(
remaining
).
toUTC
().
toString
(
"
hh:mm:ss
"
)
self
.
progress_bar
.
setFormat
(
self
.
tr
(
"
{0}
scs
remaining...
"
.
format
(
displayed_remaining_time
)))
self
.
progress_bar
.
setFormat
(
self
.
tr
(
"
{0} remaining...
"
.
format
(
displayed_remaining_time
)))
self
.
progress_bar
.
setValue
(
next_value
)
self
.
progress_bar
.
setValue
(
next_value
)
self
.
timer
.
restart
()
self
.
timer
.
restart
()
...
...
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