1+ #############################################################################
2+ # Copyright (C) 2020-2021 German Aerospace Center (DLR-SC)
3+ #
4+ # Authors: Rene Schmieding
5+ #
6+ # Contact: Martin J. Kuehn <[email protected] > 7+ #
8+ # Licensed under the Apache License, Version 2.0 (the "License");
9+ # you may not use this file except in compliance with the License.
10+ # You may obtain a copy of the License at
11+ #
12+ # http://www.apache.org/licenses/LICENSE-2.0
13+ #
14+ # Unless required by applicable law or agreed to in writing, software
15+ # distributed under the License is distributed on an "AS IS" BASIS,
16+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+ # See the License for the specific language governing permissions and
18+ # limitations under the License.
19+ #############################################################################
20+ """@ProgressIndicator.py
21+ WARNING: This file is currently not tested and maintained.
22+ """
23+ from memilio import progress_indicator
24+ import time
25+
26+ print ("This is only a usage example, and does not actually do anything." )
27+ # using start/stop
28+ p = progress_indicator .Dots (message = "waiting" , delay = 0.5 )
29+ p .start ()
30+ time .sleep (1.6 )
31+ p .stop ()
32+ # using with as block
33+ with progress_indicator .Percentage (message = "download 1" , delay = 0.4 ) as p :
34+ for i in range (13 ):
35+ time .sleep (0.1467 )
36+ p .set_progress ((i + 1 )/ 13 )
37+ with progress_indicator .Percentage (message = "download 2" , use_bar = False ,
38+ delay = 0 , keep_output = False ) as p :
39+ for i in range (97 ):
40+ time .sleep (0.0367 )
41+ p .set_progress ((i + 1 )/ 97 )
42+ # using with block ('as' is not usefull without Percentage)
43+ with progress_indicator .Spinner (message = "finish" ):
44+ time .sleep (2 )
0 commit comments