OneLineProgressMeter with text updates
This commit is contained in:
parent
bf41ebdf76
commit
85dfc451a9
3 changed files with 123 additions and 22 deletions
|
@ -8,6 +8,16 @@ import base64
|
|||
import calendar
|
||||
from random import randint
|
||||
|
||||
|
||||
|
||||
###### ##### ##### # # ### #####
|
||||
# # # # # # # # # ##### # ###### # # # # # # # #####
|
||||
# # # # # # ## ## # # # # # # # # # # #
|
||||
###### # ##### # # ## # # # # ##### # #### # # # # # #
|
||||
# # # # # # ##### # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # # # # #
|
||||
# # ##### # # # # ###### ###### ##### ##### ### #### # #
|
||||
|
||||
FORCE_PYQT5 = False
|
||||
|
||||
if not FORCE_PYQT5:
|
||||
|
@ -4404,9 +4414,48 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False)
|
|||
AddMenuItem(top_menu, item, element)
|
||||
i += 1
|
||||
|
||||
|
||||
"""
|
||||
QQQQQQQQQ tttt
|
||||
QQ:::::::::QQ ttt:::t
|
||||
QQ:::::::::::::QQ t:::::t
|
||||
Q:::::::QQQ:::::::Q t:::::t
|
||||
Q::::::O Q::::::Qttttttt:::::ttttttt
|
||||
Q:::::O Q:::::Qt:::::::::::::::::t
|
||||
Q:::::O Q:::::Qt:::::::::::::::::t
|
||||
Q:::::O Q:::::Qtttttt:::::::tttttt
|
||||
Q:::::O Q:::::Q t:::::t
|
||||
Q:::::O Q:::::Q t:::::t
|
||||
Q:::::O QQQQ:::::Q t:::::t
|
||||
Q::::::O Q::::::::Q t:::::t tttttt
|
||||
Q:::::::QQ::::::::Q t::::::tttt:::::t
|
||||
QQ::::::::::::::Q tt::::::::::::::t
|
||||
QQ:::::::::::Q tt:::::::::::tt
|
||||
QQQQQQQQ::::QQ ttttttttttt
|
||||
Q:::::Q
|
||||
QQQQQQ
|
||||
"""
|
||||
|
||||
# My crappy Qt code starts here
|
||||
|
||||
# ░░░░░░░░░░░█▀▀░░█░░░░░░
|
||||
# ░░░░░░▄▀▀▀▀░░░░░█▄▄░░░░
|
||||
# ░░░░░░█░█░░░░░░░░░░▐░░░
|
||||
# ░░░░░░▐▐░░░░░░░░░▄░▐░░░
|
||||
# ░░░░░░█░░░░░░░░▄▀▀░▐░░░
|
||||
# ░░░░▄▀░░░░░░░░▐░▄▄▀░░░░
|
||||
# ░░▄▀░░░▐░░░░░█▄▀░▐░░░░░
|
||||
# ░░█░░░▐░░░░░░░░▄░█░░░░░
|
||||
# ░░░█▄░░▀▄░░░░▄▀▐░█░░░░░
|
||||
# ░░░█▐▀▀▀░▀▀▀▀░░▐░█░░░░░
|
||||
# ░░▐█▐▄░░▀░░░░░░▐░█▄▄░░░
|
||||
# ░░░▀▀▄░░░░░░░░▄▐▄▄▄▀░░░
|
||||
# ░░░░░░░░░░░░░░░░░░░░░░░
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------------------------------------------ #
|
||||
# ------------------------------------------------------------------------------------------------------------------ #
|
||||
# ===================================== TK CODE STARTS HERE ====================================================== #
|
||||
# ===================================== Qt CODE STARTS HERE ====================================================== #
|
||||
# ------------------------------------------------------------------------------------------------------------------ #
|
||||
# ------------------------------------------------------------------------------------------------------------------ #
|
||||
def style_entry(**kwargs):
|
||||
|
@ -5735,27 +5784,28 @@ class QuickMeter(object):
|
|||
def BuildWindow(self, *args):
|
||||
layout = []
|
||||
if self.orientation.lower().startswith('h'):
|
||||
col = [*[[T(arg)] for arg in args],
|
||||
[T('', size=(25,8), key='_STATS_')],
|
||||
col = [[T(''.join(map(lambda x: str(x)+'\n',args)),key='_OPTMSG_')]] ### convert all *args into one string that can be updated
|
||||
col += [[T('', size=(25,5), key='_STATS_')],
|
||||
[ProgressBar(max_value=self.max_value, orientation='h', key='_PROG_', size=self.size,
|
||||
bar_color=self.bar_color)],
|
||||
[Cancel(button_color=self.button_color), Stretch()] ]
|
||||
[Cancel(button_color=self.button_color), Stretch()]]
|
||||
layout += [Column(col)]
|
||||
else:
|
||||
col = [[ProgressBar(max_value=self.max_value, orientation='v', key='_PROG_', size=self.size, bar_color=self.bar_color)]]
|
||||
col2 = [*[[T(arg)] for arg in args],
|
||||
[T('', size=(25, 8), key='_STATS_')],[Cancel(button_color=self.button_color), Stretch()] ]
|
||||
col2 = [[T(''.join(map(lambda x: str(x)+'\n',args)),key='_OPTMSG_')]] ### convert all *args into one string that can be updated
|
||||
col2 += [[T('', size=(25,5), key='_STATS_')],[Cancel(button_color=self.button_color), Stretch()]]
|
||||
layout += [Column(col), Column(col2)]
|
||||
self.window = Window(self.title, grab_anywhere=self.grab_anywhere, border_depth=self.border_width)
|
||||
self.window.Layout([layout]).Finalize()
|
||||
|
||||
return self.window
|
||||
|
||||
def UpdateMeter(self, current_value, max_value):
|
||||
def UpdateMeter(self, current_value, max_value, *args):
|
||||
self.current_value = current_value
|
||||
self.max_value = max_value
|
||||
self.window.Element('_PROG_').UpdateBar(self.current_value, self.max_value)
|
||||
self.window.Element('_STATS_').Update('\n'.join(self.ComputeProgressStats()))
|
||||
self.window.Element('_OPTMSG_').Update(value=''.join(map(lambda x: str(x)+'\n',args))) ### update the string with the args
|
||||
event, values = self.window.Read(timeout=0)
|
||||
if event in('Cancel', None) or current_value >= max_value:
|
||||
self.window.Close()
|
||||
|
@ -5803,7 +5853,7 @@ def OneLineProgressMeter(title, current_value, max_value, key, *args, orientatio
|
|||
else:
|
||||
meter = QuickMeter.active_meters[key]
|
||||
|
||||
rc = meter.UpdateMeter(current_value, max_value)
|
||||
rc = meter.UpdateMeter(current_value, max_value, *args)
|
||||
OneLineProgressMeter.exit_reasons = getattr(OneLineProgressMeter,'exit_reasons', QuickMeter.exit_reasons)
|
||||
return rc == METER_OK
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue