Web Updater Screen Bar Refresh

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
diamondbear
Newbie
Posts: 8
Joined: Sun Oct 21, 2018 3:57 pm
Contact:

Web Updater Screen Bar Refresh

#1 Post by diamondbear »

Hello,

I am trying to modify the renpy web updater screen to better fit my game. I found the originally defined screen in the common folder and I am overriding it currently. Everything seems to work fine aside from the progress bar. The bar refuses update (it just stays completely empty) when the update is in progress. If I use the original code for the bar in my custom screen, it still won't update. However, if I resize the window rapidly while the game is updating, the bar will move. So it appears as if the bar is just not refreshing when the value of u.progress is changed. Attached is the code from my screen. I am hoping someone has had a similar issue.

Thank you for the help!

Code: Select all

style text_btnconfirm is text:
    size 55
    font "fonts/huggable.ttf"
    color "0e4d17"
    hover_color "#ffffff"

screen updater:
    modal True

    $ updater_state = ""

    # Updater background
    add "images/bg_sky.png"
    add "images/bg_camp.png"
    # Confirmation box
    add "images/confirm_box.png" xalign .5 yalign .5

    fixed:
        vbox:
            # Position of text area
            xpos 456
            ypos 333
            xmaximum 989
            ymaximum 156
            spacing 20
            if u.state == u.ERROR:
                $ updater_state = "An error has occured:"
            elif u.state == u.CHECKING:
                $ updater_state = "Checking for updates."
            elif u.state == u.UPDATE_NOT_AVAILABLE:
                $ updater_state = "This program is up to date."
            elif u.state == u.UPDATE_AVAILABLE:
                $ updater_state = "[u.version] is available. Do you want to install it?"
            elif u.state == u.PREPARING:
                $ updater_state = "Preparing to download the updates."
            elif u.state == u.DOWNLOADING:
                $ updater_state = "Downloading the updates."
            elif u.state == u.UNPACKING:
                $ updater_state = "Unpacking the updates."
            elif u.state == u.FINISHING:
                $ updater_state ="Finishing up."
            elif u.state == u.DONE:
                $ updater_state = "The updates have been installed. The program will restart."
            elif u.state == u.DONE_NO_RESTART:
                $ updater_state = "The updates have been installed."
            elif u.state == u.CANCELLED:
                $ updater_state = "The updates were cancelled."

            text updater_state color "#fff" size 45 font "fonts/Halogen.ttf" xalign .5 text_align .5

            if u.message is not None:
                text "[u.message!q]" color "#fff" size 45 font "fonts/Halogen.ttf" xalign .5 text_align .5

            if u.progress is not None:
                bar value u.progress range 1.0 right_bar "images/bar_empty.png" left_bar "images/bar_full.png" xalign .5 xmaximum 574 ymaximum 69 ypos 577

        hbox:
            spacing 150
            xalign .5
            ypos 679
            xmaximum 1002

            if u.can_cancel:
                button:
                    xalign 0
                    xmaximum 295
                    ymaximum 121
                    # activate_sound "Audio/Buttons/button_accept.mp3"
                    add "images/confirm_button.png"
                    text "CANCEL" style "text_btnconfirm" xalign 0.5 yalign 0.5
                    action u.cancel

            if u.can_proceed:
                button:
                    xalign 1
                    xmaximum 295
                    ymaximum 121
                    # activate_sound "Audio/Buttons/button_accept.mp3"
                    add "images/confirm_button.png"
                    text "CONTINUE" style "text_btnconfirm" xalign 0.5 yalign 0.5
                    action u.proceed

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Web Updater Screen Bar Refresh

#2 Post by Remix »

Does

Code: Select all

init python:
    config.per_frame_screens.append( "updater" )
work?

Alternatively, maybe

Code: Select all

    timer 0.02 action Function( renpy.redraw, renpy.get_screen( "updater" ), 0 ) repeat True
at the end of your screen... (fly typed from memory, so likely not fully correct)
Similar with Function( renpy.restart_interaction ) should work too, just might cause glitches with anything else expecting interaction
Frameworks & Scriptlets:

diamondbear
Newbie
Posts: 8
Joined: Sun Oct 21, 2018 3:57 pm
Contact:

Re: Web Updater Screen Bar Refresh

#3 Post by diamondbear »

Remix wrote: Thu Nov 08, 2018 8:54 pm Does

Code: Select all

init python:
    config.per_frame_screens.append( "updater" )
work?

Alternatively, maybe

Code: Select all

    timer 0.02 action Function( renpy.redraw, renpy.get_screen( "updater" ), 0 ) repeat True
at the end of your screen... (fly typed from memory, so likely not fully correct)
Similar with Function( renpy.restart_interaction ) should work too, just might cause glitches with anything else expecting interaction
The first option worked beautifully. Thank you so much!

Post Reply

Who is online

Users browsing this forum: No registered users