Skip to content

Commit

Permalink
button to check updates manually
Browse files Browse the repository at this point in the history
  • Loading branch information
Booplicate committed Nov 28, 2020
1 parent 73a2f32 commit 29a7ef8
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ init -990 python:
"A util submod that adds an in-game updater for other submods. "
"Check {a=https:/Booplicate/MAS-Submods-SubmodUpdaterPlugin}{i}{u}here{/u}{/i}{/a} if you want your submod to use this."
),
version="1.5",
version="1.6",
settings_pane="sup_setting_pane"
)

Expand Down Expand Up @@ -281,6 +281,9 @@ init -991 python in sup_utils:
# a list of updaters resently finished updating
finished_updaters = list()

# Flag whether or not we're checking updates for submods (using _checkUpdates)
is_checking_updates = False

def __init__(
self,
submod,
Expand Down Expand Up @@ -1582,9 +1585,11 @@ init -991 python in sup_utils:
"""
Check updates for each registered submods
"""
cls.is_checking_updates = True
for updater in cls.registered_updaters.itervalues():
if updater.auto_check:
updater._checkUpdate()
cls.is_checking_updates = False

@classmethod
def _doLogic(cls, check_updates=True, notify=True):
Expand Down Expand Up @@ -1969,6 +1974,12 @@ screen sup_setting_pane():
xfill True
style_prefix "check"

textbutton "{b}Check updates{/b}":
ypos 1
selected False
sensitive (not store.sup_utils.SubmodUpdater.is_checking_updates)
action Function(store.sup_utils.SubmodUpdater.doLogicInThread, check_updates=True, notify=False)

if total_updaters > 0:
textbutton "{b}Adjust settings{/b}":
ypos 1
Expand All @@ -1991,6 +2002,11 @@ screen sup_setting_pane():
from_submod_screen=True
)

if store.sup_utils.SubmodUpdater.is_checking_updates:
timer 1.0:
repeat True
action Function(renpy.restart_interaction)

# # # A screen to change updaters' settings
screen sup_settings():
key "noshift_T" action NullAction()
Expand Down

0 comments on commit 29a7ef8

Please sign in to comment.