Skip to content

Commit

Permalink
Avoid a save/reload cycle when changing launcher theme.
Browse files Browse the repository at this point in the history
Makes the problem found in #2816 less severe.
  • Loading branch information
renpytom committed May 21, 2021
1 parent 3ec8d89 commit e921052
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions launcher/game/front_page.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ label start:
show screen bottom_info
$ dmgcheck()

jump expression renpy.session.pop("launcher_start_label", "front_page")

label front_page:
call screen front_page
jump front_page
Expand Down
13 changes: 9 additions & 4 deletions launcher/game/preferences.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ init python:

show_legacy = os.path.exists(os.path.join(config.renpy_base, "templates", "english", "game", "script.rpy"))

class RestartAtPreferences(Action):
def __call__(self):
renpy.session["launcher_start_label"] = "preferences"
renpy.utter_restart()

default persistent.legacy = False
default persistent.force_new_tutorial = False
default persistent.sponsor_message = True
Expand Down Expand Up @@ -196,11 +201,11 @@ screen preferences:

textbutton _("Sponsor message") style "l_checkbox" action ToggleField(persistent, "sponsor_message")

textbutton _("Default theme") style "l_checkbox" action [SetField(persistent, "theme", None), renpy.reload_script]

textbutton _("Clear theme") style "l_checkbox" action [ToggleField(persistent, "theme", "clear", None), renpy.reload_script]
add HALF_SPACER

textbutton _("Dark theme") style "l_checkbox" action [ToggleField(persistent, "theme", "dark", None), renpy.reload_script]
textbutton _("Default theme") style "l_checkbox" action [SetField(persistent, "theme", None), RestartAtPreferences() ]
textbutton _("Clear theme") style "l_checkbox" action [SetField(persistent, "theme", "clear", None), RestartAtPreferences() ]
textbutton _("Dark theme") style "l_checkbox" action [SetField(persistent, "theme", "dark", None), RestartAtPreferences()]

This comment has been minimized.

Copy link
@Gouvernathor

Gouvernathor May 22, 2021

Member

Is it normal that dark (and clear) are SetFields and not ToggleFields now ?

This comment has been minimized.

Copy link
@renpytom

renpytom May 23, 2021

Author Member

Yes - I don't think that it makes sense to have them as ToggleFields, when they are acting like Radio Buttons. I don't think it makes sense that clicking "Dark Theme" would cause the default theme to appear.



if translations:
Expand Down

0 comments on commit e921052

Please sign in to comment.