diff --git a/studio/checklist.py b/studio/checklist.py index 5c01f65..a047fde 100644 --- a/studio/checklist.py +++ b/studio/checklist.py @@ -784,6 +784,10 @@ def draw(outlayer, win, path, back="story_editor"): # CHECK BUTTON def do(): + + # Before we overwrite the button + before_star = win.analytics.get("star", 0) + if task["fraction"]: task["fraction"] = 0.0 history.record(win, path, "[Un-Checked]", schedulepath) @@ -804,6 +808,48 @@ def draw(outlayer, win, path, back="story_editor"): win.assets = {} win.multiuser["last_request"] = "" win.analytics = analytics.load(win.project) + + after_star = win.analytics.get("star", 0) + + # Calculating the amount got right + difference = after_star - before_star + positive = difference >= 0 + if positive: + difference = "+" + str(round(difference*100,2)) + 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_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_elements.roundrect(floaty_layer, win, + 0, + 0, + int(len(result)*9+40), + 30, + 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") + floaty_layer.move_to(20,20) + floaty_layer.show_text(result) + + floaty = {"fx":win.current["mx"], + "fy":win.current["my"], + "tx":win.current["w"]/2, + "ty":0, + "ff":win.current["frame"], + "tf":win.current["frame"]+200, + "sf":floaty_surface} + print(floaty) + win.floaters.append(floaty) + UI_elements.roundrect(layer, win, sx, diff --git a/studio/studio_gtk.py b/studio/studio_gtk.py index 6a9fded..e9d451e 100644 --- a/studio/studio_gtk.py +++ b/studio/studio_gtk.py @@ -115,6 +115,7 @@ def run(project, win): # Setting up the global variables. (kinda) win.animations = {} + win.floaters = [] # Currently active floating animations. win.previous = {} win.current = {} win.images = {} @@ -401,7 +402,7 @@ def pmdrawing(pmdrawing, main_layer, win): - Layers.append([UI_testing.layer(win)]) + Layers.append([UI_testing.layer(win)]) Layers.append([win.tooltip_surface]) if win.settings["scale"] != 1: @@ -430,6 +431,37 @@ def pmdrawing(pmdrawing, main_layer, win): main_layer.paint() + # Floaters + fdels = [] + for n, floaty in enumerate(win.floaters): + fx = floaty["fx"] # From X + fy = floaty["fy"] # From Y + tx = floaty["tx"] # To X + ty = floaty["ty"] # To Y + ff = floaty["ff"] # From Frame + tf = floaty["tf"] # To Frame + sf = floaty["sf"] # Surface + + total_frames = tf - ff + passed_frames = win.current["frame"] - ff + frames_fraction = passed_frames / total_frames + + if frames_fraction == 1: + fdels.append(n) + + x = fx + ( (tx - fx) * frames_fraction ) + y = fy + ( (ty - fy) * frames_fraction ) + + main_layer.set_source_surface(sf, x , y) + main_layer.paint_with_alpha(frames_fraction*-1+1) + + for n in fdels: + try: + del win.floaters[n] + except: + pass + print(win.floaters) + win.get_root_window().set_cursor(win.current["cursor"]) # If you press ESC you get back from any window to the main menu.