添加进度条
This commit is contained in:
parent
c60307aa4c
commit
bc0f82125c
|
@ -22,9 +22,9 @@ class ProgressBar:
|
|||
max_flash = 4
|
||||
__anim_obj_id = -1
|
||||
|
||||
def __draw_corner(self, r_x, r_y, x, y, colors="#000000", rid="",bgcolor=None, **kwargs):
|
||||
if bgcolor is None or self.progress==1:
|
||||
bgcolor=self.color["border_light"]
|
||||
def __draw_corner(self, r_x, r_y, x, y, colors="#000000", rid="", bgcolor=None, **kwargs):
|
||||
if bgcolor is None or self.progress == 1:
|
||||
bgcolor = self.color["border_light"]
|
||||
self.__fill_obj[rid] = []
|
||||
self.__fill_obj[rid+"_pos"] = []
|
||||
border_info = json.loads(photoload.loadres("progressborder"))
|
||||
|
@ -58,7 +58,6 @@ class ProgressBar:
|
|||
x_n += 1
|
||||
y_n += 1
|
||||
|
||||
|
||||
def __init__(self, master=None, root_anim=None, w=200, h=8, colors="primary", color_list: None | dict = None):
|
||||
self.w = max(200, w)
|
||||
self.h = 8
|
||||
|
@ -67,7 +66,7 @@ class ProgressBar:
|
|||
if (color_list is not None):
|
||||
self.color = color_list
|
||||
if (root_anim == None):
|
||||
self.__root = master
|
||||
self.__root = master.root
|
||||
else:
|
||||
self.__root = root_anim
|
||||
|
||||
|
@ -91,15 +90,16 @@ class ProgressBar:
|
|||
self.__fill_obj["bgbar"] = [
|
||||
self.canvas.create_rectangle(4, 1, self.w-5, self.h-1, width=0, fill=self.color["border_light"])]
|
||||
self.__draw_corner(1, 0, self.w-5, 0,
|
||||
self.color["border_light"], "rightside",bgcolor=self.color["background"])
|
||||
self.color["border_light"], "rightside", bgcolor=self.color["background"])
|
||||
self.__fill_obj["fgbar"] = [
|
||||
self.canvas.create_rectangle(4, 1, self.__progress_pixel+4, self.h-1, width=0, fill=self.color[self.colors])]
|
||||
self.__draw_corner(0, 0, 1, 0, self.color[self.colors], "leftside",bgcolor=self.color["background"])
|
||||
self.__draw_corner(
|
||||
0, 0, 1, 0, self.color[self.colors], "leftside", bgcolor=self.color["background"])
|
||||
self.__draw_corner(1, 0, self.__progress_pixel+3, 0,
|
||||
self.color[self.colors], "rightprog")
|
||||
|
||||
def __update_pixel(self):
|
||||
self.__move_progress_pixel = max(4,int((self.w-6)*self.progress))
|
||||
self.__move_progress_pixel = max(4, int((self.w-6)*self.progress))
|
||||
|
||||
def add_progress(self, n):
|
||||
self.progress = max(min(self.progress+n, 1.0), 0.0)
|
||||
|
|
Loading…
Reference in New Issue