:param title: text to display in titlebar of window :type title: (str) :param current_value: current value :type current_value: (int) :param max_value: max value of progress meter :type max_value: (int) :param *args: stuff to output as
(title, current_value, max_value, *args, key='OK for 1 meter', orientation='v', bar_color=(None, None), button_color=None,
size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=False, no_titlebar=False, keep_on_top=None, no_button=False)
| 18179 | |
| 18180 | |
| 18181 | def one_line_progress_meter(title, current_value, max_value, *args, key='OK for 1 meter', orientation='v', bar_color=(None, None), button_color=None, |
| 18182 | size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=False, no_titlebar=False, keep_on_top=None, no_button=False): |
| 18183 | """ |
| 18184 | :param title: text to display in titlebar of window |
| 18185 | :type title: (str) |
| 18186 | :param current_value: current value |
| 18187 | :type current_value: (int) |
| 18188 | :param max_value: max value of progress meter |
| 18189 | :type max_value: (int) |
| 18190 | :param *args: stuff to output as text in the window along with the meter |
| 18191 | :type *args: (Any) |
| 18192 | :param key: Used to differentiate between multiple meters. Used to cancel meter early. Now optional as there is a default value for single meters |
| 18193 | :type key: str | int | tuple | object |
| 18194 | :param orientation: 'horizontal' or 'vertical' ('h' or 'v' work) (Default value = 'vertical' / 'v') |
| 18195 | :type orientation: (str) |
| 18196 | :param bar_color: The 2 colors that make up a progress bar. Either a tuple of 2 strings or a string. Tuple - (bar, background). A string with 1 color changes the background of the bar only. A string with 2 colors separated by "on" like "red on blue" specifies a red bar on a blue background. |
| 18197 | :type bar_color: (str, str) or str |
| 18198 | :param button_color: button color (foreground, background) |
| 18199 | :type button_color: (str, str) | str |
| 18200 | :param size: (w,h) w=characters-wide, h=rows-high (Default value = DEFAULT_PROGRESS_BAR_SIZE) |
| 18201 | :type size: (int, int) |
| 18202 | :param border_width: width of border around element |
| 18203 | :type border_width: (int) |
| 18204 | :param grab_anywhere: If True: can grab anywhere to move the window (Default = False) |
| 18205 | :type grab_anywhere: (bool) |
| 18206 | :param no_titlebar: If True: no titlebar will be shown on the window |
| 18207 | :type no_titlebar: (bool) |
| 18208 | :param keep_on_top: If True the window will remain above all current windows |
| 18209 | :type keep_on_top: (bool) |
| 18210 | :param no_button: If True: window will be created without a cancel button |
| 18211 | :type no_button: (bool) |
| 18212 | :return: True if updated successfully. False if user closed the meter with the X or Cancel button |
| 18213 | :rtype: (bool) |
| 18214 | """ |
| 18215 | if key not in _QuickMeter.active_meters: |
| 18216 | meter = _QuickMeter(title, current_value, max_value, key, *args, orientation=orientation, bar_color=bar_color, button_color=button_color, size=size, |
| 18217 | border_width=border_width, grab_anywhere=grab_anywhere, no_titlebar=no_titlebar, keep_on_top=keep_on_top, no_button=no_button) |
| 18218 | _QuickMeter.active_meters[key] = meter |
| 18219 | _QuickMeter.exit_reasons[key] = None |
| 18220 | |
| 18221 | else: |
| 18222 | meter = _QuickMeter.active_meters[key] |
| 18223 | |
| 18224 | rc = meter.UpdateMeter(current_value, max_value, *args) ### pass the *args to to UpdateMeter function |
| 18225 | OneLineProgressMeter.exit_reasons = getattr(OneLineProgressMeter, 'exit_reasons', _QuickMeter.exit_reasons) |
| 18226 | exit_reason = OneLineProgressMeter.exit_reasons.get(key) |
| 18227 | return METER_OK if exit_reason in (None, METER_REASON_REACHED_MAX) else METER_STOPPED |
| 18228 | |
| 18229 | |
| 18230 | def one_line_progress_meter_cancel(key='OK for 1 meter'): |
nothing calls this directly
no test coverage detected