Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loading_screen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Brady James Garvin
loading_screen
Commits
7266406a
Commit
7266406a
authored
5 years ago
by
Brady James Garvin
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit.
parents
Branches
master
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+5
-0
5 additions, 0 deletions
.gitignore
main.py
+48
-0
48 additions, 0 deletions
main.py
slow.kv
+17
-0
17 additions, 0 deletions
slow.kv
with
70 additions
and
0 deletions
.gitignore
0 → 100644
+
5
−
0
View file @
7266406a
*.pyc
*.pyo
.idea
bin
This diff is collapsed.
Click to expand it.
main.py
0 → 100644
+
48
−
0
View file @
7266406a
from
time
import
sleep
,
ctime
from
kivy.app
import
App
from
kivy.clock
import
Clock
from
kivy.properties
import
BooleanProperty
,
StringProperty
from
kivy.logger
import
Logger
class
SlowApp
(
App
):
loading
=
BooleanProperty
(
False
)
message
=
StringProperty
(
'
Ready
'
)
def
_log
(
self
,
message
):
Logger
.
info
(
f
'
{
self
.
__class__
.
__name__
}
:
{
message
}
'
)
def
_start_loading
(
self
):
assert
not
self
.
loading
self
.
loading
=
True
self
.
message
=
'
Loading…
'
self
.
_log
(
f
'
Started loading at
{
ctime
()
}
'
)
def
_stop_loading
(
self
):
assert
self
.
loading
self
.
loading
=
False
self
.
message
=
'
Done
'
self
.
_log
(
f
'
Finished loading at
{
ctime
()
}
'
)
def
delay_improperly
(
self
):
self
.
_start_loading
()
sleep
(
3
)
self
.
_stop_loading
()
def
delay_properly
(
self
):
self
.
_start_loading
()
Clock
.
schedule_once
(
self
.
_continue_delay_properly
)
def
_continue_delay_properly
(
self
,
delay
):
sleep
(
3
)
self
.
_stop_loading
()
Logger
.
info
(
f
'
{
self
.
__class__
.
__name__
}
: (Lost
{
delay
:
.
3
}
seconds to GUI updates.)
'
)
def
main
():
app
=
SlowApp
()
app
.
run
()
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
slow.kv
0 → 100644
+
17
−
0
View file @
7266406a
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
Button:
id: improper_button
text: 'Slow Operation with\nImproper User Feedback'
disabled: app.loading
on_press: app.delay_improperly()
Button:
id: proper_button
text: 'Slow Operation with\nProper User Feedback'
disabled: app.loading
on_press: app.delay_properly()
Label:
id: message
text: app.message
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