minor fixes

This commit is contained in:
lazysnake 2021-07-03 14:33:50 +02:00
parent 2cba3b2be1
commit f332a988c2
1 changed files with 4 additions and 4 deletions

View File

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