Tweaks to the floaties.

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2023-02-19 19:42:07 +00:00
parent 3afea198e0
commit 89b603b013
2 changed files with 45 additions and 8 deletions

View file

@ -819,26 +819,65 @@ def draw(outlayer, win, path, back="story_editor"):
else:
difference = str(round(difference*100,2))
result = str(round(after_star*100, 2)) + "% ( "+difference+"% )"
print(result)
floaty_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(len(result)*9+40), int(30))
floaty_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(len(result)*9+40), int(50))
floaty_layer = cairo.Context(floaty_surface)
floaty_layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
UI_color.set(floaty_layer, win, "shot_5")
if not positive:
UI_color.set(floaty_layer, win, "node_badfile")
UI_color.set(floaty_layer, win, "node_background")
UI_elements.roundrect(floaty_layer, win,
0,
0,
int(len(result)*9+40),
30,
50,
10)
floaty_layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL,
cairo.FONT_WEIGHT_NORMAL)
floaty_layer.set_font_size(15)
UI_color.set(floaty_layer, win, "text_normal")
if not positive:
UI_color.set(floaty_layer, win, "node_badfile")
floaty_layer.move_to(20,20)
floaty_layer.show_text(result)
UI_color.set(floaty_layer, win, "progress_background")
UI_elements.roundrect(floaty_layer, win,
5,
35,
int(len(result)*9+30),
10,
5)
if positive:
UI_color.set(floaty_layer, win, "progress_active")
UI_elements.roundrect(floaty_layer, win,
5,
35,
int(len(result)*9+30)*min(1,after_star),
10,
5)
UI_color.set(floaty_layer, win, "text_link")
UI_elements.roundrect(floaty_layer, win,
5,
35,
int(len(result)*9+30)*min(1,before_star),
10,
5)
else:
UI_color.set(floaty_layer, win, "node_badfile")
UI_elements.roundrect(floaty_layer, win,
5,
35,
int(len(result)*9+30)*min(1,before_star),
10,
5)
UI_color.set(floaty_layer, win, "text_link")
UI_elements.roundrect(floaty_layer, win,
5,
35,
int(len(result)*9+30)*min(1,after_star),
10,
5)
floaty = {"fx":win.current["mx"],
"fy":win.current["my"],
@ -847,7 +886,6 @@ def draw(outlayer, win, path, back="story_editor"):
"ff":win.current["frame"],
"tf":win.current["frame"]+200,
"sf":floaty_surface}
print(floaty)
win.floaters.append(floaty)

View file

@ -460,7 +460,6 @@ def pmdrawing(pmdrawing, main_layer, win):
del win.floaters[n]
except:
pass
print(win.floaters)
win.get_root_window().set_cursor(win.current["cursor"])