A bunch more f-strings
I'm not done
This commit is contained in:
parent
5fa2a0ff19
commit
be88d0ed7e
@ -82,12 +82,12 @@ init python:
|
||||
child = getattr(self, layer)
|
||||
|
||||
if isinstance(child, ImageReference):
|
||||
name = getattr(self, "_{}".format(layer))
|
||||
attributes = renpy.get_attributes(name) or renpy.get_attributes("{}_{}".format(tag_prefix, layer))
|
||||
name = getattr(self, f"_{layer}")
|
||||
attributes = renpy.get_attributes(name) or renpy.get_attributes(f"{tag_prefix}_{layer}")
|
||||
|
||||
if attributes:
|
||||
attributes = " ".join(attributes)
|
||||
child = ImageReference("{} {}".format(name, attributes))
|
||||
child = ImageReference(f"{name} {attributes}")
|
||||
elif child.name != name:
|
||||
child = ImageReference(name)
|
||||
else:
|
||||
|
@ -24,7 +24,7 @@ init python:
|
||||
states.gen.image.offset = (0, 600)
|
||||
|
||||
if face:
|
||||
variant = "genie {}".format(face)
|
||||
variant = f"genie {face}"
|
||||
renpy.set_tag_attributes(variant)
|
||||
side = "genie"
|
||||
|
||||
|
@ -82,7 +82,7 @@ init python:
|
||||
else:
|
||||
chibi["base"] = "ch_hem walk_robe_n"
|
||||
else:
|
||||
chibi["base"] = "ch_hem walk"
|
||||
chibi["base"] = "ch_hem walk"
|
||||
|
||||
elif not chibi.action or chibi.action == "stand":
|
||||
# Determine clothing state
|
||||
@ -97,7 +97,7 @@ init python:
|
||||
else:
|
||||
chibi["base"] = "ch_hem blink_robe_n"
|
||||
else:
|
||||
chibi["base"] = "ch_hem blink"
|
||||
chibi["base"] = "ch_hem blink"
|
||||
|
||||
elif chibi.action == "dance":
|
||||
# Determine clothing state
|
||||
@ -140,9 +140,9 @@ init python:
|
||||
|
||||
elif chibi.action in ("drink_potion", "sniff_potion", "hold_potion"):
|
||||
if not hermione.is_any_worn("top", "bottom"):
|
||||
chibi["base"] = "ch_hem {}_nude".format(chibi.action)
|
||||
chibi["base"] = f"ch_hem {chibi.action}_nude"
|
||||
else:
|
||||
chibi["base"] = "ch_hem {}".format(chibi.action)
|
||||
chibi["base"] = f"ch_hem {chibi.action}"
|
||||
|
||||
|
||||
# Sets up a chibi scene with Hermione and Genie in it
|
||||
|
@ -14,7 +14,7 @@ screen chibi(chibi_object):
|
||||
screen chibi_emote(emote, chibi_object):
|
||||
zorder chibi_object.zorder
|
||||
sensitive False
|
||||
add "emo_{}".format(emote):
|
||||
add f"emo_{emote}":
|
||||
at emote_effect
|
||||
anchor (0.5, 1.0)
|
||||
pos chibi_object.pos
|
||||
@ -45,12 +45,12 @@ init -1 python:
|
||||
|
||||
def get_chibi_object(name):
|
||||
"""Get a chibi object by its character's name."""
|
||||
name = "{}_chibi".format(name)
|
||||
name = f"{name}_chibi"
|
||||
c = getattr(renpy.store, name, None)
|
||||
if c and isinstance(c, Chibi):
|
||||
return c
|
||||
else:
|
||||
raise Exception("Chibi object not found. {}".format(name))
|
||||
raise Exception(f"Chibi object not found. {name}")
|
||||
|
||||
def complete_chibi_moves(**elapsed):
|
||||
"""Resume old chibi action after (multiple) reduced move calls."""
|
||||
@ -120,7 +120,7 @@ init -1 python:
|
||||
if image_path:
|
||||
self.image_path = image_path
|
||||
else:
|
||||
self.image_path = "characters/{}/chibis".format(tag)
|
||||
self.image_path = f"characters/{tag}/chibis"
|
||||
|
||||
if actions:
|
||||
# Override class variable for this instance
|
||||
@ -138,11 +138,11 @@ init -1 python:
|
||||
self.transform = None
|
||||
|
||||
# Define a screen for the chibi
|
||||
self.screen_tag = "{}_chibi".format(tag)
|
||||
self.screen_tag = f"{tag}_chibi"
|
||||
renpy.define_screen(self.screen_tag, Chibi._screen, tag=self.screen_tag, zorder="chibi_object.zorder")
|
||||
|
||||
# Define a screen for the chibi emote
|
||||
self.emote_tag = "{}_chibi_emote".format(tag)
|
||||
self.emote_tag = f"{tag}_chibi_emote"
|
||||
renpy.define_screen(self.emote_tag, Chibi._emote_screen, tag=self.emote_tag, zorder="chibi_object.zorder")
|
||||
|
||||
@staticmethod
|
||||
@ -282,7 +282,7 @@ init -1 python:
|
||||
# Combine with base transform
|
||||
return combine_transforms(self.base_transform(), trans(*args))
|
||||
elif config.developer:
|
||||
raise Exception("Expected a transform: {}".format(name))
|
||||
raise Exception(f"Expected an ATL transform: {name}")
|
||||
# No transform was given or found
|
||||
return self.base_transform()
|
||||
|
||||
@ -358,7 +358,7 @@ init -1 python:
|
||||
room = room or renpy.store.states.room
|
||||
chibi_room = ChibiRoom.rooms.get(room, None)
|
||||
if not chibi_room:
|
||||
raise Exception("Chibi room is not defined for {}".format(room))
|
||||
raise Exception(f"Chibi room is not defined for {room}")
|
||||
return chibi_room
|
||||
|
||||
@staticmethod
|
||||
|
@ -37,7 +37,7 @@ init 1 python:
|
||||
ltype, *tails = fn.rsplit("_")
|
||||
|
||||
# if not ltype in types:
|
||||
# print("Invalid layer type for file: {}".format(f))
|
||||
# print(f"Invalid layer type for file: {f}")
|
||||
# continue
|
||||
|
||||
zorder = types.get(ltype) or self.zorder
|
||||
@ -50,7 +50,7 @@ init 1 python:
|
||||
lmodifier, *tails = tails
|
||||
|
||||
if not lmodifier in modifiers:
|
||||
print("Invalid modifier for file: {}".format(f))
|
||||
print(f"Invalid modifier for file: {f}")
|
||||
continue
|
||||
|
||||
zorder_mod = modifiers.get(lmodifier)
|
||||
|
@ -108,7 +108,7 @@ init python:
|
||||
ltype, *tails = fn.rsplit("_")
|
||||
|
||||
if not ltype.isdigit() and not ltype in types:
|
||||
print("Invalid layer type for file: {}".format(f))
|
||||
print(f"Invalid layer type for file: {f}")
|
||||
continue
|
||||
|
||||
zorder = z if (z := types.get(ltype)) is not None else self.zorder
|
||||
@ -121,7 +121,7 @@ init python:
|
||||
lmodifier, *tails = tails
|
||||
|
||||
if not lmodifier in modifiers:
|
||||
print("Invalid modifier for file: {}".format(f))
|
||||
print(f"Invalid modifier for file: {f}")
|
||||
continue
|
||||
|
||||
zorder_mod = modifiers.get(lmodifier)
|
||||
@ -319,7 +319,7 @@ init python:
|
||||
# Method 4
|
||||
|
||||
average = (0.3333, 0.3333, 0.3333)
|
||||
|
||||
|
||||
return Transform(img, maxsize=maxsize, matrixcolor=SepiaMatrix(c, desat=average)*OpacityMatrix(c.alpha))
|
||||
|
||||
except TypeError:
|
||||
|
@ -131,7 +131,7 @@ init python:
|
||||
lmodifier, *tails = tails
|
||||
|
||||
if not lmodifier in modifiers:
|
||||
print("Invalid modifier for file: {}".format(f))
|
||||
print(f"Invalid modifier for file: {f}")
|
||||
continue
|
||||
|
||||
zorder_mod = modifiers.get(lmodifier)
|
||||
|
@ -54,7 +54,7 @@ init python:
|
||||
ltype, *tails = fn.rsplit("_")
|
||||
|
||||
if not ltype in types:
|
||||
print("Invalid layer type for file: {}".format(f))
|
||||
print(f"Invalid layer type for file: {f}")
|
||||
continue
|
||||
|
||||
zorder = types.get(ltype) or face_layers.get(part)
|
||||
@ -63,7 +63,7 @@ init python:
|
||||
lmodifier, *tails = tails
|
||||
|
||||
if not lmodifier in modifiers:
|
||||
print("Invalid modifier for file: {}".format(f))
|
||||
print(f"Invalid modifier for file: {f}")
|
||||
continue
|
||||
|
||||
zorder_mod = modifiers.get(lmodifier)
|
||||
|
@ -49,7 +49,7 @@ init python:
|
||||
lmodifier, *tails = tails
|
||||
|
||||
if not lmodifier in modifiers:
|
||||
print("Invalid modifier for file: {}".format(f))
|
||||
print(f"Invalid modifier for file: {f}")
|
||||
continue
|
||||
|
||||
zorder_mod = modifiers.get(lmodifier)
|
||||
|
@ -218,7 +218,7 @@ init python:
|
||||
d,
|
||||
"interface/wardrobe/export_frame.webp",
|
||||
Text(states.active_girl, align=(0.5, 0.995)),
|
||||
Text("Ver. {}".format(config.version), size=10, align=(0.99, 0.99))
|
||||
Text(f"Ver. {config.version}", size=10, align=(0.99, 0.99))
|
||||
)
|
||||
|
||||
displayable_to_file(d, path, size=(310, 470) )
|
||||
@ -286,4 +286,3 @@ init python:
|
||||
if self.has_type(arg):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -26,7 +26,9 @@ init python in gui:
|
||||
The returned form is "{theme}_{name}", so styles can fall back on parent styles.
|
||||
"""
|
||||
theme = "dark" if is_dark() else "light"
|
||||
return "{}_{}".format(theme, name) if name else theme
|
||||
if name:
|
||||
return f"{theme}_{name}"
|
||||
return theme
|
||||
|
||||
def format(template):
|
||||
"""
|
||||
|
@ -36,7 +36,7 @@ screen history():
|
||||
|
||||
if "icon" in entry.show_args:
|
||||
$ icon = entry.show_args["icon"]
|
||||
add Fixed(gui.format("interface/achievements/{}/iconbox.webp"), Transform("interface/icons/head/{}.webp".format(icon), xzoom=-1, size=(40, 40), align=(0.5, 0.5)), fit_first=True)
|
||||
add Fixed(gui.format("interface/achievements/{}/iconbox.webp"), Transform(f"interface/icons/head/{icon}.webp", xzoom=-1, size=(40, 40), align=(0.5, 0.5)), fit_first=True)
|
||||
|
||||
if entry.who:
|
||||
text entry.who:
|
||||
|
@ -138,7 +138,7 @@ screen preferences_visuals():
|
||||
|
||||
label "Framerate"
|
||||
|
||||
textbutton ("{} fps".format(int(renpy.get_refresh_rate()))) action [Preference("gl framerate", None), Notify(fps_msg)]
|
||||
textbutton (f"{int(renpy.get_refresh_rate())} fps") action [Preference("gl framerate", None), Notify(fps_msg)]
|
||||
if renpy.get_refresh_rate() > 60:
|
||||
textbutton "60 fps" action [Preference("gl framerate", 60), Notify(fps_msg)]
|
||||
textbutton "30 fps" action [Preference("gl framerate", 30), Notify(fps_msg)]
|
||||
@ -178,7 +178,7 @@ screen preferences_visuals():
|
||||
|
||||
hbox:
|
||||
bar value DictValue(persistent.custom_settings, "image_cache_size", range=1792, max_is_zero=False, style="slider", offset=256, step=128, force_step=True, action=Notify("Restart the game to apply image cache size changes.")) tooltip "Improves performance at a cost of higher memory usage."
|
||||
|
||||
|
||||
text get_gpu_info() yalign 1.0 size 10
|
||||
|
||||
screen preferences_sound():
|
||||
@ -325,9 +325,9 @@ auto saves, quick saves, and manual saves.{/size}\n
|
||||
Are you sure?"""
|
||||
|
||||
define gui.SAVE_INCOMPATIBLE_WARNING = """{color=#7a0000}Warning!{/color}
|
||||
{size=-4}The save file you are attempting to load is not compatible
|
||||
with the current game version. While you can try loading it,
|
||||
doing so may result in unexpected crashes and bugs.
|
||||
{size=-4}The save file you are attempting to load is not compatible
|
||||
with the current game version. While you can try loading it,
|
||||
doing so may result in unexpected crashes and bugs.
|
||||
|
||||
Proceed anyway?"""
|
||||
|
||||
|
@ -93,8 +93,8 @@ screen file_slots(title):
|
||||
$ hours, minutes = divmod(minutes, 60)
|
||||
|
||||
text FileTime(slot, format=slot_time_format)
|
||||
text "Day: {}".format(day)
|
||||
text "Playtime: {}H {}M {}S".format(hours, minutes, seconds)
|
||||
text f"Day: {day}"
|
||||
text f"Playtime: {hours}H {minutes}M {seconds}S"
|
||||
else:
|
||||
text "INCOMPATIBLE VERSION" color "#f00"
|
||||
|
||||
@ -104,7 +104,7 @@ screen file_slots(title):
|
||||
|
||||
key "save_delete" action FileDelete(slot)
|
||||
else:
|
||||
text "Empty Slot {}.".format(FileSlotName(slot, gui.file_slot_cols * gui.file_slot_rows)) style "slot_button_text"
|
||||
text f"Empty Slot {FileSlotName(slot, gui.file_slot_cols * gui.file_slot_rows)}." style "slot_button_text"
|
||||
|
||||
## Buttons to access other pages.
|
||||
hbox:
|
||||
@ -131,7 +131,7 @@ screen file_slots(title):
|
||||
xminimum 40
|
||||
action FilePage(page)
|
||||
if page < 10:
|
||||
keysym "K_{}".format(page)
|
||||
keysym f"K_{page}"
|
||||
|
||||
textbutton _(">") action FilePageNext()
|
||||
|
||||
|
@ -193,7 +193,7 @@ screen choice(items, menu_yalign=.6):
|
||||
style "empty"
|
||||
|
||||
if style_part:
|
||||
style_prefix gui.theme("{}_menu".format(style_part))
|
||||
style_prefix gui.theme(f"{style_part}_menu")
|
||||
|
||||
fit_first "height"
|
||||
|
||||
|
@ -170,7 +170,7 @@ screen brewing_menuitem():
|
||||
text "Usable on:" size 12
|
||||
hbox:
|
||||
for c in current_item.usable_on:
|
||||
add "interface/icons/head/{}.webp".format(c) size (24, 24)
|
||||
add f"interface/icons/head/{c}.webp" size (24, 24)
|
||||
|
||||
hbox:
|
||||
spacing 10
|
||||
|
@ -62,11 +62,11 @@ init python:
|
||||
icon = item.image
|
||||
|
||||
if quantity == 1:
|
||||
text = "You have received one {}.".format(item.name)
|
||||
text = f"You have received one {item.name}."
|
||||
else:
|
||||
text = "You have received {} pieces of {}.".format(num_to_word(quantity), item.name)
|
||||
text = f"You have received {num_to_word(quantity)} pieces of {item.name}."
|
||||
else:
|
||||
items = ", ".join( [" ".join( [str(x[1]), x[0].name] ) for x in self.contents] )
|
||||
items = ", ".join(f"{x[1]} {x[0].name}" for x in self.contents)
|
||||
icon = "interface/icons/box_brown_"+str(random.randint(1, 4))+".webp"
|
||||
text = "You have received your ordered items:\n{size=-4}"+items+"{/size}"
|
||||
|
||||
|
@ -55,8 +55,9 @@ screen tutorial(entry):
|
||||
text "Tutorial" size 10 yalign 0.5
|
||||
text tutorial_dict[entry][0] size 16 xalign 0.5 yalign 0.5
|
||||
|
||||
if renpy.loadable("interface/tutorials/{}.webp".format(entry)):
|
||||
add "interface/tutorials/{}.webp".format(entry) xalign 0.5
|
||||
$ formated = f"interface/tutorials/{entry}.webp"
|
||||
if renpy.loadable(formated):
|
||||
add formated xalign 0.5
|
||||
|
||||
text tutorial_dict[entry][1] size 12
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,13 @@
|
||||
init -100 python:
|
||||
def show_gold(st, at, old, new):
|
||||
if st > 1.0:
|
||||
return Text("G {}".format(new)), None
|
||||
return Text(f"G {new}"), None
|
||||
else:
|
||||
if new > old:
|
||||
value = int( (new-old)*(1.0-st) ) + 1
|
||||
value = int((new-old)*(1.0-st)) + 1
|
||||
d = Text("G {}\n+{}".format(old + int((new-old)*st), value))
|
||||
else:
|
||||
value = int( (old-new)*(1.0-st) ) + 1
|
||||
value = int((old-new)*(1.0-st)) + 1
|
||||
d = Text("G {}\n-{}".format(old - int((old-new)*st), value))
|
||||
return d, 0.01
|
||||
|
||||
@ -62,7 +62,7 @@ init -100 python:
|
||||
value = renpy.random.choices(self.weather_types, weights=self.weather_weights)[0]
|
||||
|
||||
if not value in self.weather_types:
|
||||
raise ValueError("Unsupported weather type: {!r}".format(value))
|
||||
raise ValueError(f"Unsupported weather type: {value!r}")
|
||||
|
||||
self._weather = value
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user