minor fixes

This commit is contained in:
lazysnake 2021-07-03 14:33:50 +02:00
parent 2cba3b2be1
commit f332a988c2

View File

@ -28,7 +28,7 @@ init python:
# Global function to unlock a cg
# fname should be a key used in galleryItems
# (fname: string): None
# (fname: string) -> None
def unlockCg(fname):
unlocked = fname in persistent.cggallery
if unlocked:
@ -43,7 +43,7 @@ init python:
# Rebuild the gallery
for i in range(0, len(galleryItems) - 1):
if fname != str(galleryItems[i]["item"]):
if fname == str(galleryItems[i]["item"]):
loadGallery()
return
@ -57,7 +57,7 @@ init python:
return im.FactorScale("images/cgs/" + fname + "." + ext, scaleFactor["x"], scaleFactor["y"])
# Create an object in g:Gallery, add to galleryItems
# (imageName: string; ext: string; w: float; h: float; unlocked?: boolean): None
# (imageName: string; ext: string; w: float; h: float; unlocked?: boolean) -> None
def addGalleryItem(imageName, ext, w, h, unlocked = False):
g.button(imageName)
g.image(imageName)
@ -81,7 +81,7 @@ init python:
# Reads /images/cgs dir for all image files
# Populates g:Gallery and galleryItems
# Appends extra spaces at the end
# (): None
# () -> None
def loadGallery():
from os import listdir, getcwd
from os.path import isfile, join