%global _empty_manifest_terminate_build 0 Name: python-pyprog Version: 1.1.0.post2 Release: 1 Summary: A library for creating super customizable progress indicators. License: GNU AGPLv3 URL: https://github.com/Bill13579/pyprog Source0: https://mirrors.nju.edu.cn/pypi/web/packages/8a/13/f61254d7e503fb043cc7a822e9fc67d1eb49556c5c43d1f3501e0407f7db/pyprog-1.1.0.post2.tar.gz BuildArch: noarch %description # Introduction PyProg is an Open-Source library for creating progress indicators (e.g. progress bars). It helps you create customizable progress indicators. This library is for Python. # Compatibility PyProg is compatible with both Python 3 and Python 2, and will also work on Qt Console. # Getting Started ## Installation Latest Release: `pip install pyprog` Latest Development Release: `pip install git+https://github.com/Bill13579/pyprog.git@develop` After you have installed PyProg, you can test if it has been successfully installed by running `import pyprog` in python. If PyProg was installed successfully, it should show no errors. ## How to use the PyProg Progress Bar ### Basic PyProg Progress Bar To create a basic progress bar, follow these steps: 1. Install PyProg ([Guide](#installation "How to install PyProg")) 2. Import PyProg: `import pyprog` 3. Create a `ProgressBar` object: `prog = pyprog.ProgressBar("", "")` 4. Show the bar: `prog.update()` 5. To update the status, use `prog.set_stat()` to set the status and then use `prog.update()` to actually show the change 6. When finished, use `prog.end()` to make the Progress Bar last Example Code with Fake For loop: ```python import pyprog from time import sleep # Create a PyProg ProgressBar Object prog = pyprog.ProgressBar(":-) ", " OK!") # Show the initial status prog.update() # Fake for loop for i in range(0, 100): # Sleep for a while (This is just to slow down the for loop so that it won't end in an instant) sleep(0.1) # Update status prog.set_stat(i + 1) # Show (Update) the current status prog.update() # Make the Progress Bar final prog.end() ``` Output: ``` Initial State: :-) Progress: 0% -------------------------------------------------- OK! When progress is 50: :-) Progress: 50% #########################------------------------- OK! Final State: :-) Progress: 100% ################################################## OK! ``` #### What is the first two parameters? The first two parameters in `prog = pyprog.ProgressBar("", "")` is for telling PyProg what to put before and after the progress indicator. Example: ``` :-) Progress: 0% -------------------------------------------------- OK! ^ ^ ^ Prefix Bar Suffix ``` ### Pretty Progress Bar You can also add more options to make it look good. Adding options `complete_symbol="█", not_complete_symbol="-"` will change the original output to: ``` Initial State: :-) Progress: 0% -------------------------------------------------- OK! When progress is 50: :-) Progress: 50% █████████████████████████------------------------- OK! Final State: :-) Progress: 100% ██████████████████████████████████████████████████ OK! ``` ### Auto calculate the percentage PyProg can also auto calculate the current percentage. You just need to tell PyProg the total number of things you need to process. Change the line `prog = pyprog.ProgressBar("", "")` to `prog = pyprog.ProgressBar("", "", )`, and PyProg will calculate the percentage for you based on the status that you give it. To use it in our simple progress bar code, if we have 37 tasks to do, we can change this: ```python # Create a PyProg ProgressBar Object prog = pyprog.ProgressBar(":-) ", " OK!") ``` to this: ```python # Create a PyProg ProgressBar Object prog = pyprog.ProgressBar(":-) ", " OK!", 37) ``` And also change the fake for loop from `for i in range(0, 100):` to `for i in range(0, 37):`, and it will auto calculate the percentage and show it to the user. ## How to use the PyProg Progress Indicator (Fraction) ### Basic PyProg Progress Indicator (Fraction) To create a basic progress indicator (fraction), follow these steps: 1. Import PyProg: `import pyprog` 2. Create a `ProgressIndicatorFraction` object: `prog = pyprog.ProgressIndicatorFraction("", "", )` (Replace "" with the total number of tasks or things you need to process) 3. Show the indicator: `prog.update()` 4. To update the status, use `prog.set_stat()` to set the status and then use `prog.update()` to actually show the change 5. When finished, use `prog.end()` to make the Progress Indicator (Fraction) last Example Code with Fake For loop (We are using 56 as the total in this example): ```python import pyprog from time import sleep # Create a PyProg ProgressIndicatorFraction Object prog = pyprog.ProgressIndicatorFraction(":-) ", " OK!", 56) # Show the initial status prog.update() # Fake for loop for i in range(0, 56): # Sleep for a while (This is just to slow down the for loop so that it won't end in an instant) sleep(0.1) # Update status prog.set_stat(i + 1) # Show (Update) the current status prog.update() # Make the Progress Indicator (Fraction) final prog.end() ``` Output: ``` Initial State: :-) 0/56 OK! When half done: :-) 28/56 OK! Final State: :-) 56/56 OK! ``` # Documentation ## Progress Indicator Parameters ### Options for ProgressBar #### prefix The prefix of everything. #### suffix The suffix of everything. #### total (default is 100) This is the option that tells PyProg how many things or tasks you need to process. We used it in the [Auto calculate the percentage](#auto-calculate-the-percentage "Auto calculate the percentage") section. #### bar_length (default is 50) This tells PyProg how long should the bar should be. #### initial (default is 0) Initial status to show on the bar. #### decimals (default is 0) How many decimals should the percent have. #### complete_symbol (default is "#") The complete symbol will be shown in the complete part of the bar. We used it in the [Pretty Progress Bar](#pretty-progress-bar "Pretty Progress Bar") section. Example Position of complete symbol: Progress: 59% #############################---------------------  #### not_complete_symbol (default is "-") The not complete symbol will be shown in the not yet complete part of the bar. We used it in the [Pretty Progress Bar](#pretty-progress-bar "Pretty Progress Bar") section. Example Position of complete symbol: Progress: 59% #############################---------------------  #### progress_loc (default is 0) Where the progress explanation (prefix) and the progress text should be shown. Possible Values:
ProgressBar.PROGRESS_LOC_START or 0 - Show both at the start
ProgressBar.PROGRESS_LOC_MIDDLE or 1 - Show both at the middle of the bar
ProgressBar.PROGRESS_LOC_END or 2 - Show both at the end
ProgressBar.PROGRESS_LOC_EXP_START_PROGRESS_MID or 3 - Show explanation (prefix) at the start and the progress text at the middle of the bar
ProgressBar.PROGRESS_LOC_EXP_END_PROGRESS_MID or 4 - Show explanation (prefix) at the end and the progress text at the middle of the bar PROGRESS_LOC_START:
Progress: 32% ################----------------------------------  PROGRESS_LOC_MIDDLE:
\################ Progress: 32% ------------------  PROGRESS_LOC_END:
\################---------------------------------- Progress: 32% PROGRESS_LOC_EXP_START_PROGRESS_MID:
Progress: ################----- 32% -----------------------  PROGRESS_LOC_EXP_END_PROGRESS_MID:
\################----- 32% ----------------------- Progress: #### progress_format (default is "+p%") Format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters: "+p" -> Current percent
"+c" -> Current status #### progress_explain (default is "Progress: ") This is the progress explanation (prefix). Example position of progress explanation: Progress: 32% ################----------------------------------  Examples:
"Progress: "
"Current Progress: " #### wrap_bar_prefix (default is " ") The prefix of the bar. #### wrap_bar_suffix (default is " ") The suffix of the bar. ### Options for ProgressIndicatorFraction #### prefix The prefix of everything. #### suffix The suffix of everything. #### total This is the option that tells PyProg how many things or tasks you need to process. #### initial (default is 0) Initial status to show on the indicator. ## Progress Indicator Functions ### Functions for ProgressBar #### set_stat() Available on: PyProg 1.0.0 ~
Params: current Set the current progress. #### stat() Available on: PyProg 1.1.0-0 ~
Params: current
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon. Set the current progress and update the progress bar. #### progress() Available on: PyProg 1.1.0-0 ~
Params: progress
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon. Increase the progress by the given amount. #### update() Available on: PyProg 1.0.0 ~
Params: (none) Update the progress bar so that it shows the current progress.
Note: Also call this to initiate the bar. #### end() Available on: PyProg 1.0.0 ~
Params: (none) End the progress bar. #### end_m() Available on: PyProg 1.1.0-0 ~
Params: msg
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon. End the progress bar with a message. #### set_prefix() Available on: PyProg 1.0.0 ~
Params: prefix Set the prefix #### set_suffix() Available on: PyProg 1.0.0 ~
Params: suffix Set the suffix #### set_total() Available on: PyProg 1.0.0 ~
Params: total Set the total #### set_bar_length() Available on: PyProg 1.0.0 ~
Params: bar_length Set the length of the bar #### set_decimals() Available on: PyProg 1.0.0 ~
Params: decimals Set the number of decimals for the percent #### set_symbols() Available on: PyProg 1.0.0 ~
Params: symbols Set the complete symbol and the not complete symbol. `symbols` has to be a tuple: (complete symbol, not complete symbol) #### set_progress_loc() Available on: PyProg 1.0.0 ~
Params: progress_loc Set the progress explanation (prefix) and the progress text location. See [the progress_loc parameter](#user-content-progress_loc-default-is-0 "progress_loc") section for the possible values. #### set_progress_explain() Available on: PyProg 1.0.0 ~
Params: progress_explain Set the progress explanation (prefix). Examples:
"Progress: "
"Current Progress: " #### set_wrap_bar_text() Available on: PyProg 1.0.0 ~
Params: prefix, suffix Set the wrap bar text (the prefix and the suffix of the bar). #### set_progress_format() Available on: PyProg 1.0.0 ~
Params: progress_format Set the format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters: "+p" -> Current percent
"+c" -> Current status ### Functions for ProgressIndicatorFunction #### set_stat() Available on: PyProg 1.0.0 ~
Params: current Set the current progress. #### update() Available on: PyProg 1.0.0 ~
Params: (none) Update the progress indicator so that it shows the current progress. Note: Also call this to initiate the indicator. #### end() Available on: PyProg 1.0.0 ~
Params: (none) End the progress indicator. #### set_prefix() Available on: PyProg 1.0.0 ~
Params: prefix Set the prefix #### set_suffix() Available on: PyProg 1.0.0 ~
Params: suffix Set the suffix #### set_total() Available on: PyProg 1.0.0 ~
Params: total Set the total %package -n python3-pyprog Summary: A library for creating super customizable progress indicators. Provides: python-pyprog BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-pyprog # Introduction PyProg is an Open-Source library for creating progress indicators (e.g. progress bars). It helps you create customizable progress indicators. This library is for Python. # Compatibility PyProg is compatible with both Python 3 and Python 2, and will also work on Qt Console. # Getting Started ## Installation Latest Release: `pip install pyprog` Latest Development Release: `pip install git+https://github.com/Bill13579/pyprog.git@develop` After you have installed PyProg, you can test if it has been successfully installed by running `import pyprog` in python. If PyProg was installed successfully, it should show no errors. ## How to use the PyProg Progress Bar ### Basic PyProg Progress Bar To create a basic progress bar, follow these steps: 1. Install PyProg ([Guide](#installation "How to install PyProg")) 2. Import PyProg: `import pyprog` 3. Create a `ProgressBar` object: `prog = pyprog.ProgressBar("", "")` 4. Show the bar: `prog.update()` 5. To update the status, use `prog.set_stat()` to set the status and then use `prog.update()` to actually show the change 6. When finished, use `prog.end()` to make the Progress Bar last Example Code with Fake For loop: ```python import pyprog from time import sleep # Create a PyProg ProgressBar Object prog = pyprog.ProgressBar(":-) ", " OK!") # Show the initial status prog.update() # Fake for loop for i in range(0, 100): # Sleep for a while (This is just to slow down the for loop so that it won't end in an instant) sleep(0.1) # Update status prog.set_stat(i + 1) # Show (Update) the current status prog.update() # Make the Progress Bar final prog.end() ``` Output: ``` Initial State: :-) Progress: 0% -------------------------------------------------- OK! When progress is 50: :-) Progress: 50% #########################------------------------- OK! Final State: :-) Progress: 100% ################################################## OK! ``` #### What is the first two parameters? The first two parameters in `prog = pyprog.ProgressBar("", "")` is for telling PyProg what to put before and after the progress indicator. Example: ``` :-) Progress: 0% -------------------------------------------------- OK! ^ ^ ^ Prefix Bar Suffix ``` ### Pretty Progress Bar You can also add more options to make it look good. Adding options `complete_symbol="█", not_complete_symbol="-"` will change the original output to: ``` Initial State: :-) Progress: 0% -------------------------------------------------- OK! When progress is 50: :-) Progress: 50% █████████████████████████------------------------- OK! Final State: :-) Progress: 100% ██████████████████████████████████████████████████ OK! ``` ### Auto calculate the percentage PyProg can also auto calculate the current percentage. You just need to tell PyProg the total number of things you need to process. Change the line `prog = pyprog.ProgressBar("", "")` to `prog = pyprog.ProgressBar("", "", )`, and PyProg will calculate the percentage for you based on the status that you give it. To use it in our simple progress bar code, if we have 37 tasks to do, we can change this: ```python # Create a PyProg ProgressBar Object prog = pyprog.ProgressBar(":-) ", " OK!") ``` to this: ```python # Create a PyProg ProgressBar Object prog = pyprog.ProgressBar(":-) ", " OK!", 37) ``` And also change the fake for loop from `for i in range(0, 100):` to `for i in range(0, 37):`, and it will auto calculate the percentage and show it to the user. ## How to use the PyProg Progress Indicator (Fraction) ### Basic PyProg Progress Indicator (Fraction) To create a basic progress indicator (fraction), follow these steps: 1. Import PyProg: `import pyprog` 2. Create a `ProgressIndicatorFraction` object: `prog = pyprog.ProgressIndicatorFraction("", "", )` (Replace "" with the total number of tasks or things you need to process) 3. Show the indicator: `prog.update()` 4. To update the status, use `prog.set_stat()` to set the status and then use `prog.update()` to actually show the change 5. When finished, use `prog.end()` to make the Progress Indicator (Fraction) last Example Code with Fake For loop (We are using 56 as the total in this example): ```python import pyprog from time import sleep # Create a PyProg ProgressIndicatorFraction Object prog = pyprog.ProgressIndicatorFraction(":-) ", " OK!", 56) # Show the initial status prog.update() # Fake for loop for i in range(0, 56): # Sleep for a while (This is just to slow down the for loop so that it won't end in an instant) sleep(0.1) # Update status prog.set_stat(i + 1) # Show (Update) the current status prog.update() # Make the Progress Indicator (Fraction) final prog.end() ``` Output: ``` Initial State: :-) 0/56 OK! When half done: :-) 28/56 OK! Final State: :-) 56/56 OK! ``` # Documentation ## Progress Indicator Parameters ### Options for ProgressBar #### prefix The prefix of everything. #### suffix The suffix of everything. #### total (default is 100) This is the option that tells PyProg how many things or tasks you need to process. We used it in the [Auto calculate the percentage](#auto-calculate-the-percentage "Auto calculate the percentage") section. #### bar_length (default is 50) This tells PyProg how long should the bar should be. #### initial (default is 0) Initial status to show on the bar. #### decimals (default is 0) How many decimals should the percent have. #### complete_symbol (default is "#") The complete symbol will be shown in the complete part of the bar. We used it in the [Pretty Progress Bar](#pretty-progress-bar "Pretty Progress Bar") section. Example Position of complete symbol: Progress: 59% #############################---------------------  #### not_complete_symbol (default is "-") The not complete symbol will be shown in the not yet complete part of the bar. We used it in the [Pretty Progress Bar](#pretty-progress-bar "Pretty Progress Bar") section. Example Position of complete symbol: Progress: 59% #############################---------------------  #### progress_loc (default is 0) Where the progress explanation (prefix) and the progress text should be shown. Possible Values:
ProgressBar.PROGRESS_LOC_START or 0 - Show both at the start
ProgressBar.PROGRESS_LOC_MIDDLE or 1 - Show both at the middle of the bar
ProgressBar.PROGRESS_LOC_END or 2 - Show both at the end
ProgressBar.PROGRESS_LOC_EXP_START_PROGRESS_MID or 3 - Show explanation (prefix) at the start and the progress text at the middle of the bar
ProgressBar.PROGRESS_LOC_EXP_END_PROGRESS_MID or 4 - Show explanation (prefix) at the end and the progress text at the middle of the bar PROGRESS_LOC_START:
Progress: 32% ################----------------------------------  PROGRESS_LOC_MIDDLE:
\################ Progress: 32% ------------------  PROGRESS_LOC_END:
\################---------------------------------- Progress: 32% PROGRESS_LOC_EXP_START_PROGRESS_MID:
Progress: ################----- 32% -----------------------  PROGRESS_LOC_EXP_END_PROGRESS_MID:
\################----- 32% ----------------------- Progress: #### progress_format (default is "+p%") Format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters: "+p" -> Current percent
"+c" -> Current status #### progress_explain (default is "Progress: ") This is the progress explanation (prefix). Example position of progress explanation: Progress: 32% ################----------------------------------  Examples:
"Progress: "
"Current Progress: " #### wrap_bar_prefix (default is " ") The prefix of the bar. #### wrap_bar_suffix (default is " ") The suffix of the bar. ### Options for ProgressIndicatorFraction #### prefix The prefix of everything. #### suffix The suffix of everything. #### total This is the option that tells PyProg how many things or tasks you need to process. #### initial (default is 0) Initial status to show on the indicator. ## Progress Indicator Functions ### Functions for ProgressBar #### set_stat() Available on: PyProg 1.0.0 ~
Params: current Set the current progress. #### stat() Available on: PyProg 1.1.0-0 ~
Params: current
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon. Set the current progress and update the progress bar. #### progress() Available on: PyProg 1.1.0-0 ~
Params: progress
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon. Increase the progress by the given amount. #### update() Available on: PyProg 1.0.0 ~
Params: (none) Update the progress bar so that it shows the current progress.
Note: Also call this to initiate the bar. #### end() Available on: PyProg 1.0.0 ~
Params: (none) End the progress bar. #### end_m() Available on: PyProg 1.1.0-0 ~
Params: msg
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon. End the progress bar with a message. #### set_prefix() Available on: PyProg 1.0.0 ~
Params: prefix Set the prefix #### set_suffix() Available on: PyProg 1.0.0 ~
Params: suffix Set the suffix #### set_total() Available on: PyProg 1.0.0 ~
Params: total Set the total #### set_bar_length() Available on: PyProg 1.0.0 ~
Params: bar_length Set the length of the bar #### set_decimals() Available on: PyProg 1.0.0 ~
Params: decimals Set the number of decimals for the percent #### set_symbols() Available on: PyProg 1.0.0 ~
Params: symbols Set the complete symbol and the not complete symbol. `symbols` has to be a tuple: (complete symbol, not complete symbol) #### set_progress_loc() Available on: PyProg 1.0.0 ~
Params: progress_loc Set the progress explanation (prefix) and the progress text location. See [the progress_loc parameter](#user-content-progress_loc-default-is-0 "progress_loc") section for the possible values. #### set_progress_explain() Available on: PyProg 1.0.0 ~
Params: progress_explain Set the progress explanation (prefix). Examples:
"Progress: "
"Current Progress: " #### set_wrap_bar_text() Available on: PyProg 1.0.0 ~
Params: prefix, suffix Set the wrap bar text (the prefix and the suffix of the bar). #### set_progress_format() Available on: PyProg 1.0.0 ~
Params: progress_format Set the format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters: "+p" -> Current percent
"+c" -> Current status ### Functions for ProgressIndicatorFunction #### set_stat() Available on: PyProg 1.0.0 ~
Params: current Set the current progress. #### update() Available on: PyProg 1.0.0 ~
Params: (none) Update the progress indicator so that it shows the current progress. Note: Also call this to initiate the indicator. #### end() Available on: PyProg 1.0.0 ~
Params: (none) End the progress indicator. #### set_prefix() Available on: PyProg 1.0.0 ~
Params: prefix Set the prefix #### set_suffix() Available on: PyProg 1.0.0 ~
Params: suffix Set the suffix #### set_total() Available on: PyProg 1.0.0 ~
Params: total Set the total %package help Summary: Development documents and examples for pyprog Provides: python3-pyprog-doc %description help # Introduction PyProg is an Open-Source library for creating progress indicators (e.g. progress bars). It helps you create customizable progress indicators. This library is for Python. # Compatibility PyProg is compatible with both Python 3 and Python 2, and will also work on Qt Console. # Getting Started ## Installation Latest Release: `pip install pyprog` Latest Development Release: `pip install git+https://github.com/Bill13579/pyprog.git@develop` After you have installed PyProg, you can test if it has been successfully installed by running `import pyprog` in python. If PyProg was installed successfully, it should show no errors. ## How to use the PyProg Progress Bar ### Basic PyProg Progress Bar To create a basic progress bar, follow these steps: 1. Install PyProg ([Guide](#installation "How to install PyProg")) 2. Import PyProg: `import pyprog` 3. Create a `ProgressBar` object: `prog = pyprog.ProgressBar("", "")` 4. Show the bar: `prog.update()` 5. To update the status, use `prog.set_stat()` to set the status and then use `prog.update()` to actually show the change 6. When finished, use `prog.end()` to make the Progress Bar last Example Code with Fake For loop: ```python import pyprog from time import sleep # Create a PyProg ProgressBar Object prog = pyprog.ProgressBar(":-) ", " OK!") # Show the initial status prog.update() # Fake for loop for i in range(0, 100): # Sleep for a while (This is just to slow down the for loop so that it won't end in an instant) sleep(0.1) # Update status prog.set_stat(i + 1) # Show (Update) the current status prog.update() # Make the Progress Bar final prog.end() ``` Output: ``` Initial State: :-) Progress: 0% -------------------------------------------------- OK! When progress is 50: :-) Progress: 50% #########################------------------------- OK! Final State: :-) Progress: 100% ################################################## OK! ``` #### What is the first two parameters? The first two parameters in `prog = pyprog.ProgressBar("", "")` is for telling PyProg what to put before and after the progress indicator. Example: ``` :-) Progress: 0% -------------------------------------------------- OK! ^ ^ ^ Prefix Bar Suffix ``` ### Pretty Progress Bar You can also add more options to make it look good. Adding options `complete_symbol="█", not_complete_symbol="-"` will change the original output to: ``` Initial State: :-) Progress: 0% -------------------------------------------------- OK! When progress is 50: :-) Progress: 50% █████████████████████████------------------------- OK! Final State: :-) Progress: 100% ██████████████████████████████████████████████████ OK! ``` ### Auto calculate the percentage PyProg can also auto calculate the current percentage. You just need to tell PyProg the total number of things you need to process. Change the line `prog = pyprog.ProgressBar("", "")` to `prog = pyprog.ProgressBar("", "", )`, and PyProg will calculate the percentage for you based on the status that you give it. To use it in our simple progress bar code, if we have 37 tasks to do, we can change this: ```python # Create a PyProg ProgressBar Object prog = pyprog.ProgressBar(":-) ", " OK!") ``` to this: ```python # Create a PyProg ProgressBar Object prog = pyprog.ProgressBar(":-) ", " OK!", 37) ``` And also change the fake for loop from `for i in range(0, 100):` to `for i in range(0, 37):`, and it will auto calculate the percentage and show it to the user. ## How to use the PyProg Progress Indicator (Fraction) ### Basic PyProg Progress Indicator (Fraction) To create a basic progress indicator (fraction), follow these steps: 1. Import PyProg: `import pyprog` 2. Create a `ProgressIndicatorFraction` object: `prog = pyprog.ProgressIndicatorFraction("", "", )` (Replace "" with the total number of tasks or things you need to process) 3. Show the indicator: `prog.update()` 4. To update the status, use `prog.set_stat()` to set the status and then use `prog.update()` to actually show the change 5. When finished, use `prog.end()` to make the Progress Indicator (Fraction) last Example Code with Fake For loop (We are using 56 as the total in this example): ```python import pyprog from time import sleep # Create a PyProg ProgressIndicatorFraction Object prog = pyprog.ProgressIndicatorFraction(":-) ", " OK!", 56) # Show the initial status prog.update() # Fake for loop for i in range(0, 56): # Sleep for a while (This is just to slow down the for loop so that it won't end in an instant) sleep(0.1) # Update status prog.set_stat(i + 1) # Show (Update) the current status prog.update() # Make the Progress Indicator (Fraction) final prog.end() ``` Output: ``` Initial State: :-) 0/56 OK! When half done: :-) 28/56 OK! Final State: :-) 56/56 OK! ``` # Documentation ## Progress Indicator Parameters ### Options for ProgressBar #### prefix The prefix of everything. #### suffix The suffix of everything. #### total (default is 100) This is the option that tells PyProg how many things or tasks you need to process. We used it in the [Auto calculate the percentage](#auto-calculate-the-percentage "Auto calculate the percentage") section. #### bar_length (default is 50) This tells PyProg how long should the bar should be. #### initial (default is 0) Initial status to show on the bar. #### decimals (default is 0) How many decimals should the percent have. #### complete_symbol (default is "#") The complete symbol will be shown in the complete part of the bar. We used it in the [Pretty Progress Bar](#pretty-progress-bar "Pretty Progress Bar") section. Example Position of complete symbol: Progress: 59% #############################---------------------  #### not_complete_symbol (default is "-") The not complete symbol will be shown in the not yet complete part of the bar. We used it in the [Pretty Progress Bar](#pretty-progress-bar "Pretty Progress Bar") section. Example Position of complete symbol: Progress: 59% #############################---------------------  #### progress_loc (default is 0) Where the progress explanation (prefix) and the progress text should be shown. Possible Values:
ProgressBar.PROGRESS_LOC_START or 0 - Show both at the start
ProgressBar.PROGRESS_LOC_MIDDLE or 1 - Show both at the middle of the bar
ProgressBar.PROGRESS_LOC_END or 2 - Show both at the end
ProgressBar.PROGRESS_LOC_EXP_START_PROGRESS_MID or 3 - Show explanation (prefix) at the start and the progress text at the middle of the bar
ProgressBar.PROGRESS_LOC_EXP_END_PROGRESS_MID or 4 - Show explanation (prefix) at the end and the progress text at the middle of the bar PROGRESS_LOC_START:
Progress: 32% ################----------------------------------  PROGRESS_LOC_MIDDLE:
\################ Progress: 32% ------------------  PROGRESS_LOC_END:
\################---------------------------------- Progress: 32% PROGRESS_LOC_EXP_START_PROGRESS_MID:
Progress: ################----- 32% -----------------------  PROGRESS_LOC_EXP_END_PROGRESS_MID:
\################----- 32% ----------------------- Progress: #### progress_format (default is "+p%") Format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters: "+p" -> Current percent
"+c" -> Current status #### progress_explain (default is "Progress: ") This is the progress explanation (prefix). Example position of progress explanation: Progress: 32% ################----------------------------------  Examples:
"Progress: "
"Current Progress: " #### wrap_bar_prefix (default is " ") The prefix of the bar. #### wrap_bar_suffix (default is " ") The suffix of the bar. ### Options for ProgressIndicatorFraction #### prefix The prefix of everything. #### suffix The suffix of everything. #### total This is the option that tells PyProg how many things or tasks you need to process. #### initial (default is 0) Initial status to show on the indicator. ## Progress Indicator Functions ### Functions for ProgressBar #### set_stat() Available on: PyProg 1.0.0 ~
Params: current Set the current progress. #### stat() Available on: PyProg 1.1.0-0 ~
Params: current
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon. Set the current progress and update the progress bar. #### progress() Available on: PyProg 1.1.0-0 ~
Params: progress
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon. Increase the progress by the given amount. #### update() Available on: PyProg 1.0.0 ~
Params: (none) Update the progress bar so that it shows the current progress.
Note: Also call this to initiate the bar. #### end() Available on: PyProg 1.0.0 ~
Params: (none) End the progress bar. #### end_m() Available on: PyProg 1.1.0-0 ~
Params: msg
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon. End the progress bar with a message. #### set_prefix() Available on: PyProg 1.0.0 ~
Params: prefix Set the prefix #### set_suffix() Available on: PyProg 1.0.0 ~
Params: suffix Set the suffix #### set_total() Available on: PyProg 1.0.0 ~
Params: total Set the total #### set_bar_length() Available on: PyProg 1.0.0 ~
Params: bar_length Set the length of the bar #### set_decimals() Available on: PyProg 1.0.0 ~
Params: decimals Set the number of decimals for the percent #### set_symbols() Available on: PyProg 1.0.0 ~
Params: symbols Set the complete symbol and the not complete symbol. `symbols` has to be a tuple: (complete symbol, not complete symbol) #### set_progress_loc() Available on: PyProg 1.0.0 ~
Params: progress_loc Set the progress explanation (prefix) and the progress text location. See [the progress_loc parameter](#user-content-progress_loc-default-is-0 "progress_loc") section for the possible values. #### set_progress_explain() Available on: PyProg 1.0.0 ~
Params: progress_explain Set the progress explanation (prefix). Examples:
"Progress: "
"Current Progress: " #### set_wrap_bar_text() Available on: PyProg 1.0.0 ~
Params: prefix, suffix Set the wrap bar text (the prefix and the suffix of the bar). #### set_progress_format() Available on: PyProg 1.0.0 ~
Params: progress_format Set the format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters: "+p" -> Current percent
"+c" -> Current status ### Functions for ProgressIndicatorFunction #### set_stat() Available on: PyProg 1.0.0 ~
Params: current Set the current progress. #### update() Available on: PyProg 1.0.0 ~
Params: (none) Update the progress indicator so that it shows the current progress. Note: Also call this to initiate the indicator. #### end() Available on: PyProg 1.0.0 ~
Params: (none) End the progress indicator. #### set_prefix() Available on: PyProg 1.0.0 ~
Params: prefix Set the prefix #### set_suffix() Available on: PyProg 1.0.0 ~
Params: suffix Set the suffix #### set_total() Available on: PyProg 1.0.0 ~
Params: total Set the total %prep %autosetup -n pyprog-1.1.0.post2 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-pyprog -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 1.1.0.post2-1 - Package Spec generated